/* ==========================================================================
   CAIRN v2 — Columbia Valley mesh radio community
   Warm dark default ("ember dusk") + warm light option ("parchment").
   Zero third-party: system font stacks only.

   Layout:
     1. Tokens & base
     2. Site chrome (nav, footer)
     3. Shared components (buttons, sections, cards, callouts, tables)
     4. Home page (hero scene, status strip, paths, settings, corridor)
     5. Guide pages (steps, FAQ, glossary)
     6. Tools (planner)
     7. Responsive
   ========================================================================== */

/* ── 1. TOKENS & BASE ───────────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

:root,
[data-theme="dark"] {
  color-scheme: dark;

  --bg: #14100d;
  --bg-alt: #1a1511;
  --surface: #211b16;
  --surface-2: #2a231d;
  --border: rgba(255, 228, 196, 0.09);
  --border-strong: rgba(255, 228, 196, 0.18);

  --ink: #f4ece1;
  --ink-2: #d8cab8;
  --muted: #a69582;

  --accent: #eea24b;
  --accent-bright: #ffbb68;
  --accent-soft: rgba(238, 162, 75, 0.13);
  --accent-line: rgba(238, 162, 75, 0.38);
  --amber: #e9774a;
  --amber-soft: rgba(233, 119, 74, 0.15);
  --blue: #86b9d6;
  --blue-soft: rgba(134, 185, 214, 0.14);
  --purple: #c0a6e3;
  --purple-soft: rgba(192, 166, 227, 0.14);
  --green: #93c99a;
  --green-soft: rgba(147, 201, 154, 0.14);
  --red: #ef8070;
  --red-soft: rgba(239, 128, 112, 0.15);

  --btn-primary-ink: #1d1206;
  --code-bg: #0e0b09;
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 18px 44px rgba(0, 0, 0, 0.45);
  --radius: 14px;
  --radius-sm: 9px;

  /* Hero scene */
  --sky-top: #0f0c0b;
  --sky-mid: #2a1912;
  --sky-low: #5a2f17;
  --sun-glow: rgba(255, 150, 70, 0.42);
  --star: #f6e7cf;
  --ridge-far: #3a2a22;
  --ridge-mid: #261c17;
  --ridge-near: #1b1512;
  --ridge-fore: #120e0c;
  --snow: rgba(244, 228, 210, 0.55);
  --river: rgba(238, 162, 75, 0.22);
  --link: rgba(238, 162, 75, 0.42);
  --node: #eea24b;
  --node-halo: rgba(238, 162, 75, 0.22);
  --packet: #ffe0ad;
  --home: #93c99a;

  --font-display: ui-serif, 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  --font-body: ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, 'SFMono-Regular', Menlo, Monaco, Consolas, monospace;
  --max-w: 1160px;
  --prose-w: 72ch;
}

[data-theme="light"] {
  color-scheme: light;

  --bg: #f7f1e7;
  --bg-alt: #efe6d7;
  --surface: #fffaf2;
  --surface-2: #f4ebdd;
  --border: rgba(60, 40, 20, 0.11);
  --border-strong: rgba(60, 40, 20, 0.2);

  --ink: #241a11;
  --ink-2: #4b3b2d;
  --muted: #7a6956;

  --accent: #b0601a;
  --accent-bright: #934e12;
  --accent-soft: rgba(176, 96, 26, 0.11);
  --accent-line: rgba(176, 96, 26, 0.35);
  --amber: #b9461c;
  --amber-soft: rgba(185, 70, 28, 0.1);
  --blue: #2f6f93;
  --blue-soft: rgba(47, 111, 147, 0.1);
  --purple: #6e4bb0;
  --purple-soft: rgba(110, 75, 176, 0.1);
  --green: #3f7d4a;
  --green-soft: rgba(63, 125, 74, 0.11);
  --red: #b83a2b;
  --red-soft: rgba(184, 58, 43, 0.1);

  --btn-primary-ink: #fffaf2;
  --code-bg: #2a2018;
  --shadow-sm: 0 2px 8px rgba(60, 40, 20, 0.06);
  --shadow-md: 0 12px 32px rgba(60, 40, 20, 0.1);

  --sky-top: #b9cbd3;
  --sky-mid: #e9d4b8;
  --sky-low: #f4c48c;
  --sun-glow: rgba(255, 190, 110, 0.55);
  --star: transparent;
  --ridge-far: #9fa3a2;
  --ridge-mid: #7b746b;
  --ridge-near: #5d5146;
  --ridge-fore: #3e3229;
  --snow: rgba(255, 255, 255, 0.85);
  --river: rgba(255, 236, 205, 0.35);
  --link: rgba(150, 70, 10, 0.55);
  --node: #b0601a;
  --node-halo: rgba(176, 96, 26, 0.22);
  --packet: #fff4dc;
  --home: #d7f0c9;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.62;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.01em;
  color: var(--ink);
}

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

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

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

