:root {
  /* Fixed brand colors (the same in both themes). */
  --navy: #0b1420;
  --ink-soft: #16283a;
  --ocean: #0e4a52;
  --ocean-light: #1c7c86;
  --gold: #c9a24b;
  --gold-soft: #e4cd8d;
  --paper: #f7f4ec;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  /* Themed semantic tokens: light. Every text token clears WCAG AA
     (4.5:1) on --bg, --bg-alt and --surface. */
  color-scheme: light;
  --bg: #f7f4ec;
  --bg-alt: #eee9db;
  --surface: #ffffff;
  --text: #0b1420;
  --text-2: #2f3a45;
  --text-3: #4f5761;
  --accent: #0e4a52;
  --link: #17666e;
  --line: rgba(11, 20, 32, 0.12);
  --border-accent: #1c7c86;
  --danger-text: #a23b2d;
  --ok-text: #1d6b2a;
  --focus: #1d5fd6;
  --ink: var(--text); /* legacy alias */
  --paper-dim: var(--bg-alt); /* legacy alias */
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #0b1118;
    --bg-alt: #111a23;
    --surface: #16212c;
    --text: #eef1f4;
    --text-2: #c9d1d9;
    --text-3: #a3adb8;
    --accent: #7cc9d1;
    --link: #7cc9d1;
    --line: rgba(255, 255, 255, 0.12);
    --border-accent: #2a9aa5;
    --danger-text: #ff8a7a;
    --ok-text: #86d993;
    --focus: #8ab4ff;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1118;
  --bg-alt: #111a23;
  --surface: #16212c;
  --text: #eef1f4;
  --text-2: #c9d1d9;
  --text-3: #a3adb8;
  --accent: #7cc9d1;
  --link: #7cc9d1;
  --line: rgba(255, 255, 255, 0.12);
  --border-accent: #2a9aa5;
  --danger-text: #ff8a7a;
  --ok-text: #86d993;
  --focus: #8ab4ff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--navy);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.wordmark {
  font-family: var(--serif);
  font-size: 20px;
  letter-spacing: 0.06em;
  color: var(--gold-soft);
  text-decoration: none;
  font-weight: 700;
}

.nav { display: flex; gap: 28px; }

.nav a {
  color: rgba(247,244,236,0.82);
  text-decoration: none;
  font-size: 14px;
  letter-spacing: 0.02em;
}

.nav a:hover { color: var(--gold-soft); }

/* Hero */

.hero {
  position: relative;
  background: linear-gradient(160deg, var(--navy) 0%, var(--ink-soft) 55%, var(--ocean) 130%);
  color: var(--paper);
  padding: 96px 0 120px;
  overflow: hidden;
}

.eyebrow {
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-soft);
  margin: 0 0 18px;
}

.hero h1 {
  font-family: var(--serif);
  font-size: 48px;
  line-height: 1.15;
  font-weight: 700;
  margin: 0 0 22px;
  max-width: 720px;
}

.lede {
  font-size: 17px;
  line-height: 1.6;
  color: rgba(247,244,236,0.86);
  max-width: 560px;
  margin: 0 0 34px;
}

.hero-cta { display: flex; gap: 16px; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 13px 26px;
  border-radius: 2px;
  font-size: 14px;
  letter-spacing: 0.03em;
  text-decoration: none;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--gold);
  color: var(--navy);
  font-weight: 600;
}
.btn-primary:hover { background: var(--gold-soft); }

.btn-ghost {
  border-color: rgba(247,244,236,0.4);
  color: var(--paper);
}
.btn-ghost:hover { border-color: var(--gold-soft); color: var(--gold-soft); }

.wave {
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 70px;
}
.wave path { fill: var(--bg); }

/* Stats */

.stats { padding: 44px 0 20px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  text-align: center;
}

.stat-value {
  display: block;
  font-family: var(--serif);
  font-size: 28px;
  color: var(--accent);
}

.stat-label {
  display: block;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-top: 6px;
}

.stats-note {
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
  margin-top: 22px;
}

/* Sections */

.section { padding: 76px 0; }
.section-alt { background: var(--bg-alt); }

.section h2 {
  font-family: var(--serif);
  font-size: 30px;
  margin: 0 0 10px;
}

.section-lede {
  color: var(--text-3);
  font-size: 15px;
  margin: 0 0 40px;
  max-width: 620px;
}

/* Fee cards */

.fee-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.fee-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--border-accent);
  padding: 28px 24px;
  border-radius: 3px;
}

.fee-cards-2 { grid-template-columns: repeat(2, 1fr); max-width: 640px; }

.fee-card-mid { border-top-color: var(--gold); }

