* { box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  color-scheme: dark;
  --background: #070a12;
  --outer-glass: rgba(10, 16, 30, 0.19);
  --reading-glass: rgba(10, 16, 30, 0.20);
  --inner-glass: rgba(6, 12, 24, 0.32);
  --command-glass: rgba(5, 10, 22, 0.60);
  --line: rgba(152, 196, 232, 0.18);
  --control-line: rgba(152, 196, 232, 0.26);
  --text: #eaf0fb;
  --muted: #adbed9;
  --accent: #22d3ee;
  --secondary: #8b5cf6;
  --ready: #34d399;
  --warning: #fbbf24;
  --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
  --radius: 8px;
  background: var(--background);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  scroll-padding-top: 5rem;
}

body { position: relative; isolation: isolate; margin: 0; min-height: 100vh; overflow-wrap: anywhere; }
body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  content: "";
  background: linear-gradient(180deg, rgba(7, 10, 18, .12), rgba(7, 10, 18, .20)),
    url("./assets/network-background.png") center 42% / cover no-repeat;
}

:where(h1, h2, h3, p, dl, dd, ul) { margin: 0; }
h1, h2, h3 { line-height: 1.16; }
h1 { font-size: clamp(1.85rem, 3.3vw, 2.85rem); font-weight: 625; max-width: 28ch; text-wrap: balance; }
h2 { font-size: 1.12rem; font-weight: 660; }
h3 { font-size: 1rem; }
a { color: var(--accent); text-underline-offset: .24em; }
a:hover { color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.shell { width: min(calc(100% - clamp(2rem, 7vw, 7rem)), 1260px); margin-inline: auto; }
.skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip-link:focus { position: fixed; top: 1rem; left: 1rem; z-index: 20; padding: .75rem; background: var(--background); }
.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  border-bottom: 1px solid var(--line);
  background: var(--command-glass);
  backdrop-filter: blur(18px);
}
.topbar { display: flex; gap: clamp(1rem, 5vw, 4rem); align-items: center; min-height: 64px; }
.topbar a { display: inline-flex; min-height: 44px; align-items: center; text-decoration: none; }
.wordmark { gap: .55rem; color: var(--text); font-weight: 700; font-size: 1.06rem; white-space: nowrap; }
.wordmark img { flex: none; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 0 clamp(1rem, 2.8vw, 2.5rem); }
.topbar nav a { color: var(--muted); position: relative; font-size: .87rem; }
.topbar nav a:hover, .topbar nav a[aria-current] { color: var(--accent); }
.topbar nav a[aria-current]::after { position: absolute; content: ""; inset: auto 0 .2rem; height: 2px; background: var(--accent); }

.intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(235px, .39fr); align-items: end; gap: 1.5rem 2rem; padding-block: clamp(1.8rem, 4.2vw, 3.65rem) clamp(1.4rem, 3vw, 2.3rem); }
.eyebrow, .unit-label { color: var(--accent); font: 600 .76rem/1.3 var(--mono); text-transform: uppercase; letter-spacing: .07em; }
.eyebrow { margin-bottom: .6rem; }
.hero-note { border-left: 1px solid var(--line); padding-left: 1rem; color: var(--muted); font-size: .9rem; }
.hero-note a { display: inline-flex; align-items: center; min-height: 44px; gap: .4rem; font-size: .8rem; }
.hero-note .estimate-link { display: none; }
.estimate-link strong { font-family: var(--mono); }
.signal { display: flex; align-items: center; gap: .55rem; color: var(--ready); font-weight: 650; margin-bottom: .25rem; }
.signal.warning { color: var(--warning); }
.signal span { width: .5rem; height: .5rem; border-radius: 50%; flex: none; background: currentColor; }

.workbench { display: grid; grid-template-columns: minmax(0, .88fr) minmax(0, 1.12fr); align-items: start; gap: 1rem; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--outer-glass); backdrop-filter: blur(8px); }
.inputs, .results, .worked-example, .reading, .handoff { padding: clamp(1rem, 2vw, 1.5rem); }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: .65rem; min-height: 44px; padding-bottom: .65rem; border-bottom: 1px solid var(--line); }
.panel-header button { margin-block: -.3rem; }
.unit-label { color: var(--muted); }

