/* =========================================================================
   ClickIt design tokens — static-site copy.

   This is a straight port of web-book/src/styles/tokens.css so the marketing
   page, the legal pages, the admin dashboard and the /book app all read from
   ONE vocabulary. Token NAMES are identical on both sides on purpose: if a
   value changes there, change it here too and nothing else needs touching.

   The only additions over the web-book file are the @font-face declarations
   (web-book loads Fraunces through its own base.css) — the static pages have
   no build step, so they link this sheet directly.

   Brand anchor is Peacock Teal #096C6C (--teal-700), the same value as
   src/theme.ts's colors.gradientMid.
   ========================================================================= */

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('./fonts/fraunces-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Fraunces';
  font-style: italic;
  font-weight: 500;
  font-display: swap;
  src: url('./fonts/fraunces-500italic.woff2') format('woff2');
}

:root {
  color-scheme: light;

  /* ---- Brand ramp ---------------------------------------------------- */
  --teal-50:  #EAF7F6;
  --teal-100: #CFEDEB;
  --teal-200: #A5DEDA;
  --teal-300: #5FD1C9;
  --teal-400: #2CBDBA;
  --teal-500: #10ABAB;
  --teal-600: #0C8B8B;
  --teal-700: #096C6C;   /* ClickIt Peacock Teal — do not change */
  --teal-800: #054040;
  --teal-900: #043333;
  --teal-950: #032828;

  /* ---- Warm neutrals ------------------------------------------------- */
  --sand-50:  #FBFAF8;
  --sand-100: #F7F5F2;
  --sand-200: #EFECE6;
  --sand-300: #E5E1DB;
  --sand-400: #D3CCC2;
  --sand-500: #B4AB9E;

  --ink-900: #0A1A1A;
  --ink-700: #2A2E2E;
  --ink-600: #4A4640;
  --ink-500: #6B6459;
  --ink-400: #8C8478;

  /* ---- Semantic surfaces --------------------------------------------- */
  --surface-canvas:  var(--sand-100);
  --surface-raised:  #FFFFFF;
  --surface-sunken:  var(--sand-200);
  --surface-inverse: var(--teal-800);
  --surface-overlay: rgba(6, 26, 26, 0.52);
  --surface-glass:   rgba(255, 255, 255, 0.82);

  --border-subtle: var(--sand-300);
  --border-strong: var(--sand-400);
  --border-focus:  var(--teal-500);

  --text-primary:   var(--ink-900);
  --text-secondary: var(--ink-600);
  --text-tertiary:  var(--ink-500);
  --text-onbrand:   #FFFFFF;
  --text-brand:     var(--teal-700);

  --brand:       var(--teal-700);
  --brand-hover: var(--teal-600);
  --brand-deep:  var(--teal-800);
  --brand-tint:  #F0F9F9;

  /* Status. Foreground / background / border triples so a pill, a banner and
     an inline note can all be built from one set. */
  --success-fg: #2E7D42;  --success-bg: #EAF6EC;  --success-br: #C7E6CC;
  --danger-fg:  #9C3B32;  --danger-bg:  #FDEDEC;  --danger-br:  #F3C7C2;
  --warn-fg:    #8A5A12;  --warn-bg:    #FBF2E2;  --warn-br:    #EFDCB8;
  --info-fg:    var(--teal-700); --info-bg: var(--brand-tint); --info-br: var(--teal-200);

  --star: #E8A33D;

  /* ---- Type ----------------------------------------------------------- */
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --fs-3xs: 0.6875rem;  /* 11 */
  --fs-2xs: 0.75rem;    /* 12 */
  --fs-xs:  0.8125rem;  /* 13 */
  --fs-sm:  0.875rem;   /* 14 */
  --fs-md:  0.9375rem;  /* 15 — body */
  --fs-lg:  1.0625rem;  /* 17 */
  --fs-xl:  1.3125rem;  /* 21 */
  --fs-2xl: 1.625rem;   /* 26 */
  --fs-d3: clamp(1.375rem, 1.15rem + 0.9vw, 1.75rem);
  --fs-d2: clamp(1.625rem, 1.25rem + 1.6vw, 2.25rem);
  --fs-d1: clamp(2rem, 1.4rem + 2.6vw, 3rem);

  --lh-tight: 1.14;
  --lh-snug: 1.3;
  --lh-normal: 1.55;
  --lh-relaxed: 1.7;

  --tracking-tight: -0.015em;
  --tracking-normal: 0;
  --tracking-wide: 0.06em;

  /* ---- Space (4px base) ----------------------------------------------- */
  --space-1: 4px;   --space-2: 8px;   --space-3: 12px;  --space-4: 16px;
  --space-5: 20px;  --space-6: 24px;  --space-8: 32px;  --space-10: 40px;
  --space-12: 48px; --space-16: 64px; --space-20: 80px;

  /* ---- Radii ---------------------------------------------------------- */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 26px;
  --radius-pill: 999px;

  /* ---- Elevation ------------------------------------------------------ */
  --elev-0: none;
  --elev-1: 0 1px 2px rgba(10, 26, 26, 0.05);
  --elev-2: 0 1px 2px rgba(10, 26, 26, 0.04), 0 8px 20px rgba(10, 26, 26, 0.06);
  --elev-3: 0 2px 4px rgba(10, 26, 26, 0.04), 0 16px 36px rgba(10, 26, 26, 0.09);
  --elev-4: 0 24px 60px rgba(10, 26, 26, 0.20);
  --ring-focus: 0 0 0 3px rgba(16, 171, 171, 0.32);

  /* ---- Motion --------------------------------------------------------- */
  --dur-instant: 90ms;
  --dur-quick: 140ms;
  --dur-base: 220ms;
  --dur-slow: 380ms;
  --dur-page: 300ms;
  --dur-reveal: 620ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --ease-emphasized: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-exit: cubic-bezier(0.4, 0, 1, 1);
  --stagger-step: 45ms;

  /* ---- Layout --------------------------------------------------------- */
  --container-sm: 520px;
  --container-md: 760px;
  --container-lg: 1120px;
  --container-xl: 1360px;
  --gutter: var(--space-4);
  --topbar-h: 60px;

  --z-sticky: 20;
  --z-topbar: 50;
  --z-dropdown: 150;
  --z-overlay: 200;
  --z-toast: 300;
}

