/* Thallo base: design tokens, typography (Urbanist), page canvas.
   Palette: organic green (base), terracotta (accents, the mascot's clay), earthy brown (surfaces, secondary text),
   gold (milestones and premium states only). Pages read the semantic tokens below, so changing a
   value here re-themes every page. The older names (--terra, --forest, --saffron…) are kept as aliases,
   and the accent keeps its old --magenta-* names so no page had to change. */
/* Urbanist (SIL Open Font License), served from this site: no request to Google, works offline.
   One variable file covers every weight from 400 to 800. */
@font-face {
  font-family: 'Urbanist'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/assets/fonts/urbanist-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Urbanist'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/assets/fonts/urbanist-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* Green: the plant world */
  --green-900: #1E3A2A;
  --green-700: #2F5E43;
  --green-500: #4E8B5F;
  --green-300: #A6C9A9;
  --green-100: #E4EFE0;

  /* Terracotta accent: calls to action, "needs you" */
  --magenta-700: #8F4128;
  --magenta-500: #A9502F;
  --magenta-300: #E2A285;
  --magenta-100: #F7E4DA;
  --accent-solid: #A9502F; /* filled buttons and accent text: 5:1 or better on white and on the page */

  /* Brown: soil, wood, linen */
  --brown-900: #3B2A1E;
  --brown-700: #6B4E3A;
  --brown-500: #9C7458;
  --brown-100: #EFE4D6;
  --clay: #B9724E;
  --clay-dark: #94563A;

  /* Logo colours (assets/icons/app-icon-*.png): the seed mascot and its soft-green tile */
  --mascot-body: #C3714F;
  --mascot-leaf: #5E8E4E;
  --mascot-blush: #EC9C94;
  --mascot-tile: #A3C98A;
  --logo-word: #E8D7B4;

  /* Living background clouds and drifting leaves */
  --cloud-sage: rgba(150, 190, 140, .30);
  --cloud-peach: rgba(244, 196, 160, .30);
  --cloud-butter: rgba(240, 222, 160, .30);
  --cloud-blush: rgba(240, 190, 160, .20);
  --leaf-drift: #7FA56F;

  /* Gold: milestones, points, premium details. Use sparingly. */
  --gold-600: #A8822F;
  --gold-500: #C9A24A;
  --gold-300: #E6CD8A;
  --gold-100: #F7EED6;
  --gold-grad: #DCBD6C;
  --gold-hairline: rgba(201, 162, 74, .45);

  /* Surfaces and text */
  --bg: #F4EDE3;
  --surface: #FFFCF8;
  --surface-2: #F0E7DB;
  --surface-3: #E7DACA;
  --ink: #2A1F17;
  --muted: #5C4A3D;
  --line: rgba(92, 62, 36, .12);
  --line-strong: rgba(92, 62, 36, .22);
  --bg-glow-green: rgba(78, 139, 95, .16);
  --bg-glow-magenta: rgba(184, 90, 58, .07);

  /* Frosted glass */
  --glass: rgba(255, 252, 248, .72);
  --glass-strong: rgba(255, 252, 248, .86);
  --glass-border: rgba(255, 255, 255, .65);
  --blur: saturate(180%) blur(22px);

  /* Status colours */
  --happy-bg: var(--green-100);   --happy-ink: #2A5A3A;
  --soon-bg: var(--gold-100);     --soon-ink: #7A5A14;
  --thirsty-bg: var(--magenta-100); --thirsty-ink: var(--magenta-700);
  --info-bg: #E3EEF2;             --info-ink: #24566E;

  /* Legacy aliases used across pages */
  --terra: var(--magenta-500);
  --terra-dark: var(--magenta-700);
  --sage: var(--green-500);
  --leaf: #5D9A66;
  --leaf-dry: #B9A55A;
  --forest: var(--green-900);
  --saffron: var(--gold-500);
  --water: #3C88B5;

  /* Shape */
  --radius-sm: 12px;
  --radius: 16px;
  --radius-lg: 26px;
  --radius-xl: 32px;

  /* Depth: soft, layered, warm-tinted */
  --shadow-sm: 0 1px 1px rgba(60, 35, 15, .04), 0 2px 6px -2px rgba(60, 35, 15, .08);
  --shadow: 0 1px 1px rgba(60, 35, 15, .04), 0 6px 16px -6px rgba(60, 35, 15, .12), 0 22px 44px -20px rgba(60, 35, 15, .16);
  --shadow-lift: 0 2px 2px rgba(60, 35, 15, .05), 0 12px 24px -8px rgba(60, 35, 15, .16), 0 32px 60px -24px rgba(60, 35, 15, .22);
  --shadow-magenta: 0 10px 28px -8px rgba(184, 90, 58, .45);
  --shadow-green: 0 10px 24px -10px rgba(30, 58, 42, .5);
  --highlight: inset 0 1px 0 rgba(255, 255, 255, .7);

  /* Motion */
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --dur-fast: 160ms;
  --dur: 260ms;
  --dur-slow: 480ms;

  --font-display: "Urbanist", -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, "Segoe UI", sans-serif;
  --font-body: "Urbanist", -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", sans-serif;
  --tabbar-h: 76px;

  color-scheme: light;
}

