/* Octopote blogs — shared theme. Brand colors (--brand, --on-brand, --brand-soft, --accent) come from each site's hugo.toml.
   Rules: WCAG 2.1 AA contrast in both themes, visible focus, no motion for users who ask, no web fonts, no JS. */
:root {
  --bg: #ffffff;
  --surface: #f6f7f9;
  --fg: #151821;
  --muted: #5a6070;
  --line: #e2e5eb;
  --header-bg: rgba(255, 255, 255, .92);
  --todo: #fff1c2;
  --todo-fg: #5c4300;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(17, 24, 39, .05), 0 6px 24px rgba(17, 24, 39, .06);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1116; --surface: #171a21; --fg: #e9ebf0; --muted: #a4abba; --line: #292e39;
    --header-bg: rgba(15, 17, 22, .92);
    --todo: #4a3b0c; --todo-fg: #ffe9a6;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 1rem/1.6 var(--font); text-rendering: optimizeLegibility; }
img { max-width: 100%; height: auto; }
a { color: var(--brand); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; border-radius: 4px; }
main:focus { outline: none; }
.wrap { width: 100%; max-width: 72rem; margin: 0 auto; padding-left: max(1.25rem, env(safe-area-inset-left)); padding-right: max(1.25rem, env(safe-area-inset-right)); }
.skip { position: absolute; left: -9999px; top: .75rem; z-index: 100; background: var(--fg); color: var(--bg); padding: .6rem 1rem; border-radius: 8px; }
.skip:focus { left: .75rem; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: .65rem 1.2rem;
  border-radius: 10px; font-weight: 600; font-size: .98rem; line-height: 1.2; text-decoration: none; border: 1px solid transparent; cursor: pointer; }
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover { filter: brightness(1.1); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--fg); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-light { background: var(--bg); color: var(--fg); }
.btn-light:hover { text-decoration: underline; }
.btn-sm { min-height: 38px; padding: .45rem .9rem; font-size: .9rem; }
.btn-block { width: 100%; }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--header-bg);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; }
.logo { display: inline-flex; align-items: center; gap: .55rem; color: var(--fg); text-decoration: none; font-weight: 700; font-size: 1.08rem; }
.logo img { width: 32px; height: 32px; object-fit: contain; }
.logo-tag { font-weight: 500; color: var(--muted); padding-left: .55rem; border-left: 1px solid var(--line); }
.header-nav { display: flex; align-items: center; gap: .35rem; }
.nav-link { color: var(--muted); text-decoration: none; font-weight: 500; font-size: .95rem; padding: .5rem .7rem; border-radius: 8px; }
.nav-link:hover, .nav-link[aria-current="page"] { color: var(--fg); background: var(--surface); }
.nav-link abbr { text-decoration: none; }
@media (max-width: 640px) { .hide-sm { display: none; } .logo-tag { display: none; } .header-nav { gap: .15rem; } }

/* ---------- hero (blog home) ---------- */
.hero { padding: clamp(3rem, 8vw, 5.5rem) 0 clamp(2.5rem, 6vw, 4rem); background:
  radial-gradient(60rem 22rem at 85% -10%, var(--brand-soft), transparent 70%), var(--bg); border-bottom: 1px solid var(--line); }
.eyebrow { display: inline-block; margin: 0 0 1rem; font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); }
.eyebrow::before { content: ""; display: inline-block; width: 1.4rem; height: 3px; margin-right: .6rem; vertical-align: middle; background: var(--accent); border-radius: 2px; }
.hero h1 { max-width: 22ch; margin: 0 0 1rem; font-size: clamp(2rem, 4.6vw, 3.2rem); line-height: 1.1; letter-spacing: -.02em; text-wrap: balance; }
.lede { max-width: 62ch; margin: 0; color: var(--muted); font-size: clamp(1.05rem, 1.6vw, 1.2rem); line-height: 1.6; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }

/* ---------- listing + cards ---------- */
.listing { padding-block: 3rem 4rem; display: grid; gap: 3rem; }
.section-title { margin: 0 0 1.25rem; font-size: .85rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); }
.cards > li { display: flex; }
.card { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 1.25rem; width: 100%;
  padding: 1.5rem; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); transition: border-color .15s, box-shadow .15s, transform .15s; }
