/* The Us — design tokens
   Source of truth: brand/The-Us-Brand-Sheet.pdf (palette, type, mark) and docs/design_tokens.json.
   Cream is the default ground. Tokens marked "derived" are proposals for designer review.
   Dark mode: the existing app's dark theme is preserved in the engine page; no dark design
   is defined here until one is approved. All semantic tokens are overridable for that later. */

@font-face { font-family: "PP Fragment Serif"; src: url(../../assets/fonts/PPFragmentSerif-300.woff2) format("woff2"); font-weight: 300; font-display: swap; }
@font-face { font-family: "PP Fragment Sans";  src: url(../../assets/fonts/PPFragmentSans-300.woff2)  format("woff2"); font-weight: 300; font-display: swap; }
@font-face { font-family: "PP Fragment Sans";  src: url(../../assets/fonts/PPFragmentSans-800.woff2)  format("woff2"); font-weight: 800; font-display: swap; }

:root {
  /* ---- Brand palette (exact, brand sheet) ---- */
  --brand-gold: #E6B532;        /* midpoint core; never changes */
  --brand-terracotta: #E0603C;  /* always the first bloom ring */
  --brand-neon-pink: #892198;   /* bloom; also a ground */
  --brand-plum: #542D50;        /* "dark gray neon pink": line work on light; also a ground */
  --brand-deep-cyan: #23504E;   /* bloom; also a ground */
  --brand-bright-cyan: #5A9B98; /* bloom; also a ground — graphics only on cream (2.7:1) */
  --brand-cream: #F2EDE7;       /* line work on dark; also a ground */

  /* ---- Semantic colour (design_tokens.json semanticTokenPlan) ---- */
  --bg: var(--brand-cream);
  --text: var(--brand-plum);
  --text-2: #7C5D76;            /* derived · secondary text + captions, 4.9:1 on cream, 4.6:1 on blush */
  --action: var(--brand-plum);
  --action-text: var(--brand-cream);
  --action-hover: #452441;      /* derived */
  --accent-gold: var(--brand-gold);
  --accent-terracotta: var(--brand-terracotta);
  --accent-positive: var(--brand-deep-cyan);
  --accent-teal: var(--brand-bright-cyan);
  --accent-bloom: var(--brand-neon-pink);
  --surface: #FAF7F3;           /* derived · raised card, slightly lighter than cream */
  --surface-soft: #F1E5DF;      /* derived · blush rows and tiles seen in wireframes */
  --surface-sunk: #EAE1D9;      /* derived · input wells, skeletons */
  --hairline: #E2D5D0;          /* derived · dividers, card borders */
  --hairline-strong: #978080;   /* derived · input + control borders, 3.2:1 (WCAG non-text) */
  --focus: var(--brand-neon-pink);
  --danger: #B3402A;            /* derived from terracotta for text contrast (5.2:1) */
  --scrim: rgba(52, 26, 50, .42);

  /* ---- Type ---- */
  --font-display: "PP Fragment Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "PP Fragment Sans", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-reading: var(--font-display);
  /* scale (px at 16px root) */
  --fs-display: 2.5rem;   /* 40 · welcome / screen hero */
  --fs-h1: 2rem;          /* 32 · screen title */
  --fs-h2: 1.5rem;        /* 24 · section / card title */
  --fs-h3: 1.25rem;       /* 20 · list item title */
  --fs-reading: 1.1875rem;/* 19 · insight + chapter prose */
  --fs-body: 1rem;        /* 16 */
  --fs-small: .875rem;    /* 14 */
  --fs-label: .6875rem;   /* 11 · tracked caps labels */
  --lh-tight: 1.12;
  --lh-snug: 1.3;
  --lh-body: 1.55;
  --lh-reading: 1.6;
  --track-label: .2em;

  /* ---- Space (4px base) ---- */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px;
  --gutter: 20px;          /* screen side padding on phone */
  --content-max: 560px;    /* single-column reading width */

  /* ---- Shape ---- */
  --r-sm: 8px;    /* chips, small tiles */
  --r-md: 14px;   /* artwork, inputs */
  --r-lg: 20px;   /* cards */
  --r-xl: 28px;   /* sheets */
  --r-pill: 999px;/* buttons (wireframes use pills) */

  /* ---- Elevation ---- */
  --shadow-1: 0 1px 2px rgba(84,45,80,.06), 0 2px 8px rgba(84,45,80,.05);
  --shadow-2: 0 6px 24px rgba(84,45,80,.10);
  --shadow-ask: 0 6px 18px rgba(84,45,80,.28);

  /* ---- Motion ---- */
  --ease: cubic-bezier(.2,.7,.2,1);
  --dur-1: 140ms; --dur-2: 240ms; --dur-3: 420ms;

  /* ---- Brand mark on cream (outer ring matched to ground) ---- */
  --mk-ink: var(--brand-plum); --mk-r3: var(--brand-plum); --mk-r3o: .26; --mk-r2o: .40; --mk-r1o: .58;

  /* ---- Layout ---- */
  --tabbar-h: 64px;
  --ask-size: 60px;
  --page-max: 100%;        /* widest content column; set per breakpoint below */
  --sidenav-w: 280px;      /* desktop navigation rail */
}

/* ---- Breakpoints ----
   Three sizes of one system, measured on the app's own width (container queries on .us-app),
   so a component adapts to the space it is given, in the app and in the gallery alike.
     mobile   < 700px     reference 390   phone: the approved foundation, unchanged
     tablet   700–1099px  reference 768   tablet portrait, small windows
     desktop  ≥ 1100px    reference 1920  laptops 1280–1440 and up
   Only spacing, type size and layout change between them. Colour, type families, shapes,
   icons and imagery are identical at every size. */
.us-app { container: us / inline-size; }
@container us (min-width: 700px) {
  .us-app > * {
    --gutter: 40px; --page-max: 840px;
    --fs-display: 3.25rem;   /* 52 */
    --fs-h1: 2.5rem;         /* 40 */
    --fs-h2: 1.625rem;       /* 26 */
    --fs-reading: 1.25rem;   /* 20 */
  }
}
@container us (min-width: 1100px) {
  .us-app > * {
    --gutter: 56px; --page-max: 1200px;
    --fs-display: 4rem;      /* 64 */
    --fs-h1: 3rem;           /* 48 */
    --fs-h2: 1.75rem;        /* 28 */
    --fs-h3: 1.375rem;       /* 22 */
  }
}

/* Mark grounds — each version belongs to the ground it sits on (brand sheet p.5) */
.ground-cream      { --mk-ink:#542D50; --mk-r3:#542D50; --mk-r3o:.26; --mk-r2o:.40; --mk-r1o:.58; background:#F2EDE7; }
.ground-plum       { --mk-ink:#F2EDE7; --mk-r3:#892198; --mk-r3o:.34; --mk-r2o:.42; --mk-r1o:.52; background:#542D50; }
.ground-neon-pink  { --mk-ink:#F2EDE7; --mk-r3:#5E1468; --mk-r3o:.55; --mk-r2o:.0;  --mk-r1o:.60; background:#892198; }
.ground-deep-cyan  { --mk-ink:#F2EDE7; --mk-r3:#3E7471; --mk-r3o:.55; --mk-r2o:.42; --mk-r1o:.60; background:#23504E; }
.ground-bright-cyan{ --mk-ink:#F2EDE7; --mk-r3:#3B7370; --mk-r3o:.55; --mk-r2o:.42; --mk-r1o:.60; background:#5A9B98; }

@media (prefers-reduced-motion: reduce) {
  :root { --dur-1: 0ms; --dur-2: 0ms; --dur-3: 0ms; }
}
