/*
 * Design tokens. CLAUDE.md section 5.
 *
 * "The app is a room at dusk. Color means light."
 * The interface stays quiet and blue-slate. Warm or cool colour appears only
 * where a real light is on, or where an action will create light.
 */

:root {
  color-scheme: dark light;

  /* Light is the default here so every token has a value outside a media query. */
  --dusk: #f3f5f9;
  --slate: #ffffff;
  --filament: #d9831c;
  --daylight: #5b8fd9;
  --moonlight: #151a24;
  --haze: #667085;
  --alert: #d93a2b;

  /* Hairline separators, derived rather than a new token. */
  --edge: color-mix(in srgb, var(--haze) 22%, transparent);

  /* Spacing scale: 4, 8, 12, 16, 24, 32. Nothing else. */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;

  --screen-pad: var(--s4);
  --section-gap: var(--s5);

  /* Shape */
  --r-tile: 16px;
  --r-card: 20px;
  --card-ratio: 1.586; /* a real credit card */

  /* Motion. Springs for interaction, nothing on entrance. */
  --dur-fast: 150ms;
  --dur: 300ms;
  --dur-slow: 600ms;
  --ease-spring: cubic-bezier(0.22, 1.2, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* Type. System stack resolves to SF Pro on Apple and Roboto on Android,
     and falls through to SF Arabic / Noto for Arabic automatically. */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --font-round: ui-rounded, "SF Pro Rounded", -apple-system, system-ui, sans-serif;

  --t-title: clamp(2rem, 1.5rem + 2.2vw, 2.6rem);
  --t-card: clamp(1.25rem, 1.1rem + 0.7vw, 1.5rem);
  --t-head: 1.0625rem;
  --t-body: 1rem;
  --t-sub: 0.875rem;
  --t-value: clamp(3rem, 2rem + 5vw, 3.5rem);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --dusk: #151a24;
    --slate: #202736;
    --filament: #ffb25c;
    --daylight: #d6e6ff;
    --moonlight: #edf0f5;
    --haze: #8c95a8;
    --alert: #ff6b5e;
  }
}

:root[data-theme="dark"] {
  --dusk: #151a24;
  --slate: #202736;
  --filament: #ffb25c;
  --daylight: #d6e6ff;
  --moonlight: #edf0f5;
  --haze: #8c95a8;
  --alert: #ff6b5e;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--dusk);
  color: var(--moonlight);
  font-family: var(--font);
  font-size: var(--t-body);
  line-height: 1.45;
  /* iOS: keep content clear of the notch and home indicator. */
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
  overflow-x: hidden;
}

/* Screen titles and card names carry the app's typographic personality. */
h1,
.t-card-name {
  font-weight: 600;
  font-stretch: expanded;
  font-variation-settings: "wdth" 120;
  letter-spacing: -0.01em;
  margin: 0;
}

h1 {
  font-size: var(--t-title);
}

h2 {
  font-size: var(--t-head);
  font-weight: 600;
  margin: 0;
}

.num {
  font-family: var(--font-round);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.sub {
  font-size: var(--t-sub);
  color: var(--haze);
}

[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
