/* VoltaDoc public site — mobile-first, no framework. */

:root {
  color-scheme: light dark;

  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef2f9;
  --text: #13213d;
  --text-2: #4a5878;
  --muted: #6b7794;
  --line: #d9e0ee;

  --brand: #0b2d63;
  --brand-ink: #ffffff;
  --accent: #0f5fe6;
  --accent-strong: #0a4cc0;
  --accent-soft: #e4eeff;
  --accent-ink: #ffffff;

  --ok: #157a4c;
  --ok-soft: #e1f5ea;
  --warn: #9a5b00;
  --warn-soft: #fff3dc;
  --danger: #b42318;
  --danger-soft: #fde8e6;

  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgb(16 32 64 / 6%), 0 8px 24px -12px rgb(16 32 64 / 18%);
  --font:
    system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --container: 68rem;
  --gutter: 16px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0a1424;
    --surface: #111e33;
    --surface-2: #172640;
    --text: #e8eef9;
    --text-2: #b8c4dc;
    --muted: #8d9bb8;
    --line: #26385a;

    --brand: #0f2a55;
    --brand-ink: #ffffff;
    --accent: #5eb1ff;
    --accent-strong: #86c5ff;
    --accent-soft: #14294a;
    --accent-ink: #061530;

    --ok: #5fd39a;
    --ok-soft: #10301f;
    --warn: #ffc76b;
    --warn-soft: #3a2a0b;
    --danger: #ff8a80;
    --danger-soft: #3c1512;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 8px 24px -12px rgb(0 0 0 / 60%);
  }
}

:root[data-theme='dark'] {
  --bg: #0a1424;
  --surface: #111e33;
  --surface-2: #172640;
  --text: #e8eef9;
  --text-2: #b8c4dc;
  --muted: #8d9bb8;
  --line: #26385a;
  --brand: #0f2a55;
  --brand-ink: #ffffff;
  --accent: #5eb1ff;
  --accent-strong: #86c5ff;
  --accent-soft: #14294a;
  --accent-ink: #061530;
  --ok: #5fd39a;
  --ok-soft: #10301f;
  --warn: #ffc76b;
  --warn-soft: #3a2a0b;
  --danger: #ff8a80;
  --danger-soft: #3c1512;
  --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 8px 24px -12px rgb(0 0 0 / 60%);
}

/* ---------- base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  overflow-x: hidden;
}

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

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--accent-strong);
}

h1,
h2,
h3,
h4 {
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
}

h1 {
  font-size: clamp(1.9rem, 6vw, 3rem);
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.4rem, 4.5vw, 2rem);
}

h3 {
  font-size: 1.15rem;
}

p {
  margin: 0 0 1em;
}

small,
.muted {
  color: var(--muted);
}

code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: var(--surface-2);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.narrow {
  max-width: 46rem;
}

section {
  padding-block: clamp(2rem, 6vw, 4rem);
}

.section-title {
  margin-bottom: 1.25rem;
}

.lead {
  font-size: 1.125rem;
  color: var(--text-2);
}

/* ---------- header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(150%) blur(10px);
  -webkit-backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--line);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding-block: 0.6rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  margin-right: auto;
}

.wordmark svg {
  width: 28px;
  height: 28px;
  flex: none;
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
  order: 3;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.nav-links::-webkit-scrollbar {
  display: none;
}

.nav-links a {
  display: inline-block;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  color: var(--text-2);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a[aria-current='page'] {
  background: var(--accent-soft);
  color: var(--accent);
}

@media (min-width: 640px) {
  .nav-links {
    order: 0;
    width: auto;
    overflow: visible;
  }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 0.15s,
    transform 0.05s;
}

.btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--accent-ink);
}

.btn-sm {
  min-height: 36px;
  padding: 0.35rem 0.85rem;
  font-size: 0.92rem;
}

.btn-block {
  width: 100%;
}

/* ---------- hero ---------- */
.hero {
  padding-block: clamp(2.5rem, 8vw, 5rem) clamp(2rem, 6vw, 4rem);
  background:
    radial-gradient(60rem 30rem at 90% -10%, var(--accent-soft), transparent 60%),
    radial-gradient(40rem 20rem at -10% 110%, var(--accent-soft), transparent 60%);
}

