/* Krovan webfonts.
   SUBSTITUTION NOTE: no font binaries were provided. The screenshots show a
   geometric sans with tall x-height and circular bowls; Poppins is the closest
   Google Fonts match and is used throughout. Khmer copy appears in-product, so
   Kantumruy Pro is paired for Khmer script. Replace both if the real files exist. */
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&family=Kantumruy+Pro:wght@400;500;600;700&family=JetBrains+Mono:wght@500;600&display=swap");

:root {
  /* ---- Base ramps -------------------------------------------------- */

  /* Plum: the ground. Near-black at 900, brand plum at 500. */
  --plum-900: #0e0311;   /* app background */
  --plum-850: #150520;
  --plum-800: #19071d;   /* card / surface */
  --plum-700: #1f0a26;   /* raised surface, icon well */
  --plum-600: #2a1032;   /* pill, chip, tag fill */
  --plum-500: #2f0f38;   /* brand plum — app-icon ground */
  --plum-400: #3d1a48;
  --plum-300: #5a3566;
  --plum-200: #856b88;   /* segmented-control active fill */
  --plum-100: #b8a5bd;

  /* Sun: the accent. Petal yellow from the app icon. */
  --sun-700: #8a7409;
  --sun-600: #c9a80d;
  --sun-500: #f7d117;   /* primary accent — buttons, active nav, checks */
  --sun-400: #ffdf1b;   /* icon highlight, hover */
  --sun-300: #ffe75c;
  --sun-200: #fff09a;
  --sun-100: #fff8d1;

  /* Neutral text ramp, warmed toward plum so it sits on the ground. */
  --ink-000: #ffffff;
  --ink-100: #f4f0f6;   /* primary text */
  --ink-300: #c6bccb;   /* secondary text */
  --ink-500: #9b8ea2;   /* muted / supporting text */
  --ink-700: #6d5f75;   /* disabled, placeholder */
  --ink-900: #2a1c32;   /* hairline borders */

  /* Semantic status. Sampled only for streak-flame orange; the rest are
     derived in the same hue family and flagged as additions in readme.md. */
  --flame-500: #ff8a3d;
  --success-500: #4fd18b;
  --danger-500: #ff5c6a;

  /* ---- Semantic aliases -------------------------------------------- */
  --bg-app: var(--plum-900);
  --bg-header: var(--plum-800);
  --bg-surface: var(--plum-800);
  --bg-surface-raised: var(--plum-700);
  --bg-chip: var(--plum-600);
  --bg-track: #2e1b39;
  --bg-scrim: rgba(14, 3, 17, 0.72);

  --text-primary: var(--ink-100);
  --text-secondary: var(--ink-300);
  --text-muted: var(--ink-500);
  --text-disabled: var(--ink-700);
  --text-on-accent: var(--plum-900);
  --text-accent: var(--sun-500);

  --accent: var(--sun-500);
  --accent-hover: var(--sun-400);
  --accent-press: var(--sun-600);
  --accent-soft: rgba(247, 209, 23, 0.14);

  --border-hairline: var(--ink-900);
  --border-strong: var(--plum-400);
  --border-accent: var(--sun-500);

  --focus-ring: var(--sun-500);

  /* Icon tiles on the Habits screen carry a gold-foil gradient. */
  --gradient-tile: linear-gradient(145deg, #f5d97a 0%, #c9a233 48%, #6b530f 100%);
  --gradient-petal: linear-gradient(140deg, var(--sun-400) 0%, var(--sun-500) 55%, var(--sun-600) 100%);
}

:root {
  --font-display: "Poppins", "Kantumruy Pro", system-ui, sans-serif;
  --font-body: "Poppins", "Kantumruy Pro", system-ui, sans-serif;
  --font-khmer: "Kantumruy Pro", "Noto Sans Khmer", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* Mobile scale, measured off the 575px-wide screenshots. */
  --text-display: 28px;   /* screen title — "Habits" */
  --text-h1: 22px;        /* section heading — "Your habits" */
  --text-h2: 18px;        /* card title — "Drink water" */
  --text-body: 15px;      /* card body copy */
  --text-label: 14px;     /* nav labels, meta rows */
  --text-caption: 13px;   /* streak text, tab labels */
  --text-micro: 11px;     /* duration badges */

  /* Marketing-web scale — same family, larger steps. */
  --text-web-hero: 64px;
  --text-web-h1: 44px;
  --text-web-h2: 30px;
  --text-web-body: 18px;

  --leading-tight: 1.15;
  --leading-snug: 1.3;
  --leading-normal: 1.5;

  --tracking-tight: -0.02em;
  --tracking-normal: 0;
  --tracking-wide: 0.04em;
  --tracking-mono: 0.06em;
}

:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  --gutter-screen: 16px;   /* left/right page inset on mobile */
  --gap-card: 12px;        /* between stacked cards */
  --pad-card: 16px;        /* inside a card */

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;       /* cards */
  --radius-xl: 20px;
  --radius-pill: 999px;    /* buttons, chips, avatars, nav tab */

  --hit-min: 44px;         /* minimum tap target */
  --control-sm: 32px;
  --control-md: 40px;
  --control-lg: 52px;      /* full-width primary button */
  --border-width: 1px;
}