input, select, button, .button { font: inherit; }
input, select, button, .button { min-height: 44px; border: 1px solid var(--control-line); border-radius: 7px; background: var(--inner-glass); color: var(--text); }
input, select { inline-size: 100%; min-inline-size: 0; padding: .45rem .64rem; backdrop-filter: blur(6px); }
select { text-overflow: ellipsis; padding-inline-end: .2rem; }
button, .button { min-width: 44px; padding: .5rem .75rem; font-size: .83rem; font-weight: 630; line-height: 1.3; cursor: pointer; }
button:hover, .button:hover { border-color: var(--accent); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .55rem; text-align: center; text-decoration: none; }
.button.primary { color: var(--background); background: var(--accent); border-color: var(--accent); }
.button.primary:hover { background: #80e8f7; }
.button.secondary { border-color: var(--secondary); }
.button.secondary:hover { background: color-mix(in srgb, var(--secondary) 22%, var(--inner-glass)); }

.form-group { border: 0; border-top: 1px solid var(--line); padding: .55rem 0 0; margin: 1.15rem 0 0; min-inline-size: 0; }
.form-group:first-of-type { border-top: 0; padding-top: .2rem; }
.form-group legend, summary { color: var(--text); font-size: .87rem; font-weight: 650; }
.form-group legend { padding: 0 .6rem 0 0; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem .85rem; }
.field { display: flex; flex-direction: column; justify-content: end; gap: .32rem; min-width: 0; font-size: .8rem; font-weight: 550; }
.field:has(#policy) { grid-column: 1 / -1; }
.field span { line-height: 1.35; }
.fine-print { color: var(--muted); font-size: .8rem; }
.group-note { margin-top: .6rem; }
summary { display: list-item; align-content: center; cursor: pointer; min-height: 44px; padding: .35rem 0; }
summary::marker { color: var(--accent); }
details.form-group { padding-top: 0; }
details.form-group[open] .field-grid { padding-top: .25rem; }

.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 1.1rem 0; gap: .75rem 1rem; }
.metrics > div:first-child { grid-column: 1 / -1; border-bottom: 1px solid var(--line); padding-bottom: .75rem; }
.metrics dt { color: var(--muted); font-size: .78rem; }
.metrics dd { font: 620 clamp(.9rem, 1.3vw, 1.16rem)/1.3 var(--mono); margin-top: .18rem; }
.metrics > div:first-child dd { color: var(--accent); font: 630 clamp(1.9rem, 4.6vw, 3rem)/1.15 var(--mono); margin-top: .25rem; }
.result-heading { margin: 1.2rem 0 .65rem; }
.facts > div { display: flex; justify-content: space-between; gap: .75rem; padding: .42rem 0; border-bottom: 1px solid var(--line); font-size: .82rem; }
.facts dt { color: var(--muted); }
.facts dd { flex: 0 1 48%; font-family: var(--mono); text-align: right; }

.comparison { border-collapse: collapse; width: 100%; font-size: .82rem; }
.comparison caption { text-align: left; font-size: 1rem; font-weight: 650; margin: .35rem 0 .55rem; }
.comparison th, .comparison td { padding: .5rem .45rem; text-align: right; }
.comparison th:first-child { text-align: left; }
.comparison thead { color: var(--muted); font-size: .72rem; border-bottom: 1px solid var(--line); }
.comparison tbody tr { border-bottom: 1px solid var(--line); }
.comparison tbody th { font-weight: 600; }
.comparison tbody td:last-child { font-family: var(--mono); }
.comparison[data-columns="4"] tbody td { font-family: var(--mono); }
.comparison small { display: block; font-weight: 400; color: var(--muted); }
.comparison .is-selected { box-shadow: inset 2px 0 var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.comparison .is-selected td:last-child { color: var(--accent); }
.mobile-label { display: none; }
.scope { margin-top: .8rem; }
.comparison + .facts { margin-top: .75rem; }
.scenario-choice { max-width: 21rem; margin-top: 1rem; }
.exports { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .85rem; }
.exports button { border-color: color-mix(in srgb, var(--secondary) 70%, var(--line)); }

.worked-example { margin-top: 1rem; }
.worked-example .panel-header { flex-wrap: wrap; }
.worked-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.15rem 1.5rem; margin-top: 1rem; }
.worked-steps { margin: .35rem 0 0; padding-inline-start: 1.4rem; font-size: .85rem; }
.worked-steps li { padding: .35rem 0; border-bottom: 1px solid var(--line); }
.worked-steps li::marker { color: var(--muted); }
.worked-steps strong { display: block; }
.worked-steps span { color: var(--muted); }
.worked-steps b { color: var(--text); font-family: var(--mono); white-space: nowrap; }
.worked-prices { width: 100%; table-layout: fixed; border-collapse: collapse; text-align: left; }
.worked-prices caption { margin-bottom: .55rem; text-align: left; font-weight: 650; }
.worked-prices th, .worked-prices td { padding-inline: clamp(.35rem, 1vw, .75rem); vertical-align: top; }
.worked-prices :is(th, td):first-child { padding-inline-start: 0; }
.worked-prices :is(th, td):last-child { padding-inline-end: 0; }
.worked-prices :is(th, td) + :is(th, td) { border-left: 1px solid var(--line); }
.worked-prices th { font-size: .8rem; line-height: 1.35; }
.worked-totals td { padding-block: .32rem .48rem; font: 650 clamp(.88rem, 1.5vw, 1.2rem)/1.3 var(--mono); }
.worked-totals td:first-child { color: var(--accent); }
.worked-rates td { color: var(--muted); font-size: .75rem; line-height: 1.4; }
.worked-rates span { display: block; }
.worked-rates span + span { margin-top: .28rem; }

.handoff { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem 1.3rem; margin-block: 1rem; }
.handoff p { margin-top: .3rem; color: var(--muted); font-size: .83rem; }
.handoff .handoff-warning { flex-basis: 100%; margin-top: 0; color: var(--warning); }
.handoff strong { color: var(--text); font-family: var(--mono); }
.handoff-actions { display: flex; flex-wrap: wrap; gap: .65rem; }
.reading-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 1rem; }
.reading { background: var(--reading-glass); }
.reading h2 { margin-bottom: .65rem; }
.reading ul { list-style: none; padding: 0; }
.reading details, .reference-list li { border-top: 1px solid var(--line); }
.reading details > p { padding: .08rem 0 .7rem; }
.reading p { color: var(--muted); font-size: .86rem; }
.reference-list li { padding-bottom: .6rem; }
.reference-list a, .source-links a, footer a { display: inline-flex; align-items: center; gap: .35rem; min-height: 44px; font-size: .83rem; }
.source-links { display: flex; flex-wrap: wrap; gap: 0 .95rem; border-top: 1px solid var(--line); }
footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; column-gap: 1rem; border-top: 1px solid var(--line); padding: .5rem 0 1rem; margin-top: 1.5rem; }
footer > span { font-weight: 650; }
footer nav { display: flex; flex-wrap: wrap; gap: 0 1rem; }

