/* ============================================================
   LoonieLab design system
   Tokens → base → header → hero → cards → calculator layout
   → forms → results → charts → faq → footer → motion → print
   ============================================================ */

:root {
  --loon: #0c3b2e;          /* deep loon green */
  --loon-deep: #082a21;
  --loon-soft: #e7efe9;     /* pale green tint */
  --amber: #e9a13b;         /* warm amber accent */
  --amber-deep: #c77f1d;
  --amber-soft: #faf0dd;
  --paper: #faf8f3;         /* warm off-white */
  --card: #ffffff;
  --ink: #1b211e;
  --muted: #5d6a63;
  --line: #e5e0d4;
  --danger: #b3402e;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(12, 59, 46, .06), 0 8px 28px -12px rgba(12, 59, 46, .18);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); margin-top: 2.5em; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
a { color: var(--loon); }
img, svg { max-width: 100%; }

.num, output, .result-value {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.container { max-width: 1120px; margin: 0 auto; padding: 0 1.25rem; }
.narrow { max-width: 760px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(250, 248, 243, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .container {
  display: flex; align-items: center; gap: 1.5rem;
  padding-top: .8rem; padding-bottom: .8rem;
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 1.25rem; letter-spacing: -0.02em; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--amber) 0 22%, var(--loon) 23% 100%);
  flex: none;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.25);
}
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 1.25rem; }
.site-nav a { text-decoration: none; color: var(--muted); font-weight: 600; font-size: .95rem; }
.site-nav a:hover { color: var(--loon); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--loon); color: #fff; border: none; cursor: pointer;
  padding: .7rem 1.3rem; border-radius: 999px;
  font-weight: 700; font-size: .95rem; text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { background: var(--loon-deep); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-amber { background: var(--amber); color: var(--loon-deep); }
.btn-amber:hover { background: var(--amber-deep); color: #fff; }
.btn-ghost { background: transparent; color: var(--loon); border: 1.5px solid var(--loon); }
.btn-ghost:hover { background: var(--loon-soft); }

/* ---------- hero ---------- */
.hero { padding: 4.5rem 0 3rem; text-align: center; }
.hero .kicker {
  display: inline-block; background: var(--loon-soft); color: var(--loon);
  font-weight: 700; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase;
  padding: .35rem .9rem; border-radius: 999px; margin-bottom: 1.2rem;
}
.hero p.lede { font-size: 1.2rem; color: var(--muted); max-width: 640px; margin: 0 auto 2rem; }

/* ---------- calculator cards ---------- */
.calc-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem; padding: 1rem 0 3rem;
}
.calc-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.6rem; text-decoration: none; color: var(--ink);
  display: flex; flex-direction: column; gap: .6rem;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.calc-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--loon); }
.calc-card .card-icon {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  background: var(--loon-soft); color: var(--loon);
  display: grid; place-items: center; font-size: 1.3rem; font-weight: 800;
}
.calc-card h3 { margin: 0; }
.calc-card p { color: var(--muted); font-size: .95rem; margin: 0; flex: 1; }
.calc-card .card-cta { color: var(--loon); font-weight: 700; font-size: .95rem; }
.calc-card.coming { opacity: .55; border-style: dashed; }
.calc-card.coming:hover { transform: none; box-shadow: none; }

/* ---------- calculator page layout ---------- */
.calc-layout {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 2rem; align-items: start; margin-top: 2rem;
}
.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.6rem;
}
.inputs h2, .results h2 { margin-top: 0; font-size: 1.1rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.results { position: sticky; top: 90px; }

/* Compact variant: for simple tools (≤4 inputs). Single centered column —
   inputs and results stack in one flow, no empty half-page. Use with
   class="calc-layout compact" on the layout div. */
.calc-layout.compact { grid-template-columns: 1fr; max-width: 680px; margin-left: auto; margin-right: auto; }
.calc-layout.compact .results { position: static; }

.field { margin-bottom: 1.1rem; }
.field label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .35rem; }
.field .hint { font-size: .82rem; color: var(--muted); margin-top: .25rem; }
.field input[type="number"], .field input[type="text"], .field select {
  width: 100%; padding: .65rem .8rem; font-size: 1rem;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--paper); color: var(--ink); font-family: var(--font);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--loon); box-shadow: 0 0 0 3px var(--loon-soft); }
.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
details.advanced { border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: .7rem 1rem; margin-top: .5rem; }
details.advanced summary { cursor: pointer; font-weight: 600; color: var(--loon); }