/* Dark theme: follows the phone unless Settings → Appearance picks light or dark (data-theme on <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --green-100: rgba(93, 154, 102, .16);
    --magenta-500: #DE8461;
    --magenta-700: #C76B48;
    --magenta-100: rgba(222, 132, 97, .17);
    --gold-100: rgba(201, 162, 74, .15);
    --gold-hairline: rgba(230, 205, 138, .35);
    --brown-100: #2B241D;

    --bg: #12100D;
    --surface: #1C1814;
    --surface-2: #26201A;
    --surface-3: #30281F;
    --ink: #F4ECE2;
    --muted: #B5A491;
    --line: rgba(255, 235, 210, .09);
    --line-strong: rgba(255, 235, 210, .17);
    --bg-glow-green: rgba(78, 139, 95, .16);
    --bg-glow-magenta: rgba(222, 132, 97, .08);

    --glass: rgba(30, 26, 21, .7);
    --glass-strong: rgba(30, 26, 21, .88);
    --glass-border: rgba(255, 240, 220, .08);

    --happy-ink: #A8D8B0;
    --soon-ink: #E8C979;
    --thirsty-ink: #F2B39A;
    --info-bg: rgba(60, 136, 181, .17); --info-ink: #9CCBE6;

    --leaf: #79B482;
    --forest: #2B5A40;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -12px rgba(0, 0, 0, .55);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, .35), 0 20px 48px -16px rgba(0, 0, 0, .65);
    --highlight: inset 0 1px 0 rgba(255, 240, 220, .06);

    --cloud-sage: rgba(78, 139, 95, .16);
    --cloud-peach: rgba(190, 120, 80, .10);
    --cloud-butter: rgba(201, 162, 74, .08);
    --cloud-blush: rgba(184, 90, 58, .08);
    --leaf-drift: #5E8E4E;

    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --green-100: rgba(93, 154, 102, .16);
  --magenta-500: #DE8461;
  --magenta-700: #C76B48;
  --magenta-100: rgba(222, 132, 97, .17);
  --gold-100: rgba(201, 162, 74, .15);
  --gold-hairline: rgba(230, 205, 138, .35);
  --brown-100: #2B241D;

  --bg: #12100D;
  --surface: #1C1814;
  --surface-2: #26201A;
  --surface-3: #30281F;
  --ink: #F4ECE2;
  --muted: #B5A491;
  --line: rgba(255, 235, 210, .09);
  --line-strong: rgba(255, 235, 210, .17);
  --bg-glow-green: rgba(78, 139, 95, .16);
  --bg-glow-magenta: rgba(222, 132, 97, .08);

  --glass: rgba(30, 26, 21, .7);
  --glass-strong: rgba(30, 26, 21, .88);
  --glass-border: rgba(255, 240, 220, .08);

  --happy-ink: #A8D8B0;
  --soon-ink: #E8C979;
  --thirsty-ink: #F2B39A;
  --info-bg: rgba(60, 136, 181, .17); --info-ink: #9CCBE6;

  --leaf: #79B482;
  --forest: #2B5A40;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -12px rgba(0, 0, 0, .55);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, .35), 0 20px 48px -16px rgba(0, 0, 0, .65);
  --highlight: inset 0 1px 0 rgba(255, 240, 220, .06);

  --cloud-sage: rgba(78, 139, 95, .16);
  --cloud-peach: rgba(190, 120, 80, .10);
  --cloud-butter: rgba(201, 162, 74, .08);
  --cloud-blush: rgba(184, 90, 58, .08);
  --leaf-drift: #5E8E4E;

  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }
/* Sizes are in rem, so a bigger text setting in the browser or phone makes the whole app's text bigger. */
html { font-size: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.55;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px);
}

