/* ==========================================================================
   Editorial Design Tokens (:root & html.dark)
   Monochrome neutral system + reference link accent
   ========================================================================== */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/inter-latin.woff2') format('woff2');
  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;
}

@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('/fonts/newsreader-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('/fonts/newsreader-latin.woff2') format('woff2');
  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;
}

@font-face {
  font-family: 'Newsreader';
  font-style: italic;
  font-weight: 200 800;
  font-display: swap;
  src: url('/fonts/newsreader-italic-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Newsreader';
  font-style: italic;
  font-weight: 200 800;
  font-display: swap;
  src: url('/fonts/newsreader-italic-latin.woff2') format('woff2');
  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 {
  color-scheme: light;

  /* Neutral HSL Triples */
  --neutral-0: 0 0% 100%;
  --neutral-25: 0 0% 98%;
  --neutral-50: 0 0% 96%;
  --neutral-100: 0 0% 93%;
  --neutral-200: 0 0% 87%;
  --neutral-300: 0 0% 62%;
  --neutral-400: 0 0% 54%;
  --neutral-500: 0 0% 40%;
  --neutral-600: 0 0% 28%;
  --neutral-700: 0 0% 21%;
  --neutral-800: 0 0% 14%;
  --neutral-900: 0 0% 10%;
  --neutral-950: 0 0% 7%;
  --neutral-1000: 0 0% 4%;
  --black: 0 0% 4%;
  --white: 0 0% 100%;

  /* Surfaces */
  --surface-base: hsl(var(--neutral-25));       /* #fafafa */
  --surface-l1: hsl(var(--neutral-0));          /* #ffffff */
  --surface-l2: hsl(var(--neutral-50));         /* #f5f5f5 */
  --surface-l3: hsl(var(--neutral-100));        /* #ededed */
  --surface-elevated: hsl(var(--neutral-0));
  --surface-glass: hsl(var(--neutral-25) / 0.88);

  /* Borders */
  --border-l1: hsl(var(--black) / 0.07);
  --border-l2: hsl(var(--black) / 0.11);
  --border-l3: hsl(var(--black) / 0.16);

  /* Foreground / Text (HSL triples) */
  --fg-primary: var(--neutral-1000);            /* #0a0a0a */
  --fg-secondary: var(--neutral-500);           /* #666666 */
  --fg-tertiary: var(--neutral-400);            /* #8a8a8a */
  --fg-muted: var(--neutral-400);
  --fg-invert: var(--white);
  --fg-reading: var(--neutral-900);
  --fg-highlight: 0 0% 4%;

  /* Reference Link Accent */
  --link: 216 62% 49%;                          /* #2f6bc9 */

  /* Elevations */
  --elevation-raised: 0 1px 2px hsl(0 0% 0% / 0.04), 0 2px 8px hsl(0 0% 0% / 0.04);
  --elevation-composer: 0 2px 6px hsl(0 0% 0% / 0.03), 0 8px 12px hsl(0 0% 0% / 0.03);
  --elevation-menu: 0 2px 6px hsl(0 0% 0% / 0.05), 0 12px 32px hsl(0 0% 0% / 0.08);
  --elevation-book: 0 14px 32px hsl(0 0% 0% / 0.14), 0 3px 8px hsl(0 0% 0% / 0.08);

  /* Font Stacks */
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Newsreader', 'Iowan Old Style', Charter, Georgia, serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* Custom Select Chevron (Light Mode Neutral) */
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");

  /* Layout & Motion */
  --header-h: 56px;
  --catbar-h: 40px;
  --container-max: 1440px;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
}

html.dark {
  color-scheme: dark;

  /* Surfaces */
  --surface-base: hsl(var(--neutral-950));      /* #121212 */
  --surface-l1: hsl(0 0% 9.5%);                 /* #181818 */
  --surface-l2: hsl(0 0% 13%);                  /* #212121 */
  --surface-l3: hsl(0 0% 17%);                  /* #2b2b2b */
  --surface-elevated: hsl(0 0% 12%);
  --surface-glass: hsl(0 0% 7% / 0.88);

  /* Borders */
  --border-l1: hsl(var(--white) / 0.07);
  --border-l2: hsl(var(--white) / 0.11);
  --border-l3: hsl(var(--white) / 0.16);

  /* Foreground / Text */
  --fg-primary: 0 0% 96%;                       /* #f5f5f5 */
  --fg-secondary: 0 0% 64%;
  --fg-tertiary: 0 0% 50%;
  --fg-muted: 0 0% 46%;
  --fg-invert: var(--neutral-1000);
  --fg-reading: 0 0% 90%;
  --fg-highlight: 0 0% 96%;

  /* Scholarly Reference Link (Dark Mode) */
  --link: 214 76% 78%;

  /* Custom Select Chevron (Dark Mode Neutral) */
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a3a3a3' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");

  /* Elevations */
  --elevation-raised: 0 2px 8px hsl(0 0% 0% / 0.30);
  --elevation-composer: 0 2px 6px hsl(0 0% 0% / 0.20), 0 8px 12px hsl(0 0% 0% / 0.18);
  --elevation-menu: 0 2px 6px hsl(0 0% 0% / 0.35), 0 12px 32px hsl(0 0% 0% / 0.40);
  --elevation-book: 0 18px 40px hsl(0 0% 0% / 0.55), 0 4px 12px hsl(0 0% 0% / 0.35);
}

/* Prevent transition flash during theme toggle */
html.theme-switching,
html.theme-switching *,
html.theme-switching *::before,
html.theme-switching *::after {
  transition-duration: 0s !important;
}
