/* Haviola: Guide template, Midnight & Amber.
   Dark top bar + category strip, hero > headline > reading column (one shared left edge), contents hanging in the left margin.
   Font: Inter (self-hosted, SIL OFL). Every colour comes from the tokens below. */

@font-face { font-family: "Inter"; src: url("/fonts/inter-var-latin.woff2") format("woff2"); font-weight: 400 800; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  /* Midnight base */
  --bar:        oklch(22% 0.04 250);
  --bar-2:      oklch(30% 0.05 250);
  --bar-ink:    oklch(94% 0.02 250);
  --link:       oklch(32% 0.08 250);
  --ink:        oklch(20% 0.03 250);
  --ink-2:      oklch(31% 0.03 250);
  --muted:      oklch(46% 0.03 250);
  --rule:       oklch(91% 0.01 250);
  --paper:      oklch(100% 0 0);
  /* Amber accent */
  --accent:     oklch(84% 0.15 80);
  --accent-ink: oklch(20% 0.04 250);
  --wash:       oklch(97% 0.022 90);
}

:root {
  color-scheme: light;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gutter: clamp(1.25rem, 4vw, 2rem);
  --col: 46rem;          /* reading column (pages) */
  --wrap: 68rem;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --dur: 150ms;
  --radius: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; scroll-padding-top: 1.5rem; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body { margin: 0; overflow-x: clip; background: var(--paper); color: var(--ink-2); font: 400 1.0625rem/1.65 var(--font);
       -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
::selection { background: var(--accent); color: var(--accent-ink); }
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.col  { width: 100%; max-width: calc(var(--col) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }

a { color: var(--link); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.2em; text-decoration-color: oklch(from var(--link) l c h / 0.35);
    transition-property: color, text-decoration-color, background-color; transition-duration: var(--dur); transition-timing-function: var(--ease); }
a:hover { text-decoration-color: currentColor; }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; box-shadow: 0 0 0 5px var(--bar); }
h1, h2, h3 { font-family: var(--font); color: var(--ink); letter-spacing: -0.025em; line-height: 1.15; text-wrap: balance; overflow-wrap: anywhere; margin: 0; font-weight: 700; }
p, li { text-wrap: pretty; }
time, .num { font-variant-numeric: tabular-nums; }

.skip { position: absolute; left: 1rem; top: -4rem; background: var(--accent); color: var(--accent-ink); padding: 0.75rem 1rem; z-index: 20; font-weight: 600; }
.skip:focus { top: 0.75rem; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ── Top bar + category strip ─────────────────────────────────────────── */
.topbar { background: var(--bar); color: var(--bar-ink); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; }
.brand { font-weight: 800; font-size: 1.65rem; letter-spacing: -0.045em; color: var(--accent); text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.brand:hover { color: var(--bar-ink); }
.topnav { display: flex; align-items: center; gap: 0.25rem; }
.topnav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.85rem; color: var(--bar-ink); font-weight: 600; font-size: 0.9375rem; text-decoration: none; border-radius: 999px; }
.topnav a:hover { color: var(--accent); }
.topnav a[aria-current="page"] { color: var(--accent); }
.pillbtn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 1.25rem; border-radius: 999px; background: var(--accent); color: var(--accent-ink);
           font-weight: 700; font-size: 0.9375rem; text-decoration: none; margin-left: 0.5rem;
           transition-property: background-color, scale; transition-duration: var(--dur); transition-timing-function: var(--ease); }
.pillbtn:hover { background: var(--bar-ink); color: var(--bar); }
.pillbtn:active { scale: 0.96; }
.topnav .pillbtn { color: var(--accent-ink); }
.topnav .pillbtn:hover { color: var(--bar); }
.subnav { background: var(--bar-2); color: var(--bar-ink); }
.subnav .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 0 0.5rem; min-height: 52px; }
.subnav__label { font-weight: 800; font-size: 1.1rem; letter-spacing: -0.03em; color: var(--accent); margin-right: 0.75rem; }
.subnav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.6rem; color: var(--bar-ink); font-weight: 600; font-size: 0.875rem; text-decoration: none; }
.subnav a:hover { color: var(--accent); }

main { padding-block: 2rem 4.5rem; min-height: 55vh; }