code,
kbd,
.mono {
  font-family: var(--font-mono);
}

code {
  font-size: 0.9em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  background: var(--accent);
  color: var(--btn-primary-ink);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

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

.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

.container-wide {
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── 2. SITE CHROME ─────────────────────────────────────────────────────── */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.04em;
  margin-right: auto;
}

.brand:hover {
  color: var(--ink);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-line);
}

.brand-sub {
  display: block;
  white-space: nowrap;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 18px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}

.nav-links a,
.nav-group-btn {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--ink-2);
  text-decoration: none;
  font: inherit;
  font-size: 0.93rem;
  font-weight: 600;
  background: none;
  border: 0;
  cursor: pointer;
}

.nav-links a:hover,
.nav-group-btn:hover {
  color: var(--ink);
  background: var(--surface);
}

.nav-links a[aria-current="page"],
.nav-group.has-current > .nav-group-btn {
  color: var(--accent);
}

.nav-group {
  position: relative;
}

.nav-group-btn::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-3px) rotate(45deg);
}

.nav-sub {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 230px;
  list-style: none;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}

.nav-sub a {
  padding: 9px 12px;
}

.nav-sub a:hover {
  background: var(--surface-2);
}

.nav-group:hover > .nav-sub,
.nav-group:focus-within > .nav-sub,
.nav-group-btn[aria-expanded="true"] + .nav-sub {
  display: block;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--ink-2);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--accent-line);
}

.theme-icon {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}

.nav-toggle {
  display: none;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--ink);
  border-radius: 8px;
  padding: 7px 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.site-footer {
  margin-top: 40px;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: 32px;
  padding-top: 44px;
  padding-bottom: 32px;
}

.footer-brand p {
  margin-top: 10px;
  max-width: 34ch;
}

