/* ─────────────────────────────────────────────────────────────────────────────
   Apple design system — tokens
   Everything downstream (liquid-glass.css, components) reads from here.
   Override the BRAND block; leave the SYSTEM block alone unless you know why.
   ───────────────────────────────────────────────────────────────────────────── */

:root {
  color-scheme: light dark;

  /* ═══ BRAND — override these ═════════════════════════════════════════════ */

  /* The accent tints exactly ONE thing per view: the primary action.
     Give it real RGB triplets so alpha compositing works. */
  --accent-rgb: 0 136 255;                 /* light appearance */
  --accent-dark-rgb: 0 145 255;            /* dark appearance */
  --accent-hc-rgb: 30 110 244;             /* increased contrast, light */
  --accent-hc-dark-rgb: 92 184 255;        /* increased contrast, dark */

  /* Two families, no more. The UI/chrome font should feel native — that is what
     makes glass chrome read as part of the OS rather than as a widget. The
     display font is where brand personality lives (content layer). */
  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --font-display: var(--font-ui);          /* ← swap for the brand face */
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;

  /* Base curvature. Everything nested derives from these, so they are the only
     radii you should ever type by hand. */
  --radius-window: 24px;                   /* outermost surface */
  --radius-card: 18px;
  --radius-control: 12px;
  --radius-capsule: 9999px;

  /* ═══ SYSTEM ═════════════════════════════════════════════════════════════ */

  /* ── Spacing (4pt rhythm) ─────────────────────────────────────────────── */
  --sp-1: 4px;   --sp-2: 8px;   --sp-3: 12px;  --sp-4: 16px;
  --sp-5: 20px;  --sp-6: 24px;  --sp-8: 32px;  --sp-10: 40px;
  --sp-12: 48px; --sp-16: 64px; --sp-20: 80px; --sp-24: 96px;

  /* Minimum comfortable hit target, and the gap between targets. Spacing
     between controls matters as much as their size. */
  --hit-min: 44px;
  --hit-gap: var(--sp-2);

  /* ── Type scale ─────────────────────────────────────────────────────────
     Proportions follow Apple's text styles (iOS runs 17pt body; the web
     equivalent is 17px with the same hierarchy shape). Bolder and
     left-aligned by default — that is the 2025 change.
     For pixel-exact platform tables use Apple Design Resources.            */
  --text-large-title:  34px;  --leading-large-title: 41px;  --weight-large-title: 700;
  --text-title-1:      28px;  --leading-title-1:     34px;  --weight-title-1:     700;
  --text-title-2:      22px;  --leading-title-2:     28px;  --weight-title-2:     700;
  --text-title-3:      20px;  --leading-title-3:     25px;  --weight-title-3:     600;
  --text-headline:     17px;  --leading-headline:    22px;  --weight-headline:    600;
  --text-body:         17px;  --leading-body:        22px;  --weight-body:        400;
  --text-callout:      16px;  --leading-callout:     21px;  --weight-callout:     400;
  --text-subheadline:  15px;  --leading-subheadline: 20px;  --weight-subheadline: 400;
  --text-footnote:     13px;  --leading-footnote:    18px;  --weight-footnote:    400;
  --text-caption-1:    12px;  --leading-caption-1:   16px;  --weight-caption-1:   400;
  --text-caption-2:    11px;  --leading-caption-2:   13px;  --weight-caption-2:   500;

  /* ── Motion ─────────────────────────────────────────────────────────────
     Liquid Glass flexes and settles; it does not ease linearly. The spring
     curve carries a small overshoot, which is what reads as "gel". */
  --ease-glass: cubic-bezier(0.32, 0.72, 0, 1);        /* sheets, morphs, presents */
  --ease-out:   cubic-bezier(0.25, 0.46, 0.45, 0.94);  /* everyday transitions */
  --ease-spring: linear(
    0, 0.0092 4.8%, 0.0369 9.7%, 0.1523 19.9%, 0.3413 30.1%,
    0.5459 41.4%, 0.7351 51.4%, 0.8749 61.6%, 0.9585 69.2%,
    1.0202 79.6%, 1.0375 87.1%, 1.0198 94.6%, 1
  );

  --dur-instant: 120ms;   /* press feedback */
  --dur-fast:    220ms;   /* hover, tint, small state change */
  --dur-base:    340ms;   /* morph, expand, present */
  --dur-slow:    520ms;   /* large surfaces, sheets */

  /* ── Liquid Glass material ──────────────────────────────────────────────
     Defaults are the REGULAR variant at small size (bar, button).
     liquid-glass.css re-declares these per variant and per size. */
  --lg-blur: 24px;              /* frost */
  --lg-sat: 180%;               /* backdrops go grey under blur; saturation restores richness */
  --lg-bright: 1.05;
  --lg-veil-rgb: 255 255 255;   /* the tint the glass itself carries */
  --lg-veil-a: 0.16;
  --lg-specular: 0.55;          /* top-edge highlight strength */
  --lg-rim: 0.22;               /* hairline rim */
  --lg-lens-w: 1.5px;           /* width of the refracting rim band */
  --lg-lens-bright: 1.25;
  --lg-shadow-y: 8px;
  --lg-shadow-blur: 24px;
  --lg-shadow-a: 0.12;
  --lg-glow: 0;                 /* pointer illumination, driven by JS on press */
  --lg-radius: var(--radius-capsule);
  --lg-fg: rgb(0 0 0 / 0.92);

  /* Opaque stand-in used when transparency is unavailable or unwanted.
     Not a grey — it is the surface the glass would average to. */
  --lg-solid-rgb: 246 246 248;

  /* ── Semantic surfaces & text (light) ───────────────────────────────────
     Named for role, never for hue — that is what lets them flip. */
  --bg-primary:    rgb(255 255 255);
  --bg-secondary:  rgb(242 242 247);
  --bg-tertiary:   rgb(229 229 234);
  --label:           rgb(0 0 0 / 0.92);
  --label-secondary: rgb(0 0 0 / 0.60);
  --label-tertiary:  rgb(0 0 0 / 0.36);
  --label-quaternary:rgb(0 0 0 / 0.20);
  --separator:       rgb(0 0 0 / 0.12);
  --fill:            rgb(120 120 128 / 0.20);
  --fill-secondary:  rgb(120 120 128 / 0.16);
  --fill-tertiary:   rgb(118 118 128 / 0.12);

  --accent: rgb(var(--accent-rgb));
}

