/* Stylesheet for the statically generated /guides pages (see scripts/build-guides.mjs).
   Lives in public/ rather than src/ because these pages are generated outside Vite and so
   can't resolve its content-hashed asset filenames -- this needs a stable, unhashed URL, the
   same reason the favicon lives here.

   Palette values are copied from src/styles.css rather than shared, since a static page can't
   import the app's CSS. Keep them in sync if the palette changes.

   Dark mode keys off prefers-color-scheme here, NOT the app's data-theme attribute: that's an
   account-level preference set by React after login, and these pages are public and have no
   session to read it from. Following the OS is the only signal available. */

:root {
  --bg: #E3ECD5;
  --card-bg: #F2F6E9;
  --tile-bg: #AFC2B4;
  --text: #22301B;
  --text-muted: #5A6B4B;
  --border: #C6D4AE;
  --amber: #AC8542;
  --forest: #2D5016;
  --blue: #2F5A6E;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16211A;
    --card-bg: #1E2B21;
    --tile-bg: #283528;
    --text: #E7EEDB;
    --text-muted: #9CB089;
    --border: #34432E;
    --amber: #CBA35C;
    --forest: #6FA548;
    --blue: #5E93AC;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  font-size: 1.02rem;
  line-height: 1.65;
}

h1, h2, h3, h4 { font-family: 'Lora', Georgia, serif; line-height: 1.25; }

a { color: var(--blue); }

img { max-width: 100%; height: auto; }

/* Topbar ------------------------------------------------------------------------------ */

.rs-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 780px; margin: 0 auto; padding: 14px 20px;
}
.rs-brand { display: flex; align-items: center; gap: 8px; font-family: 'Lora', Georgia, serif; font-weight: 700; color: var(--text); text-decoration: none; }
.rs-topnav { display: flex; align-items: center; gap: 14px; font-size: 0.92rem; }
.rs-topnav a { text-decoration: none; }
.rs-cta-link { background: var(--forest); color: #fff; padding: 8px 14px; border-radius: 999px; }

/* Article ----------------------------------------------------------------------------- */

/* Capped at 780px: article measure, not the app's 430px mobile-first shell. These are
   long-form reading pages on desktop as often as phones. */
.rs-main { max-width: 780px; margin: 0 auto; padding: 8px 20px 40px; }

.rs-breadcrumb { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 14px; }
.rs-breadcrumb a { color: var(--text-muted); }
.rs-breadcrumb span { margin: 0 4px; }

.rs-article h1 { font-size: clamp(1.75rem, 5vw, 2.5rem); margin: 0 0 12px; }

.rs-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 0.85rem; color: var(--text-muted); margin: 0 0 22px; }
.rs-tag { display: inline-block; background: var(--tile-bg); color: var(--text); padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; }

/* The lead answer. Visually set apart because it's the passage most likely to be quoted,
   by a reader skimming or by an answer engine extracting. */
.rs-summary {
  font-size: 1.12rem; line-height: 1.6; margin: 0 0 22px;
  padding: 16px 18px; background: var(--card-bg);
  border-left: 4px solid var(--forest); border-radius: 0 14px 14px 0;
}

.rs-takeaways { background: var(--card-bg); border: 1px solid var(--border); border-radius: 16px; padding: 16px 18px; margin: 0 0 26px; }
.rs-takeaways h2 { font-size: 1rem; margin: 0 0 8px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); font-family: 'DM Sans', sans-serif; }
.rs-takeaways ul { margin: 0; padding-left: 20px; }
.rs-takeaways li { margin-bottom: 6px; }

.rs-body h2 { font-size: 1.45rem; margin: 34px 0 10px; }
.rs-body h3 { font-size: 1.15rem; margin: 26px 0 8px; }
.rs-body p { margin: 0 0 16px; }
.rs-body ul, .rs-body ol { margin: 0 0 16px; padding-left: 24px; }
.rs-body li { margin-bottom: 6px; }
.rs-body blockquote {
  margin: 0 0 18px; padding: 12px 18px;
  background: var(--card-bg); border-left: 4px solid var(--amber); border-radius: 0 12px 12px 0;
}
.rs-body blockquote p:last-child { margin-bottom: 0; }
.rs-body code { background: var(--card-bg); padding: 2px 6px; border-radius: 6px; font-size: 0.92em; }

/* Tables scroll inside their own container so a wide comparison table never makes the whole
   page scroll sideways on a phone. */
.rs-body table { width: 100%; border-collapse: collapse; margin: 0 0 18px; font-size: 0.94rem; }
.rs-body th, .rs-body td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.rs-body th { background: var(--card-bg); font-weight: 700; }