.footer-col h2 {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.footer-col ul {
  list-style: none;
  display: grid;
  gap: 8px;
}

.footer-col a {
  color: var(--ink-2);
  text-decoration: none;
}

.footer-col a:hover {
  color: var(--accent);
}

.footer-base {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 24px;
  padding-top: 18px;
  padding-bottom: 28px;
  border-top: 1px solid var(--border);
  font-size: 0.84rem;
}

.footer-base strong {
  color: var(--ink);
}

/* ── 3. SHARED COMPONENTS ───────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
}

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

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

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

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  color: var(--ink);
  border-color: var(--accent);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.88rem;
}

.btn-mini {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.text-link {
  font-weight: 700;
  text-decoration: none;
}

.text-link::after {
  content: ' →';
}

.inline-link {
  font-weight: 600;
}

.section {
  padding: 72px 0;
}

.section-tight {
  padding: 48px 0;
}

.section-alt {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-header {
  max-width: 720px;
  margin-bottom: 32px;
}

.section-header h2 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  margin-bottom: 10px;
}

.section-header p {
  color: var(--ink-2);
  font-size: 1.04rem;
}

.section-kicker,
.eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

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

.two-col,
.three-col,
.four-col {
  display: grid;
  gap: 20px;
}

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

.three-col {
  grid-template-columns: repeat(3, 1fr);
}

.four-col {
  grid-template-columns: repeat(4, 1fr);
}

.callout {
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  color: var(--ink-2);
}

.callout strong {
  color: var(--ink);
}

.callout-warn {
  border-left-color: var(--amber);
  background: var(--amber-soft);
}

.callout-info {
  border-left-color: var(--blue);
  background: var(--blue-soft);
}

.callout > * + * {
  margin-top: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border: 1px solid var(--border-strong);
  color: var(--ink-2);
}

.badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

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

.badge-wanted {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

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

.badge-planned::before {
  background: transparent;
  border: 1.5px solid currentColor;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.data-table th,
.data-table td {
  text-align: left;
  vertical-align: top;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.data-table thead th {
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.data-table tbody th {
  color: var(--ink);
  font-weight: 700;
  width: 34%;
}

.data-table td {
  color: var(--ink-2);
}

.data-table .value {
  font-family: var(--font-mono);
  color: var(--ink);
  font-weight: 600;
}

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

.data-table-wide {
  min-width: 640px;
}

.data-table-wide tbody th {
  width: 16%;
}

.table-wrap .data-table tr:last-child > * {
  border-bottom: 0;
}

/* Inner page header */
.page-hero {
  padding: 60px 0 36px;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(ellipse 60% 120% at 85% 0%, var(--accent-soft), transparent 70%),
    var(--bg);
}

.page-hero h1 {
  font-size: clamp(2rem, 4.4vw, 2.8rem);
  margin-bottom: 12px;
  max-width: 22ch;
}

.page-hero p {
  color: var(--ink-2);
  font-size: 1.1rem;
  max-width: 62ch;
}

.page-meta {
  margin-top: 16px;
  font-size: 0.84rem;
  color: var(--muted);
}

.summary-box {
  background: var(--surface);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 40px;
}

.summary-box h2 {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

.summary-box ul {
  padding-left: 20px;
  display: grid;
  gap: 6px;
  color: var(--ink-2);
}

.summary-box li strong {
  color: var(--ink);
}

/* Long-form text */
.prose {
  max-width: var(--prose-w);
}

.prose > * + * {
  margin-top: 16px;
}

.prose h2 {
  font-size: 1.7rem;
  margin-top: 52px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.prose h3 {
  font-size: 1.22rem;
  margin-top: 32px;
}

.prose p,
.prose li {
  color: var(--ink-2);
}

.prose strong {
  color: var(--ink);
}

.prose ul,
.prose ol {
  padding-left: 22px;
  display: grid;
  gap: 6px;
}

.prose .table-wrap,
.prose .callout {
  margin-top: 20px;
}

.prose > h2:first-child {
  margin-top: 0;
}

.page-with-toc {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

.toc {
  position: sticky;
  top: 92px;
  font-size: 0.9rem;
}

.toc h2 {
  font-family: var(--font-body);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.toc ol {
  list-style: none;
  display: grid;
  gap: 4px;
  border-left: 1px solid var(--border-strong);
}

.toc a {
  display: block;
  padding: 3px 0 3px 14px;
  color: var(--ink-2);
  text-decoration: none;
}

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

.feedback-line {
  margin-top: 48px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--muted);
}

/* ── 4. HOME PAGE ───────────────────────────────────────────────────────── */

.hero {
  position: relative;
  overflow: hidden;
  min-height: clamp(560px, 78vh, 760px);
  display: flex;
  align-items: flex-start;
  isolation: isolate;
}

.hero-scene {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
}

.hero-copy {
  padding-top: clamp(56px, 9vh, 104px);
  padding-bottom: 260px;
}

.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4rem);
  max-width: 15ch;
  margin-bottom: 18px;
  text-shadow: 0 2px 24px color-mix(in srgb, var(--bg) 60%, transparent);
}

.hero-lead {
  font-size: clamp(1.05rem, 1.8vw, 1.22rem);
  color: var(--ink-2);
  max-width: 52ch;
  margin-bottom: 28px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Scene paint (SVG, theme-aware) */
.sky-top { stop-color: var(--sky-top); }
.sky-mid { stop-color: var(--sky-mid); }
.sky-low { stop-color: var(--sky-low); }
.sun-in { stop-color: var(--sun-glow); }
.sun-out { stop-color: transparent; stop-opacity: 0; }
.stars circle { fill: var(--star); }
.ridge-far { fill: var(--ridge-far); }
.ridge-mid { fill: var(--ridge-mid); }
.ridge-near { fill: var(--ridge-near); }
.ridge-fore { fill: var(--ridge-fore); }
.snow { fill: var(--snow); }
.river { fill: none; stroke: var(--river); stroke-width: 3; stroke-linecap: round; }
.mesh-link { fill: none; stroke: var(--link); stroke-width: 1.4; stroke-dasharray: 3 6; }
.relay-halo { fill: var(--node-halo); }
.relay-dot { fill: var(--node); }
.relay-mast { stroke: var(--node); stroke-width: 1.5; }
.home-light { fill: var(--home); }
.home-body { fill: var(--ridge-fore); stroke: var(--home); stroke-width: 1; stroke-opacity: 0.6; }
.packet { fill: var(--packet); }
.packet-direct { fill: var(--home); }
.mesh-link.direct { stroke: var(--home); stroke-opacity: 0.55; stroke-dasharray: 2 5; }
.pulse { fill: none; stroke: var(--packet); stroke-width: 1.5; }

.relay-halo {
  transform-box: fill-box;
  transform-origin: center;
  animation: halo 3.6s ease-in-out infinite;
}

.relay:nth-of-type(2n) .relay-halo { animation-delay: -1.2s; }
.relay:nth-of-type(3n) .relay-halo { animation-delay: -2.4s; }

@keyframes halo {
  0%, 100% { opacity: 0.45; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}

@media (prefers-reduced-motion: reduce) {
  .relay-halo { animation: none; }
  .btn:hover { transform: none; }
  html { scroll-behavior: auto; }
}

.hero-legend {
  position: absolute;
  right: 24px;
  bottom: 84px;
  display: flex;
  gap: 16px;
  list-style: none;
  font-size: 0.8rem;
  color: var(--ink-2);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
}

.hero-legend li {
  display: flex;
  align-items: center;
  gap: 7px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-dot.via-relay { background: var(--packet); box-shadow: 0 0 6px var(--node); }
.legend-dot.direct { background: var(--home); }

/* Status strip */
.status-strip {
  padding-top: 72px;
}

.status-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 22px 24px;
}

.status-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px 16px;
  margin-bottom: 18px;
}

.status-head h2 {
  font-size: 1.2rem;
}

.status-head p {
  font-size: 0.84rem;
  color: var(--muted);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.stat {
  background: var(--surface);
  padding: 14px 16px;
}

.stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--ink);
}

.stat-value.small {
  font-size: 1.3rem;
  padding-top: 6px;
}

.stat-label {
  display: block;
  margin-top: 4px;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink-2);
}

.stat-note {
  display: block;
  margin-top: 2px;
  font-size: 0.8rem;
  color: var(--muted);
}

/* Audience paths */
.path-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.path-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
}

