/* ============================================================
   ryanhoopesmusic.com — static, self-contained, no external requests.
   System fonts only. Colours are custom properties; dark mode
   redefines them under prefers-color-scheme.
   Contrast checked against WCAG AA (body text >= 4.5:1,
   UI borders/focus >= 3:1).
   ============================================================ */

:root {
  --bg:          #f7f3ec;
  --surface:     #fffdf8;
  --active:      #efe7d9;
  --ink:         #1c1917;  /* 15.8:1 on --bg */
  --ink-2:       #5f574d;  /*  6.4:1 on --bg */
  --accent:      #8a4423;  /*  6.5:1 on --bg */
  --line:        #e4dbcc;  /* decorative hairline */
  --line-strong: #8d8271;  /*  3.4:1 on --bg — control borders */
  --focus:       #8a4423;

  --shadow: 0 -1px 0 var(--line), 0 -10px 30px rgba(28, 25, 23, .08);

  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --wrap: 60rem;
  --gutter: 1rem;
  --radius: 10px;
  --dock-h: 0px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #14120f;
    --surface:     #1e1b16;
    --active:      #2a251e;
    --ink:         #f4ede1;  /* 16.1:1 */
    --ink-2:       #aa9f90;  /*  7.2:1 */
    --accent:      #e2955f;  /*  7.7:1 */
    --line:        #342d25;
    --line-strong: #7a6f60;  /*  3.8:1 */
    --focus:       #e2955f;
    --shadow: 0 -1px 0 var(--line), 0 -10px 30px rgba(0, 0, 0, .5);
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.6;
  /* keeps the last section clear of the docked player */
  padding-bottom: var(--dock-h);
  overflow-wrap: break-word;
}

body.has-dock { --dock-h: 8.75rem; }
@media (min-width: 720px) { body.has-dock { --dock-h: 5.5rem; } }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

img, svg, video { max-width: 100%; }

a { color: var(--accent); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}
/* Only suppress the ring for pointer users, never for keyboard. */
:focus:not(:focus-visible) { outline: none; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: var(--gutter); top: -4rem;
  z-index: 100;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: .6rem .9rem;
  text-decoration: none;
  transition: top .15s ease;
}
.skip-link:focus { top: .75rem; }

/* ---------------- header ---------------- */

.site-head {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.site-head__inner {
  display: flex; flex-wrap: wrap;
  align-items: baseline; justify-content: space-between;
  gap: .5rem 1rem;
  padding-block: .9rem;
}
.wordmark { margin: 0; font-family: var(--font-display); font-size: 1.05rem; letter-spacing: .02em; }
.wordmark__name { color: var(--ink); }

.navlist {
  display: flex; gap: 1rem;
  list-style: none; margin: 0; padding: 0;
  font-size: .9rem;
}
.navlist a { color: var(--ink-2); text-decoration: none; }
.navlist a:hover { color: var(--accent); text-decoration: underline; }

/* ---------------- sections ---------------- */

.section { padding-block: clamp(2.5rem, 7vw, 4.5rem); }
.section + .section { border-top: 1px solid var(--line); }

.section__title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4.5vw, 2rem);
  font-weight: 600;
  letter-spacing: .01em;
  margin: 0 0 .35rem;
}
.section__note { margin: 0 0 1.75rem; color: var(--ink-2); font-size: .95rem; max-width: 46ch; }

.eyebrow {
  margin: 0 0 .5rem;
  font-size: .78rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-2);
}

.hero__inner { max-width: 44rem; }
.hero__title {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 11vw, 4.25rem);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -.015em;
  margin: 0 0 1.25rem;
}
.hero__lede { font-size: clamp(1.05rem, 2.6vw, 1.25rem); margin: 0 0 1rem; max-width: 34ch; }
.hero__body { color: var(--ink-2); margin: 0 0 2rem; max-width: 52ch; }
.hero__cta { margin: 0; }

.btn {
  display: inline-block;
  font: inherit;
  padding: .6rem 1.1rem;
  border-radius: var(--radius);
  text-decoration: none;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  background: var(--surface);
}
.btn:hover { border-color: var(--accent); color: var(--accent); }

