/* ============================================================
   Verdancy: shared design system
   Tokens pulled directly from the iOS app Theme.
   Light + full dark mode. System font stack (SF Pro on Apple).
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  --leaf: #4C9153;
  --leaf-deep: #2C5C33;
  --terracotta: #C2603F;
  --bg: #F6F8F3;
  --surface: #FFFFFF;
  --surface-2: #FBFCF9;
  --text: #1E241E;
  --text-secondary: #5B6B5B;
  --separator: #E4EADD;
  --danger: #C0392B;
  --warning: #CB8A14;

  --leaf-tint: color-mix(in srgb, var(--leaf) 12%, transparent);
  --leaf-tint-strong: color-mix(in srgb, var(--leaf) 18%, transparent);
  --terracotta-tint: color-mix(in srgb, var(--terracotta) 12%, transparent);
  --gradient: linear-gradient(135deg, var(--leaf) 0%, var(--leaf-deep) 100%);

  --radius-card: 20px;
  --radius-btn: 14px;
  --radius-pill: 999px;

  --shadow-card: 0 4px 14px rgba(0, 0, 0, 0.04);
  --shadow-soft: 0 10px 30px rgba(44, 92, 51, 0.10);
  --shadow-float: 0 18px 50px rgba(44, 92, 51, 0.16);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;

  --max: 1120px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  color-scheme: light;
}

/* Dark defaults from prefers-color-scheme, plus an explicit toggle. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --leaf: #6FB477;
    --leaf-deep: #3E7E46;
    --terracotta: #D98A66;
    --bg: #12150F;
    --surface: #1C2118;
    --surface-2: #20261B;
    --text: #EAF0E2;
    --text-secondary: #A7B6A0;
    --separator: #2A3124;
    --danger: #E57368;
    --warning: #F0C860;
    --shadow-card: 0 4px 14px rgba(0, 0, 0, 0.35);
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.4);
    --shadow-float: 0 18px 50px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --leaf: #6FB477;
  --leaf-deep: #3E7E46;
  --terracotta: #D98A66;
  --bg: #12150F;
  --surface: #1C2118;
  --surface-2: #20261B;
  --text: #EAF0E2;
  --text-secondary: #A7B6A0;
  --separator: #2A3124;
  --danger: #E57368;
  --warning: #F0C860;
  --shadow-card: 0 4px 14px rgba(0, 0, 0, 0.35);
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.4);
  --shadow-float: 0 18px 50px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.3s ease, color 0.3s ease;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3, h4 { margin: 0; line-height: 1.1; letter-spacing: -0.02em; font-weight: 700; }
p { margin: 0; }
::selection { background: var(--leaf-tint-strong); }

:focus-visible {
  outline: 3px solid var(--leaf);
  outline-offset: 3px;
  border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.section { padding: 88px 0; }
@media (max-width: 640px) { .section { padding: 60px 0; } }

.eyebrow {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--leaf);
  margin-bottom: 14px;
}
.section-head { max-width: 640px; margin: 0 auto 48px; text-align: center; }
.section-head h2 { font-size: clamp(28px, 4vw, 42px); }
.section-head p { margin-top: 14px; font-size: 18px; color: var(--text-secondary); }

.muted { color: var(--text-secondary); }
.leaf-text { color: var(--leaf); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  padding: 0 26px;
  border: none;
  border-radius: var(--radius-btn);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: transform 0.14s ease, opacity 0.14s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  will-change: transform;
}
.btn:active { transform: scale(0.97); opacity: 0.9; }

.btn-primary { background: var(--gradient); color: #fff; box-shadow: var(--shadow-soft); }
.btn-primary:hover { box-shadow: var(--shadow-float); transform: translateY(-1px); }

.btn-secondary { background: var(--leaf-tint); color: var(--leaf); }
.btn-secondary:hover { background: var(--leaf-tint-strong); }

.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--leaf-tint); color: var(--leaf); }

.btn-sm { height: 42px; padding: 0 18px; font-size: 15px; }

/* Official App Store badge */
.appstore { display: inline-block; line-height: 0; border-radius: 9px; box-shadow: var(--shadow-soft); transition: transform 0.14s ease, box-shadow 0.2s ease; }
.appstore:hover { transform: translateY(-1px); box-shadow: var(--shadow-float); }
.appstore:active { transform: scale(0.98); }
.appstore .asb { height: 52px; width: auto; display: block; border-radius: 9px; }

/* ---------- Card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--separator);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 28px;
}

/* ---------- Icon-in-circle (SF Symbol pattern) ---------- */
.icon-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-pill);
  background: var(--leaf-tint);
  color: var(--leaf);
  flex: none;
}
.icon-circle svg { width: 26px; height: 26px; }
.icon-circle.terracotta { background: var(--terracotta-tint); color: var(--terracotta); }