.path-card.featured {
  border-color: var(--accent-line);
  background:
    linear-gradient(160deg, var(--accent-soft), transparent 60%),
    var(--surface);
}

.path-num {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--accent);
  margin-bottom: 14px;
}

.path-card h3 {
  font-size: 1.35rem;
  margin-bottom: 10px;
}

.path-card p {
  color: var(--ink-2);
  margin-bottom: 20px;
  flex: 1;
}

/* Is / isn't */
.fit-list {
  list-style: none;
  display: grid;
  gap: 12px;
}

.fit-list li {
  position: relative;
  padding-left: 28px;
  color: var(--ink-2);
}

.fit-list li::before {
  position: absolute;
  left: 0;
  top: 0;
  font-weight: 700;
}

.fit-yes li::before {
  content: '✓';
  color: var(--green);
}

.fit-no li::before {
  content: '✕';
  color: var(--amber);
}

.fit-list strong {
  color: var(--ink);
}

.card h3 {
  font-size: 1.2rem;
  margin-bottom: 14px;
}

/* Settings block */
.settings-layout {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 40px;
  align-items: start;
}

.settings-layout .section-header {
  margin-bottom: 20px;
}

.settings-layout .callout {
  margin-bottom: 20px;
}

/* Corridor */
.corridor {
  list-style: none;
  position: relative;
  display: grid;
  gap: 0;
}

