/* ====================================================================
   Mekong — design tokens
   Palette derived from the river itself: deep monsoon blue, sediment
   ochre, paddy green. Restraint: one accent, neutrals do the work.
   ==================================================================== */

:root {
  /* Type scale (fluid) */
  --text-xs:   clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.82rem + 0.3vw, 1rem);
  --text-base: clamp(0.95rem, 0.92rem + 0.2vw, 1.0625rem);
  --text-lg:   clamp(1.05rem, 0.95rem + 0.5vw, 1.25rem);
  --text-xl:   clamp(1.35rem, 1.1rem + 1.2vw, 2rem);
  --text-2xl:  clamp(1.75rem, 1.2rem + 2vw, 2.75rem);

  /* Spacing */
  --space-1: .25rem; --space-2: .5rem; --space-3: .75rem; --space-4: 1rem;
  --space-5: 1.25rem; --space-6: 1.5rem; --space-8: 2rem; --space-10: 2.5rem;
  --space-12: 3rem; --space-16: 4rem; --space-20: 5rem; --space-24: 6rem;

  /* Radius */
  --radius-sm: .375rem; --radius-md: .5rem; --radius-lg: .75rem;
  --radius-xl: 1rem; --radius-full: 9999px;

  /* Transitions */
  --transition: 200ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Fonts */
  --font-body: "Satoshi", "Inter", system-ui, -apple-system, sans-serif;
  --font-display: "General Sans", "Satoshi", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Roboto Mono", Menlo, monospace;
}

/* ===== LIGHT — paper-white, sandbank warmth ===== */
:root,
[data-theme="light"] {
  --color-bg:              #f5f3ed;  /* warm river-bank cream */
  --color-surface:         #fbfaf6;
  --color-surface-2:       #ffffff;
  --color-surface-offset:  #ece9e0;
  --color-surface-offset-2:#dfdbcf;
  --color-divider:         #ddd8cb;
  --color-border:          #c9c3b3;

  --color-text:        #1b2a32;
  --color-text-muted:  #5e6a72;
  --color-text-faint:  #a3aab0;
  --color-text-inverse:#f7f5ef;

  /* Primary — Mekong monsoon teal */
  --color-primary:           #006b7f;
  --color-primary-hover:     #00566a;
  --color-primary-active:    #003e4d;
  --color-primary-highlight: #cfe2e7;

  /* Sediment ochre — used for hazards / cautions */
  --color-warning:           #b06b1c;
  --color-warning-highlight: #f2dec0;

  /* Danger — sundown red */
  --color-error:             #b8331f;
  --color-error-highlight:   #f2cdc5;

  /* Paddy / mangrove green — success */
  --color-success:           #3f7c3a;
  --color-success-highlight: #d6e6d0;

  /* Data viz palette */
  --color-blue:   #1f6f9a;
  --color-gold:   #c8893c;
  --color-purple: #7a4caa;
  --color-orange: #d96a26;

  --shadow-sm: 0 1px 2px rgba(20, 24, 28, 0.06);
  --shadow-md: 0 4px 14px rgba(20, 24, 28, 0.08);
  --shadow-lg: 0 16px 40px rgba(20, 24, 28, 0.14);
}

/* ===== DARK — dusk on the river ===== */
[data-theme="dark"] {
  --color-bg:              #0d1417;
  --color-surface:         #121a1e;
  --color-surface-2:       #18222a;
  --color-surface-offset:  #1c2730;
  --color-surface-offset-2:#243239;
  --color-divider:         #243038;
  --color-border:          #2f3f49;

  --color-text:        #dde7eb;
  --color-text-muted:  #8a99a2;
  --color-text-faint:  #5a6770;
  --color-text-inverse:#0d1417;

  --color-primary:           #4fb3c4;
  --color-primary-hover:     #74c6d5;
  --color-primary-active:    #2b8d9e;
  --color-primary-highlight: #14333a;

  --color-warning:           #e0a14a;
  --color-warning-highlight: #3a2c14;

  --color-error:             #e26a55;
  --color-error-highlight:   #3a1d18;

  --color-success:           #76b86b;
  --color-success-highlight: #1d2f1c;

  --color-blue:   #5cb0e0;
  --color-gold:   #e3b370;
  --color-purple: #b58be5;
  --color-orange: #ec925a;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.7);
}

/* ============ RESET ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  background: var(--color-bg);
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100dvh;
  overflow-x: hidden;
}

img, svg, canvas, video { display: block; max-width: 100%; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--color-text);
}

a { color: inherit; text-decoration: none; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

input, select, textarea {
  font: inherit;
  color: inherit;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-primary) 18%, transparent);
}

:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; border-radius: var(--radius-sm); }

::selection { background: color-mix(in oklab, var(--color-primary) 25%, transparent); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-faint); }

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