:root {
  --bg: #f7f5f1;
  --surface: #ffffff;
  --ink: #1f2328;
  --muted: #5b6370;
  --line: #e2ddd4;
  --brand: #9a3b1e;
  --brand-ink: #ffffff;
  --brand-soft: #f6e6df;
  --accent: #2f5d50;
  --warn-bg: #fff7d6;
  --warn-line: #e8cf6a;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 6px 20px rgba(0,0,0,.05);
  --max: 1080px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a;
    --surface: #1e2125;
    --ink: #eceae6;
    --muted: #a3a9b2;
    --line: #33373d;
    --brand: #e07a52;
    --brand-ink: #15171a;
    --brand-soft: #3a2a23;
    --accent: #7cc2ad;
    --warn-bg: #3a3420;
    --warn-line: #7a6a2c;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--brand); }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); margin: 0 0 .5rem; }
h2 { font-size: 1.5rem; margin-top: 2.5rem; }
h3 { font-size: 1.15rem; margin-top: 1.75rem; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 760px; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); text-decoration: none; font-size: 1.1rem; }
.logo svg { flex: none; }
.nav { display: flex; gap: 18px; flex-wrap: wrap; font-size: .95rem; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }

/* Hero / intro */
.intro { padding: 32px 0 8px; }
.lede { font-size: 1.12rem; color: var(--ink); max-width: 760px; }
.for-who { color: var(--muted); font-size: .95rem; }
.byline { font-size: .9rem; color: var(--muted); margin: .25rem 0 1rem; }
.byline a { color: var(--muted); }

/* Answer box */
.answer {
  background: var(--brand-soft);
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  padding: 14px 18px;
  margin: 16px 0;
}
.answer p { margin: .25rem 0; }

/* Calculator */
.calc-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 24px; margin: 24px 0; align-items: start; }
@media (max-width: 860px) { .calc-grid { grid-template-columns: 1fr; } }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card h2, .card h3 { margin-top: 0; }
fieldset { border: 0; padding: 0; margin: 0 0 20px; }
legend { font-weight: 700; margin-bottom: 8px; font-size: 1.02rem; }
label { display: block; font-size: .9rem; color: var(--muted); margin-bottom: 4px; }
input, select {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.row-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (max-width: 520px) { .row { grid-template-columns: 1fr 1fr; } }
.hint { font-size: .82rem; color: var(--muted); margin: 4px 0 0; }
.plane {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  position: relative;
}
.plane-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 600; font-size: .92rem; }
.btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  font-size: .95rem;
  border-radius: 8px;
  padding: 9px 14px;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: var(--brand-ink);
  cursor: pointer;
  text-decoration: none;
}
.btn.ghost { background: transparent; color: var(--brand); }
.btn.small { padding: 4px 10px; font-size: .82rem; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs button { flex: 1; min-width: 140px; }
.tabs button[aria-pressed="false"] { background: transparent; color: var(--brand); }

.results { position: sticky; top: 16px; }
.big-number { font-size: 2.6rem; font-weight: 800; line-height: 1; color: var(--brand); }
.big-label { color: var(--muted); font-size: .92rem; }
.result-table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: .95rem; }
.result-table td { padding: 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.result-table td:last-child { text-align: right; font-weight: 700; white-space: nowrap; padding-left: 10px; }
.result-table small { display: block; color: var(--muted); font-weight: 400; }
.bar-wrap { margin-top: 16px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 60px; gap: 8px; align-items: center; font-size: .85rem; margin: 6px 0; }
.bar { height: 12px; border-radius: 6px; background: var(--brand); min-width: 2px; }
.bar.alt { background: var(--accent); }

/* Content */
.content { padding-bottom: 40px; }
.content table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .95rem; background: var(--surface); border-radius: 8px; overflow: hidden; }
.content th, .content td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.content th { background: var(--brand-soft); }
.table-scroll { overflow-x: auto; }
.formula { font-family: ui-monospace, Consolas, monospace; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; overflow-x: auto; }
.verify {
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: .85em;
}
.placeholder {
  border: 2px dashed var(--warn-line);
  background: var(--warn-bg);
  border-radius: 10px;
  padding: 16px;
  margin: 1.25rem 0;
  font-size: .95rem;
}
.placeholder strong { display: block; margin-bottom: 4px; }
.photo-slot {
  border: 2px dashed var(--line);
  border-radius: 10px;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  padding: 16px;
  margin: 1.25rem 0;
  background: var(--surface);
  font-size: .92rem;
}
.cards-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 1.25rem 0; }
@media (max-width: 760px) { .cards-3 { grid-template-columns: 1fr; } }
.cards-3 .card h3 { margin-top: 0; font-size: 1.05rem; }
.cards-3 .card p { margin: .4rem 0 .8rem; color: var(--muted); font-size: .95rem; }
.cta {
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  padding: 24px;
  margin: 2.5rem 0;
}
.cta h2 { margin-top: 0; color: #fff; }
.cta a.btn { background: #fff; color: var(--accent); border-color: #fff; }
@media (prefers-color-scheme: dark) {
  .cta { background: #23423a; }
  .cta a.btn { color: #23423a; }
}
.author-box { display: flex; gap: 16px; align-items: flex-start; }
.avatar-slot { flex: none; width: 88px; height: 88px; border-radius: 50%; border: 2px dashed var(--line); display: grid; place-items: center; font-size: .7rem; color: var(--muted); text-align: center; background: var(--surface); }
details { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 8px 0; }
summary { cursor: pointer; font-weight: 600; }

.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 28px 0; font-size: .9rem; color: var(--muted); margin-top: 40px; }
.site-footer .cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 24px; }
@media (max-width: 700px) { .site-footer .cols { grid-template-columns: 1fr; } }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: 4px 0; }
.site-footer a { color: var(--muted); }
.disclaimer { font-size: .82rem; margin-top: 18px; }

@media print {
  .site-header, .site-footer, .cta, .nav, .btn { display: none !important; }
  body { background: #fff; color: #000; }
}