.corridor::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 14px;
  bottom: 14px;
  width: 2px;
  background: linear-gradient(var(--border-strong), var(--accent-line), var(--green));
}

.corridor li {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 16px;
  align-items: center;
  padding: 14px 0 14px 40px;
  border-bottom: 1px solid var(--border);
}

.corridor li:last-child {
  border-bottom: 0;
}

.corridor li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border-strong);
}

.corridor li.is-live::before {
  border-color: var(--green);
  background: var(--green);
}

.corridor li.is-wanted::before {
  border-color: var(--accent);
}

.corridor-place {
  font-weight: 700;
  color: var(--ink);
}

.corridor-note {
  grid-column: 1;
  font-size: 0.88rem;
  color: var(--muted);
}

.corridor .badge {
  grid-column: 2;
  grid-row: 1 / span 2;
}

/* Contact band */
.contact-band {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 32px;
  align-items: center;
  padding: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--accent-line);
  background:
    radial-gradient(ellipse 70% 140% at 100% 100%, var(--accent-soft), transparent 70%),
    var(--surface);
}

.contact-band h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin-bottom: 10px;
}

.contact-band p {
  color: var(--ink-2);
}

.contact-email {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 600;
  word-break: break-all;
  margin-bottom: 14px;
}

/* Featured device (hardware page) */
.device-feature {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 32px;
  align-items: start;
  border-color: var(--accent-line);
}

.device-feature h2 {
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  margin-bottom: 12px;
}

.device-feature > div > * + * {
  margin-top: 14px;
}

.device-feature p {
  color: var(--ink-2);
}

/* ── 5. GUIDE PAGES ─────────────────────────────────────────────────────── */

.steps {
  list-style: none;
  display: grid;
  gap: 18px;
  counter-reset: step;
}

.step {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 24px 22px 76px;
  counter-increment: step;
}

.step::before {
  content: counter(step);
  position: absolute;
  left: 22px;
  top: 22px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 700;
}

.step h2 {
  font-size: 1.3rem;
  margin-bottom: 8px;
  border: 0;
  padding: 0;
}

.step p,
.step li {
  color: var(--ink-2);
}

.step > * + * {
  margin-top: 10px;
}

.step ul,
.step ol {
  padding-left: 20px;
  display: grid;
  gap: 4px;
}

.trouble {
  margin-top: 14px;
  border-top: 1px dashed var(--border-strong);
  padding-top: 12px;
}

.trouble summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--accent);
  font-size: 0.92rem;
}

.trouble[open] summary {
  margin-bottom: 8px;
}

.faq-list {
  display: grid;
  gap: 10px;
}

.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.faq-item summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 48px 16px 20px;
  position: relative;
  font-weight: 700;
  color: var(--ink);
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: '+';
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.3rem;
  color: var(--accent);
}

.faq-item[open] summary::after {
  content: '−';
}

.faq-body {
  padding: 0 20px 18px;
  color: var(--ink-2);
}

.faq-body > * + * {
  margin-top: 10px;
}

.faq-body ul {
  padding-left: 20px;
}

.glossary {
  display: grid;
  grid-template-columns: minmax(130px, 200px) 1fr;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.glossary dt,
.glossary dd {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.glossary dt {
  font-weight: 700;
  color: var(--ink);
}

.glossary dd {
  color: var(--ink-2);
}

.glossary dt:last-of-type,
.glossary dd:last-of-type {
  border-bottom: 0;
}

.host-asks {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  list-style: none;
  padding: 0 !important;
}

.host-asks li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
}

.host-asks strong {
  display: block;
  margin-bottom: 4px;
}

/* ── 6. TOOLS ───────────────────────────────────────────────────────────── */

/* ── PLANNER (designer.html) ────────────────────────────────────────────── */
.planner-section {
  padding: 20px 0 64px;
}

.planner-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.planner-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.planner-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font: 600 0.88rem var(--font-body);
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.planner-btn:hover {
  border-color: var(--accent-line);
}

.planner-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--btn-primary-ink);
}

