/* =====================================================================
   Design tokens — single source of truth.
   Portal 10 Gen 2 viewport: 512×300 CSS px (1280×800 physical @ 2.5 DPR).
   Two themes: 'dark' (night/dusk) and 'light' (day). Theme is set
   automatically by /scripts/theme.js based on solar time.
   ===================================================================== */

/* =================== Self-hosted display fonts =================== */
@font-face {
  font-family: "Playfair Display";
  font-weight: 300;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/playfair-display-300.woff2") format("woff2");
}

@font-face {
  font-family: "Space Grotesk";
  font-weight: 300;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/space-grotesk-300.woff2") format("woff2");
}

@font-face {
  font-family: "Instrument Serif";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/instrument-serif-400.woff2") format("woff2");
}

@font-face {
  font-family: "DM Serif Display";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/dm-serif-display-400.woff2") format("woff2");
}

@font-face {
  font-family: "Bodoni Moda";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/bodoni-moda-400.woff2") format("woff2");
}

@font-face {
  font-family: "Share Tech Mono";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/share-tech-mono-400.woff2") format("woff2");
}

:root {
  /* Layout */
  --app-width: 512px;
  --app-height: 300px;
  --frame-padding: 14px;
  --dock-height: 40px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  /* Overscan bleed per side for the burn-in pixel-shift (display-care.js drifts
     the surface ±1px). #app is grown by 2× this so the drift never exposes the
     theme background at an edge; bottom-anchored chrome adds it back. */
  --app-bleed: 2px;

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

  /* Type ramp — 8 sizes only. Use these everywhere. */
  --t-eyebrow: 9px;
  --t-caption: 10px;
  --t-body: 12px;
  --t-body-lg: 13px;
  --t-h3: 14px;
  --t-h2: 18px;
  --t-h1: 26px;
  --t-display: 92px;
  --t-display-xl: 148px;

  /* Home-page accent (vibrant orange) */
  --home-accent: #FF6A00;
  --home-accent-soft: rgba(255, 106, 0, 0.18);
  --home-accent-glow: rgba(255, 106, 0, 0.35);

  /* Home palette — warm (clock dots, hijri, pin, high temps) +
     cool (low temps, forecast lows). Used across home.css/home.js. */
  --home-accent-warm: #f7a520;
  --home-accent-cool: #6ea7c7;

  /* Type families */
  --font-swiss: "Inter Tight", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-ui: "Inter Tight", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Inter Tight", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-editorial: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --font-arabic: "Amiri", "Noto Naskh Arabic", serif;
  --font-urdu: "Noto Nastaliq Urdu", "Noto Nastaliq", serif;
  --font-mono: "JetBrains Mono", monospace;
  --font-home-mono: "Share Tech Mono", "JetBrains Mono", monospace;
  --font-home-display: "Inter Tight", "Inter", sans-serif;
  --font-home-label: "Inter Tight", "Inter", sans-serif;

  /* Home frame type controls — viewport is fixed at 512×300, so no clamp needed. */
  --home-display-size: 115px;
  --home-track-date: 0.02em;
  --home-track-label: 0.02em;
  --home-track-numeric: -0.022em;

  /* Tabular numerals (for clock) */
  --feat-tnum: "tnum" 1, "lnum" 1, "ss01" 1, "zero" 1;

  /* Motion */
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-tap: 140ms;
  --dur-tick: 280ms;
  --dur-card: 600ms;
  --dur-splash: 1200ms;

  /* Cadences (in milliseconds, exposed as design tokens) */
  --cadence-sidebar: 90000;
  --cadence-splash: 600000;
  --cadence-clock: 1000;

  /* Z-index ladder */
  --z-base: 0;
  --z-frame: 1;
  --z-content: 2;
  --z-weather-fx: 3;
  --z-dock: 30;
  --z-settings: 40;
  --z-splash: 50;
  --z-credit: 25;

  /* Hero clock typography — driven by typography.js */
  --hero-font: var(--font-mono, var(--font-display));
  --hero-weight: 200;
  --hero-color: rgba(252, 250, 244, 0.97);
  --hero-shadow: 0 2px 18px rgba(0, 0, 0, 0.55), 0 0 1px rgba(0, 0, 0, 0.30);
  --hero-meta-color: rgba(252, 250, 244, 0.78);
}

