/* ── Reset ────────────────────────────────────────────── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Base / structural (non-theme) ───────────────────── */
body {
  font-family:
    "Atkinson Hyperlegible Next",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────── */
.section-header {
  display: flex;
  justify-content: center;
  padding: 12px 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.section-header__inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 32px;
  max-width: 1200px;
  width: 100%;
}

.topbar__logo {
  height: 84px;
  width: auto;
}

.tabs {
  display: flex;
  gap: 18px;
  padding-top: 12px;
  justify-content: center;
}

.tab {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid;
  cursor: pointer;
  text-decoration: none;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
}

/* ── Theme toggle ─────────────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 12px;
  font-size: 13px;
  font-weight: 600;
}

.theme-toggle__switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  cursor: pointer;
}

.theme-toggle__switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.theme-toggle__slider {
  position: absolute;
  inset: 0;
  border-radius: 26px;
  border: 2px solid transparent;
  transition:
    background 0.2s,
    border-color 0.2s;
}

.theme-toggle__slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  left: 2px;
  top: 2px;
  transition: transform 0.2s;
}

#theme-toggle:checked + .theme-toggle__slider::before {
  transform: translateX(20px);
}

/* ── Displays ────────────────────────────────────────── */
.section-displays {
  padding: 40px;
}

.terminal-content {
  width: fit-content;
  margin: 0 auto;
}

.section-note {
  font-size: 14px;
  font-style: italic;
  margin-bottom: 24px;
}

/* ── Cards grid ──────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 280px);
  gap: 20px;
  width: fit-content;
  margin: 0 auto;
}

.card {
  border-radius: 12px;
  padding: 12px;
  text-decoration: none;
  border: 1px solid;
  transition:
    background 0.15s,
    border-color 0.15s;
}

.card h2 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
}

.card .slug {
  display: inline-block;
  font-family: "SFMono-Regular", Menlo, monospace;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 12px;
}

.card .meta {
  font-size: 12px;
  line-height: 1.5;
}

.card.card--placeholder {
  cursor: not-allowed;
  opacity: 0.5;
  pointer-events: none;
}

/* Group card: a <button> styled to match the link cards. Inherits the themed
   .card background/border/hover rules; just needs the button defaults reset. */
.card--group {
  font: inherit;
  text-align: left;
  width: 100%;
  cursor: pointer;
  appearance: none;
}

/* ── Page-picker modal ───────────────────────────────── */
.page-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.6);
}