.fee-foot {
  margin-top: 22px;
  font-size: 14px;
  color: var(--text-2);
}
.fee-foot a { color: var(--link); }

.fee-tier {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 0 0 8px;
}

.fee-rate {
  font-family: var(--serif);
  font-size: 40px;
  margin: 0 0 14px;
  color: var(--text);
}

.fee-desc {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-2);
  margin: 0;
}

/* Payouts */

.payout-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
}

.payout-copy p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-2);
}

.maturity-diagram {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 32px 28px;
}

.maturity-track {
  display: flex;
  align-items: center;
  gap: 0;
}

.maturity-point { display: flex; flex-direction: column; align-items: center; width: 90px; }
.maturity-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--ocean-light);
  border: 3px solid var(--bg-alt);
  box-shadow: 0 0 0 1px var(--ocean-light);
}
.maturity-point-end .maturity-dot { background: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.maturity-caption {
  margin-top: 10px;
  font-size: 12px;
  text-align: center;
  color: var(--text-3);
  line-height: 1.4;
}
.maturity-bar {
  flex: 1;
  height: 3px;
  background: linear-gradient(90deg, var(--ocean-light), var(--gold));
  margin: 0 -6px;
}

.maturity-fine {
  font-size: 12px;
  color: var(--text-3);
  margin: 22px 0 0;
  text-align: center;
}

/* Connect */

.code-block {
  background: var(--navy);
  color: var(--gold-soft);
  padding: 22px 24px;
  border-radius: 3px;
  font-size: 13.5px;
  line-height: 1.8;
  overflow-x: auto;
}

/* Security */

.security-note {
  max-width: 680px;
}

.security-note p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-2);
}

/* Footer */

.site-footer {
  background: var(--navy);
  color: rgba(247,244,236,0.55);
  padding: 28px 0;
  font-size: 13px;
}

@media (max-width: 760px) {
  .hero { padding: 64px 0 90px; }
  .hero h1 { font-size: 34px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 28px 24px; }
  .fee-cards, .fee-cards-2 { grid-template-columns: 1fr; }
  .payout-grid { grid-template-columns: 1fr; gap: 28px; }
  .nav { gap: 16px; }
  .section { padding: 56px 0; }
}

/* Narrow phones: stack the header so the wordmark + nav never overflow one row. */
@media (max-width: 620px) {
  .header-row { flex-direction: column; height: auto; padding: 12px 0; gap: 10px; }
  .nav { gap: 22px; }
  .hero h1 { font-size: 30px; }
}

/* ---- Dashboard ---- */
.dash { min-height: 100vh; }
.dash-live { color: #4ea86a; font-size: 12px; letter-spacing: 0.04em; }
.dash-body { padding: 40px 24px 80px; }
.dash-msg { color: var(--text-3); font-size: 15px; padding: 40px 24px; }
.dash-err { color: var(--danger-text); }

.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 44px; }
.kpi { background: var(--surface); border:1px solid var(--line); border-top:3px solid var(--border-accent); border-radius:3px; padding: 22px 20px; }
.kpi-value { display:block; font-family: var(--serif); font-size: 30px; color: var(--text); }
.kpi-label { display:block; font-size: 12px; letter-spacing:0.06em; text-transform:uppercase; color: var(--text-3); margin-top:6px; }

.dash-cols { display:grid; grid-template-columns: 1.6fr 1fr; gap: 40px; align-items:start; }
.dash-main h2, .dash-side h2 { font-family: var(--serif); font-size: 22px; margin: 0 0 18px; }
/* grid items default to min-width:auto; a wide table (longer headers in some languages) would widen the page */
.dash-main, .dash-side { min-width: 0; }
.dash-main { overflow-x: auto; }

.miners { width:100%; border-collapse: collapse; background: var(--surface); border:1px solid var(--line); border-radius:3px; overflow:hidden; }
.miners th, .miners td { text-align:start; padding: 12px 16px; border-bottom:1px solid var(--line); font-size: 14px; }
.miners th { font-size:11px; letter-spacing:0.06em; text-transform:uppercase; color: var(--text-3); background: var(--bg-alt); }
.miners tr:last-child td { border-bottom:none; }
.miners .num { text-align:end; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; }

.info-row { display:flex; justify-content:space-between; gap:16px; padding: 9px 0; border-bottom:1px solid var(--line); font-size:14px; }
.info-k { color: var(--text-3); }
.info-v { color: var(--text); text-align:end; word-break: break-all; }
.dash-note { margin-top:20px; font-size:13px; line-height:1.6; color: var(--text-3); }

@media (max-width: 760px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .dash-cols { grid-template-columns: 1fr; }
}

/* ---- Accessibility & theme chrome (shared by every page) ---- */