.planner-btn-quiet {
  background: transparent;
  color: var(--ink-2);
}

.sym {
  display: inline-block;
  width: 10px;
  height: 10px;
}

.sym-repeater {
  background: var(--accent);
  transform: rotate(45deg) scale(0.85);
}

.sym-room {
  background: var(--purple);
}

.sym-companion {
  background: var(--blue);
  border-radius: 50%;
}

.planner-btn[aria-pressed="true"] .sym {
  outline: 1.5px solid var(--btn-primary-ink);
}

.planner-map {
  position: relative;
  height: clamp(440px, 74vh, 940px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-alt);
  touch-action: none;
}

.planner-map.is-expanded {
  position: fixed;
  inset: 0;
  z-index: 1000;
  height: 100dvh;
  border-radius: 0;
  border: 0;
}

body.planner-expanded {
  overflow: hidden;
}

#planner-canvas {
  display: block;
  cursor: grab;
}

#planner-canvas:active {
  cursor: grabbing;
}

#planner-canvas[data-tool="repeater"],
#planner-canvas[data-tool="room_server"],
#planner-canvas[data-tool="companion"],
#planner-canvas[data-tool="delete"] {
  cursor: crosshair;
}

.planner-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  color: var(--ink-2);
}

.planner-status[hidden] {
  display: none;
}

.planner-zoom {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  gap: 6px;
}

.planner-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.planner-icon[aria-pressed="true"] {
  background: var(--accent);
  color: var(--btn-primary-ink);
}

.planner-legend,
.planner-readout {
  position: absolute;
  left: 10px;
  margin: 0;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--ink-2);
}

.planner-legend {
  top: 10px;
  display: flex;
  gap: 12px;
}

.planner-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.leg-line {
  display: inline-block;
  width: 20px;
  border-top: 3px solid var(--green);
}

.leg-marginal {
  border-top: 3px dashed var(--accent);
}

.leg-route {
  border-top-color: var(--blue);
}

.planner-readout {
  bottom: 10px;
  right: 10px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.planner-hint {
  margin: 8px 2px 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.planner-panels {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.planner-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.planner-card h3 {
  font-size: 1.2rem;
}

.planner-card h4 {
  margin: 16px 0 6px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.planner-sub,
.planner-empty {
  margin-top: 4px;
  font-size: 0.86rem;
  color: var(--ink-2);
}

.planner-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
}

.planner-fields label {
  display: grid;
  gap: 4px;
  flex: 1 1 150px;
  font-size: 0.8rem;
  color: var(--muted);
}

.planner-fields select,
.planner-fields input {
  font: 0.9rem var(--font-body);
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  padding: 7px 8px;
  min-width: 0;
}

.planner-fields [aria-invalid="true"] {
  border-color: var(--red);
}

.planner-hears {
  list-style: none;
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
}

.planner-hears button {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 7px 9px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--ink);
  font: 0.88rem var(--font-body);
  cursor: pointer;
}

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

.q-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.q-good { background: var(--green); }
.q-marginal { background: var(--accent); }
.q-none { background: var(--muted); opacity: 0.6; }

.q-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--btn-primary-ink);
}

.planner-profile {
  margin: 12px 0;
}

.planner-profile svg {
  width: 100%;
  height: auto;
  display: block;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
}

.planner-profile figcaption {
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--muted);
}

.pf-ground { fill: color-mix(in srgb, var(--green) 30%, var(--surface-2)); stroke: var(--green); stroke-width: 1; }
.pf-los { stroke: var(--ink); stroke-width: 1.5; }
.pf-fresnel { fill: none; stroke: var(--accent); stroke-width: 1.2; stroke-dasharray: 5 4; }
.pf-edge { stroke: var(--red); stroke-width: 1; stroke-dasharray: 2 3; }
.pf-grid { stroke: var(--border); }
.pf-tick { fill: var(--muted); font: 11px var(--font-mono); }

