/* OutageReady v2 — tokens, base, layout, components. Fonts are self-hosted (fast, no third-party requests). */
@font-face { font-family: "Archivo"; src: url("/assets/fonts/archivo-latin-wdth-normal.woff2") format("woff2"); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }
@font-face { font-family: "Public Sans"; src: url("/assets/fonts/public-sans-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Public Sans"; src: url("/assets/fonts/public-sans-latin-wght-italic.woff2") format("woff2"); font-weight: 100 900; font-style: italic; font-display: swap; }

:root {
  --ink: #1c2b36;
  --ink-soft: #4a5b66;
  --ink-faint: #7b8a93;
  --paper: #f3f5f4;
  --surface: #ffffff;
  --amber: #e8a317;
  --amber-deep: #b97c00;
  --amber-wash: #fdf3dc;
  --teal: #0e5e63;
  --teal-wash: #e3efee;
  --line: #d5dde0;
  --warn: #a63a2b;
  --warn-wash: #f7e6e2;
  --ok: #2f6b3a;
  --radius-s: 4px;
  --radius-m: 10px;
  --display: "Archivo", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --body: "Public Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --measure: 42rem;
  --wide: 72rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1.5rem; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 1.125rem; line-height: 1.62; }
img, svg { max-width: 100%; height: auto; }
a { color: var(--teal); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--ink); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

h1, h2, h3 { font-family: var(--display); font-stretch: 85%; word-spacing: 0.06em; line-height: 1.12; letter-spacing: -0.01em; margin: 2.4rem 0 0.8rem; }
h1 { font-size: clamp(2.1rem, 5vw, 3.2rem); font-weight: 800; margin-top: 0.3rem; }
h2 { font-size: clamp(1.5rem, 3vw, 1.95rem); font-weight: 750; }
h3 { font-size: 1.22rem; font-weight: 700; margin-top: 1.8rem; }
p, ul, ol { margin: 0 0 1.1rem; }
li { margin-bottom: 0.4rem; }
small { font-size: 0.85em; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--surface); padding: 0.5rem 1rem; z-index: 10; }

