/* Sound Maps — an echolocation course.
   Blind-first, low-vision-friendly styling.
   Big type, high contrast, obvious focus, no motion. */

:root {
  --bg: #faf8f3;
  --bg-raised: #ffffff;
  --ink: #1c1a17;
  --ink-soft: #4a463f;
  --line: #d8d3c8;
  --accent: #7a3e0d;        /* warm brown-orange, 7:1 on bg */
  --link: #0b4f8a;          /* 7.2:1 on bg */
  --link-visited: #5a3d8a;
  --focus: #0b4f8a;
  --done: #1d6b34;
  --btn-bg: #1c1a17;
  --btn-ink: #faf8f3;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181c;
    --bg-raised: #1f2228;
    --ink: #ece9e2;
    --ink-soft: #b8b3a8;
    --line: #3a3e46;
    --accent: #e8a266;
    --link: #8fc1f0;
    --link-visited: #c3aef0;
    --focus: #8fc1f0;
    --done: #7fd39a;
    --btn-bg: #ece9e2;
    --btn-ink: #16181c;
  }
}

* { box-sizing: border-box; }

html {
  font-size: 125%; /* 20px base — comfortable for low vision */
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Atkinson Hyperlegible", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
}

/* ---------- Focus: thick, unmistakable ---------- */
:focus {
  outline: 4px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}
:focus:not(:focus-visible) { outline-width: 3px; }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--btn-bg);
  color: var(--btn-ink);
  padding: 0.75rem 1.25rem;
  font-weight: 700;
  text-decoration: none;
  z-index: 10;
}
.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

/* ---------- Layout ---------- */
.page {
  max-width: 46rem; /* ~72ch at body size */
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

header.site {
  border-bottom: 3px solid var(--ink);
  padding: 1.5rem 0 1rem;
  margin-bottom: 1.5rem;
}
.site-name {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 0.25rem;
}
.site-name a { color: var(--ink); text-decoration: none; }
.site-name a:hover, .site-name a:focus { text-decoration: underline; }
.site-tag { margin: 0; color: var(--ink-soft); font-size: 0.95rem; }

h1 { font-size: 2rem; line-height: 1.25; margin: 0.5rem 0 1rem; }
h2 { font-size: 1.45rem; line-height: 1.3; margin: 2.5rem 0 0.75rem;
     border-bottom: 2px solid var(--line); padding-bottom: 0.3rem; }
h3 { font-size: 1.15rem; margin: 1.75rem 0 0.5rem; }

p, li { max-width: 70ch; }
ul, ol { padding-left: 1.5rem; }
li { margin: 0.4rem 0; }

a { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
a:visited { color: var(--link-visited); }
a:hover { text-decoration-thickness: 3px; }

/* ---------- Course navigation ---------- */
nav.course {
  background: var(--bg-raised);
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0 2rem;
}
nav.course h2 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  border: none;
  padding: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
nav.course ol { margin: 0; }
nav.course a[aria-current="page"] {
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}
.done-flag { color: var(--done); font-weight: 700; }

/* ---------- Meta line under lesson titles ---------- */
.lesson-meta { color: var(--ink-soft); margin-top: -0.5rem; }

/* ---------- Audio player ---------- */
.player {
  background: var(--bg-raised);
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 1.25rem;
  margin: 1.5rem 0;
}
.player .now-playing { margin: 0 0 1rem; font-weight: 700; }
.player-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}
.player button, .btn {
  font: inherit;
  font-weight: 700;
  background: var(--btn-bg);
  color: var(--btn-ink);
  border: 2px solid var(--btn-bg);
  border-radius: 8px;
  padding: 0.7rem 1.2rem;
  min-height: 48px;
  cursor: pointer;
}
.player button.secondary {
  background: var(--bg-raised);
  color: var(--ink);
  border-color: var(--ink);
}
.player button:hover { opacity: 0.85; }
.player label { font-weight: 700; }
.player select {
  font: inherit;
  padding: 0.5rem;
  min-height: 48px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--bg-raised);
  color: var(--ink);
}
.seek-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.seek-row input[type="range"] {
  flex: 1 1 12rem;
  min-height: 48px;
  accent-color: var(--accent);
}
.time-display { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Mark complete ---------- */
.complete-row { margin: 1.5rem 0; }
button.mark-complete {
  font: inherit;
  font-weight: 700;
  min-height: 48px;
  padding: 0.7rem 1.2rem;
  border-radius: 8px;
  border: 3px solid var(--done);
  background: var(--bg-raised);
  color: var(--ink);
  cursor: pointer;
}
button.mark-complete[aria-pressed="true"] {
  background: var(--done);
  color: #fff;
}
@media (prefers-color-scheme: dark) {
  button.mark-complete[aria-pressed="true"] { color: #10251a; }
}

/* ---------- Transcript ---------- */
.transcript p { margin: 0.9rem 0; }
.transcript .cue {
  font-style: italic;
  color: var(--ink-soft);
}

/* ---------- Prev / next ---------- */
nav.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  border-top: 3px solid var(--ink);
  margin-top: 3rem;
  padding-top: 1.25rem;
}
nav.pager a {
  font-weight: 700;
}

/* ---------- Footer ---------- */
footer.site {
  border-top: 2px solid var(--line);
  margin-top: 3rem;
  padding-top: 1rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

/* ---------- Lock gate ---------- */
/* Applied by the inline head script so a locked lesson never flashes. */
html.is-locked #lesson-body { display: none !important; }
html.is-locked #lesson-gate { display: block !important; }

.gate {
  background: var(--bg-raised);
  border: 3px solid var(--accent);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
}
.gate h2 { margin-top: 0; border: none; padding: 0; }
.gate-progress { font-weight: 700; }
a.gate-link {
  display: inline-block;
  font-weight: 700;
  background: var(--btn-bg);
  color: var(--btn-ink);
  text-decoration: none;
  border-radius: 8px;
  padding: 0.7rem 1.2rem;
  min-height: 48px;
}
a.gate-link:hover, a.gate-link:focus { text-decoration: underline; }

/* Locked items in the course nav, rendered as plain text by the script. */
.locked-item {
  color: var(--ink-soft);
}
.lock-note { font-style: italic; }

/* ---------- Unlock status on the introduction ---------- */
.unlock-status {
  background: var(--bg-raised);
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}
.unlock-status h2 { margin-top: 0; border: none; padding: 0; font-size: 1.15rem; }
#unlock-progress { font-weight: 700; }

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

[aria-live] { min-height: 1.5rem; }
.status-msg { color: var(--ink-soft); font-weight: 700; }

/* ---------- Motion: none by default ---------- */
@media (prefers-reduced-motion: no-preference) {
  a, button { transition: opacity 120ms ease; }
}

/* ---------- Print ---------- */
@media print {
  .player, .skip-link, nav.course, nav.pager { display: none; }
}