.callout, .state {
  margin: 0;
  padding: 1rem 1.1rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink-2);
  background: var(--surface);
  max-width: 46ch;
}
.state--loading { border-style: solid; }

/* ---------------- part 2: song list ---------------- */

.songlist {
  list-style: none;
  margin: 0; padding: 0;
  border-top: 1px solid var(--line);
}
.songlist > li { border-bottom: 1px solid var(--line); }

.song {
  display: grid;
  grid-template-columns: 1.75rem minmax(0, 1fr) auto;
  align-items: baseline;
  gap: .25rem .75rem;
  width: 100%;
  font: inherit;
  text-align: left;
  color: inherit;
  background: none;
  border: 0;
  border-radius: 0;
  padding: .85rem .5rem;
  cursor: pointer;
}
.song:hover { background: var(--active); }
.song:focus-visible { outline-offset: -2px; }

.song__idx {
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.song__title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  line-height: 1.3;
}
.song__meta {
  grid-column: 2;
  font-size: .85rem;
  color: var(--ink-2);
}
.song__dur {
  grid-column: 3; grid-row: 1;
  font-family: var(--font-mono);
  font-size: .85rem;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

/* active / playing state */
.song[aria-current="true"] { background: var(--active); }
.song[aria-current="true"] .song__title { color: var(--accent); }
.song[aria-current="true"] .song__idx { color: var(--accent); }

/* animated bars replace the index while playing */
.bars { display: inline-flex; align-items: flex-end; gap: 2px; height: .75rem; }
.bars i {
  display: block; width: 2px; height: 30%;
  background: var(--accent);
  animation: bar 900ms ease-in-out infinite;
}
.bars i:nth-child(2) { animation-delay: 150ms; }
.bars i:nth-child(3) { animation-delay: 300ms; }
@keyframes bar { 0%, 100% { height: 25%; } 50% { height: 100%; } }

/* a song with no recording is listed but not playable */
.song--silent { cursor: default; }
.song--silent:hover { background: none; }
.song--silent .song__title { color: var(--ink-2); }

/* ---------------- part 3: video grid ---------------- */

.vidgrid {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
}

.tile {
  display: block;
  width: 100%;
  font: inherit; text-align: left; color: inherit;
  background: none; border: 0; padding: 0;
  cursor: pointer;
}
.tile__thumb {
  position: relative;
  display: block;
  /* default 16:9; JS overrides per-video from the manifest's width/height,
     which is how portrait phone takes keep their own shape. */
  aspect-ratio: var(--tile-ar, 16 / 9);
  background: var(--active);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.tile__thumb img {
  width: 100%; height: 100%;
  object-fit: cover;      /* crops, never distorts */
  display: block;
}
/* poster missing or 404 → a drawn placeholder, never a broken-image icon */
.tile__thumb.is-broken img { display: none; }
.tile__thumb.is-broken::before {
  content: attr(data-fallback);
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--ink-2);
  text-align: center;
}

/* play badge, drawn not downloaded */
.tile__play {
  position: absolute; inset: auto .55rem .55rem auto;
  width: 2.25rem; height: 2.25rem;
  border-radius: 50%;
  background: rgba(28, 25, 23, .66);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3);
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.tile__play::before {
  content: "";
  width: 0; height: 0;
  margin-left: .18rem;
  border-left: .72rem solid #fff;
  border-top: .44rem solid transparent;
  border-bottom: .44rem solid transparent;
}
.tile:hover .tile__thumb { border-color: var(--line-strong); }
.tile__title {
  display: block;
  font-family: var(--font-display);
  font-size: 1.02rem;
  margin-top: .6rem;
}
.tile__meta { display: block; font-size: .85rem; color: var(--ink-2); }
.tile__portrait {
  position: absolute; top: .5rem; left: .5rem;
  font-size: .68rem; letter-spacing: .08em; text-transform: uppercase;
  background: rgba(28, 25, 23, .68); color: #fff;
  padding: .12rem .4rem; border-radius: 4px;
}

/* ---------------- lightbox ---------------- */

.lightbox {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 0;
  width: min(60rem, 100% - 1.5rem);
  max-width: 100%;
}
.lightbox::backdrop { background: rgba(10, 9, 8, .78); }
/* belt and braces for engines that treat <dialog> as an unknown element */
.lightbox:not([open]) { display: none; }
/* non-modal fallback when dialog.showModal() is unavailable; app.js adds
   this class, so the rule never depends on the :modal pseudo-class */
.lightbox--floating[open] {
  position: fixed;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  z-index: 200;
  box-shadow: 0 10px 50px rgba(0, 0, 0, .5);
}
.lightbox__bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem;
  padding: .6rem .6rem .6rem 1rem;
  border-bottom: 1px solid var(--line);
}
.lightbox__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem; font-weight: 600;
  min-width: 0; overflow-wrap: anywhere;
}
.lightbox__video {
  display: block;
  width: 100%;
  /* portrait takes must not be stretched: contain inside a bounded box */
  max-height: min(72vh, 46rem);
  object-fit: contain;
  background: #000;
}