/* Cozy living background: soft clouds of sage, peach and butter that drift very slowly.
   Two fixed layers moving at different speeds; only transforms animate, so it stays smooth. */
body::before, body::after {
  content: ""; position: fixed; inset: -25%; z-index: -2; pointer-events: none;
  will-change: transform;
}
body::before {
  background:
    radial-gradient(38% 32% at 18% 22%, var(--cloud-sage), transparent 70%),
    radial-gradient(34% 30% at 82% 30%, var(--cloud-peach), transparent 70%),
    radial-gradient(40% 34% at 60% 85%, var(--cloud-butter), transparent 70%);
  animation: clouds-a 46s ease-in-out infinite alternate;
}
body::after {
  background:
    radial-gradient(30% 26% at 30% 75%, var(--cloud-blush), transparent 70%),
    radial-gradient(28% 24% at 75% 70%, var(--cloud-sage), transparent 70%),
    radial-gradient(26% 22% at 50% 12%, var(--cloud-peach), transparent 70%);
  animation: clouds-b 62s ease-in-out infinite alternate;
}
@keyframes clouds-a { 0% { transform: translate3d(0, 0, 0) rotate(0deg); } 50% { transform: translate3d(4%, -3%, 0) rotate(4deg); } 100% { transform: translate3d(-3%, 4%, 0) rotate(-3deg); } }
@keyframes clouds-b { 0% { transform: translate3d(0, 0, 0) scale(1); } 50% { transform: translate3d(-5%, 3%, 0) scale(1.06); } 100% { transform: translate3d(3%, -4%, 0) scale(.97); } }

/* A few leaves drifting down now and then (added by js/app.js) */
.ambient-leaves { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.ambient-leaves span {
  position: absolute; top: -60px; width: 26px; height: 26px; opacity: 0;
  color: var(--leaf-drift);
  animation: leaf-fall var(--dur, 34s) linear var(--delay, 0s) infinite;
  will-change: transform, opacity;
}
.ambient-leaves span svg { width: 100%; height: 100%; animation: leaf-sway 5.5s ease-in-out infinite alternate; transform-origin: 50% 0; }
@keyframes leaf-fall {
  0% { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 0; }
  8% { opacity: var(--alpha, .5); }
  85% { opacity: var(--alpha, .5); }
  100% { transform: translate3d(var(--drift, 80px), 110vh, 0) rotate(var(--spin, 220deg)); opacity: 0; }
}
@keyframes leaf-sway { from { transform: rotate(-18deg) translateX(-6px); } to { transform: rotate(18deg) translateX(6px); } }

/* Apple-style type scale: heavy, tightly tracked headings; relaxed body */
h1, h2, h3 { font-family: var(--font-display); font-weight: 800; margin: 0; color: inherit; }
h1 { font-size: 2.125rem; line-height: 1.08; letter-spacing: -0.03em; }
h2 { font-size: 1.375rem; line-height: 1.18; letter-spacing: -0.02em; }
h3 { font-size: 1.125rem; line-height: 1.25; letter-spacing: -0.015em; }
p { margin: 0; }
strong { font-weight: 700; }

button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
a { color: inherit; }
img { max-width: 100%; }

::selection { background: var(--magenta-100); color: var(--ink); }

.page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 20px 16px;
  animation: page-in var(--dur-slow) var(--ease-out) both;
}
@keyframes page-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.muted { color: var(--muted); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}