/* ── Article ──────────────────────────────────────────────────────────── */
.hero { max-width: calc(58rem + 2 * var(--gutter)); margin: -2rem auto 2.25rem; padding-inline: var(--gutter); }
.hero .art { display: block; width: 100%; height: auto; aspect-ratio: 2 / 1; }
.figure { margin: 2.5rem 0; }
.figure .art { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; border-radius: 4px; }
.figure figcaption { margin-top: 0.6rem; font-size: 0.8125rem; color: var(--muted); }
.hero img { display: block; width: 100%; height: auto; aspect-ratio: 2 / 1; object-fit: cover; border-radius: 4px; outline: 1px solid oklch(0 0 0 / 0.1); outline-offset: -1px; }
.chips { display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; margin: 0 0 1rem; }
.chip { display: inline-flex; align-items: center; min-height: 32px; font-size: 0.8125rem; font-weight: 600; color: var(--ink); text-decoration: underline; text-decoration-color: var(--ink); text-decoration-thickness: 1.5px; text-underline-offset: 0.25em; }
.chip:hover { color: var(--link); }
.article-title { font-size: clamp(2rem, 2.6vw + 1.2rem, 3rem); letter-spacing: -0.035em; line-height: 1.1; font-weight: 800; margin-bottom: 1.25rem; }
.byline { display: flex; align-items: center; gap: 0.85rem; margin-bottom: 2rem; }
.avatar { flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.1rem; }
.byline__name { margin: 0; font-weight: 600; color: var(--ink); font-size: 0.9375rem; line-height: 1.3; }
.byline__meta { margin: 0; font-size: 0.8125rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0 1rem; }
.aff-note { font-size: 0.875rem; color: var(--muted); margin: 0 0 1.5rem; }

.prose p { margin: 0 0 1.4em; }
.prose a { font-weight: 600; }
.prose h2 { font-size: 1.6rem; margin: 2.6em 0 0.7em; }
.prose h3 { font-size: 1.25rem; margin: 2em 0 0.5em; }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0 0 1.6em; }
.prose li { margin: 0.45em 0; padding-left: 0.2rem; }
.prose li::marker { color: var(--link); font-weight: 700; }
.prose strong { color: var(--ink); font-weight: 650; }
.prose .notice { padding: 1rem 1.25rem; margin: 1.6rem 0; background: var(--wash); border-radius: var(--radius); font-size: 0.9375rem; }
.prose .notice p:last-child { margin-bottom: 0; }
.idea { margin-top: 0; }
.idea h2 { margin-top: 2.2em; }
.idea .tag { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin-right: 0.25rem; }

          transition-property: background-color, scale; transition-duration: var(--dur); transition-timing-function: var(--ease); }

/* Affiliate CTA + tool pick */
.cta-wrap { text-align: center; margin: 2rem 0; }
.cta { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 1.75rem; border-radius: 999px; background: var(--accent); color: var(--accent-ink);
       font-weight: 700; font-size: 1rem; text-decoration: none; text-align: center;
       transition-property: background-color, scale; transition-duration: var(--dur); transition-timing-function: var(--ease); }
