/* Shared styles for ndph.org tools, printables and articles.
   The older pages (index, about, app) carry their own inline styles; newer
   pages use this file so they stay consistent and small. */

:root {
  --bg: #f6f1e8; --bg-warm: #efe7d7; --bg-card: #fbf6ec;
  --ink: #2a2e2c; --ink-soft: #5c625e; --ink-faint: #8a8f8b;
  --sage: #6b8478; --sage-deep: #4a5e54; --sage-soft: #b8c9bf;
  --amber: #c08552; --amber-soft: #e3c5a3; --rose: #b48b8b;
  --alarm: #b5452f; --alarm-bg: #fbeee9;
  --hairline: rgba(42, 46, 44, 0.12);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif; font-size: 17px; line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--amber-soft); }
a { color: var(--sage-deep); }
img { max-width: 100%; height: auto; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 22px 20px 0; }
.narrow { max-width: 720px; }

/* ---- top bar ---- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 4px 0 18px; border-bottom: 1px solid var(--hairline); flex-wrap: wrap; }
.topbar .brand { display: flex; align-items: center; gap: 10px; font-family: 'Lora', serif; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.topbar .brand img { width: 26px; height: 26px; display: block; }
.topbar nav { display: flex; gap: 22px; flex-wrap: wrap; }
.topbar nav a { color: var(--ink-soft); text-decoration: none; font-size: .86rem; }
.topbar nav a:hover, .topbar nav a[aria-current] { color: var(--sage-deep); }

/* ---- page header ---- */
.page-head { padding: 46px 0 10px; }
.eyebrow { font-size: .72rem; letter-spacing: .3em; text-transform: uppercase; color: var(--amber); font-weight: 600; margin: 0 0 12px; }
h1 { font-family: 'Lora', serif; font-weight: 400; font-size: clamp(2rem, 4.8vw, 3rem); line-height: 1.12; letter-spacing: -.015em; margin: 0 0 18px; }
h1 em, h2 em { color: var(--sage-deep); }
.lede { font-family: 'Lora', serif; font-size: 1.15rem; line-height: 1.6; color: var(--ink-soft); max-width: 680px; margin: 0 0 18px; }
.byline { font-size: .82rem; color: var(--ink-faint); margin: 0 0 8px; }

/* ---- sections & prose ---- */
section.block { padding: 34px 0; }
h2 { font-family: 'Lora', serif; font-weight: 400; font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.2; margin: 0 0 14px; }
h3 { font-family: 'Lora', serif; font-weight: 600; font-size: 1.12rem; margin: 26px 0 8px; }
.prose { max-width: 720px; }
.prose p, .prose li { color: var(--ink-soft); }
.prose p { margin: 0 0 16px; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 16px; }
.prose li { margin-bottom: 6px; }
.prose strong { color: var(--ink); font-weight: 600; }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 0; cursor: pointer; text-decoration: none;
  background: var(--sage-deep); color: var(--bg); padding: 12px 24px; border-radius: 999px; font: 500 .95rem 'Inter', sans-serif; }
.btn:hover { background: var(--ink); }
.btn.secondary { background: transparent; color: var(--sage-deep); border: 1px solid var(--sage-soft); }
.btn.secondary:hover { border-color: var(--sage); background: rgba(107,132,120,.06); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 6px 0 12px; }
.tip { font-size: .85rem; color: var(--ink-faint); }

/* ---- cards ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 18px; margin: 18px 0; }
.card { background: var(--bg-card); border: 1px solid var(--hairline); border-radius: 10px; padding: 22px 22px 20px; text-decoration: none; color: inherit; display: block; transition: border-color .2s, transform .2s; }
a.card:hover { border-color: var(--sage); transform: translateY(-2px); }
.card .kind { font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; color: var(--amber); font-weight: 600; }
.card h3 { margin: 6px 0 6px; font-size: 1.12rem; }
.card p { margin: 0; color: var(--ink-soft); font-size: .94rem; line-height: 1.55; }
.card .go { display: inline-block; margin-top: 10px; color: var(--sage-deep); font-size: .88rem; font-weight: 500; }

/* ---- callouts ---- */
.note, .warn, .alarm { border-radius: 8px; padding: 16px 20px; margin: 18px 0; font-size: .95rem; line-height: 1.6; }
.note { background: var(--bg-card); border: 1px solid var(--hairline); border-left: 3px solid var(--sage); color: var(--ink-soft); }
.warn { background: var(--bg-card); border: 1px solid var(--hairline); border-left: 3px solid var(--amber); color: var(--ink-soft); }
.alarm { background: var(--alarm-bg); border: 1px solid rgba(181,69,47,.25); border-left: 3px solid var(--alarm); color: var(--ink); }
.note strong, .warn strong, .alarm strong { color: var(--ink); }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; margin: 18px 0; border: 1px solid var(--hairline); border-radius: 10px; background: var(--bg-card); }
table.compare { border-collapse: collapse; width: 100%; min-width: 760px; font-size: .9rem; }
table.compare th, table.compare td { text-align: left; vertical-align: top; padding: 12px 14px; border-bottom: 1px solid var(--hairline); }
table.compare thead th { background: var(--bg-warm); font-family: 'Lora', serif; font-weight: 600; font-size: .98rem; }
table.compare tbody th { font-weight: 600; color: var(--ink); width: 150px; background: rgba(239,231,215,.45); }
table.compare td { color: var(--ink-soft); }
table.compare tr:last-child td, table.compare tr:last-child th { border-bottom: 0; }