/* Photo headers: a real plant photo (set per page with --photo / --photo-pos) under a deep-green
   wash that keeps text readable, with a slow drift for life and a gold hairline edge.
   Photos use root paths (/assets/...) so they resolve the same from every stylesheet. */
.photo-hero {
  position: relative; isolation: isolate; overflow: hidden;
  background: linear-gradient(160deg, #24452F 0%, #1A3324 100%);
  color: #FBF6EE;
  box-shadow: inset 0 0 0 1px rgba(230, 205, 138, .24), inset 0 1px 0 rgba(255, 255, 255, .08), var(--shadow);
}
.photo-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background: var(--photo, none) var(--photo-pos, center) / cover no-repeat;
  animation: photo-drift 30s ease-in-out infinite alternate;
  will-change: transform; backface-visibility: hidden;
}
.photo-hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(100deg, rgba(14, 28, 19, .9) 0%, rgba(14, 28, 19, .68) 45%, rgba(14, 28, 19, .3) 100%),
    linear-gradient(0deg, rgba(14, 28, 19, .55) 0%, transparent 60%);
}
@keyframes photo-drift { from { transform: scale3d(1.04, 1.04, 1); } to { transform: scale3d(1.08, 1.08, 1) translate3d(-1%, -.6%, 0); } }

@media (prefers-reduced-motion: reduce) {
  .page, .photo-hero::before, body::before, body::after { animation: none; }
  .ambient-leaves { display: none; }
}

/* Keyboard users always see where they are (specific components can style their own ring). */
:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible { outline: 2px solid var(--gold-500); outline-offset: 2px; }

/* Cross-document View Transitions (js/lib/transition.js → data-morph links): a plant's photo morphs
   from its card into its page. Browsers without support simply ignore this. */
@view-transition { navigation: auto; }
::view-transition-group(*) { animation-duration: .42s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .28s; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* Theme switch (js/lib/look.js): the new theme grows out of the tapped button in a circle. */
.theme-wipe::view-transition-old(root) { animation: none; }
.theme-wipe::view-transition-new(root) { animation: theme-reveal .6s cubic-bezier(.4, 0, .2, 1); }
@keyframes theme-reveal { from { clip-path: circle(0 at var(--reveal-x, 50%) var(--reveal-y, 50%)); } to { clip-path: circle(150vmax at var(--reveal-x, 50%) var(--reveal-y, 50%)); } }

/* Translating (js/lib/i18n.js): hidden for a moment, then shown in the chosen language. */
.i18n-wait body { opacity: 0; }
body { transition: opacity .2s ease-out; }

/* Arabic: system Arabic fonts (Urbanist has no Arabic letters) and no letter spacing, which would
   break the joined script. */
:root[lang="ar"] { --font-display: system-ui, "Segoe UI", Tahoma, "Geeza Pro", "Noto Sans Arabic", sans-serif; --font-body: system-ui, "Segoe UI", Tahoma, "Geeza Pro", "Noto Sans Arabic", sans-serif; }
:root[lang="ar"] body, :root[lang="ar"] h1, :root[lang="ar"] h2, :root[lang="ar"] h3, :root[lang="ar"] .btn, :root[lang="ar"] .eyebrow { letter-spacing: 0 !important; }
:root[lang="ar"] .eyebrow { text-transform: none; }

/* Right-to-left: arrows point the other way. */
[dir="rtl"] .quiz-go, [dir="rtl"] .care-strip > span:last-child, [dir="rtl"] .ready-scan > span:last-child,
[dir="rtl"] .pl-back .ic, [dir="rtl"] .pf-back .ic, [dir="rtl"] .set-back, [dir="rtl"] .mq-back, [dir="rtl"] .legal-back { display: inline-block; transform: scaleX(-1); }
[dir="rtl"] .legal-back { transform: none; }
[dir="rtl"] .switch.on i { transform: translateX(-20px); }
[dir="rtl"] .cp-brand input:checked + .cp-switch::after { transform: translateX(-18px); }
[dir="rtl"] .mode-signup .seg-pill { transform: translateX(-100%); }
[dir="rtl"] .set-back:hover { transform: scaleX(-1) translateX(-3px); }
