/* ── official fonts ───────────────────────────────────────────────────── */
@font-face {
  font-family: "Geeeki";
  src: url("fonts/Geeeki.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Astrovans";
  src: url("fonts/Astrovans-Font/Astrovans.otf") format("opentype"),
       url("fonts/Astrovans-Font/Astrovans.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ── design tokens: matched to localfrequency.mindbase.ca ──────────────── */
:root {
  --cream: #FBF3E7;
  --cream-soft: #F3E8D8;
  --ink: #2A2320;
  --ink-soft: #5C534C;
  --red: #C0281A;
  --red-dark: #9A1F14;
  --orange: #E8A855;
  --peach: #F2C879;
  --peach-soft: #F6D9A0;
  --surface: var(--cream);

  --shadow-soft: rgba(42, 35, 32, 0.12);
  --shadow-glow: rgba(154, 31, 20, 0.28);

  --font-display: "Geeeki", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: "Geeeki", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-accent: "Astrovans", Georgia, serif;
}

[data-theme="dark"] {
  --cream: #121113;
  --cream-soft: #1C1A1E;
  --ink: #F4F0E9;
  --ink-soft: #ADA79E;
  --red: #C6F135;
  --red-dark: #A9CE2A;
  --orange: #A97C94;
  --peach: #C9A3B5;
  --peach-soft: #D9BFCB;
  --surface: #1C1A1E;
  --shadow-soft: rgba(0, 0, 0, 0.45);
  --shadow-glow: rgba(198, 241, 53, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;  /* mobile Safari/Chrome: shrinks with the on-screen toolbar,
                          instead of the stale "largest possible" 100vh */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 20px;
  /* env(safe-area-inset-bottom) clears the home-indicator / gesture-nav bar
     on notched phones (0 on everything else, so this is a no-op elsewhere) */
  padding: 6vh 24px calc(40px + env(safe-area-inset-bottom));
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
  transition: background .2s ease, color .2s ease;
}

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.titlebar {
  width: min(80vw, 400px); /* same content width as the turntable/deck/links below */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.titles {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.theme-toggle {
  align-self: flex-start;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: none;
  border: 2px solid var(--peach-soft);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  transition: background .18s ease, transform .18s ease;
}
.theme-toggle:hover { background: var(--surface); transform: translateY(-2px); }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(22px, 5vw, 30px);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: .01em;
  text-align: center;
}
h2#trackTitle {
  margin: 0;
  font-family: var(--font-display);
  /* ~4px below the h1 across the clamp range */
  font-size: clamp(18px, 4.3vw, 26px);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: .01em;
  text-align: center;
}
.hint {
  margin: 0;
  font-family: var(--font-accent);
  font-size: 13px;
  color: var(--ink-soft);
  text-align: center;
  max-width: 340px;
  letter-spacing: .02em;
}

/* ── turntable: record + round start/stop button ───────────────────────── */
.turntable { width: min(80vw, 400px); position: relative; }

/* dark mode: soft green gradient glow radiating all around the record */
[data-theme="dark"] .turntable::after {
  content: "";
  position: absolute;
  inset: -7%;
  border-radius: 50%;
  background: radial-gradient(circle at center,
              rgba(198, 241, 53, 0) 42%,
              rgba(198, 241, 53, 0.6) 51%,
              rgba(198, 241, 53, 0.28) 60%,
              rgba(198, 241, 53, 0) 70%);
  filter: blur(14px);
  z-index: -1;
  pointer-events: none;
}

#record_svg {
  display: block;
  width: 100%;
  height: auto;
  cursor: grab;
  user-select: none;
  touch-action: none;                 /* let us drag/scratch without page scroll */
  /* white ring in both themes so the record edge reads cleanly */
  box-sizing: content-box;
  border: 1px solid #F4F0E9;
  border-radius: 50%;
  filter: drop-shadow(0 20px 40px var(--shadow-soft));
}
#record_svg.grabbing { cursor: grabbing; }
#record_svg image { -webkit-user-drag: none; user-select: none; }

/* record label takes the theme accent: red in light, green in dark */
#labelDisc { fill: var(--red); }
#labelRing { stroke: var(--red-dark); }

.deck {
  width: min(80vw, 400px);
  margin-top: 14px;   /* breathing space off the record edge */
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.deck-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

/* per-album cover, doubling as the "open tracklist" button — album pages
   only. Shows the cover image when the album has one; otherwise falls back
   to a plain "Tracklist" label so it's still reachable without art. */
.album-art-btn {
  flex: none;
  width: clamp(64px, 20vw, 96px);
  aspect-ratio: 1;
  padding: 0;
  border-radius: 10px;
  border: 2px solid var(--peach-soft);
  background: var(--surface);
  box-shadow: 0 10px 24px var(--shadow-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .18s ease;
}
.album-art-btn:hover { transform: translateY(-2px); }
.album-art-btn[hidden] { display: none; }

.album-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.album-art[hidden] { display: none; }

.album-art-fallback {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-align: center;
  color: var(--red);
  padding: 4px;
}
.album-art-fallback[hidden] { display: none; }

.readout {
  display: inline-flex;
  align-items: baseline;
  font-family: Arial, Helvetica, sans-serif;   /* real tabular digits — no wobble */
  font-weight: 700;
  font-size: clamp(17px, 4.5vw, 21px);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  line-height: 1;
}
.readout .t-cs {
  font-size: 0.6em;      /* hundredths sit smaller than the M:SS */
  font-weight: 600;
  opacity: 0.6;
  margin-left: 1px;
}

.transport {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

/* prev/next track — flank the play button, only shown on album pages */
.skip-btn {
  width: clamp(40px, 10vw, 48px);
  aspect-ratio: 1;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: transparent;
  border: 2px solid var(--red);
  color: var(--red);
  cursor: pointer;
  touch-action: manipulation;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.skip-btn:hover:not(:disabled) { background: var(--red); color: var(--cream); transform: translateY(-2px); }
.skip-btn:disabled { opacity: .35; cursor: default; }
.skip-btn[hidden] { display: none; }

.play-btn {
  flex: none;
  width: clamp(64px, 17vw, 78px);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--red);
  color: var(--cream);
  box-shadow: 0 10px 24px var(--shadow-glow);
  cursor: pointer;
  touch-action: manipulation;
  transition: background .18s ease, transform .18s ease;
}
.play-btn:disabled { opacity: .55; cursor: default; box-shadow: none; }
.play-btn.is-playing { background: var(--red-dark); }
.play-btn:not(:disabled):hover { transform: translateY(-2px); }
/* the play triangle sits slightly off-centre visually, so nudge it */
.play-btn .icon-play { margin-left: 3px; }
.play-btn .icon-stop { display: none; }
.play-btn.is-playing .icon-play { display: none; }
.play-btn.is-playing .icon-stop { display: block; }

.deck-status {
  margin: 0;
  min-height: 14px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ── pitch fader ──────────────────────────────────────────────────────── */
.pitch-section {
  width: min(80vw, 400px);
  display: flex;
  flex-direction: column;
  align-items: flex-end; /* Reset sits above the border box, right-aligned */
  gap: 6px;
}
.pitch-reset {
  padding: 6px 14px;
  border-radius: 8px;              /* same corner radius as .link */
  border: 2px solid var(--peach-soft);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
  transition: background .18s ease, transform .18s ease;
}
.pitch-reset:hover { background: var(--cream-soft); transform: translateY(-1px); }

/* border/radius/shadow/background matched to .link so this reads as part of
   the same button family, just holding a slider instead of a label */
.pitch-control {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 8px;
  border: 2px solid var(--peach-soft);
  background: var(--surface);
  box-shadow: 0 2px 10px var(--shadow-soft);
}
.pitch-label {
  flex: none;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--ink-soft);
}
.pitch-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--peach-soft);
  outline: none;
  cursor: pointer;
  touch-action: manipulation;
}
/* thumb sized to nearly fill the control's inner height (padding is 12px
   top/bottom), rather than the small default dot */
.pitch-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid var(--cream);
  box-shadow: 0 2px 6px var(--shadow-soft);
  cursor: pointer;
}
.pitch-slider::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--peach-soft);
}
.pitch-slider::-moz-range-thumb {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid var(--cream);
  box-shadow: 0 2px 6px var(--shadow-soft);
  cursor: pointer;
}

/* ── more-info page ──────────────────────────────────────────────────── */
.more-header {
  width: min(80vw, 400px);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.back-link {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: none;
  border: 2px solid var(--peach-soft);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  touch-action: manipulation;
  transition: background .18s ease, transform .18s ease;
}
.back-link:hover { background: var(--surface); transform: translateY(-2px); }

.page-heading {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(18px, 4.3vw, 26px);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: .01em;
  text-align: center;
}

.bio {
  width: min(80vw, 400px);
  margin: 0;
  font-family: var(--font-accent);
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-soft);
  text-align: center;
}

/* ── link list + download ─────────────────────────────────────────────── */
.links {
  width: min(80vw, 400px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.link {
  display: block;
  width: 100%;
  padding: 12px 18px;
  border-radius: 8px;
  font-family: var(--font-accent);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .01em;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--peach-soft);
  box-shadow: 0 2px 10px var(--shadow-soft);
  cursor: pointer;
  touch-action: manipulation;
  transition: background .18s ease, transform .18s ease, color .18s ease;
}
.link:hover { background: var(--cream-soft); transform: translateY(-2px); }
.link--download {
  margin-top: 6px;
  font-family: var(--font-body);
  color: var(--cream);
  background: var(--red);
  border: none;
  box-shadow: 0 10px 24px var(--shadow-glow);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.link--download:hover { background: var(--red-dark); color: var(--cream); }
.link--download:disabled { opacity: .55; cursor: default; box-shadow: none; }
.link--download:disabled:hover { background: var(--red); }
.link--download[hidden] { display: none; }

/* ── tracklist modal ──────────────────────────────────────────────────── */
.modal--tracklist { max-width: 380px; text-align: left; }
.modal--tracklist h2 { text-align: center; }

.play-album-btn {
  display: block;
  width: 100%;
  margin: 4px 0 14px;
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-align: center;
  color: var(--cream);
  background: var(--red);
  box-shadow: 0 10px 24px var(--shadow-glow);
  cursor: pointer;
  touch-action: manipulation;
  transition: background .18s ease, transform .18s ease;
}
.play-album-btn:hover { background: var(--red-dark); }
.play-album-btn[hidden] { display: none; }

.tracklist {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tracklist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--cream-soft);
  border: 2px solid transparent;
}
.tracklist-item.is-loaded { border-color: var(--red); }
.tracklist-item-name {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tracklist-load {
  flex: none;
  padding: 7px 14px;
  border: none;
  border-radius: 6px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--cream);
  background: var(--red);
  cursor: pointer;
  touch-action: manipulation;
  transition: background .18s ease;
}
.tracklist-load:hover { background: var(--red-dark); }
.tracklist-item.is-loaded .tracklist-load { background: var(--ink-soft); cursor: default; }

/* ── passcode modal ───────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  padding: 24px;
  display: grid;
  place-items: center;
  background: rgba(42, 35, 32, 0.5);
  backdrop-filter: blur(3px);
}
.modal-backdrop[hidden], .toast[hidden] { display: none; }

.modal {
  width: 100%;
  max-width: 330px;
  text-align: center;
  background: var(--surface);
  color: var(--ink);
  border: 3px solid var(--peach-soft);
  border-radius: 18px;
  padding: 24px 22px;
  box-shadow: 0 14px 30px var(--shadow-glow);
}
.modal h2 {
  margin: 0 0 4px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 18px;
  font-weight: 900;
}
.modal .sub { margin: 0 0 16px; font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: var(--ink-soft); }
.modal input {
  width: 100%;
  padding: 11px 12px;
  font: inherit;
  font-family: Arial, Helvetica, sans-serif;
  text-align: center;
  letter-spacing: 2px;
  color: var(--ink);
  background: var(--cream);
  border: 2px solid var(--peach-soft);
  border-radius: 8px;
}
.modal input:focus { outline: 2px solid var(--red); outline-offset: 1px; }
.modal-error {
  min-height: 16px;
  margin: 10px 0 0;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--red);
}
.modal-actions { display: flex; gap: 8px; margin-top: 16px; }
.modal-actions button {
  flex: 1;
  padding: 12px 18px;
  border: none;
  border-radius: 4px;
  font: inherit;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  background: var(--red);
  color: var(--cream);
  transition: background .18s ease, transform .18s ease;
}
.modal-actions button:hover { background: var(--red-dark); transform: translateY(-2px); }
.modal .ghost {
  background: transparent;
  color: var(--red);
  border: 2px solid var(--red);
}
.modal .ghost:hover { background: var(--red); color: var(--cream); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 60;
  background: var(--red);
  color: var(--cream);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .02em;
  padding: 11px 20px;
  border-radius: 8px;
  box-shadow: 0 10px 24px var(--shadow-glow);
}
