/* Design tokens. Site world (near-black, Inter Tight, one serif italic word, one blue)
   plus Apple's Liquid Glass layer for everything that floats above content. */
:root {
  --f-sans: "Unbounded", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --f-serif: "Playfair Display", "Times New Roman", Times, serif;

  /* type scale (fixed rem, product UI) */
  --t-display: 64px;   /* Today headline / timer digits use their own sizes */
  --t-title: 34px;     /* screen titles */
  --t-h2: 22px;
  --t-h3: 17px;
  --t-body: 15px;
  --t-small: 13px;
  --t-micro: 11px;

  /* spacing (4pt grid) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px; --s12: 48px; --s16: 64px;
  --pad: 20px;
  --content-max: 760px;
  --wide-max: 1120px;

  /* radii — concentric: inner radius = outer radius - padding */
  --r-xs: 8px; --r-s: 12px; --r-m: 18px; --r-l: 26px; --r-xl: 34px; --r-pill: 999px;

  /* tab bar */
  --tabbar-h: 64px;
  --tabbar-gap: 14px;          /* distance from the bottom edge */
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --bottom-space: calc(var(--tabbar-h) + var(--tabbar-gap) + var(--safe-b) + 28px);

  /* motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 160ms;
  --dur: 240ms;
  /* controls (switch knob, segmented lens, slider jumps): one smooth ease-out, no overshoot */
  --ease-ctl: cubic-bezier(0.25, 0.9, 0.3, 1);
  --dur-ctl: 230ms;
  /* --spring / --spring-bouncy and their durations are generated in ui/motion.js */
  --spring: var(--ease-out);
  --spring-dur: 420ms;
  --spring-bouncy: var(--ease-out);
  --spring-bouncy-dur: 560ms;

  /* state colours (Apple system palette, tuned for dark) */
  --green: #30d158;
  --orange: #ff9f0a;
  --red: #ff453a;
  --yellow: #ffd60a;
  --mint: #63e6e2;
  --purple: #bf5af2;
  --pink: #ff375f;
}

/* ---------- dark (default, the site's world) ---------- */
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg-rgb: 11 11 12;
  --fg-rgb: 237 237 234;
  --bg: rgb(var(--bg-rgb));
  --fg: rgb(var(--fg-rgb));
  --panel: #17181b;
  --panel-2: #1f2024;
  --muted: rgb(var(--fg-rgb) / 0.62);
  --faint: rgb(var(--fg-rgb) / 0.36);
  --line: rgb(var(--fg-rgb) / 0.12);
  --line-strong: rgb(var(--fg-rgb) / 0.22);
  --hover: rgb(var(--fg-rgb) / 0.06);
  --press: rgb(var(--fg-rgb) / 0.1);
  --accent: var(--skin-accent, #2d5bff);
  --accent-rgb: var(--skin-accent-rgb, 45 91 255);
  --on-accent: #fff;
  --cta-rgb: 45 91 255;   /* main action buttons (ui/look.js sets it: the app colour, blue for Graphite) */
  --scrim: rgb(0 0 0 / 0.46);

  /* glass */
  --glass-tint: rgb(255 255 255 / 0.045);
  --glass-tint-strong: rgb(30 31 35 / 0.55);
  --glass-rim: 255 255 255;
  --glass-rim-a: 0.55;
  --glass-shadow: 0 18px 40px -12px rgb(0 0 0 / 0.65), 0 4px 12px -2px rgb(0 0 0 / 0.4);
  --glass-shadow-s: 0 8px 20px -6px rgb(0 0 0 / 0.55), 0 2px 6px -1px rgb(0 0 0 / 0.35);
  --glass-inner-dark: rgb(0 0 0 / 0.28);
  --glass-fallback: blur(18px) saturate(170%) brightness(1.05);
  --sheet-rgb: 26 27 31;
}

