/* ============================================================
   Solid State — shared stylesheet
   No external resources. Light and dark themes via prefers-color-scheme.
   ============================================================ */

:root {
  --bg: #f5f8f6;
  --surface: #ffffff;
  --surface-2: #edf3f0;
  --text: #0f1f1b;
  --muted: #4e655e;
  --border: #d7e3de;
  --accent: #0d7a63;
  --accent-strong: #0a5d4c;
  --accent-soft: #dff1ea;
  --radius-lg: 18px;
  --radius: 12px;
  --radius-sm: 8px;
  --maxw: 1080px;
  --shadow: 0 1px 2px rgba(15, 31, 27, 0.06), 0 10px 30px -12px rgba(15, 31, 27, 0.18);
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1512;
    --surface: #111e1a;
    --surface-2: #15231e;
    --text: #e7f1ed;
    --muted: #9db4ac;
    --border: #24382f;
    --accent: #4ed6ad;
    --accent-strong: #7ce8c6;
    --accent-soft: #102b23;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 30px -12px rgba(0, 0, 0, 0.6);
  }
}

/* ---------- 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-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  margin: 0 0 0.5em;
  line-height: 1.2;
  letter-spacing: -0.015em;
  font-weight: 700;
}

h1 { font-size: clamp(2rem, 5vw, 3.05rem); }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1rem; }

ul, ol { margin: 0 0 1rem; padding-left: 1.25rem; }
li { margin-bottom: 0.45rem; }

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

strong { font-weight: 650; }
sub { font-size: 0.72em; }

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

/* ---------- layout ---------- */

.wrap {
  width: min(100% - 2.5rem, var(--maxw));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 1rem; color: var(--bg); }

.prose { max-width: 44rem; }

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

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding-block: 0.8rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand:hover { color: var(--text); }

.brand-mark {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.32);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  font-size: 0.98rem;
}
.brand-text em {
  font-style: normal;
  font-weight: 500;
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
}

.nav a {
  display: inline-block;
  padding: 0.45rem 0.72rem;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 550;
  text-decoration: none;
}
.nav a:hover {
  color: var(--text);
  background: var(--surface-2);
}
.nav a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: transparent;
}

/* ---------- hero ---------- */

.hero {
  padding-block: clamp(2.4rem, 6vw, 4.4rem) clamp(1.4rem, 3vw, 2.2rem);
}

.eyebrow {
  margin-bottom: 0.9rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.lede {
  max-width: 48rem;
  font-size: clamp(1.02rem, 1.7vw, 1.22rem);
  color: var(--muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.6rem;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-block;
  padding: 0.65rem 1.15rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: var(--bg);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
}
.btn:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--bg);
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
}
.btn-ghost:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: var(--accent);
}

/* ---------- stats ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-block: 0.5rem 1rem;
}

.stat {
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.stat b {
  display: block;
  font-size: 1.55rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.stat span {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.86rem;
  color: var(--muted);
}

/* ---------- sections ---------- */

.section { padding-block: clamp(1.8rem, 4vw, 3rem); }

.section-head {
  max-width: 44rem;
  margin-bottom: 1.6rem;
}
.section-head p { color: var(--muted); margin-bottom: 0; }

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.card {
  padding: 1.2rem 1.3rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.card h3 { margin-bottom: 0.4rem; }
.card p:last-child { margin-bottom: 0; }
.card .tag {
  margin-bottom: 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ---------- split ---------- */

.split {
  display: grid;
  gap: 2rem;
  align-items: start;
}
@media (min-width: 820px) {
  .split { grid-template-columns: 1fr 1fr; }
}

/* ---------- cell diagram ---------- */

.cell {
  display: grid;
  gap: 0.45rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.cell-layer {
  padding: 0.72rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
}

.cell-collector {
  padding-block: 0.42rem;
  border-style: dashed;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
}

.cell-anode {
  background: var(--accent-soft);
  color: var(--accent);
}

.cell-electrolyte {
  padding-block: 0.95rem;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

.cell-cathode {
  background: var(--surface-2);
  color: var(--text);
}

/* ---------- tables ---------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  min-width: 34rem;
  border-collapse: collapse;
  font-size: 0.93rem;
}

caption {
  caption-side: bottom;
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.8rem;
  color: var(--muted);
}

th, td {
  padding: 0.72rem 0.9rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

thead th {
  background: var(--surface-2);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

tbody th {
  font-weight: 650;
  white-space: nowrap;
}

tbody tr:last-child th,
tbody tr:last-child td { border-bottom: 0; }

/* ---------- callout ---------- */

.callout {
  margin-block: 1rem;
  padding: 1rem 1.2rem;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--accent-soft);
}
.callout p:last-child { margin-bottom: 0; }

/* ---------- FAQ ---------- */

.faq {
  display: grid;
  gap: 0.75rem;
  max-width: 52rem;
}

details {
  padding: 0.15rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
details[open] { border-color: var(--accent); }

summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+";
  color: var(--accent);
  font-size: 1.2rem;
  line-height: 1;
}
details[open] summary::after { content: "\2013"; }

details p { margin-top: 0; }
details > :last-child { margin-bottom: 1rem; }

/* ---------- link grid ---------- */

.link-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.link-card {
  display: block;
  padding: 1rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.link-card:hover {
  border-color: var(--accent);
  color: var(--text);
  transform: translateY(-2px);
}
.link-card strong { display: block; margin-bottom: 0.15rem; }
.link-card span { font-size: 0.86rem; color: var(--muted); }

/* ---------- footer ---------- */

.site-footer {
  margin-top: 3rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer-inner {
  display: grid;
  gap: 0.8rem;
  padding-block: 2rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.footer-inner p { margin: 0; }
.footer-inner nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.1rem;
}
.footer-inner a {
  color: var(--muted);
  text-decoration: none;
}
.footer-inner a:hover {
  color: var(--accent);
  text-decoration: underline;
}
.fine { font-size: 0.8rem; }

/* ---------- 404 ---------- */

.error-page {
  padding-block: clamp(2.5rem, 9vw, 5.5rem);
  text-align: center;
}
.error-code {
  margin: 0 0 0.5rem;
  font-size: clamp(4rem, 16vw, 8rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.045em;
  color: var(--accent);
}
.error-page .lede { margin-inline: auto; }
.error-page .hero-actions { justify-content: center; }
.error-page .link-grid { margin-top: 2.2rem; text-align: left; }

/* ---------- motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .link-card { transition: none; }
  .link-card:hover { transform: none; }
  .skip-link { transition: none; }
}