.rs-body hr { border: none; border-top: 1px solid var(--border); margin: 30px 0; }

/* FAQ + related ------------------------------------------------------------------------ */

.rs-faq { margin-top: 40px; padding-top: 8px; border-top: 1px solid var(--border); }
.rs-faq h2 { font-size: 1.45rem; margin: 22px 0 14px; }
.rs-faq-item { margin-bottom: 18px; }
.rs-faq-item h3 { font-size: 1.05rem; margin: 0 0 4px; }
.rs-faq-item p { margin: 0; }

.rs-related { margin-top: 36px; padding-top: 8px; border-top: 1px solid var(--border); }
.rs-related h2 { font-size: 1.2rem; margin: 20px 0 8px; }
.rs-related ul { margin: 0; padding-left: 20px; }
.rs-related li { margin-bottom: 6px; }

/* Index -------------------------------------------------------------------------------- */

.rs-index-head { margin-bottom: 28px; }
.rs-index-head h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); margin: 0 0 10px; }
.rs-index-head p { color: var(--text-muted); margin: 0; max-width: 620px; }

.rs-cat { margin-bottom: 32px; }
.rs-cat h2 { font-size: 1.3rem; margin: 0 0 14px; }

.rs-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.rs-card a { display: block; height: 100%; background: var(--card-bg); border: 1px solid var(--border); border-radius: 18px; padding: 16px; text-decoration: none; color: var(--text); }
.rs-card h3 { font-size: 1.1rem; margin: 8px 0 6px; }
.rs-card p { margin: 0 0 10px; font-size: 0.93rem; color: var(--text-muted); }
.rs-card time { font-size: 0.8rem; color: var(--text-muted); }

.rs-empty { color: var(--text-muted); }

/* Footer ------------------------------------------------------------------------------- */

.rs-footer { max-width: 780px; margin: 0 auto; padding: 0 20px 48px; }

.rs-cta { background: var(--card-bg); border: 1px solid var(--border); border-radius: 20px; padding: 26px 22px; text-align: center; margin-bottom: 24px; }
.rs-cta h2 { font-size: 1.4rem; margin: 0 0 8px; }
.rs-cta p { color: var(--text-muted); margin: 0 auto 16px; max-width: 480px; }
.rs-btn { display: inline-block; background: var(--forest); color: #fff; text-decoration: none; padding: 12px 26px; border-radius: 999px; font-weight: 700; }

.rs-footlinks { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; font-size: 0.9rem; margin-bottom: 10px; }

.rs-fine { font-size: 0.8rem; color: var(--text-muted); text-align: center; margin: 8px 0 0; }

/* Embedded calculators --------------------------------------------------------------------
   Rendered server-side by scripts/build-guides.mjs; public/guides-calculators.js only adds
   behavior, so this styles markup that exists whether or not the script runs. */

.rs-calc { background: var(--card-bg); border: 1px solid var(--border); border-radius: 18px; padding: 18px; margin: 26px 0; }
.rs-calc h2 { font-size: 1.2rem; margin: 0 0 6px; }
.rs-calc-intro { margin: 0 0 14px; color: var(--text-muted); font-size: 0.93rem; }

.rs-calc-form { display: grid; gap: 12px; }
.rs-calc-field { display: block; }
.rs-calc-field > span { display: block; font-size: 0.85rem; font-weight: 700; margin-bottom: 4px; }
.rs-calc-field > small { display: block; margin-top: 4px; color: var(--text-muted); font-size: 0.78rem; }
/* 16px minimum on the control itself: anything smaller makes iOS Safari zoom the page on
   focus, which on a phone reads as the layout breaking when you tap a field. */
.rs-calc input, .rs-calc select {
  width: 100%; font: inherit; font-size: 16px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg); color: var(--text);
}

.rs-calc-modes { border: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 14px; }
.rs-calc-modes legend { font-size: 0.85rem; font-weight: 700; padding: 0; margin-bottom: 6px; }
.rs-calc-modes label { display: flex; align-items: center; gap: 6px; font-size: 0.93rem; }
.rs-calc-modes input { width: auto; }

.rs-calc-output { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.rs-calc-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 7px 0; }
.rs-calc-row + .rs-calc-row { border-top: 1px solid var(--border); }
.rs-calc-row span { color: var(--text-muted); font-size: 0.9rem; }
.rs-calc-row b { font-variant-numeric: tabular-nums; }
.rs-calc-headline { font-family: 'Lora', Georgia, serif; font-size: 1.25rem; color: var(--forest); }
.rs-calc-warn { margin: 12px 0 0; font-size: 0.83rem; color: var(--text-muted); }