/* ---------- light (Apple reference ground) ---------- */
:root[data-theme="light"] {
  color-scheme: light;
  --bg-rgb: 240 241 244;
  --fg-rgb: 13 13 14;
  --panel: #ffffff;
  --panel-2: #f7f8fa;
  --muted: rgb(var(--fg-rgb) / 0.6);
  --faint: rgb(var(--fg-rgb) / 0.5);   /* was 0.34: 2.2:1 on the light page (week days, calendar numbers, kickers); now 3.6:1 (owner 2026-11-19) */
  --line: rgb(var(--fg-rgb) / 0.1);
  --line-strong: rgb(var(--fg-rgb) / 0.2);
  --hover: rgb(var(--fg-rgb) / 0.045);
  --press: rgb(var(--fg-rgb) / 0.08);
  --accent: var(--skin-accent-light, var(--skin-accent, #2450f0));
  --scrim: rgb(20 22 28 / 0.22);
  --green: #28b44a; --orange: #f08c00; --red: #e5372c; --yellow: #d9a800;

  --glass-tint: rgb(255 255 255 / 0.10);
  --glass-tint-strong: rgb(246 247 250 / 0.6);
  --glass-rim: 255 255 255;
  --glass-rim-a: 0.95;
  --glass-shadow: 0 1px 2px rgb(28 34 52 / 0.08), 0 14px 30px -16px rgb(28 34 52 / 0.22);
  --sheet-rgb: 250 250 252;
  --glass-shadow-s: 0 1px 2px rgb(28 34 52 / 0.08), 0 6px 14px -8px rgb(28 34 52 / 0.16);
  --glass-inner-dark: rgb(40 48 70 / 0.16);
  --glass-fallback: blur(18px) saturate(180%) brightness(1.06);
}

/* ---------- skins (change silk, stone and accent) ---------- */
:root[data-skin="graphite"] { --skin-accent: #2d5bff; --skin-accent-rgb: 45 91 255; --stone-a: #f4f4f1; --stone-b: #9a9ba0; --stone-glow: 255 255 255; }
:root[data-theme="light"][data-skin="graphite"] { --stone-a: #c9cbd1; --stone-b: #45474d; --stone-glow: 120 124 136; }
:root[data-skin="sapphire"] { --skin-accent: #3d6bff; --skin-accent-rgb: 61 107 255; --stone-a: #a9c1ff; --stone-b: #1f45d6; --stone-glow: 80 130 255; }
:root[data-skin="dawn"]     { --skin-accent: #ff7a45; --skin-accent-rgb: 255 122 69; --skin-accent-light: #e8602a; --stone-a: #ffe08a; --stone-b: #ff4f6d; --stone-glow: 255 150 90; }

@media (prefers-reduced-transparency: reduce) {
  :root { --glass-tint: var(--panel); --glass-fallback: none; }
}
@media (prefers-contrast: more) {
  :root { --glass-tint: var(--panel); --line: rgb(var(--fg-rgb) / 0.3); }
}

/* the seven parts of the day, one hue each, carried around the day lens (ui/stone.js) and in labels */
:root, :root[data-skin="graphite"] { --p0: #ffb84d; --p1: #ff8b6a; --p2: #ff6b8f; --p3: #b779ff; --p4: #6f8bff; --p5: #3fc6ff; --p6: #43d6a3; }
:root[data-skin="sapphire"] { --p0: #a6d8ff; --p1: #7fb8ff; --p2: #5f97ff; --p3: #6d7bff; --p4: #8b6dff; --p5: #a66dff; --p6: #74e0ff; }
:root[data-skin="dawn"] { --p0: #ffd66e; --p1: #ffb763; --p2: #ff925c; --p3: #ff6f6c; --p4: #ff5f8c; --p5: #e86bb6; --p6: #ffc8a0; }
:root[data-theme="light"] { --p-dim: 0.92; }
:root[data-theme="light"][data-skin="graphite"], :root[data-theme="light"]:not([data-skin]) { --p0: #f29d1c; --p1: #f2704c; --p2: #ef4c78; --p3: #9b57f2; --p4: #4f6ff5; --p5: #1aa8e8; --p6: #19b886; }

:root[data-theme="light"][data-skin="sapphire"] { --p0: #5fb2f0; --p1: #4a8ff0; --p2: #3a6ff0; --p3: #4b55e8; --p4: #6a48e6; --p5: #8a46e0; --p6: #2fb7e6; }
:root[data-theme="light"][data-skin="dawn"] { --p0: #e8a91c; --p1: #ef8a2c; --p2: #ef6a3a; --p3: #ec4a4a; --p4: #e83f72; --p5: #cf4a98; --p6: #ee9a6a; }
:root[data-theme="light"] { --ring-label-done: rgb(var(--fg-rgb)); }   /* custom ring colours stay readable as label text on a light page */
:root[data-skin="forest"] { --stone-a: #b6f0d6; --stone-b: #1d8a62; --stone-glow: 60 200 150; }
:root[data-skin="violet"] { --stone-a: #d6c4ff; --stone-b: #5b34d6; --stone-glow: 150 110 255; }
:root[data-theme="light"] { --ring-empty: 0.13; }   /* empty ring parts stay visible on a light page */