.card:hover, .card:focus-within { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-2px); }
.card-label { margin: 0 0 .75rem; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--brand); }
.card-title { margin: 0 0 .6rem; font-size: 1.2rem; line-height: 1.3; letter-spacing: -.01em; text-wrap: balance; }
.card-title a { color: var(--fg); text-decoration: none; }
.card-title a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }   /* whole card clickable */
.card-title a:focus-visible { outline: none; }
.card:focus-within { outline: 3px solid var(--brand); outline-offset: 3px; }
.card-excerpt { margin: 0 0 1rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { margin: 0; font-size: .87rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .4rem; }
.card-more { font-size: .92rem; font-weight: 600; color: var(--brand); }
.card-featured { padding: clamp(1.5rem, 4vw, 2.5rem); background: linear-gradient(135deg, var(--brand-soft), var(--bg) 70%); }
.card-featured .card-title { font-size: clamp(1.5rem, 3vw, 2.1rem); max-width: 28ch; }
.card-featured .card-excerpt { font-size: 1.08rem; max-width: 65ch; -webkit-line-clamp: 4; }
.empty { padding: 3rem 2rem; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface); }
.empty-title { margin: 0 0 .5rem; font-size: 1.25rem; font-weight: 700; }
.empty p { margin: 0 0 .5rem; color: var(--muted); }