.hero h1 {
  max-width: 14ch;
}

.hero .lead {
  max-width: 34rem;
  font-size: clamp(1.05rem, 2.6vw, 1.3rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

/* ---------- cards / grid ---------- */
.grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 720px) {
  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.card h3 {
  margin-top: 0.5rem;
}

.card p:last-child {
  margin-bottom: 0;
}

.icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}

.icon svg {
  width: 24px;
  height: 24px;
}

/* ---------- steps ---------- */
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
  counter-reset: step;
}

@media (min-width: 720px) {
  .steps {
    grid-template-columns: repeat(3, 1fr);
  }
}

.steps li {
  position: relative;
  padding: 1.25rem 1.25rem 1.25rem 4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 1.1rem;
  top: 1.1rem;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 800;
}

.steps h3 {
  margin: 0 0 0.25rem;
}

.steps p {
  margin: 0;
  color: var(--text-2);
}

/* ---------- callouts / notes ---------- */
.callout {
  background: var(--brand);
  color: var(--brand-ink);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 4vw, 2rem);
  display: grid;
  gap: 1rem;
}

.callout h2 {
  margin: 0;
  color: inherit;
}

.callout p {
  margin: 0;
  color: #d5e1f5;
}

.callout .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.callout .btn {
  background: #ffffff;
  border-color: #ffffff;
  color: #0b2d63;
}

.callout .btn:hover {
  background: #e4eeff;
  border-color: #e4eeff;
}

.callout .btn-ghost {
  background: transparent;
  border-color: rgb(255 255 255 / 45%);
  color: #ffffff;
}

.callout .btn-ghost:hover {
  background: rgb(255 255 255 / 12%);
  border-color: #ffffff;
}

.note {
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  background: var(--surface-2);
  margin: 1rem 0;
}

.note p:last-child,
.note ul:last-child {
  margin-bottom: 0;
}

.note-warn {
  background: var(--warn-soft);
  border-color: color-mix(in srgb, var(--warn) 40%, transparent);
}

.note-warn strong {
  color: var(--warn);
}

.note-danger {
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 40%, transparent);
}

.note-danger strong {
  color: var(--danger);
}

.note-ok {
  background: var(--ok-soft);
  border-color: color-mix(in srgb, var(--ok) 40%, transparent);
}

.status-line {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.92rem;
}

.status-line .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
  flex: none;
}

/* ---------- forms ---------- */
.form {
  display: grid;
  gap: 0.9rem;
}

@media (min-width: 640px) {
  .form-2 {
    grid-template-columns: 1fr 1fr;
  }

  .form-2 .span-2 {
    grid-column: span 2;
  }
}

.field {
  display: grid;
  gap: 0.3rem;
}

.field label {
  font-weight: 600;
  font-size: 0.95rem;
}

.field .hint {
  font-size: 0.85rem;
  color: var(--muted);
}

.input {
  width: 100%;
  min-height: 46px;
  padding: 0.6rem 0.8rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.input:focus {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  outline-offset: 0;
}

.input-unit {
  position: relative;
}

.input-unit .input {
  padding-right: 3.6rem;
}

.input-unit span {
  position: absolute;
  right: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.9rem;
  pointer-events: none;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  cursor: pointer;
}

.check input {
  width: 1.25rem;
  height: 1.25rem;
  margin: 0.15rem 0 0;
  accent-color: var(--accent);
  flex: none;
}

.form-msg {
  display: none;
}

.form-msg[data-visible='true'] {
  display: block;
}

/* ---------- calculator ---------- */
.calc {
  display: grid;
  gap: 1rem;
}

@media (min-width: 860px) {
  .calc {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .calc-results {
    position: sticky;
    top: 4.5rem;
  }
}

.stats {
  display: grid;
  gap: 0.35rem;
  margin: 0;
}

.stats div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px dashed var(--line);
}

.stats dt {
  color: var(--text-2);
}

.stats dd {
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.stats .sub dt {
  padding-left: 1rem;
  font-size: 0.95rem;
}

.total {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
}

.total-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.total-head strong {
  font-size: 2.2rem;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.total-head strong small {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-2);
}

.meter {
  position: relative;
  height: 14px;
  border-radius: 999px;
  background: var(--line);
  background: color-mix(in srgb, var(--text) 10%, transparent);
  overflow: hidden;
}

.meter > span {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  transition: width 0.25s ease;
}

.meter .m-contrib {
  background: var(--accent);
}

.meter .m-cap {
  background: var(--ok);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-2);
}

.legend span::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 0.35rem;
  vertical-align: -1px;
  background: var(--accent);
}