@media (max-width: 900px) {
  .workbench { grid-template-columns: minmax(0, 1fr); }
  .hero-note .estimate-link { display: flex; width: fit-content; }
}

@media (max-width: 620px) {
  :root { scroll-padding-top: 7rem; }
  .topbar { flex-direction: column; align-items: start; gap: 0; padding-top: .15rem; }
  .topbar nav { column-gap: clamp(.65rem, 3vw, 1.1rem); }
  .topbar nav a { font-size: .8rem; }
  .intro { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  h1 { text-wrap: initial; }
  .reading-grid { grid-template-columns: minmax(0, 1fr); }
  .worked-grid { grid-template-columns: minmax(0, 1fr); }
  .handoff-actions, .handoff-actions .button { width: 100%; }
  .handoff { row-gap: .85rem; }
  .metrics { gap: .75rem .6rem; }
  .field-grid > .field:has(select) { grid-column: 1 / -1; }
  .comparison th, .comparison td { padding-inline: .32rem; }
  .comparison[data-columns="4"], .comparison[data-columns="4"] tbody { display: block; }
  .comparison[data-columns="4"] thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .comparison[data-columns="4"] tbody tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .comparison[data-columns="4"] tbody th { grid-column: 1 / -1; padding-bottom: 0; }
  .comparison[data-columns="4"] tbody td { text-align: left; }
  .comparison[data-columns="4"] .mobile-label { display: block; color: var(--muted); font: .72rem/1.25 system-ui, sans-serif; }
}

@media (max-width: 350px) {
  .field-grid { grid-template-columns: minmax(0, 1fr); }
}