/* ---- forms (tools) ---- */
.tool { background: var(--bg-card); border: 1px solid var(--hairline); border-radius: 12px; padding: 24px; margin: 18px 0; }
.field { display: grid; grid-template-columns: 1fr 120px; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--hairline); }
.field:last-child { border-bottom: 0; }
.field label { color: var(--ink); font-size: .97rem; line-height: 1.45; }
.field label small { display: block; color: var(--ink-faint); font-size: .82rem; margin-top: 2px; }
input[type=number], select, input[type=text] {
  width: 100%; font: 500 1rem 'Inter', sans-serif; color: var(--ink); background: #fff;
  border: 1px solid #cfc6b6; border-radius: 8px; padding: 10px 12px; }
input[type=number]:focus, select:focus, input[type=text]:focus { outline: 2px solid var(--sage-soft); border-color: var(--sage); }
.result { margin-top: 18px; }
.result:empty { display: none; }
.score { display: flex; align-items: center; gap: 18px; background: #fff; border: 1px solid var(--hairline); border-radius: 12px; padding: 18px 20px; }
.score .big { font-family: 'Lora', serif; font-size: 2.6rem; line-height: 1; color: var(--sage-deep); min-width: 64px; text-align: center; }
.score .big small { display: block; font-family: 'Inter', sans-serif; font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint); margin-top: 6px; }
.flag { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--hairline); }
.flag:last-child { border-bottom: 0; }
.flag .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 8px; flex-shrink: 0; background: var(--sage); }
.flag.over .dot { background: var(--alarm); }
.flag.near .dot { background: var(--amber); }

/* ---- citations & references ---- */
.cite { font-size: .62em; line-height: 0; margin-left: 1px; font-weight: 600; }
.cite a { color: var(--amber); text-decoration: none; }
.refs { padding: 40px 0 10px; border-top: 1px solid var(--hairline); margin-top: 30px; }
.refs .container-prose { max-width: 760px; }
.refs h2 { font-size: 1.5rem; }
.refs-note { color: var(--ink-faint); font-size: .88rem; }
.refs ol { padding-left: 1.8em; }
.refs li { font-size: .84rem; line-height: 1.55; color: var(--ink-soft); margin-bottom: 8px; overflow-wrap: anywhere; }
.refs li:target { background: var(--bg-warm); outline: 6px solid var(--bg-warm); }

/* ---- footer ---- */
.site-foot { margin-top: 50px; background: var(--ink); color: rgba(246,241,232,.7); padding: 40px 20px 34px; text-align: center; font-size: .84rem; }
.site-foot .f-logo { font-family: 'Lora', serif; color: var(--bg); font-size: 1.2rem; margin-bottom: 6px; }
.site-foot p { max-width: 640px; margin: 10px auto; line-height: 1.65; color: rgba(246,241,232,.55); }
.site-foot a { color: var(--amber-soft); text-decoration: none; margin: 0 6px; }
.site-foot a:hover { text-decoration: underline; }

/* ---- printable sheets ---- */
.sheet-holder { overflow: hidden; margin: 18px 0 8px; }
.sheet { background: #fff; color: #111; transform-origin: top left; box-shadow: 0 10px 34px rgba(42,46,44,.16);
  -webkit-print-color-adjust: exact; print-color-adjust: exact; font-family: 'Inter', system-ui, sans-serif; }
.print-only { display: none; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .field { grid-template-columns: 1fr; gap: 6px; }
  .topbar nav { gap: 14px; }
  .score { flex-direction: column; align-items: flex-start; }
}
@media print {
  body { background: #fff; }
  .screen-only, .topbar, .site-foot, .lang-switch { display: none !important; }
  .print-only { display: block; }
  .wrap { max-width: none; padding: 0; margin: 0; }
  .sheet-holder { height: auto !important; overflow: visible; margin: 0; }
  .sheet { transform: none !important; box-shadow: none; }
  a { color: inherit; text-decoration: none; }
}