/* ---------------- docked mini-player ---------------- */

.dock {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 50;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding-block: .6rem;
  padding-bottom: max(.6rem, env(safe-area-inset-bottom));
}

.dock__inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: .4rem .85rem;
}
.dock__controls { grid-column: 1; grid-row: 1; display: flex; gap: .3rem; align-items: center; }
.dock__meta     { grid-column: 2; grid-row: 1; min-width: 0; }
.dock__seek     { grid-column: 1 / -1; grid-row: 2; display: flex; align-items: center; gap: .6rem; }

@media (min-width: 720px) {
  .dock__inner { grid-template-columns: auto minmax(8rem, 18rem) minmax(0, 1fr); }
  .dock__seek  { grid-column: 3; grid-row: 1; }
}

.dock__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dock__sub {
  margin: 0;
  font-size: .8rem; color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dock__error {
  margin: .4rem 0 0;
  padding-inline: var(--gutter);
  font-size: .85rem;
  color: var(--accent);
}

.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.5rem; height: 2.5rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: none;
  color: var(--ink);
  cursor: pointer;
}
.iconbtn svg { width: 1.25rem; height: 1.25rem; fill: currentColor; }
.iconbtn:hover { background: var(--active); }
.iconbtn:disabled { opacity: .4; cursor: default; }
.iconbtn:disabled:hover { background: none; }

.iconbtn--primary {
  width: 2.9rem; height: 2.9rem;
  border-color: var(--line-strong);
}
.iconbtn--primary:hover { border-color: var(--accent); color: var(--accent); }

/* swap play/pause glyph from the button's own aria state */
.iconbtn .i-pause { display: none; }
.dock.is-playing .i-play { display: none; }
.dock.is-playing .i-pause { display: inline; }

.t {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  flex: none;
  min-width: 2.75rem;
}
.t--dur { text-align: right; }

/* scrubber — styled in both engines, keeps a visible focus ring */
.scrub {
  flex: 1 1 auto;
  min-width: 0;
  height: 1.5rem;
  margin: 0;
  background: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.scrub::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: var(--line-strong);
}
.scrub::-moz-range-track {
  height: 4px; border-radius: 2px;
  background: var(--line-strong);
}
.scrub::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; margin-top: -5px;
  border-radius: 50%;
  background: var(--accent);
  border: 0;
}
.scrub::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 0;
}
.scrub:disabled { cursor: default; opacity: .5; }

/* The native <audio> is the no-JS fallback. app.js hides it once the
   custom transport is wired up. */
.native-audio { grid-column: 1 / -1; width: 100%; }
.js-on .native-audio { display: none; }

/* ---------------- footer ---------------- */

.site-foot {
  border-top: 1px solid var(--line);
  padding-block: 2rem;
  color: var(--ink-2);
  font-size: .9rem;
}
.site-foot p { margin: 0; }

/* ---------------- motion ---------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .bars i { height: 60%; }
}
