/* ==========================================================================
   MORI Gold — Design Tokens v1.0
   Dark-first. Restrained luxury: ink bases, ivory type, metallic gold used
   sparingly (primary action, key figures, seal), one accent (sovereign emerald).
   Fonts: Cormorant Garamond (display, OFL) + Inter (UI, OFL). System fallbacks.
   ========================================================================== */
:root {
  color-scheme: dark;

  /* ---- Ink (bases) ---------------------------------------------------- */
  --ink-0: #070708;          /* app background, deepest */
  --ink-1: #0c0c0f;          /* screen background */
  --ink-2: #131317;          /* raised surface (cards, rows) */
  --ink-3: #1b1b21;          /* elevated (sheets, inputs) */
  --ink-4: #25252d;          /* pressed / hover */
  --line-1: rgba(243, 238, 227, 0.07);   /* hairline */
  --line-2: rgba(243, 238, 227, 0.13);   /* stronger divider / input border */
  --line-gold: rgba(217, 182, 90, 0.38); /* gilded hairline */

  /* ---- Ivory (text) — all AA on --ink-1 ---------------------------------- */
  --ivory-1: #f3eee3;        /* primary text   ~16.9:1 */
  --ivory-2: #c9c1b1;        /* secondary text ~11.0:1 */
  --ivory-3: #948d80;        /* tertiary/meta   ~5.9:1 (AA body; 5.2:1 on ink-3) */
  --ivory-4: #6b665d;        /* disabled only (not for essential text) */

  /* ---- Gold (metal) ----------------------------------------------------- */
  --gold-100: #f8ecc4;
  --gold-200: #ecd48c;
  --gold-300: #d9b65a;       /* gold text on ink ~10.0:1 */
  --gold-400: #c29a3c;
  --gold-500: #a07c2a;
  --gold-600: #7a5d1d;
  --gold-ink: #17120a;       /* text on gold ~9.6:1 (>=4.8:1 at darkest gradient stop) */

  /* True metallic gradients: multiple stops simulate a specular band */
  --gold-metal: linear-gradient(135deg,
      #7a5d1d 0%, #c29a3c 18%, #f8ecc4 34%, #d9b65a 48%,
      #a07c2a 64%, #ecd48c 82%, #8f6d22 100%);
  --gold-metal-soft: linear-gradient(135deg,
      #a07c2a 0%, #d9b65a 30%, #f1dd9c 50%, #c9a24a 72%, #9a7727 100%);
  --gold-text: linear-gradient(100deg, #c29a3c 0%, #f8ecc4 45%, #d9b65a 60%, #a07c2a 100%);
  --gold-glow: radial-gradient(60% 60% at 50% 0%, rgba(217,182,90,.18), transparent 70%);

  /* ---- Accent: sovereign emerald (live / positive / verified) ----------- */
  --accent: #5cc49a;         /* ~9.3:1 on ink */
  --accent-dim: rgba(92, 196, 154, 0.14);
  /* Functional (not decorative) */
  --warn: #e8b86a;
  --danger: #e88a7a;         /* ~7.0:1 on ink */
  --danger-dim: rgba(232, 138, 122, 0.14);

  /* ---- Typography ------------------------------------------------------- */
  --font-display: "Cormorant Garamond", "Cormorant", "Playfair Display",
                  "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-ui: "Inter", "Inter Tight", system-ui, -apple-system, "Segoe UI",
             Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-num: "Inter", system-ui, sans-serif; /* use with tabular-nums */

  /* Scale (mobile-first, 1.25 ratio for UI; display is free-standing) */
  --fs-micro: 0.6875rem;   /* 11 — overlines, ALL CAPS w/ tracking */
  --fs-xs: 0.75rem;        /* 12 */
  --fs-sm: 0.8125rem;      /* 13 */
  --fs-md: 0.9375rem;      /* 15 — body */
  --fs-lg: 1.0625rem;      /* 17 — row titles, buttons */
  --fs-xl: 1.375rem;       /* 22 — section titles (display) */
  --fs-2xl: 1.875rem;      /* 30 — screen titles (display) */
  --fs-3xl: 2.625rem;      /* 42 — hero figures (display) */
  --fs-4xl: 3.5rem;        /* 56 — welcome mark */

  --fw-light: 300; --fw-reg: 400; --fw-med: 500; --fw-semi: 600;
  --lh-tight: 1.08; --lh-snug: 1.25; --lh-body: 1.5;
  --track-caps: 0.18em;    /* overlines */
  --track-display: -0.01em;

  /* ---- Spacing (4pt grid) ---------------------------------------------- */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-7: 32px; --sp-8: 40px;
  --sp-9: 56px; --sp-10: 72px;
  --gutter: 20px;          /* screen side padding */

  /* ---- Radii ------------------------------------------------------------ */
  --r-xs: 6px; --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-xl: 28px;
  --r-pill: 999px;

  /* ---- Elevation & glass ------------------------------------------------ */
  --shadow-1: 0 1px 0 rgba(255,255,255,.03) inset, 0 1px 2px rgba(0,0,0,.4);
  --shadow-2: 0 1px 0 rgba(255,255,255,.04) inset, 0 8px 24px -8px rgba(0,0,0,.6);
  --shadow-3: 0 1px 0 rgba(255,255,255,.05) inset, 0 24px 60px -12px rgba(0,0,0,.75);
  --shadow-gold: 0 10px 30px -10px rgba(217,182,90,.45), 0 0 0 1px rgba(248,236,196,.25) inset;
  --glass-bg: rgba(19, 19, 23, 0.72);
  --glass-blur: saturate(140%) blur(22px);
  --scrim: rgba(4, 4, 5, 0.62);

  /* ---- Motion ----------------------------------------------------------- */
  --dur-instant: 90ms;     /* press feedback */
  --dur-fast: 160ms;       /* toggles, hovers */
  --dur-base: 260ms;       /* most transitions */
  --dur-slow: 420ms;       /* sheets, screen changes */
  --dur-ceremony: 900ms;   /* welcome reveal, one per session max */
  --ease-standard: cubic-bezier(.2, 0, 0, 1);
  --ease-enter: cubic-bezier(.05, .7, .1, 1);    /* decelerate */
  --ease-exit: cubic-bezier(.3, 0, .8, .15);     /* accelerate */
  --ease-spring: cubic-bezier(.34, 1.36, .64, 1);/* subtle overshoot */

  /* ---- Touch & layout --------------------------------------------------- */
  --touch-min: 44px;       /* minimum target; Android prefers 48 */
  --touch-comfort: 52px;   /* primary buttons, list rows */
  --tabbar-h: 64px;
  --appbar-h: 56px;
  --focus-ring: 0 0 0 2px var(--ink-1), 0 0 0 4px var(--gold-300);

  /* ---- Safe areas (Capacitor: viewport-fit=cover) ---------------------- */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);

  /* ---- Map palette (MapLibre GL / Mapbox style spec compatible) ---------
     See map-style.json. Gold is reserved for records & selection only;
     the basemap must stay quiet so markers carry the meaning. */
  --map-bg: #08090b;            /* land / background layer */
  --map-land-alt: #0d0e11;      /* parks, landuse, subtle variance */
  --map-water: #050a10;         /* water: darker + faint blue-black */
  --map-water-line: #10202c;    /* coastline / waterway lines */
  --map-road-minor: #16171b;
  --map-road-major: #212227;
  --map-road-highway: #2c2a24;  /* faint warm cast, never gold */
  --map-building: #111216;
  --map-boundary: rgba(201,193,177,.18);
  --map-label: #7d776c;         /* place labels (map text is non-essential) */
  --map-label-major: #a8a091;
  --map-label-halo: #08090b;
  --map-marker: #d9b65a;        /* record marker fill */
  --map-marker-ring: rgba(217,182,90,.35);
  --map-marker-selected: #f8ecc4;
  --map-cluster-fill: rgba(217,182,90,.16);
  --map-cluster-stroke: rgba(217,182,90,.55);
  --map-heat: rgba(217,182,90,.08); /* density glow */
  --map-route: #d9b65a;         /* transport paths, 2px, dashed when inferred */
  --map-user: #f8ecc4;          /* you-are-here: pale gold core + pulsing gold halo + heading cone (records are solid gold dots, no halo cone) */
  --map-user-halo: rgba(217,182,90,.22);

  /* ---- Land & Claims (first-class status system) -------------------------
     Same 5 statuses on map zones, badges and sheets. Never encode by color
     alone: every zone has a label, every badge an icon + words. */
  --land-open: #5cc49a;       /* Open to prospect (public land, open to entry) */
  --land-open-fill: rgba(92,196,154,.09);
  --land-claim: #e8b86a;      /* Active claim (someone holds mineral rights) */
  --land-claim-fill: rgba(232,184,106,.12);
  --land-private: #8fa3c7;    /* Private land (owner permission required) */
  --land-private-fill: rgba(143,163,199,.10);
  --land-nogo: #e88a7a;       /* Protected, no-go (wilderness, park, withdrawn) — hatched */
  --land-nogo-fill: rgba(232,138,122,.06);
  --land-unknown: #948d80;    /* Unknown, verify locally — dotted outline */
  --land-stroke-dash: 5 4;

  /* ---- Z ---------------------------------------------------------------- */
  --z-tabbar: 20; --z-scrim: 40; --z-sheet: 50; --z-toast: 60;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-instant: 0ms; --dur-fast: 0ms; --dur-base: 0ms;
    --dur-slow: 0ms; --dur-ceremony: 0ms;
  }
}

/* Optional light "Ivory" theme for daylight/print contexts */
[data-theme="ivory"] {
  color-scheme: light;
  --ink-0: #ece6d8; --ink-1: #f6f2e9; --ink-2: #fffdf8; --ink-3: #fffdf8; --ink-4: #ebe4d4;
  --line-1: rgba(23,18,10,.08); --line-2: rgba(23,18,10,.16);
  --ivory-1: #17120a; --ivory-2: #3d362a; --ivory-3: #6a6152; --ivory-4: #9c9484;
  --gold-300: #8a6a1f; --accent: #1f7a55; --danger: #a8402f;
  --glass-bg: rgba(255,253,248,.8); --scrim: rgba(23,18,10,.35);
}