@media (min-width: 768px) {
  :root { --gutter: var(--space-6); }
}
@media (min-width: 1280px) {
  :root { --gutter: var(--space-8); }
}

/* =========================================================================
   Dark theme. Only the semantic layer is redefined — every component reads
   through it, so nothing else needs a dark variant.

   Two selectors on purpose: the media query covers the OS default, and the
   [data-theme] attribute lets an explicit choice win in both directions.
   Never give a color its ONLY definition inside these blocks.
   ========================================================================= */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;

    --surface-canvas:  #0B1616;
    --surface-raised:  #122020;
    --surface-sunken:  #0E1A1A;
    --surface-inverse: #E8EFEE;
    --surface-overlay: rgba(0, 0, 0, 0.66);
    --surface-glass:   rgba(18, 32, 32, 0.86);

    --border-subtle: #1F3030;
    --border-strong: #2C4141;

    --text-primary:   #E9F0EF;
    --text-secondary: #A8B8B6;
    --text-tertiary:  #7E908E;
    --text-brand:     var(--teal-300);

    --brand:       var(--teal-500);
    --brand-hover: var(--teal-400);
    --brand-deep:  var(--teal-600);
    --brand-tint:  rgba(16, 171, 171, 0.14);

    --success-fg: #7BD79A;  --success-bg: rgba(46, 125, 66, 0.18);  --success-br: rgba(123, 215, 154, 0.28);
    --danger-fg:  #F0A69E;  --danger-bg:  rgba(156, 59, 50, 0.20);  --danger-br:  rgba(240, 166, 158, 0.28);
    --warn-fg:    #E7C179;  --warn-bg:    rgba(138, 90, 18, 0.20);  --warn-br:    rgba(231, 193, 121, 0.28);
    --info-fg:    var(--teal-300); --info-bg: rgba(16, 171, 171, 0.14); --info-br: rgba(95, 209, 201, 0.28);

    --elev-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --elev-2: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 20px rgba(0, 0, 0, 0.35);
    --elev-3: 0 2px 4px rgba(0, 0, 0, 0.3), 0 16px 36px rgba(0, 0, 0, 0.45);
    --elev-4: 0 24px 60px rgba(0, 0, 0, 0.6);
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;

  --surface-canvas:  #0B1616;
  --surface-raised:  #122020;
  --surface-sunken:  #0E1A1A;
  --surface-inverse: #E8EFEE;
  --surface-overlay: rgba(0, 0, 0, 0.66);
  --surface-glass:   rgba(18, 32, 32, 0.86);

  --border-subtle: #1F3030;
  --border-strong: #2C4141;

  --text-primary:   #E9F0EF;
  --text-secondary: #A8B8B6;
  --text-tertiary:  #7E908E;
  --text-brand:     var(--teal-300);

  --brand:       var(--teal-500);
  --brand-hover: var(--teal-400);
  --brand-deep:  var(--teal-600);
  --brand-tint:  rgba(16, 171, 171, 0.14);

  --success-fg: #7BD79A;  --success-bg: rgba(46, 125, 66, 0.18);  --success-br: rgba(123, 215, 154, 0.28);
  --danger-fg:  #F0A69E;  --danger-bg:  rgba(156, 59, 50, 0.20);  --danger-br:  rgba(240, 166, 158, 0.28);
  --warn-fg:    #E7C179;  --warn-bg:    rgba(138, 90, 18, 0.20);  --warn-br:    rgba(231, 193, 121, 0.28);
  --info-fg:    var(--teal-300); --info-bg: rgba(16, 171, 171, 0.14); --info-br: rgba(95, 209, 201, 0.28);

  --elev-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --elev-2: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 20px rgba(0, 0, 0, 0.35);
  --elev-3: 0 2px 4px rgba(0, 0, 0, 0.3), 0 16px 36px rgba(0, 0, 0, 0.45);
  --elev-4: 0 24px 60px rgba(0, 0, 0, 0.6);
}

/* =========================================================================
   Global reduced-motion guard — same policy as web-book/src/styles/base.css.
   Motion is reduced, not removed: elements still land in their final state,
   nothing depends on an animation completing to become usable.
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