/* =================== DARK THEME (default — dusk/night) =================== */
:root,
[data-theme="dark"] {
  --bg-base: #06080c;
  --bg-elev: #0e1117;
  --bg-elev-2: #161a22;

  --surface: rgba(20, 24, 32, 0.62);
  --surface-strong: rgba(28, 33, 42, 0.78);
  --surface-soft: rgba(255, 255, 255, 0.04);
  --surface-glass: rgba(16, 20, 28, 0.55);

  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --border-soft: rgba(255, 255, 255, 0.04);

  --text: rgba(248, 250, 252, 0.96);
  --text-2: rgba(248, 250, 252, 0.72);
  --text-3: rgba(248, 250, 252, 0.48);
  --text-4: rgba(248, 250, 252, 0.30);

  --accent: #d8b46a;        /* warm amber — calm, editorial */
  --accent-2: #6ea7c7;      /* cool blue */
  --accent-soft: rgba(216, 180, 106, 0.18);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.32);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.42);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.48);

  --scrim-top: rgba(8, 11, 16, 0.10);
  --scrim-bottom: rgba(6, 9, 14, 0.62);

  /* Photo-overlay text — always pure white / luminous shades of white, never dark. */
  --splash-text: #ffffff;
  --splash-text-2: rgba(255, 255, 255, 0.88);
  --splash-text-3: rgba(255, 255, 255, 0.76);
  --splash-text-4: rgba(255, 255, 255, 0.36);
  --splash-shadow: 0 2px 18px rgba(0, 0, 0, 0.55), 0 0 1px rgba(0, 0, 0, 0.30);

  color-scheme: dark;
}

/* =================== DAYTIME THEME (luminous white text, dark glass) =================== */
[data-theme="light"] {
  --bg-base: #0a0e14;
  --bg-elev: #11161f;
  --bg-elev-2: #181f2b;

  --surface: rgba(16, 22, 32, 0.64);
  --surface-strong: rgba(22, 28, 40, 0.82);
  --surface-soft: rgba(255, 255, 255, 0.06);
  --surface-glass: rgba(14, 18, 28, 0.58);

  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.22);
  --border-soft: rgba(255, 255, 255, 0.06);

  --text: #ffffff;
  --text-2: rgba(255, 255, 255, 0.86);
  --text-3: rgba(255, 255, 255, 0.70);
  --text-4: rgba(255, 255, 255, 0.42);

  --accent: #ffffff;
  --accent-2: rgba(255, 255, 255, 0.84);
  --accent-soft: rgba(255, 255, 255, 0.16);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.32);
  --shadow-md: 0 8px 22px rgba(0, 0, 0, 0.42);
  --shadow-lg: 0 18px 46px rgba(0, 0, 0, 0.48);

  --scrim-top: rgba(6, 12, 22, 0.22);
  --scrim-bottom: rgba(4, 10, 18, 0.68);

  color-scheme: dark;
}

/* =================== GOLDEN HOUR (transitional) =================== */
[data-theme="golden"] {
  --bg-base: #2a1d12;
  --bg-elev: #3a2615;
  --bg-elev-2: #4a3018;

  --surface: rgba(50, 32, 18, 0.55);
  --surface-strong: rgba(60, 38, 22, 0.74);
  --surface-soft: rgba(255, 215, 160, 0.06);
  --surface-glass: rgba(40, 26, 14, 0.55);

  --border: rgba(255, 220, 170, 0.12);
  --border-strong: rgba(255, 220, 170, 0.22);
  --border-soft: rgba(255, 220, 170, 0.06);

  --text: rgba(255, 246, 230, 0.96);
  --text-2: rgba(255, 240, 215, 0.74);
  --text-3: rgba(255, 230, 195, 0.50);
  --text-4: rgba(255, 220, 175, 0.30);

  --accent: #e9b061;
  --accent-2: #c97a40;
  --accent-soft: rgba(233, 176, 97, 0.22);

  --shadow-sm: 0 2px 8px rgba(20, 10, 4, 0.40);
  --shadow-md: 0 8px 22px rgba(20, 10, 4, 0.50);
  --shadow-lg: 0 18px 46px rgba(20, 10, 4, 0.58);

  --scrim-top: rgba(20, 12, 6, 0.10);
  --scrim-bottom: rgba(15, 8, 4, 0.50);

  color-scheme: dark;
}