/* ---------- Chips / badges ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  background: var(--leaf-tint);
  color: var(--leaf);
  font-size: 13px;
  font-weight: 600;
}
.chip.safe { background: var(--leaf-tint); color: var(--leaf); }
.chip.warn { background: var(--terracotta-tint); color: var(--terracotta); }
.chip svg { width: 15px; height: 15px; }

.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--separator);
  box-shadow: var(--shadow-card);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}
.pill-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--leaf); box-shadow: 0 0 0 4px var(--leaf-tint); }

/* ---------- Brand mark ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; letter-spacing: -0.02em; }
.brand .mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--gradient);
}
.brand .mark svg { width: 22px; height: 22px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--separator);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.nav-links { display: flex; align-items: center; gap: 30px; font-size: 15px; font-weight: 500; color: var(--text-secondary); }
.nav-links a:hover { color: var(--text); }
.nav-right { display: flex; align-items: center; gap: 12px; }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: var(--radius-pill);
  border: 1px solid var(--separator); background: var(--surface); color: var(--text);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.theme-toggle:hover { border-color: var(--leaf); color: var(--leaf); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: block; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: none; }
}

@media (max-width: 780px) {
  .nav-links { display: none; }
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--separator); background: var(--surface-2); padding: 56px 0 40px; }
.footer-grid { display: flex; flex-wrap: wrap; gap: 40px; justify-content: space-between; }
.footer-brand { max-width: 300px; }
.footer-brand p { margin-top: 14px; color: var(--text-secondary); font-size: 15px; }
.footer-cols { display: flex; flex-wrap: wrap; gap: 56px; }
.footer-col h4 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-secondary); margin-bottom: 14px; font-weight: 700; }
.footer-col a { display: block; padding: 6px 0; color: var(--text-secondary); font-size: 15px; }
.footer-col a:hover { color: var(--leaf); }
.footer-bottom {
  margin-top: 44px; padding-top: 24px; border-top: 1px solid var(--separator);
  display: flex; flex-wrap: wrap; gap: 10px 24px; justify-content: space-between;
  color: var(--text-secondary); font-size: 13px;
}

/* ---------- Prose (legal / support pages) ---------- */
.prose-page { padding: 56px 0 96px; }
.prose { max-width: 760px; margin: 0 auto; }
.prose .lead { font-size: 19px; color: var(--text-secondary); margin: 8px 0 32px; }
.prose h1 { font-size: clamp(32px, 5vw, 44px); }
.prose h2 { font-size: 22px; margin: 40px 0 12px; }
.prose h3 { font-size: 17px; margin: 24px 0 8px; }
.prose p, .prose li { color: var(--text); font-size: 16px; line-height: 1.7; }
.prose p + p { margin-top: 14px; }
.prose ul, .prose ol { margin: 12px 0; padding-left: 22px; }
.prose li { margin: 6px 0; }
.prose a { color: var(--leaf); font-weight: 600; }
.prose a:hover { text-decoration: underline; }
.prose strong { font-weight: 700; }
.prose .updated { display: inline-block; margin-top: 6px; font-size: 14px; color: var(--text-secondary); }
.prose hr { border: none; border-top: 1px solid var(--separator); margin: 40px 0; }
.prose .table-wrap { overflow-x: auto; margin: 22px 0; border: 1px solid var(--separator); border-radius: 14px; -webkit-overflow-scrolling: touch; }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 560px; }
.prose thead th { text-align: left; background: var(--surface-2); font-weight: 700; color: var(--text); }
.prose th, .prose td { padding: 12px 16px; border-bottom: 1px solid var(--separator); vertical-align: top; line-height: 1.5; }
.prose tbody tr:last-child td { border-bottom: none; }
.ph {
  background: color-mix(in srgb, var(--warning) 22%, transparent);
  color: var(--text); padding: 1px 6px; border-radius: 5px;
  font-weight: 600; font-size: 0.92em; white-space: nowrap;
}
.prose .legal-caps { font-size: 13.5px; line-height: 1.7; color: var(--text-secondary); letter-spacing: 0.01em; }
.callout {
  margin: 24px 0; padding: 18px 20px; border-radius: var(--radius-card);
  background: var(--leaf-tint); border: 1px solid var(--separator);
  font-size: 15px; color: var(--text);
}
.back-home {
  display: inline-flex; align-items: center; gap: 8px;
  margin-bottom: 28px; font-size: 15px; font-weight: 600; color: var(--text-secondary);
}
.back-home:hover { color: var(--leaf); }