.cta:hover { background: var(--bar); color: var(--accent); }
.cta:active { scale: 0.96; }
.pick { margin: 2rem 0; padding: 1.5rem; background: var(--wash); border-radius: 20px; text-align: left; }
.pick__kicker { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.pick__name { font-size: 1.4rem; margin: 0.25rem 0 0.5rem; }
.pick__note { margin: 0.75rem 0 0; font-size: 0.8125rem; color: var(--muted); }

/* ── Home + lists ─────────────────────────────────────────────────────── */
.home-head { max-width: 46rem; margin: 1rem 0 2.5rem; }
.home-head h1 { font-size: clamp(2.1rem, 3.6vw + 1rem, 3.6rem); font-weight: 800; letter-spacing: -0.04em; line-height: 1.05; }
.home-head p { font-size: 1.25rem; line-height: 1.5; color: var(--ink-2); margin: 1rem 0 0; max-width: 34rem; }
.cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
.card { display: flex; flex-direction: column; gap: 1rem; padding: 0.75rem 0.75rem 1.5rem; background: var(--wash); border-radius: 20px; text-decoration: none; color: var(--ink);
        transition-property: background-color; transition-duration: var(--dur); transition-timing-function: var(--ease); }
.card:hover { background: var(--accent); color: var(--accent-ink); }
.card__img { display: block; aspect-ratio: 3 / 2; overflow: hidden; border-radius: 14px; }
.card__img .art, .card__img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card__body { display: flex; flex-direction: column; gap: 0.6rem; padding-inline: 0.75rem; flex: 1; }
.card__cat { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.card:hover .card__cat, .card:hover .card__meta { color: var(--accent-ink); }
.card__title { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; }
.card__desc { margin: 0; color: var(--ink-2); }
.card:hover .card__desc { color: var(--accent-ink); }
.card__meta { font-size: 0.8125rem; color: var(--muted); margin-top: auto; }
.card--feature { padding: 0.75rem 0.75rem 1.5rem; }
@media (min-width: 720px) { .card--feature { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: 1.5rem; align-items: center; padding: 0.75rem; }
  .card--feature .card__img { aspect-ratio: 4 / 3; } .card--feature .card__body { padding: 1rem 1.5rem 1rem 0.5rem; } }
.card--feature .card__title { font-size: clamp(1.8rem, 2vw + 1rem, 2.5rem); }
.sec-title { font-size: 1.25rem; margin: 3rem 0 1rem; }
.page-title { font-size: clamp(2rem, 2.6vw + 1.2rem, 3rem); font-weight: 800; letter-spacing: -0.035em; margin-bottom: 1.5rem; }
.empty { color: var(--muted); padding: 1.25rem 0; }

/* ── Footer ───────────────────────────────────────────────────────────── */
.footer { background: var(--bar); color: var(--bar-ink); padding: 3rem 0 3.5rem; }
.footer .wrap { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr); }
.footer .brand { font-size: 1.5rem; }
.footer__tag { margin: 0.25rem 0 0; color: oklch(from var(--bar-ink) l c h / 0.75); font-size: 0.9375rem; max-width: 34ch; }
.footer nav { display: flex; flex-wrap: wrap; gap: 0 1.25rem; }
.footer nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--bar-ink); font-weight: 600; font-size: 0.9375rem; text-decoration: none; }
.footer nav a:hover { color: var(--accent); }
.footer__fine { margin: 0; padding-top: 1.5rem; border-top: 1px solid oklch(from var(--bar-ink) l c h / 0.2); font-size: 0.8125rem; color: oklch(from var(--bar-ink) l c h / 0.75); max-width: 70ch; }
.footer__fine a { color: var(--bar-ink); }

.preview-bar { background: oklch(14% 0.02 260); color: oklch(96% 0.005 260); display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.5rem 1rem; padding: 0.5rem 1rem; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }

@media (min-width: 720px) {
  .cards--grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer .wrap { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
  .footer__fine { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .topnav a:not(.pillbtn) { padding: 0 0.6rem; }
  .topnav .pillbtn { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0.01ms !important; } }

/* ── Post layout: hero 58rem > headline + reading column share one 46rem column (left edges aligned).
      The contents list hangs in the left margin when there is room, and collapses to a row at the top when there is not. ── */
.post-head, .post-body { width: 100%; max-width: calc(46rem + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.post-main { position: relative; min-width: 0; }
.toc-rail { display: none; }
.toc-mobile { margin: 0 0 1.5rem; border-block: 1px solid var(--rule); }
.toc-mobile summary { min-height: 48px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; font-weight: 700; font-size: 0.9375rem; color: var(--ink); }
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile summary::after { content: "+"; font-size: 1.4rem; line-height: 1; }
.toc-mobile[open] summary::after { content: "\2212"; }
.toc-mobile ol, .toc-side ol { list-style: none; margin: 0; padding: 0; }
.toc-mobile a, .toc-side a { display: flex; align-items: center; min-height: 40px; padding-block: 0.25rem; color: var(--ink-2); font-size: 0.9rem; font-weight: 500; line-height: 1.35; text-decoration: none; }
.toc-mobile a:hover, .toc-side a:hover { color: var(--link); text-decoration: underline; }
.toc-side { padding-left: 2px; }
.toc-side__label { display: block; margin-bottom: 0.5rem; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.toc-side a[aria-current="true"] { color: var(--ink); font-weight: 700; }
.toc-side a[aria-current="true"]::before { content: ""; flex: none; width: 8px; height: 8px; margin: 0 0.6rem 0 0; border-radius: 50%; background: var(--bar); }


@media (min-width: 1240px) {
  .toc-rail { display: block; position: absolute; top: 0; bottom: 0; right: 100%; width: 12rem; margin-right: 2rem; }
  .toc-side { position: sticky; top: 1.5rem; max-height: calc(100vh - 3rem); overflow-y: auto; padding-bottom: 1rem; }
  .toc-mobile { display: none; }
}