.page-modal__dialog {
  position: relative;
  width: min(560px, 100%);
  padding: 32px 32px 36px;
  border-radius: 16px;
  border: 1px solid;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.page-modal__close {
  position: absolute;
  top: 12px;
  right: 16px;
  padding: 4px 8px;
  font: inherit;
  font-size: 28px;
  line-height: 1;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

.page-modal__title {
  margin-bottom: 24px;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
}

.page-modal__pages {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.page-modal__page {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 12px;
  border-radius: 12px;
  border: 1px solid;
  color: inherit;
  text-decoration: none;
  transition:
    background 0.15s,
    border-color 0.15s;
}

.page-modal__num {
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
}

.page-modal__name {
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.page-modal__slug {
  font-family: "SFMono-Regular", Menlo, monospace;
  font-size: 10px;
  opacity: 0.7;
}

/* ── Map section ─────────────────────────────────────── */
.section-map {
  padding: 0 40px 40px;
  text-align: center;
}

.section-map img {
  max-width: 600px;
  height: auto;
  width: 100%;
  border-radius: 12px;
}

.section-map .caption {
  font-size: 14px;
  margin-top: 20px;
}

/* ── Color bar ───────────────────────────────────────── */
.sow-image-container {
  line-height: 0;
  overflow: hidden;
  margin-top: auto;
}

.sow-image-container img {
  width: 100%;
  display: block;
}

/* ── Footer ──────────────────────────────────────────── */
.section-footer {
  font-size: 14px;
  padding: 24px 40px;
  text-align: center;
}

.section-footer a {
  text-decoration: none;
}

.section-footer a:hover {
  text-decoration: underline;
  transition: color 0.15s;
}

/* ── States ──────────────────────────────────────────── */
.loading,
.empty {
  max-width: 1200px;
  margin: 0 auto;
  padding: 64px 0;
  text-align: center;
}

/* ═══════════════════════════════════════════════════════
   Dark theme
   ═══════════════════════════════════════════════════════ */
[data-theme="dark"] body {
  background: #0c233c;
  color: #ffffff;
}

[data-theme="dark"] .section-header {
  background: #0c233c;
  border-bottom: 2px solid #1c3555;
}

[data-theme="dark"] .tab {
  background: transparent;
  border-color: #1c3555;
  color: #a0a1a3;
}

[data-theme="dark"] .tab:hover {
  background: #0f2239;
  color: #ffffff;
}

[data-theme="dark"] .tab.active {
  background: #0078ae;
  border-color: #0078ae;
  color: #ffffff;
}

[data-theme="dark"] .theme-toggle__label {
  color: #a0a1a3;
}

[data-theme="dark"] .theme-toggle__slider {
  background: #1c3555;
  border-color: #2a4a6b;
}

[data-theme="dark"] .theme-toggle__slider::before {
  background: #a0a1a3;
}

[data-theme="dark"] #theme-toggle:checked + .theme-toggle__slider {
  background: #0078ae;
  border-color: #0078ae;
}

[data-theme="dark"] #theme-toggle:checked + .theme-toggle__slider::before {
  background: #ffffff;
}

[data-theme="dark"] .section-displays {
  color: #ffd200;
}

[data-theme="dark"] .section-note {
  color: #a0a1a3;
}

[data-theme="dark"] .card {
  background: #0f2239;
  border-color: #1c3555;
  color: inherit;
}

[data-theme="dark"] .card:hover {
  background: #183556;
  border-color: #0078ae;
}

[data-theme="dark"] .card .slug {
  background: #0078ae;
  color: #ffffff;
}

[data-theme="dark"] .card .meta {
  color: #a0a1a3;
}

[data-theme="dark"] .card.card--placeholder:hover {
  background: #0f2239;
  border-color: #1c3555;
}

[data-theme="dark"] .card.card--placeholder .meta {
  color: #ffd200;
}

[data-theme="dark"] .page-modal__dialog {
  background: #0f2239;
  border-color: #1c3555;
  color: #ffffff;
}

[data-theme="dark"] .page-modal__page {
  background: #0c233c;
  border-color: #1c3555;
}

[data-theme="dark"] .page-modal__page:hover {
  background: #183556;
  border-color: #0078ae;
}

[data-theme="dark"] .page-modal__num {
  color: #ffd200;
}

[data-theme="dark"] .section-map img {
  border: 1px solid #1c3555;
  background: white;
}

[data-theme="dark"] .section-map .caption {
  color: #717073;
}

[data-theme="dark"] .section-footer {
  background: #626262;
  color: #ffffff;
}

[data-theme="dark"] .section-footer a {
  color: #ffffff;
}

[data-theme="dark"] .section-footer a:hover {
  color: #b4b5b8;
}

[data-theme="dark"] .loading,
[data-theme="dark"] .empty {
  color: #a0a1a3;
}

/* ═══════════════════════════════════════════════════════
   Light theme
   ═══════════════════════════════════════════════════════ */
[data-theme="light"] body {
  background: #ffffff;
  color: #000000;
}

[data-theme="light"] .section-header {
  background: #0078ae;
  border-bottom: 1px solid #ffffff;
}

[data-theme="light"] .tab {
  background: #ffffff;
  border-color: #1c3555;
  color: #000000;
}

[data-theme="light"] .tab:hover {
  background: #0f2239;
  color: #ffffff;
}

[data-theme="light"] .tab.active {
  background: #0f2239;
  border-color: #ffd200;
  color: #ffffff;
}

[data-theme="light"] .theme-toggle__label {
  color: rgba(255, 255, 255, 0.85);
}

[data-theme="light"] .theme-toggle__slider {
  background: rgba(0, 0, 0, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
}

[data-theme="light"] .theme-toggle__slider::before {
  background: #ffffff;
}

[data-theme="light"] #theme-toggle:checked + .theme-toggle__slider {
  background: #ffd200;
  border-color: #ffd200;
}

[data-theme="light"] #theme-toggle:checked + .theme-toggle__slider::before {
  background: #0078ae;
}

[data-theme="light"] .section-displays {
  color: #ffffff;
}

[data-theme="light"] .section-note {
  color: #000000;
}

[data-theme="light"] .card {
  background: #6db33f;
  border-color: #ffffff;
  color: inherit;
}

[data-theme="light"] .card h2 {
  color: #ffd200;
}

[data-theme="light"] .card:hover {
  background: #5a9e33;
  border-color: #1c3555;
}

[data-theme="light"] .card .slug {
  background: #0078ae;
  color: #ffffff;
}

[data-theme="light"] .card .meta {
  color: inherit;
}

[data-theme="light"] .card.card--placeholder:hover {
  background: #0f2239;
  border-color: #1c3555;
}

[data-theme="light"] .card.card--placeholder .meta {
  color: #ffd200;
}

[data-theme="light"] .page-modal__dialog {
  background: #ffffff;
  border-color: #d4d7dc;
  color: #0c233c;
}

[data-theme="light"] .page-modal__page {
  background: #f3f5f7;
  border-color: #d4d7dc;
}

[data-theme="light"] .page-modal__page:hover {
  background: #e7ebef;
  border-color: #0078ae;
}

[data-theme="light"] .page-modal__num {
  color: #0078ae;
}

[data-theme="light"] .section-map {
  background: #ffffff;
}

[data-theme="light"] .section-map img {
  border: none;
  background: transparent;
}

[data-theme="light"] .section-map .caption {
  color: #717073;
}

[data-theme="light"] .section-footer {
  background: #626262;
  color: #ffffff;
}

[data-theme="light"] .section-footer a {
  color: #ffffff;
}

[data-theme="light"] .section-footer a:hover {
  color: #b4b5b8;
}

[data-theme="light"] .loading,
[data-theme="light"] .empty {
  color: #ffffff;
}
