/* Water Operator Math — shared mobile-first stylesheet
   Slate-navy + water-blue / emerald, aligned with the Gumroad covers. */
:root {
  --navy: #0a3348;
  --navy-2: #0d425c;
  --navy-3: #15607f;
  --ink: #15232c;
  --muted: #4b5c66;
  --teal: #0f6e62;
  --teal-2: #148577;
  --emerald: #0f7a4a;
  --gold: #b8892a;
  --gold-2: #d4a84b;
  --gold-soft: #f4ead2;
  --paper: #f3eee5;
  --card: #fffdf8;
  --line: #d9d0c3;
  --line-2: #c9bead;
  --ok: #0f7a4a;
  --ok-bg: #e5f6ed;
  --bad: #b42318;
  --bad-bg: #fdecea;
  --warn: #9a4b00;
  --shadow: 0 10px 30px rgba(10, 51, 72, 0.10);
  --shadow-lg: 0 18px 50px rgba(10, 51, 72, 0.16);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --radius: 16px;
  --wrap: 1120px;
  --site-nav-h: 64px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; }
a { color: var(--navy-3); }
a:hover { color: var(--teal); }
:focus-visible {
  outline: 3px solid var(--gold-2);
  outline-offset: 2px;
}
.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 100;
  background: var(--gold);
  color: #1a160c;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ----- Site chrome ----- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--navy);
  color: #f8f4ec;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}