/* ---------- Header ---------- */
.site-header { background: var(--ink); color: #fff; }
.site-header .inner { max-width: var(--wide); margin: 0 auto; padding: 0.8rem 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: #fff; text-decoration: none; flex-shrink: 0; }
.brand-mark { width: 2.1rem; height: 2.1rem; border-radius: 7px; background: var(--amber); display: grid; place-items: center; }
.brand-mark svg { width: 0.95rem; height: 1.3rem; }
.brand-name { word-spacing: 0.05em; font-family: var(--display); font-stretch: 85%; font-weight: 800; font-size: 1.4rem; line-height: 1; }
.brand-tag { display: block; font-family: var(--body); font-size: 0.72rem; font-weight: 400; color: #b8c6cc; margin-top: 0.2rem; letter-spacing: 0.01em; }
.site-nav { display: flex; gap: 0.25rem; font-size: 0.98rem; overflow-x: auto; scrollbar-width: none; }
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a { color: #dfe7ea; text-decoration: none; padding: 0.45rem 0.75rem; border-radius: 6px; white-space: nowrap; }
.site-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.site-nav a[aria-current="page"] { color: var(--ink); background: var(--amber); }
@media (max-width: 760px) {
  .site-header .inner { flex-direction: column; align-items: stretch; gap: 0.6rem; padding-bottom: 0.6rem; }
  .brand-tag { display: none; }
  .site-nav { margin: 0 -1.25rem; padding: 0 1.25rem; }
  .site-nav a { padding: 0.4rem 0.7rem; }
}

/* ---------- Page layout ---------- */
main { display: block; }
.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 1.25rem; }
.crumbs { font-size: 0.88rem; color: var(--ink-soft); margin: 1.4rem 0 0.4rem; }
.crumbs a { color: var(--ink-soft); }
.crumbs span[aria-hidden] { margin: 0 0.35rem; color: var(--ink-faint); }

.layout { display: grid; grid-template-columns: minmax(0, var(--measure)); gap: 3rem; justify-content: center; }
@media (min-width: 1100px) { .layout.has-rail { grid-template-columns: minmax(0, var(--measure)) 300px; justify-content: space-between; } }
.content { min-width: 0; }
.rail { display: none; }
@media (min-width: 1100px) { .rail { display: block; } }
.rail-inner { position: sticky; top: 1.5rem; display: grid; gap: 1.5rem; }

.toc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1rem 1.1rem; font-size: 0.95rem; }
.toc-title { word-spacing: 0.05em; font-family: var(--display); font-stretch: 90%; font-weight: 750; font-size: 1.02rem; margin: 0 0 0.5rem; }
.toc ol { list-style: none; padding: 0; margin: 0; }
.toc li { margin: 0; }
.toc a { display: block; padding: 0.3rem 0 0.3rem 0.75rem; border-left: 2px solid var(--line); color: var(--ink-soft); text-decoration: none; line-height: 1.35; }
.toc a:hover { color: var(--teal); border-left-color: var(--teal); }
.toc a.on { color: var(--ink); border-left-color: var(--amber); font-weight: 700; }

/* Article header */
.lede { font-size: 1.24rem; color: var(--ink-soft); }
.byline { display: flex; align-items: center; gap: 0.7rem; font-size: 0.93rem; color: var(--ink-soft); margin: 1rem 0 1.4rem; padding-bottom: 1.2rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.byline strong { color: var(--ink); }
.byline a { color: inherit; }
.avatar { width: 2.4rem; height: 2.4rem; border-radius: 50%; background: var(--ink); color: var(--amber); display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 0.95rem; flex-shrink: 0; }
.byline .sep { width: 4px; height: 4px; border-radius: 50%; background: var(--ink-faint); }

/* Answer box: first thing readers and Google see */
.answer { background: var(--surface); border-left: 6px solid var(--amber); padding: 1.1rem 1.3rem; margin: 1.5rem 0; border-radius: 0 var(--radius-m) var(--radius-m) 0; box-shadow: 0 1px 0 var(--line); }
.answer-label { font-family: var(--display); font-stretch: 90%; font-weight: 750; font-size: 0.95rem; color: var(--amber-deep); margin: 0 0 0.3rem; }
.answer p:last-child { margin-bottom: 0; }

.note { background: var(--teal-wash); padding: 1rem 1.25rem; border-radius: var(--radius-m); margin: 1.5rem 0; }
.safety { background: var(--warn-wash); border-left: 6px solid var(--warn); padding: 1rem 1.25rem; margin: 1.5rem 0; border-radius: 0 var(--radius-m) var(--radius-m) 0; }
.note p:last-child, .safety p:last-child { margin-bottom: 0; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 1.25rem 0 1.75rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); }
table { border-collapse: collapse; width: 100%; font-size: 0.98rem; }
th, td { text-align: left; padding: 0.65rem 0.85rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { word-spacing: 0.05em; font-family: var(--display); font-stretch: 90%; font-weight: 700; background: #eaf0f1; line-height: 1.25; }
tbody tr:nth-child(even) td { background: #fafbfb; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td small { color: var(--ink-soft); }
tr:last-child td { border-bottom: 0; }

/* FAQ */
.faq details { border-bottom: 1px solid var(--line); }
.faq details:first-of-type { border-top: 1px solid var(--line); }
.faq summary { word-spacing: 0.06em; cursor: pointer; list-style: none; padding: 1rem 2rem 1rem 0; font-family: var(--display); font-stretch: 90%; font-weight: 700; font-size: 1.12rem; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 0.3rem; top: 0.85rem; font-size: 1.4rem; color: var(--teal); font-weight: 400; }
.faq details[open] summary::after { content: "\2212"; }
.faq details p { margin: 0 0 1rem; color: var(--ink-soft); }

/* Author and sources */
.author-box { display: grid; grid-template-columns: auto 1fr; gap: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1.25rem; margin: 2.5rem 0 1.5rem; }
.author-box .avatar { width: 3.4rem; height: 3.4rem; font-size: 1.2rem; }
.author-box p { margin: 0 0 0.5rem; font-size: 1rem; }
.author-box p:last-child { margin: 0; }
.author-name { word-spacing: 0.05em; font-family: var(--display); font-stretch: 88%; font-weight: 750; font-size: 1.15rem; }
.sources { font-size: 0.95rem; color: var(--ink-soft); border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 1.5rem; }
.sources h2 { font-size: 1.1rem; margin: 0 0 0.5rem; color: var(--ink); }
.sources ul { padding-left: 1.1rem; margin-bottom: 0.6rem; }

/* Related */
.related { display: grid; gap: 0.6rem; margin: 1rem 0 0; padding: 0; list-style: none; }
.related a { display: flex; align-items: center; gap: 0.75rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 0.75rem 0.9rem; text-decoration: none; color: var(--ink); font-weight: 700; }
.related a:hover { border-color: var(--teal); color: var(--teal); }
.related .icon { width: 2.2rem; height: 2.2rem; }

/* Ads: clearly labeled, space reserved so the page never jumps */
.ad { margin: 2rem 0; text-align: center; }
.ad-label { display: block; font-size: 0.72rem; color: var(--ink-faint); margin-bottom: 0.3rem; }
.ad-box { min-height: 280px; display: block; }
.rail .ad { margin: 0; }
.rail .ad-box { min-height: 600px; }

/* Icons */
.icon { width: 2.6rem; height: 2.6rem; border-radius: 8px; background: var(--amber-wash); color: var(--ink); display: grid; place-items: center; flex-shrink: 0; }
.icon svg { width: 62%; height: 62%; }

/* ---------- Calculators ---------- */
.calc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1.3rem; margin: 1.5rem 0 2rem; box-shadow: 0 2px 0 var(--line); }
.calc h2 { margin-top: 0; }
.calc fieldset { border: 0; padding: 0; margin: 0 0 1.25rem; min-width: 0; }
.calc legend { word-spacing: 0.05em; font-family: var(--display); font-stretch: 90%; font-weight: 700; font-size: 1.1rem; margin-bottom: 0.6rem; padding: 0; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.9rem; }
label { display: block; font-size: 0.95rem; font-weight: 700; margin-bottom: 0.25rem; }
.hint { display: block; font-weight: 400; color: var(--ink-soft); font-size: 0.85rem; }
input[type="number"], select { width: 100%; font: inherit; font-size: 1rem; padding: 0.55rem 0.65rem; border: 1.5px solid var(--line); border-radius: var(--radius-s); background: #fff; color: var(--ink); }
input[type="number"]:focus, select:focus { border-color: var(--teal); }
.appl-list { display: grid; gap: 0.3rem; }
.appl, .appl-head { display: grid; grid-template-columns: 1fr 5.5rem 5.5rem; gap: 0.6rem; align-items: center; }
.appl.gen, .appl-head.gen { grid-template-columns: 1fr 5.5rem; }
.appl { padding: 0.5rem 0.6rem; border-radius: var(--radius-s); }
.appl:nth-child(odd) { background: #f5f8f8; }
.appl.active { background: var(--amber-wash); }
.appl .name { font-size: 1rem; line-height: 1.3; margin: 0; }
.appl .name small { display: block; color: var(--ink-soft); font-size: 0.82rem; font-weight: 400; }
.appl input { padding: 0.4rem 0.5rem; text-align: right; }
.appl-head { font-size: 0.82rem; color: var(--ink-soft); padding: 0 0.6rem; }
.appl-head span:not(:first-child) { text-align: right; }
.result { border-top: 2px solid var(--ink); margin-top: 1rem; padding-top: 1rem; }
.result-main { font-family: var(--display); font-stretch: 85%; font-weight: 800; font-size: clamp(1.9rem, 6vw, 2.8rem); line-height: 1.05; margin: 0 0 0.35rem; }
.result-sub { color: var(--ink-soft); margin-bottom: 0.9rem; }
.checks { list-style: none; padding: 0; margin: 0.75rem 0 0; }
.checks li { padding-left: 1.6rem; position: relative; }
.checks li::before { position: absolute; left: 0; font-weight: 700; }
.checks li.pass::before { content: "\2713"; color: var(--ok); }
.checks li.fail::before { content: "\2715"; color: var(--warn); }
.checks li.fail { color: var(--warn); }
@media (max-width: 560px) {
  body { font-size: 1.0625rem; }
  .calc { padding: 1rem; }
  .appl, .appl-head { grid-template-columns: 1fr 4.3rem 4.3rem; gap: 0.4rem; }
  .appl.gen, .appl-head.gen { grid-template-columns: 1fr 4.3rem; }
}

/* Battery gauge: the one expressive element */
.battery { margin: 1rem 0 0.5rem; }
.battery-body { position: relative; height: 3.2rem; border: 3px solid var(--ink); border-radius: 8px; padding: 4px; margin-right: 12px; background: #fff; }
.battery-body::after { content: ""; position: absolute; right: -13px; top: 50%; transform: translateY(-50%); width: 8px; height: 1.3rem; background: var(--ink); border-radius: 0 3px 3px 0; }
.battery-fill { height: 100%; width: 0; border-radius: 3px; background: repeating-linear-gradient(90deg, var(--amber) 0 22px, var(--amber-deep) 22px 24px); transition: width 0.6s cubic-bezier(.2,.8,.2,1); }
.battery-fill.low { background: repeating-linear-gradient(90deg, #d8603f 0 22px, var(--warn) 22px 24px); }
.battery-scale { position: relative; height: 1.4rem; margin-right: 12px; font-size: 0.8rem; color: var(--ink-soft); }
.battery-scale span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.battery-scale span::before { content: ""; position: absolute; left: 50%; top: -0.35rem; height: 0.3rem; border-left: 1px solid var(--ink-soft); }
.battery-scale span:last-child { transform: translateX(-100%); }
.battery-scale span:last-child::before { left: 100%; }
@media (prefers-reduced-motion: reduce) { .battery-fill { transition: none; } }

/* ---------- Home ---------- */
.hero { background: var(--ink); color: #fff; padding: 2.8rem 0 3.2rem; }
.hero .wrap { display: grid; gap: 2rem; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 900px) { .hero .wrap { grid-template-columns: 1.05fr 1fr; gap: 3.5rem; } }
.hero h1 { color: #fff; font-size: clamp(2.3rem, 5.5vw, 3.7rem); margin-top: 0; }
.hero p { color: #cfdade; font-size: 1.2rem; max-width: 34rem; }
.hero .calc { color: var(--ink); margin: 0; box-shadow: 0 18px 40px rgba(0,0,0,0.25); border: 0; }
.hero .calc p { color: var(--ink); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }
.quick-result { font-size: 1.05rem; margin: 0.75rem 0 0; }
.quick-result strong { font-family: var(--display); font-stretch: 85%; font-size: 1.6rem; }

.section { padding: 3rem 0 0; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.section-head h2 { margin: 0 0 0.3rem; }
.section-head p { color: var(--ink-soft); margin: 0; }

.card-grid { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); margin-top: 1.3rem; }
.card { display: flex; gap: 0.9rem; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1.1rem; text-decoration: none; color: var(--ink); }
.card:hover { border-color: var(--teal); }
.card:hover .card-title { color: var(--teal); }
.card-title { word-spacing: 0.05em; font-family: var(--display); font-stretch: 88%; font-weight: 750; font-size: 1.13rem; line-height: 1.2; display: block; margin-bottom: 0.25rem; }
.card-desc { font-size: 0.95rem; color: var(--ink-soft); line-height: 1.45; display: block; }
.card.tool { background: var(--ink); color: #fff; border-color: var(--ink); }
.card.tool .card-desc { color: #c3d0d5; }
.card.tool .icon { background: var(--amber); }
.card.tool:hover .card-title { color: var(--amber); }

.principles { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); margin-top: 1.3rem; }
.principles h3 { margin: 0 0 0.4rem; font-size: 1.15rem; }
.principles p { color: var(--ink-soft); font-size: 1rem; margin: 0; }
.principles > div { border-top: 3px solid var(--amber); padding-top: 0.9rem; }

.author-strip { display: flex; gap: 1rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1.2rem 1.3rem; margin-top: 2.5rem; }
.author-strip .avatar { width: 3.2rem; height: 3.2rem; font-size: 1.1rem; }
.author-strip p { margin: 0; font-size: 1rem; }

.btn { display: inline-block; font: inherit; font-weight: 700; font-size: 1rem; cursor: pointer; background: var(--amber); color: var(--ink); border: 0; border-radius: 6px; padding: 0.7rem 1.2rem; text-decoration: none; }
.btn:hover { background: #f4b938; color: var(--ink); }
.btn.ghost { background: transparent; color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.5); }
.btn.ghost:hover { box-shadow: inset 0 0 0 1.5px #fff; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 4.5rem; background: var(--ink); color: #b8c6cc; font-size: 0.95rem; }
.site-footer .inner { max-width: var(--wide); margin: 0 auto; padding: 2.8rem 1.25rem 2rem; display: grid; gap: 2rem; grid-template-columns: 1fr; }
@media (min-width: 800px) { .site-footer .inner { grid-template-columns: 1.4fr 1fr 1fr 1fr; } }
.site-footer .brand { margin-bottom: 0.8rem; }
.site-footer h2 { font-size: 1rem; color: #fff; margin: 0 0 0.7rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 0.45rem; }
.site-footer a { color: #dfe7ea; text-decoration: none; }
.site-footer a:hover { color: var(--amber); }
.footer-base { max-width: var(--wide); margin: 0 auto; padding: 1.2rem 1.25rem 2rem; border-top: 1px solid rgba(255,255,255,0.12); font-size: 0.85rem; }
.footer-base p { margin: 0 0 0.4rem; }
@media (max-width: 560px) { .byline .sep { display: none; } .byline { gap: 0.3rem 0.8rem; } }