/* ── Dark appearance ──────────────────────────────────────────────────────
   Provide these even if the product ships light-only: glass flips light/dark
   independently of the app's appearance setting. */
@media (prefers-color-scheme: dark) {
  :root {
    --lg-veil-rgb: 255 255 255;
    --lg-veil-a: 0.10;
    --lg-bright: 0.92;
    --lg-specular: 0.28;
    --lg-rim: 0.16;
    --lg-shadow-a: 0.40;
    --lg-fg: rgb(255 255 255 / 0.94);
    --lg-solid-rgb: 28 28 30;

    --bg-primary:    rgb(0 0 0);
    --bg-secondary:  rgb(28 28 30);
    --bg-tertiary:   rgb(44 44 46);
    --label:           rgb(255 255 255 / 0.94);
    --label-secondary: rgb(255 255 255 / 0.62);
    --label-tertiary:  rgb(255 255 255 / 0.38);
    --label-quaternary:rgb(255 255 255 / 0.22);
    --separator:       rgb(255 255 255 / 0.16);
    --fill:            rgb(120 120 128 / 0.36);
    --fill-secondary:  rgb(120 120 128 / 0.32);
    --fill-tertiary:   rgb(118 118 128 / 0.24);

    --accent: rgb(var(--accent-dark-rgb));
  }
}

/* ── Increased contrast ───────────────────────────────────────────────────
   Not a nudge. Elements become predominantly black or white with a
   contrasting border, and translucency largely stops carrying meaning. */
@media (prefers-contrast: more) {
  :root {
    --label:           rgb(0 0 0);
    --label-secondary: rgb(0 0 0 / 0.80);
    --separator:       rgb(0 0 0 / 0.42);
    --accent: rgb(var(--accent-hc-rgb));
  }
}
@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
  :root {
    --label:           rgb(255 255 255);
    --label-secondary: rgb(255 255 255 / 0.85);
    --separator:       rgb(255 255 255 / 0.45);
    --accent: rgb(var(--accent-hc-dark-rgb));
  }
}

/* ── Concentricity ────────────────────────────────────────────────────────
   Nested radius = parent radius − padding. That is the whole formula, but
   WHERE it lives matters.

   It cannot be a `:root` token. Custom properties are substituted at
   computed-value time on the element where they are DECLARED, so a token
   like `--radius-concentric: calc(var(--radius-outer) - var(--pad))` sitting
   in `:root` resolves against :root's own (absent) values and computes to
   0px. A child that reads it inherits the already-substituted 0 and every
   nested corner silently goes square. Measured in Chrome: via a :root token
   → 0px; the identical calc written on the child → 6px.

   So the parent publishes the two inputs — they inherit normally — and the
   CHILD does the arithmetic in a real property:

     .card     { --radius-outer: var(--radius-card); --pad: var(--sp-3);
                 border-radius: var(--radius-outer); padding: var(--pad); }
     .card img { border-radius: max(0px, calc(var(--radius-outer) - var(--pad))); }

   …or just give the child this class.                                       */
.concentric {
  border-radius: max(0px, calc(var(--radius-outer, 0px) - var(--pad, 0px)));
}

/* ── Base type ───────────────────────────────────────────────────────────── */
body {
  font-family: var(--font-ui);
  font-size: var(--text-body);
  line-height: calc(var(--leading-body) / var(--text-body));
  color: var(--label);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
