/* ==========================================================================
   alsonkaw.com — design tokens + base
   Drop into the child theme as assets/css/tokens.css and enqueue first.
   ========================================================================== */

:root {
  --type-scale: 1.2;
  /* Light palette (default) */
  --paper:        #FAFAFB;
  --surface:      #FFFFFF;
  --surface-alt:  #F2F4F6;
  --ink:          #14171C;
  --ink-muted:    #4A515C;
  --ink-quiet:    #66707C;
  --ink-faint:    #6B7280;
  --rule:         #E3E6EA;
  --rule-soft:    #EDEFF2;
  --accent:       #2F5FD0;
  --accent-hover: #1B419A;

  /* Inverse block (dark panels inside light mode: footer, stat bands) */
  --inverse-bg:   #14171C;
  --inverse-ink:  #FAFAFB;
  --inverse-mute: #949CA8;
  --inverse-rule: #262B33;
  --inverse-link: #C9CFD8;

  /* Type */
  --font-ui:    'Archivo', system-ui, -apple-system, sans-serif;
  --font-body:  'Newsreader', Georgia, serif;
  --font-mono:  'IBM Plex Mono', ui-monospace, Menlo, monospace;

  --step--1: calc(13.5px * var(--type-scale));
  --step-0:  calc(15px * var(--type-scale));
  --step-1:  calc(19px * var(--type-scale));   /* body copy */
  --step-2:  calc(21px * var(--type-scale));   /* lede */
  --step-3:  calc(25px * var(--type-scale));   /* index row title */
  --step-4:  calc(27px * var(--type-scale));   /* h2 */
  --step-5:  calc(44px * var(--type-scale));   /* post h1 */
  --step-6:  calc(52px * var(--type-scale));   /* page h1 */

  --meta:     calc(11px * var(--type-scale));  /* mono metadata */
  --meta-lg:  calc(12.5px * var(--type-scale));

  /* Measure */
  --measure-prose: 68ch;
  --shell:  1280px;
  --prose:  680px;

  /* Space — 4pt base */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px; --s5: 22px;
  --s6: 26px; --s7: 34px; --s8: 44px; --s9: 56px; --s10: 76px;

  --radius: 4px;

  /* Motion */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --sweep: .34s;
}

/* Dark palette — system preference, overridable via [data-theme] */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:        #0F1216;
    --surface:      #161A20;
    --surface-alt:  #1A1F27;
    --ink:          #E4E7EC;
    --ink-muted:    #D4D9E0;   /* body copy: NOT full contrast — 19px serif on black vibrates */
    --ink-quiet:    #949CA8;
    --ink-faint:    #7F8B9A;
    --rule:         #262B33;
    --rule-soft:    #1E232B;
    --accent:       #86A8F5;
    --accent-hover: #A9C2F8;

    --inverse-bg:   #1A1F27;
    --inverse-ink:  #E4E7EC;
    --inverse-mute: #949CA8;
    --inverse-rule: #2E343D;
    --inverse-link: #C9CFD8;
  }
}

:root[data-theme="dark"] {
  --paper:        #0F1216;
  --surface:      #161A20;
  --surface-alt:  #1A1F27;
  --ink:          #E4E7EC;
  --ink-muted:    #D4D9E0;
  --ink-quiet:    #949CA8;
  --ink-faint:    #7F8B9A;
  --rule:         #262B33;
  --rule-soft:    #1E232B;
  --accent:       #86A8F5;
  --accent-hover: #A9C2F8;
  --inverse-bg:   #1A1F27;
  --inverse-ink:  #E4E7EC;
  --inverse-mute: #949CA8;
  --inverse-rule: #2E343D;
  --inverse-link: #C9CFD8;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--step-1)/1.75 var(--font-body);
  text-wrap: pretty;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--ink);
  text-wrap: balance;           /* kills orphans on headlines */
  margin: 0;
}

h1 { font-size: var(--step-5); line-height: 1.08; letter-spacing: -.026em; }
h2 { font-size: var(--step-4); line-height: 1.28; letter-spacing: -.014em; }
h3 { font-size: var(--step-3); line-height: 1.3;  letter-spacing: -.012em; }

p { margin: 0 0 var(--s6); text-wrap: pretty; }   /* pretty for body, balance for headings */

.prose { max-width: var(--prose); }
.prose p, .prose li { max-width: var(--measure-prose); }

.meta {
  font: 500 var(--meta)/1 var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-quiet);
}

.eyebrow {
  font: 500 calc(10px * var(--type-scale))/1 var(--font-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-quiet);
  padding-bottom: var(--s4);
  border-bottom: 1px solid var(--ink);
}

/* --------------------------------------------------------------------------
   Links — underline sweep
   Put data-u on an INNER SPAN when the link ends in an external ↗ icon,
   so the rule stops before the glyph.
   -------------------------------------------------------------------------- */

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

[data-u] {
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0 1px;
  padding-bottom: 3px;
  transition: background-size var(--sweep) var(--ease);
}
a[data-u]:not(.ak-external-link):hover,
a:focus-visible [data-u],
a:hover [data-u],
a.ak-external-link:hover > [data-u] { background-size: 100% 1px; }

.ak-external-link[data-u] { background-image: none; padding-bottom: 0; }
.ak-external-icon { display: inline-block; margin-left: .18em; color: var(--ink-quiet); font: 400 .82em/1 var(--font-mono); text-decoration: none; }

/* "More →" links sweep from the right, toward the arrow */
[data-u="r"] { background-position: 100% 100%; }

/* Anchors inside a column flex container must shrink-wrap or the sweep
   runs the full column width. */
.footer-col { display: flex; flex-direction: column; align-items: flex-start; gap: 11px; }

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