/* ---------- article ---------- */
.crumbs { padding-top: 1.5rem; font-size: .88rem; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; color: var(--muted); }
.crumbs li:not(:last-child)::after { content: "/"; margin-left: .4rem; color: var(--line); }
.crumbs a { display: inline-block; padding: .2rem 0; color: var(--muted); }
.crumbs [aria-current] { color: var(--fg); display: inline-block; max-width: 40ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.post-header { max-width: 50rem; padding-block: 2rem 2.5rem; }
.post-header h1 { margin: 0 0 1rem; font-size: clamp(1.9rem, 4.2vw, 2.9rem); line-height: 1.15; letter-spacing: -.02em; text-wrap: balance; }
.post-meta { margin: 1.25rem 0 0; display: flex; flex-wrap: wrap; gap: .45rem; font-size: .92rem; color: var(--muted); }
.post-layout { display: grid; grid-template-columns: minmax(0, 1fr) 18rem; gap: 4rem; align-items: start; padding-bottom: 4rem; border-top: 1px solid var(--line); padding-top: 2.5rem; }
.post { min-width: 0; max-width: 46rem; }
.post-aside { position: sticky; top: 88px; display: grid; gap: 1.25rem; }
.aside-title { margin: 0 0 .75rem; font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.toc-list { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.toc-list li { margin: 0; }
.toc-list a { display: block; padding: .35rem 0 .35rem 1rem; margin-left: -2px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; font-size: .92rem; line-height: 1.4; }
.toc-list a:hover { color: var(--brand); border-left-color: var(--brand); }
.toc-mobile { display: none; margin-bottom: 2rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.toc-mobile summary { cursor: pointer; padding: .9rem 1.1rem; font-weight: 600; min-height: 44px; }
.toc-mobile .toc-list { margin: 0 1.1rem 1rem; }
.cta-card { padding: 1.4rem; border-radius: var(--radius); background: var(--brand-soft); border: 1px solid var(--line); }
.cta-card-title { margin: 0 0 .5rem; font-weight: 700; font-size: 1.08rem; line-height: 1.3; }
.cta-card p { margin: 0 0 1rem; font-size: .93rem; color: var(--muted); }
@media (max-width: 960px) {
  .post-layout { grid-template-columns: minmax(0, 1fr); gap: 2.5rem; }
  .post-aside { position: static; }
  .post-aside .toc { display: none; }
  .toc-mobile { display: block; }
}

/* ---------- article body ---------- */
.prose { font-size: 1.1rem; line-height: 1.78; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose table, .prose pre, .prose blockquote, .prose figure { margin: 0 0 1.4rem; }
.prose h2 { margin: 3rem 0 1rem; font-size: 1.65rem; line-height: 1.25; letter-spacing: -.015em; scroll-margin-top: 90px; text-wrap: balance; }
.prose h3 { margin: 2.2rem 0 .75rem; font-size: 1.28rem; line-height: 1.3; scroll-margin-top: 90px; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li { margin-bottom: .45rem; }
.prose li::marker { color: var(--brand); }
.prose strong { font-weight: 700; }
.prose img { border-radius: 10px; border: 1px solid var(--line); }
.prose figcaption { margin-top: .5rem; font-size: .9rem; color: var(--muted); }
.prose blockquote { padding: 1rem 1.25rem; border-left: 4px solid var(--accent); background: var(--surface); border-radius: 0 10px 10px 0; color: var(--fg); }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose code { font-family: var(--mono); font-size: .88em; padding: .12em .4em; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.prose pre { overflow-x: auto; padding: 1.1rem 1.25rem; background: #0f1320; color: #e6e9f2; border-radius: 12px; font-size: .9rem; line-height: 1.6; }
.prose pre code { padding: 0; background: none; border: 0; color: inherit; font-size: inherit; }
.prose table { display: block; width: 100%; overflow-x: auto; border-collapse: collapse; font-size: .95rem; }
.prose th, .prose td { padding: .7rem .9rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { background: var(--surface); font-weight: 600; white-space: nowrap; }
.prose .octopote-cta { margin: 2.5rem 0; padding: 1.4rem 1.5rem; border-radius: var(--radius); background: var(--brand-soft); border: 1px solid var(--line); }
.prose .octopote-cta p { margin: 0; }
.prose .octopote-cta a { font-weight: 700; }
mark.todo { background: var(--todo); color: var(--todo-fg); padding: .1em .35em; border-radius: 4px; font-weight: 600; font-size: .92em; }

.share { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.share-title { margin: 0; font-weight: 600; font-size: .95rem; }
.share-links { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: 0; }
.share-links a { display: inline-flex; align-items: center; min-height: 40px; padding: .4rem .9rem; border: 1px solid var(--line); border-radius: 999px; color: var(--fg); text-decoration: none; font-size: .9rem; }
.share-links a:hover { border-color: var(--brand); color: var(--brand); }
.author-box { display: flex; gap: 1rem; align-items: flex-start; margin-top: 2rem; padding: 1.4rem; background: var(--surface); border-radius: var(--radius); }
.author-box img { width: 48px; height: 48px; object-fit: contain; flex: none; }
.author-name { margin: 0 0 .3rem; font-size: 1rem; }
.author-box p { margin: 0; color: var(--muted); font-size: .95rem; }

.related { padding-block: 3.5rem; background: var(--surface); border-top: 1px solid var(--line); }

/* ---------- CTA band ---------- */
.cta-band { background: var(--brand); color: var(--on-brand); }
.cta-band-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.5rem 3rem; padding-block: 3rem; }
.cta-band h2 { margin: 0 0 .5rem; font-size: clamp(1.4rem, 3vw, 1.9rem); line-height: 1.2; text-wrap: balance; }
.cta-band p { margin: 0; max-width: 55ch; opacity: .92; }
.cta-band .btn-light { background: var(--on-brand); color: var(--brand); }

/* ---------- 404 ---------- */
.notfound { padding-block: 5rem 6rem; }
.notfound h1 { margin: 0 0 1rem; font-size: clamp(2rem, 4vw, 2.8rem); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); font-size: .93rem; }
.footer-grid { display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 2rem; padding-block: 3rem 2rem; }
.footer-logo { display: flex; align-items: center; gap: .5rem; margin: 0 0 .6rem; font-weight: 700; font-size: 1.05rem; }
.footer-logo img { width: 28px; height: 28px; object-fit: contain; }
.footer-brand p:last-child { margin: 0; color: var(--muted); max-width: 34ch; }
.footer-title { margin: 0 0 .75rem; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.site-footer ul a { display: inline-block; padding: .2rem 0; color: var(--fg); text-decoration: none; }
.site-footer ul a:hover { color: var(--brand); text-decoration: underline; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 2rem; padding-block: 1.25rem 2rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .87rem; }
.footer-bottom p { margin: 0; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-brand { grid-column: 1 / -1; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .card:hover, .card:focus-within { transform: none; }
}
@media print {
  .site-header, .post-aside, .share, .related, .cta-band, .site-footer, .toc-mobile { display: none; }
  .post-layout { display: block; border: 0; }
}
