/* =====================================================================
   Design tokens - Lea
   Light is the default. Dark is applied with <html data-theme="dark">
   (set by the inline script in the layout) and, without JavaScript,
   by prefers-color-scheme. Components use ONLY these variables.
   Conservative CSS on purpose: entry-level Android WebViews must render it.
   Contrast (WCAG AA, 4.5:1 for text) was checked for every text/background pair below.
   ===================================================================== */

:root {
  color-scheme: light;

  /* Surfaces */
  --c-bg: #FBF8F1;
  --c-surface: #FFFFFF;
  --c-surface-2: #F4EFE3;
  --c-border: #E6DECB;
  --c-border-strong: #CFC4AB;
  --c-overlay: rgba(31, 29, 26, .45);

  /* Text */
  --c-ink: #1F1D1A;
  --c-ink-2: #57524A;
  --c-ink-3: #6B655A;

  /* Brand accent (amber) */
  --c-accent: #F5B301;
  --c-accent-hover: #E4A400;
  --c-accent-ink: #1F1D1A;          /* text ON the accent color: always dark */
  --c-accent-soft: #FFF1C2;
  --c-accent-text: #8A5E00;         /* accent used as TEXT on light surfaces */

  /* Status */
  --c-read: #1B7049;
  --c-read-soft: #DDF2E7;
  --c-urgent: #B42318;
  --c-urgent-soft: #FDE7E4;
  --c-on-urgent: #FFFFFF;
  --c-info: #1D5FA8;
  --c-info-soft: #E3EEFA;
  --c-focus: #1D5FA8;

  /* Shape and depth */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(31, 29, 26, .06), 0 2px 8px rgba(31, 29, 26, .05);
  --shadow-md: 0 2px 4px rgba(31, 29, 26, .06), 0 10px 28px rgba(31, 29, 26, .09);

  /* Spacing scale */
  --s-1: .25rem;
  --s-2: .5rem;
  --s-3: .75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;
  --s-8: 4.5rem;

  /* Type */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --fs-sm: .875rem;
  --fs-base: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;
  --fs-2xl: clamp(1.5rem, 1.2rem + 1.5vw, 2.125rem);
  --fs-hero: clamp(2rem, 1.3rem + 3.2vw, 3.5rem);

  /* Layout */
  --touch: 48px;                     /* minimum touch target */
  --nav-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --c-bg: #141311;
  --c-surface: #1E1C19;
  --c-surface-2: #27241F;
  --c-border: #38342D;
  --c-border-strong: #4B463D;
  --c-overlay: rgba(0, 0, 0, .6);

  --c-ink: #F3EFE6;
  --c-ink-2: #C4BDAE;
  --c-ink-3: #A29B8D;

  --c-accent: #F5B301;
  --c-accent-hover: #FFC533;
  --c-accent-ink: #1F1D1A;
  --c-accent-soft: #3A2E0B;
  --c-accent-text: #F7C948;

  --c-read: #4CC38A;
  --c-read-soft: #14301F;
  --c-urgent: #FF8A80;
  --c-urgent-soft: #3B1A17;
  --c-on-urgent: #2A0D0A;
  --c-info: #7CB4F0;
  --c-info-soft: #14283F;
  --c-focus: #7CB4F0;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .3);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, .45), 0 12px 30px rgba(0, 0, 0, .4);
}

/* No-JavaScript fallback: follow the operating system. Keep in sync with the block above. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --c-bg: #141311; --c-surface: #1E1C19; --c-surface-2: #27241F;
    --c-border: #38342D; --c-border-strong: #4B463D; --c-overlay: rgba(0, 0, 0, .6);
    --c-ink: #F3EFE6; --c-ink-2: #C4BDAE; --c-ink-3: #A29B8D;
    --c-accent-hover: #FFC533; --c-accent-soft: #3A2E0B; --c-accent-text: #F7C948;
    --c-read: #4CC38A; --c-read-soft: #14301F;
    --c-urgent: #FF8A80; --c-urgent-soft: #3B1A17; --c-on-urgent: #2A0D0A;
    --c-info: #7CB4F0; --c-info-soft: #14283F; --c-focus: #7CB4F0;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .3);
    --shadow-md: 0 2px 4px rgba(0, 0, 0, .45), 0 12px 30px rgba(0, 0, 0, .4);
  }
}
