:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --text: #1f2421;
  --muted: #5b625e;
  --border: #dcdad3;
  --accent: #2f6b5a;
  --accent-text: #ffffff;
  --on: #1f6b3f;
  --on-bg: #e2f2e7;
  --off: #8a3b2e;
  --off-bg: #f7e4df;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #161a18;
    --surface: #1f2421;
    --text: #e8ebe9;
    --muted: #a3aba6;
    --border: #353c38;
    --accent: #7cc4ad;
    --accent-text: #10201a;
    --on: #9bdcb3;
    --on-bg: #1d3528;
    --off: #f0a99b;
    --off-bg: #3d2420;
    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
  --bg: #161a18;
  --surface: #1f2421;
  --text: #e8ebe9;
  --muted: #a3aba6;
  --border: #353c38;
  --accent: #7cc4ad;
  --accent-text: #10201a;
  --on: #9bdcb3;
  --on-bg: #1d3528;
  --off: #f0a99b;
  --off-bg: #3d2420;
  color-scheme: dark;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    1rem/1.6 system-ui,
    -apple-system,
    'Segoe UI',
    sans-serif;
}

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

h1,
h2,
h3 {
  line-height: 1.25;
  text-wrap: balance;
}

h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  margin: 0 0 0.5rem;
}

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

.wrap {
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 1rem;
}

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

.skip-link {
  position: absolute;
  left: -999px;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  background: var(--surface);
  padding: 0.5rem;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
  padding-block: 0.75rem;
}

.brand {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.brand span {
  font-weight: 400;
  color: var(--muted);
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  flex: 1;
}

nav a {
  color: var(--muted);
  text-decoration: none;
}

nav a:hover,
nav a[aria-current='page'] {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.3em;
}

button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 6px;
  padding: 0.35rem 0.8rem;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

main.wrap {
  padding-block: 2.5rem;
}

.lead {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 42rem;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
  margin-block: 1.5rem;
}

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

.card h3 {
  margin-top: 0;
}

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

table {
  border-collapse: collapse;
  width: 100%;
}

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

.steps li {
  margin-bottom: 0.5rem;
}

.embeds {
  display: grid;
  gap: 1.5rem;
  margin-block: 1.5rem;
}

/* The runtime renders the player at its declared size; keep it inside the page on phones. */
.embeds iframe,
.map iframe {
  max-width: 100%;
}

.map iframe {
  width: 100%;
  height: 24rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

/* A gated frame has no src until preferences are permitted. */
.map iframe:not([src]) {
  display: none;
}

.map iframe[src] + .map-blocked {
  display: none;
}

.map-blocked {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
}

.test-panel {
  margin-block: 2rem;
  padding-block: 1rem;
  border-top: 2px solid var(--border);
}

.test-panel-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem 1rem;
}

.test-panel h2 {
  margin: 0;
  font-size: 1.1rem;
}

.test-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.test-panel-grid {
  display: grid;
  grid-template-columns: minmax(8rem, max-content) 1fr;
  gap: 0.35rem 1rem;
  margin: 0;
  font-size: 0.9rem;
}

.test-panel-grid dt {
  color: var(--muted);
}

.test-panel-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.badge {
  border-radius: 999px;
  padding: 0 0.5rem;
}

.badge.on {
  color: var(--on);
  background: var(--on-bg);
}

.badge.off {
  color: var(--off);
  background: var(--off-bg);
}

.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 1.5rem 6rem;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 40rem) {
  .header-row {
    justify-content: space-between;
  }

  nav {
    order: 3;
    flex-basis: 100%;
  }
}

@media (max-width: 30rem) {
  .test-panel-grid {
    grid-template-columns: 1fr;
  }

  .test-panel-grid dd {
    margin-bottom: 0.5rem;
  }
}