.skip-link {
  position: absolute;
  left: 12px;
  top: -64px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--gold);
  color: var(--navy);
  font-weight: 600;
  font-size: 14px;
  border-radius: 3px;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

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

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}
/* On the navy header and hero, the page focus color is too dark; gold clears 3:1. */
.site-header :focus-visible,
.hero :focus-visible,
.site-footer :focus-visible { outline-color: var(--gold-soft); }
main:focus { outline: none; }

.nav { align-items: center; }
.nav a.is-current { color: var(--gold-soft); text-decoration: underline; text-underline-offset: 6px; }
.nav a { padding: 6px 0; }

.theme-picker { display: inline-flex; align-items: center; gap: 8px; }
.theme-label { color: rgba(247,244,236,0.82); font-size: 13px; }
.theme-select, .lang-select {
  font: inherit;
  font-size: 13px;
  min-height: 32px;
  padding: 4px 8px;
  color: #f7f4ec;
  background: #16283a;
  border: 1px solid rgba(247,244,236,0.35);
  border-radius: 3px;
  color-scheme: dark;
}

:where(a) { color: var(--link); }
.site-footer a { color: var(--gold-soft); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 620px) {
  .nav { flex-wrap: wrap; justify-content: center; row-gap: 8px; }
}

/* ---- pool node card (homepage #node and Metrics #node, web/src/NodeCard.elm) ---- */
.node-card {
  display: grid; grid-template-columns: minmax(220px, 1fr) 2.2fr; gap: 20px 32px;
  background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--gold);
  border-radius: 4px; padding: 22px 24px; margin: 8px 0 12px; min-width: 0;
}
.node-client { font-family: var(--serif); font-size: 26px; line-height: 1.2; margin: 0; color: var(--text); }
.node-sub { margin: 6px 0 14px; font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.node-badge {
  display: inline-block; margin: 0; padding: 3px 10px; border: 1px solid currentColor; border-radius: 3px;
  font-size: 13px; font-weight: 600;
}
.node-badge.sev-good { color: var(--ok-text); }
.node-badge.sev-critical { color: var(--danger-text); }
.node-peers { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.node-peers-num { margin: 0; font-family: var(--serif); font-size: 44px; line-height: 1; color: var(--text); font-variant-numeric: tabular-nums; }
.node-peers-label { margin: 4px 0 0; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.node-peers-sub { margin: 6px 0 0; font-size: 14px; color: var(--text-2); }
.node-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px 28px; margin: 0; min-width: 0; }
.node-fact dt { margin: 0 0 3px; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.node-fact dd { margin: 0; font-size: 15px; line-height: 1.45; color: var(--text); overflow-wrap: anywhere; }
.node-foot, .node-empty { font-size: 14px; color: var(--text-2); margin: 10px 0 0; }
@media (max-width: 720px) {
  .node-card { grid-template-columns: 1fr; padding: 18px 16px; gap: 16px; }
}
@media (forced-colors: active) {
  .node-card { border-top-color: CanvasText; }
  .node-badge { border-color: CanvasText; }
}

/* DB-IP attribution (CC BY 4.0), on every page's footer */
.geo-credit { margin: 10px 0 0; font-size: 12px; color: var(--text-3); }
.geo-credit a { color: inherit; }
.dash-foot { padding: 0 24px 40px; }

/* theme.js holds the first paint while i18n.js applies a known non-English
   language (at most 1.5 s), so English never flashes first */
html.i18n-pending body { visibility: hidden; }

/* i18n.js: the prompt that offers visitors from non-Chinese-speaking
   countries their own language. It sits outside <body> (the homepage's Elm
   app owns <body>), so it sets its own font. */
.lang-prompt {
  width: min(440px, calc(100vw - 32px));
  margin: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.5;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}
.lang-prompt::backdrop { background: rgba(11, 20, 32, 0.6); }
.lang-prompt p { margin: 0 0 6px; }
.lang-prompt-ask { font-weight: 600; }
.lang-prompt-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.lang-prompt-actions button {
  flex: 1 1 auto;
  padding: 11px 18px;
  border-radius: 2px;
  font: inherit;
  font-size: 16px;
  cursor: pointer;
}
.lang-prompt-switch { background: var(--gold); border: 1px solid var(--gold); color: var(--navy); font-weight: 600; }
.lang-prompt-switch:hover { background: var(--gold-soft); border-color: var(--gold-soft); }
.lang-prompt-stay { background: transparent; border: 1px solid var(--line); color: var(--text); }
.lang-prompt-stay:hover { border-color: var(--border-accent); }
.lang-prompt button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (forced-colors: active) {
  .lang-prompt, .lang-prompt-actions button { border-color: CanvasText; }
}