.legend .cap::before {
  background: var(--ok);
}

.warnings {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.warnings li {
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
  font-size: 0.92rem;
}

.warnings li[data-level='danger'] {
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
}

.formula {
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.6;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  overflow-x: auto;
  white-space: pre;
  margin: 0 0 1rem;
}

.tips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.tips li {
  padding: 0.9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.tips strong {
  display: block;
  margin-bottom: 0.15rem;
}

/* ---------- checklist ---------- */
.progress {
  position: sticky;
  top: 4.3rem;
  z-index: 5;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.progress-head strong {
  font-size: 1.4rem;
  font-variant-numeric: tabular-nums;
}

.progress .meter > span {
  background: var(--ok);
}

.progress .meter[data-level='low'] > span {
  background: var(--danger);
}

.progress .meter[data-level='mid'] > span {
  background: var(--warn);
}

.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.checklist li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.checklist li:has(input:checked) {
  border-color: color-mix(in srgb, var(--ok) 50%, transparent);
  background: var(--ok-soft);
}

.checklist label {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.75rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
}

.checklist input {
  width: 1.35rem;
  height: 1.35rem;
  margin: 0.1rem 0 0;
  accent-color: var(--ok);
  grid-row: span 2;
}

.checklist .title {
  font-weight: 600;
}

.checklist .where {
  font-size: 0.9rem;
  color: var(--text-2);
}

.checklist .badge {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--warn-soft);
  color: var(--warn);
  vertical-align: 2px;
}

.checklist-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.conditions {
  display: grid;
  gap: 0.6rem;
  padding-left: 1.2rem;
  margin: 0;
}

/* ---------- prose (guide) ---------- */
.prose h2 {
  margin-top: 2rem;
  padding-top: 0.5rem;
}

.prose h3 {
  margin-top: 1.5rem;
}

.prose ul,
.prose ol {
  padding-left: 1.3rem;
}

.prose li {
  margin-bottom: 0.35rem;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin: 1rem 0;
}

.prose th,
.prose td {
  text-align: left;
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.prose th {
  color: var(--text-2);
  font-weight: 600;
}

.table-wrap {
  overflow-x: auto;
}

.keyfacts {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, 1fr);
  margin: 1.25rem 0;
}

@media (min-width: 640px) {
  .keyfacts {
    grid-template-columns: repeat(4, 1fr);
  }
}

.keyfacts div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
}

.keyfacts strong {
  display: block;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.keyfacts span {
  font-size: 0.85rem;
  color: var(--text-2);
}

.toc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem 0.9rem 2rem;
  margin: 1rem 0 1.5rem;
  columns: 2;
  column-gap: 1.5rem;
}

.toc li {
  margin-bottom: 0.25rem;
  break-inside: avoid;
}

.sources {
  font-size: 0.9rem;
  color: var(--text-2);
}

.sources a {
  word-break: break-all;
}

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 2rem;
  color: var(--text-2);
  font-size: 0.92rem;
}

.site-footer .container {
  display: grid;
  gap: 1rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-links a {
  color: var(--text-2);
}

@media (min-width: 640px) {
  .site-footer .container {
    grid-template-columns: 1fr auto;
    align-items: center;
  }
}

/* ---------- misc ---------- */
.cta-band {
  text-align: center;
}

.cta-band p {
  max-width: 34rem;
  margin-inline: auto;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 1.5rem 0;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .meter > span,
  .btn {
    transition: none;
  }
}