.planner-dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 14px;
  font-size: 0.88rem;
}

.planner-dl dt {
  color: var(--muted);
}

.planner-route {
  margin-top: 10px;
  font-size: 0.9rem;
}

.planner-how {
  margin-top: 8px;
}

@media (max-width: 900px) {
  .planner-panels {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .planner-map {
    height: 68vh;
  }

  .planner-legend {
    display: none;
  }

  .planner-readout {
    left: 6px;
    right: 6px;
    bottom: 6px;
    font-size: 0.7rem;
  }

  .planner-dl {
    grid-template-columns: 1fr;
  }
}

.resource-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.res-link {
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 6px 10px;
  border-radius: 7px;
}

.res-link:hover {
  text-decoration: underline;
}


/* Resources page */
.resource-feature h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin: 6px 0 10px;
}

.resource-feature h2 a {
  color: inherit;
  text-decoration: none;
}

.resource-feature h2 a:hover {
  text-decoration: underline;
}

.resource-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 8px;
}

.resource-cols h3 {
  font-size: 1rem;
  margin-bottom: 8px;
}

.resource-cols ul {
  list-style: none;
  display: grid;
  gap: 6px;
}

.map-shot {
  margin: 0;
  max-width: 560px;
}

.map-shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.map-shot figcaption {
  margin-top: 10px;
  font-size: 0.9rem;
  color: var(--ink-2);
}

@media (max-width: 720px) {
  .resource-cols {
    grid-template-columns: 1fr;
  }
}

/* ── 7. RESPONSIVE ──────────────────────────────────────────────────────── */

@media (max-width: 1080px) {
  .settings-layout {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 900px) {
  .nav-toggle {
    display: inline-block;
  }

  .nav-inner {
    flex-wrap: wrap;
  }

  /* With JS the menu collapses behind the toggle; without JS it stays open. */
  .nav-menu {
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 4px 0 16px;
  }

  .js .nav-menu {
    display: none;
  }

  .js .nav-menu.is-open {
    display: flex;
  }

  .nav-links {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-group-btn {
    display: none;
  }

  .nav-sub {
    display: block;
    position: static;
    min-width: 0;
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
  }

  .nav-actions {
    justify-content: space-between;
  }

  .page-with-toc {
    /* minmax(0, …) so wide content (tables) scrolls inside .table-wrap
       instead of widening the page. */
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .toc {
    position: static;
  }

  .path-grid,
  .three-col,
  .contact-band,
  .device-feature {
    grid-template-columns: 1fr;
  }

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

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .container,
  .container-wide {
    padding: 0 16px;
  }

  .section {
    padding: 52px 0;
  }

  /* Phones: on a tall, narrow hero the slice-scaled scene zooms into its
     middle and the mesh runs through the text. Stack instead: copy on the
     sky colour, then the whole valley as a short band underneath. */
  .hero {
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
    background: var(--sky-top);
  }

  .hero-copy {
    padding-top: 40px;
    padding-bottom: 8px;
  }

  .hero-scene {
    position: relative;
    inset: auto;
    order: 2;
    height: clamp(220px, 62vw, 300px);
  }

  .hero-legend {
    order: 3;
    position: static;
    align-self: flex-start;
    margin: 0 16px 24px;
    gap: 12px;
  }

  .two-col,
  .four-col,
  .field-checks,
  .form-grid,
  .host-asks {
    grid-template-columns: 1fr;
  }

  .step {
    padding: 70px 18px 20px;
  }

  .brand-sub {
    display: none;
  }

  .step::before {
    left: 18px;
    top: 20px;
  }

  .glossary {
    grid-template-columns: 1fr;
  }

  .glossary dt {
    border-bottom: 0;
    padding-bottom: 0;
  }

  .data-table tbody th {
    width: auto;
  }

  .contact-band {
    padding: 24px;
  }

  .map-stage {
    height: 460px;
  }
}