.site-header-inner {
  width: min(var(--wrap), calc(100% - 32px));
  margin: 0 auto;
  min-height: var(--site-nav-h);
  padding: calc(8px + var(--safe-t)) 0 8px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.site-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
  margin-right: auto;
}
.site-brand-mark {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
}
.site-brand-text { display: flex; flex-direction: column; min-width: 0; }
.site-brand-kicker {
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-2);
  font-weight: 700;
}
.site-brand-name {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.site-nav a {
  color: #e8eef1;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 8px;
}
.site-nav a:hover, .site-nav a[aria-current="page"] {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.site-nav .btn-gold, .site-nav .btn-teal {
  margin-left: 6px;
}
.nav-toggle {
  display: none;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: 10px;
  height: 40px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 650;
}
@media (max-width: 880px) {
  .nav-toggle { display: inline-flex; align-items: center; }
  .site-nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: var(--navy-2);
    flex-direction: column;
    align-items: stretch;
    padding: 10px 16px calc(14px + var(--safe-b));
    gap: 4px;
    box-shadow: var(--shadow-lg);
  }
  .site-nav.is-open { display: flex; }
  .site-nav a { padding: 12px 10px; }
  .site-nav .btn-gold, .site-nav .btn-teal { margin: 8px 0 0; text-align: center; }
  .site-header { position: sticky; }
  .site-header-inner { position: relative; }
}

/* Quiz page: site header is not sticky so the quiz topbar can pin cleanly. */
body.quiz-page .site-header { position: relative; z-index: 40; }

/* ----- Buttons (namespaced variants; no generic .btn so quiz.html can share this file) ----- */
.btn-gold, .btn-teal, .btn-ghost, .btn-ghost-ink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 700;
  font-size: 14.5px;
  line-height: 1.2;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
}
.btn-gold {
  background: var(--gold);
  color: #1a160c;
  border-color: #a37a22;
}
.btn-gold:hover { background: var(--gold-2); color: #1a160c; }
.btn-teal {
  background: var(--teal);
  color: #fff;
  border-color: #0c5c52;
}
.btn-teal:hover { background: var(--teal-2); color: #fff; }
.btn-ghost {
  background: rgba(255, 255, 255, 0.1);
  color: #f8f4ec;
  border-color: rgba(255, 255, 255, 0.2);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.18); color: #fff; }
.btn-ghost-ink {
  background: transparent;
  color: var(--navy);
  border-color: var(--line-2);
}
.btn-ghost-ink:hover { background: #efe9de; color: var(--navy); }
.btn-lg { padding: 14px 22px; font-size: 16px; }

/* ----- Layout ----- */
.wrap { width: min(var(--wrap), calc(100% - 32px)); margin: 0 auto; }
.section { padding: 56px 0; }
.section-tight { padding: 36px 0; }
.kicker {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
  margin: 0 0 8px;
}
h1, h2, h3, h4 {
  font-family: var(--serif);
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--navy);
  margin: 0 0 12px;
}
h1 { font-size: clamp(30px, 6vw, 48px); }
h2 { font-size: clamp(24px, 4vw, 32px); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 14px; }
.lede { font-size: 1.125rem; color: var(--muted); max-width: 44rem; }
.muted { color: var(--muted); }
.center { text-align: center; }
.center .lede { margin-left: auto; margin-right: auto; }

/* ----- Hero ----- */
.hero-landing {
  background: linear-gradient(165deg, var(--navy) 0%, #0c4a62 72%, #0e5a68 100%);
  color: #f8f4ec;
  padding: 56px 0 64px;
  position: relative;
  overflow: hidden;
}
.hero-landing::after {
  content: "";
  position: absolute;
  width: 320px;
  height: 320px;
  right: -80px;
  top: -90px;
  background: radial-gradient(circle, rgba(212, 168, 75, 0.22), transparent 70%);
  pointer-events: none;
}
.hero-landing h1, .hero-landing .kicker { color: inherit; }
.hero-landing h1 { color: #fff; max-width: 18ch; }
.hero-landing .lede { color: #d5e4ea; }
.hero-landing .kicker { color: var(--gold-2); }
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 22px 0 18px;
}
.badge-row { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 650;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #eef5f7;
}
.badge-ink {
  background: #efe9de;
  border-color: var(--line);
  color: var(--navy);
}

/* ----- Cards / grids ----- */
.grid-3, .grid-2, .grid-4 {
  display: grid;
  gap: 18px;
}
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .grid-3, .grid-2, .grid-4 { grid-template-columns: 1fr; }
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card h3 { margin-top: 0; }
.card a.stretched { font-weight: 700; text-decoration: none; }
.card-link { transition: transform 0.15s ease, box-shadow 0.15s ease; }
.card-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.formula {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #eef5f4;
  color: var(--navy);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.95em;
}

/* ----- Callouts ----- */
.callout {
  background: var(--card);
  border-left: 4px solid var(--gold);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.callout.teal { border-left-color: var(--teal); }
.author-block {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: start;
}
.author-mark {
  width: 72px;
  height: 72px;
}
@media (max-width: 640px) {
  .author-block { grid-template-columns: 1fr; }
}

/* ----- Calculators ----- */
.calc-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  align-items: start;
}
@media (max-width: 800px) {
  .calc-layout { grid-template-columns: 1fr; }
}
.calc-form label {
  display: block;
  font-weight: 650;
  font-size: 13.5px;
  margin: 0 0 6px;
  color: var(--navy);
}
.calc-form .field { margin-bottom: 14px; }
.calc-form .hint { font-weight: 500; color: var(--muted); font-size: 12.5px; }
.calc-form input[type="number"],
.calc-form select {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: #fff;
  color: var(--ink);
}
.calc-form input:invalid:not(:placeholder-shown) {
  border-color: var(--bad);
}
.field-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
}
.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.seg button {
  appearance: none;
  border: 1px solid var(--line-2);
  background: #fff;
  color: var(--navy);
  border-radius: 999px;
  padding: 7px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.seg button[aria-pressed="true"],
.seg button.is-active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.steps {
  background: #eef5f4;
  border: 1px solid #cfe3df;
  border-radius: 12px;
  padding: 14px 16px;
}
.steps ol { margin: 8px 0 0; padding-left: 1.2rem; }
.steps li { margin: 0 0 6px; }
.result-panel {
  background: var(--ok-bg);
  border: 1px solid #8fd0ad;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.result-panel.error {
  background: var(--bad-bg);
  border-color: #f2b4ae;
}
.result-panel .value {
  font-family: var(--serif);
  font-size: 1.6rem;
  color: var(--navy);
  font-weight: 650;
  margin: 0;
}
.worked-example {
  margin-top: 0;
}
.worked-example + .worked-example { margin-top: 16px; }
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.tabs button {
  appearance: none;
  border: 1px solid var(--line-2);
  background: #fff;
  color: var(--navy);
  border-radius: 10px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  flex: 1;
}
.tabs button[aria-selected="true"] {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.tab-panel[hidden] { display: none !important; }

/* ----- Guides ----- */
.prose { max-width: 46rem; }
.prose h2 { margin-top: 2rem; }
.prose ul, .prose ol { padding-left: 1.2rem; }
.prose li { margin: 0 0 8px; }
.checklist { list-style: none; padding: 0; }
.checklist li {
  position: relative;
  padding: 8px 0 8px 32px;
  border-bottom: 1px solid var(--line);
}
.checklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  width: 16px;
  height: 16px;
  border: 2px solid var(--teal);
  border-radius: 4px;
}
table.data {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: 12px;
  overflow: hidden;
  font-size: 0.95rem;
}
table.data th, table.data td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.data th {
  background: var(--navy);
  color: #f8f4ec;
  font-weight: 650;
}
.faq details {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  margin: 0 0 10px;
}
.faq summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--navy);
}

/* ----- Page hero (inner pages) ----- */
.page-hero {
  background: linear-gradient(165deg, var(--navy) 0%, #0c4a62 80%);
  color: #f8f4ec;
  padding: 36px 0 40px;
}
.page-hero h1 { color: #fff; }
.page-hero .lede { color: #d5e4ea; }
.page-hero .kicker { color: var(--gold-2); }
.crumbs { font-size: 13px; color: #c5d5dc; margin: 0 0 12px; }
.crumbs a { color: #e8eef1; }

/* ----- Footer ----- */
.site-footer {
  background: var(--navy);
  color: #d5e4ea;
  padding: 36px 0 calc(28px + var(--safe-b));
  margin-top: 12px;
}
.site-footer h2, .site-footer h3 { color: #fff; font-size: 1.1rem; }
.site-footer a { color: var(--gold-2); }
.site-footer .fine {
  font-size: 13px;
  color: #b9c9d0;
  max-width: 58rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}
@media (max-width: 720px) {
  .footer-grid { grid-template-columns: 1fr; }
}
.disclaimer {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 18px;
  font-size: 12.5px;
  color: #b9c9d0;
  max-width: 64rem;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* Quiz start-screen promo strip */
.site-promo {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 4px;
}
.site-promo-note {
  flex: 1 1 100%;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