:root {
  /* Elevation on this ground is an edge plus ambient darkness — never a
     bright shadow. Cards read as raised by the 1px hairline, not the blur. */
  --shadow-none: none;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-raised: 0 4px 16px rgba(0, 0, 0, 0.45);
  --shadow-overlay: 0 12px 40px rgba(0, 0, 0, 0.6);
  --glow-accent: 0 0 0 4px rgba(247, 209, 23, 0.18);
  --glow-accent-strong: 0 4px 18px rgba(247, 209, 23, 0.28);
}

:root {
  --duration-fast: 120ms;
  --duration-base: 200ms;
  --duration-slow: 320ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --press-scale: 0.97;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
}

:lang(km), .km { font-family: var(--font-khmer); line-height: 1.7; }

a { color: var(--text-accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

::selection { background: var(--accent-soft); color: var(--text-primary); }

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

[disabled], .is-disabled { opacity: 0.45; pointer-events: none; }


/* ---- Landing page ---- */
html { scroll-behavior: smooth; }
body { background: var(--bg-app); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 32px 96px; }

/* Bilingual visibility. The page paints Khmer server-side; the script
   flips [data-lang] on <html> and CSS does the rest — no layout shift. */
[data-l] { display: none; }
html[data-lang="en"] [data-l="en"],
html[data-lang="km"] [data-l="km"] { display: inline; }

.lang-tab {
  padding: 6px 14px; border: 0; cursor: pointer;
  border-radius: var(--radius-pill);
  font-family: var(--font-body); font-size: 13px; font-weight: var(--weight-semibold);
  background: transparent; color: var(--text-secondary);
  transition: background var(--duration-base) var(--ease-standard), color var(--duration-base) var(--ease-standard);
}
.lang-tab:hover { color: var(--text-primary); }
html[data-lang="en"] .lang-tab[data-set-lang="en"],
html[data-lang="km"] .lang-tab[data-set-lang="km"] {
  background: var(--plum-200); color: var(--plum-900);
}

.btn-store {
  display: inline-flex; align-items: center; gap: 10px;
  height: var(--control-lg); padding: 0 24px;
  border-radius: var(--radius-pill);
  font-weight: var(--weight-semibold); font-size: 16px;
}
.btn-store i { font-size: 20px; }
.btn-store--play { background: var(--accent); color: var(--text-on-accent); border: 1px solid transparent; }
.btn-store--app { background: transparent; color: var(--text-accent); border: 1px solid var(--border-accent); }
.btn-store[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }

.nav-cta { transition: background var(--duration-fast) var(--ease-standard); }
.nav-cta:hover { background: var(--accent-hover); color: var(--text-on-accent); }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .wrap { padding: 0 20px 64px; }
  .hero, .content-split { grid-template-columns: 1fr !important; gap: 40px !important; padding-bottom: 64px !important; }
  .feature-grid { grid-template-columns: 1fr !important; }
  h1 { font-size: 44px !important; }
  h2 { font-size: 32px !important; }
  .cta-band { padding: 40px 28px !important; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px 56px; }
  h1 { font-size: 34px !important; }
  h2 { font-size: 26px !important; }
  .hero-shots img { width: 46vw !important; }
  .hero-shots img + img { margin-bottom: 0 !important; }
  .site-header { gap: 12px !important; }
  .btn-store { width: 100%; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}