/* ---------- results ---------- */
.result-hero { text-align: center; padding: 1rem 0 1.5rem; }
.result-label { font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.result-value { font-size: clamp(2.4rem, 6vw, 3.6rem); font-weight: 800; color: var(--loon); letter-spacing: -0.03em; }
.result-sub { color: var(--muted); font-size: .95rem; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .8rem; margin: 1.2rem 0; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .8rem; text-align: center; }
.stat .stat-v { font-weight: 800; font-size: 1.15rem; color: var(--ink); }
.stat .stat-l { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* ---------- charts (dependency-free) ---------- */
.waterfall { display: flex; flex-direction: column; gap: .45rem; margin: 1rem 0; }
.wf-row { display: grid; grid-template-columns: 150px 1fr 110px; gap: .7rem; align-items: center; font-size: .9rem; }
.wf-row .wf-label { color: var(--muted); text-align: right; }
.wf-row .wf-val { text-align: right; font-weight: 700; }
.wf-track { height: 14px; background: var(--loon-soft); border-radius: 999px; overflow: hidden; }
.wf-fill { height: 100%; border-radius: 999px; background: var(--loon); transform-origin: left; transition: transform .6s cubic-bezier(.22,1,.36,1); }
.wf-fill.amber { background: var(--amber); }
.wf-fill.green-light { background: #4d9e6b; }
.donut-wrap { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.donut { width: 170px; height: 170px; border-radius: 50%; flex: none; transition: background .6s ease; }
.legend { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.legend li { display: flex; align-items: center; gap: .5rem; margin-bottom: .35rem; }
.legend .swatch { width: 12px; height: 12px; border-radius: 4px; flex: none; }

/* ---------- methodology / faq / sources ---------- */
.method { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.6rem; margin-top: 2rem; }
.method table { width: 100%; border-collapse: collapse; font-size: .9rem; margin: 1rem 0; }
.method th, .method td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
.method th { color: var(--muted); text-transform: uppercase; font-size: .78rem; letter-spacing: .05em; }
details.faq { border-bottom: 1px solid var(--line); padding: .9rem 0; }
details.faq summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; font-size: 1.4rem; color: var(--amber-deep); font-weight: 400; flex: none; transition: transform .2s ease; }
details.faq[open] summary::after { transform: rotate(45deg); }
.sources { font-size: .88rem; color: var(--muted); }
.sources li { margin-bottom: .3rem; }
.updated-stamp {
  display: inline-flex; align-items: center; gap: .45rem;
  background: var(--amber-soft); color: var(--loon-deep);
  font-size: .82rem; font-weight: 700; padding: .3rem .8rem; border-radius: 999px;
}
.disclaimer {
  border-left: 4px solid var(--amber); background: var(--amber-soft);
  padding: 1rem 1.2rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: .9rem; margin: 2rem 0;
}
.related { display: flex; gap: .8rem; flex-wrap: wrap; margin: 1.5rem 0; }
.feedback-cta {
  text-align: center; background: var(--loon); color: #fff;
  border-radius: var(--radius); padding: 2.2rem 1.5rem; margin: 2.5rem 0;
}
.feedback-cta h2 { margin-top: 0; color: #fff; }
.feedback-cta p { color: rgba(255,255,255,.8); max-width: 560px; margin: 0 auto 1.4rem; }

/* ---------- trust section (hub) ---------- */
.trust { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.25rem; padding: 1rem 0 3rem; }
.trust-item { padding: 1.2rem 0; }
.trust-item h3 { color: var(--loon); margin-bottom: .3rem; }
.trust-item p { color: var(--muted); font-size: .95rem; margin: 0; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 4rem; padding: 2.5rem 0; color: var(--muted); font-size: .9rem; }
.site-footer .container { display: flex; flex-wrap: wrap; gap: 2rem; justify-content: space-between; }
.site-footer nav { display: flex; gap: 1.2rem; flex-wrap: wrap; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--loon); }
.footer-note { width: 100%; margin-top: 1rem; font-size: .82rem; }

/* ---------- motion ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s cubic-bezier(.22,1,.36,1); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .calc-layout { grid-template-columns: 1fr; }
  .calc-layout.compact { max-width: 100%; }
  .results { position: static; }
  .site-nav a:not(.btn) { display: none; }
  .wf-row { grid-template-columns: 110px 1fr 90px; font-size: .82rem; }
}

/* ---------- print ---------- */
@media print {
  .site-header, .site-footer, .feedback-cta, .inputs, .related { display: none; }
  body { background: #fff; }
  .results { position: static; box-shadow: none; }
  .reveal { opacity: 1; transform: none; }
}
