/* The one song player (caseproofagent/opal#32), with player/player.js. Each song sets its own
   colours and fonts in its song.js (theme); player.js writes them onto <html> as --op-*
   properties, over these defaults. */

:root {
  --op-bg: #0B0C24;
  --op-panel: #12133A;
  --op-line: rgba(255, 255, 255, 0.1);
  --op-ink: #F3EEE6;
  --op-soft: #C9C5DA;
  --op-dim: #9F9BB8;
  --op-accent: #8FF3E0;
  --op-accent-2: #A9B8FF;
  --op-on-accent: #0B1020;
  --op-now: #FFFFFF;
  --op-display: var(--display);
  --op-words: var(--font);
  --op-body: var(--font);
}
.song-page {
  background: var(--op-bg);
  color: var(--op-ink);
  font-family: var(--op-body);
  overflow-x: hidden;
}
.song-page a { color: var(--op-accent); }
.song-page a:hover { color: var(--op-ink); }

/* The song's heading */
.song-head { padding: clamp(20px, 4vw, 40px) 0 clamp(18px, 2.5vw, 28px); display: flex; flex-wrap: wrap; gap: 20px 48px; align-items: flex-end; }
.song-head > div:first-child { flex: 1 1 420px; min-width: 0; }
.song-kicker { margin: 0 0 10px; font-size: 13px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--op-accent); }
.song-head h1 { margin: 0; font-family: var(--op-display); font-weight: 400; font-size: clamp(40px, 7vw, 72px); line-height: 1; letter-spacing: -0.01em; color: var(--op-ink); }
.song-intro { flex: 1 1 360px; min-width: 0; margin: 0; font-size: clamp(16px, 1.7vw, 19px); line-height: 1.55; color: var(--op-ink); text-wrap: pretty; }
.song-intro p { margin: 0; }
/* The link to the song's stage page (/<song>/landing/, opal#37). */
.song-intro .song-stage { margin-top: 4px; font-size: 15px; font-weight: 600; }
.song-stage a { display: inline-flex; align-items: center; gap: 0.25em; min-height: 44px; text-decoration: none; }
.song-stage a:hover { text-decoration: underline; }
.song-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; font-size: 14px; }
.song-list a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--op-line); color: var(--op-ink); text-decoration: none; }
.song-list a:hover { border-color: var(--op-accent); color: var(--op-accent); }
.song-list a[aria-current="page"] { border-color: var(--op-accent); color: var(--op-accent); }

/* The player */
.op { padding-bottom: clamp(36px, 6vw, 72px); }
.op-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.op-tabs[hidden] { display: none; }
.op-tab {
  min-height: 44px; padding: 0 18px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--op-line); background: transparent; color: var(--op-soft);
  font: 600 15px/1 var(--op-body);
}
.op-tab:hover { color: var(--op-ink); border-color: var(--op-soft); }
.op-tab[aria-selected="true"] { background: var(--op-accent); border-color: var(--op-accent); color: var(--op-on-accent); }
.op-tab:focus-visible, .op-toggle:focus-visible, .op-cover:focus-visible, .op-scrub:focus-visible, .op-line:focus-visible, .op-scroll:focus-visible {
  outline: 3px solid var(--op-accent); outline-offset: 3px;
}

.op-grid { display: grid; grid-template-columns: minmax(0, 2.15fr) minmax(280px, 1fr); gap: 24px; align-items: stretch; }
.op-main { min-width: 0; }
/* A version with no words: the picture keeps the size it has beside the words, centred. */
.is-wordless .op-grid { grid-template-columns: minmax(0, 1fr); }
.is-wordless .op-main { width: 100%; max-width: calc((100% - 24px) * 2.15 / 3.15); margin: 0 auto; }
.op-words[hidden] { display: none; }

.op-stage {
  position: relative; aspect-ratio: 16 / 9; width: 100%; border-radius: 18px; overflow: hidden; cursor: pointer;
  background: #04050A; box-shadow: 0 30px 80px -30px var(--op-accent-2), 0 0 0 1px var(--op-line); isolation: isolate;
}
.op-media, .op-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.op-media { object-fit: cover; background: #04050A; }
.op-media.is-audio { visibility: hidden; }
.op-frame { pointer-events: none; background: #04050A; }
.op-frame[hidden] { display: none; }

.op-still { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; display: block; }
.op-still[hidden] { display: none; }
.op-loading {
  position: absolute; left: 50%; top: 50%; z-index: 2; margin: 0; transform: translate(-50%, -50%);
  width: max-content; max-width: calc(100% - 32px); padding: 10px 18px; border-radius: 999px;
  background: rgba(4, 5, 10, 0.78); text-align: center; font-size: 15px; line-height: 1.35; color: #FFFFFF;
}
.op-loading[hidden] { display: none; }
.op-cover {
  position: absolute; inset: 0; z-index: 3; width: 100%; margin: 0; border: 0; cursor: pointer;
  display: flex; align-items: flex-end; justify-content: flex-start; padding: clamp(16px, 3vw, 32px);
  background: linear-gradient(to top, rgba(4, 5, 10, 0.82), rgba(4, 5, 10, 0) 62%);
  color: #FFFFFF; font: inherit; text-align: left;
}
.op-cover[hidden] { display: none; }
.op-cover-row { display: flex; align-items: center; gap: 16px; }
.op-cover-play {
  position: relative; flex: none; width: clamp(52px, 7vw, 68px); height: clamp(52px, 7vw, 68px);
  border-radius: 50%; background: var(--op-accent); box-shadow: 0 0 40px var(--op-accent);
}
.op-cover-play::after {
  content: ""; position: absolute; left: 54%; top: 50%; transform: translate(-50%, -50%);
  border-style: solid; border-width: 11px 0 11px 18px; border-color: transparent transparent transparent var(--op-on-accent);
}
.op-cover-text { display: flex; flex-direction: column; gap: 2px; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6); }
.op-cover-title { font-size: clamp(17px, 2vw, 20px); font-weight: 600; }
.op-cover-sub { font-size: 14px; color: #E2DEEE; }

.op-bar { display: flex; align-items: center; gap: 14px; margin-top: 14px; min-width: 0; }
.op-toggle {
  position: relative; flex: none; width: 48px; height: 48px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--op-accent);
}
.op-toggle::before {
  content: ""; position: absolute; left: 50%; top: 50%; transform: translate(-40%, -50%);
  border-style: solid; border-width: 9px 0 9px 14px; border-color: transparent transparent transparent var(--op-on-accent);
}
.is-playing .op-toggle::before {
  transform: translate(-50%, -50%); width: 14px; height: 16px; border: 0;
  background: linear-gradient(90deg, var(--op-on-accent) 0 5px, transparent 5px 9px, var(--op-on-accent) 9px 14px);
}
.op-time { flex: none; min-width: 38px; font-size: 14px; color: var(--op-soft); font-variant-numeric: tabular-nums; }
.op-scrub { flex: 1; min-width: 60px; height: 44px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.op-track { position: relative; width: 100%; height: 4px; border-radius: 2px; background: var(--op-line); }
.op-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 2px; background: linear-gradient(90deg, var(--op-accent), var(--op-accent-2)); }
.op-tick { position: absolute; top: -3px; width: 2px; height: 10px; margin-left: -1px; border-radius: 1px; background: var(--op-dim); opacity: 0.7; }
.op-note { margin: 10px 0 0; font-size: 15px; color: var(--op-soft); }
.op-note[hidden] { display: none; }

/* The words. On a wide screen the column is as tall as the picture and its play bar,
   and scrolls inside itself; on a phone it sits under the picture with its own height. */
.op-words {
  position: relative; min-width: 0; min-height: 360px; border-radius: 18px; overflow: hidden;
  background: var(--op-panel); border: 1px solid var(--op-line);
}
.op-words-head {
  position: absolute; left: 0; right: 0; top: 0; z-index: 2; display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 14px 20px 22px; background: linear-gradient(180deg, var(--op-panel) 62%, transparent);
}
.op-words-head h2 { margin: 0; font-family: var(--op-body); font-size: 13px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--op-accent); line-height: 1.4; }
.op-now { font-size: 13px; color: var(--op-accent-2); text-align: right; }
.op-scroll {
  position: absolute; inset: 0; overflow-y: auto; padding: 52px 20px 45%;
  scrollbar-width: thin; scrollbar-color: var(--op-line) transparent; overscroll-behavior: contain;
}
.op-sec { margin: 0 0 18px; }
.op-sec-label { margin: 10px 0 4px; font-family: var(--op-body); font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--op-dim); line-height: 1.4; }
.op-line {
  display: block; width: 100%; margin: 0; padding: 10px 0 10px 12px; border: 0; border-left: 2px solid transparent; background: none;
  text-align: left; cursor: pointer; font-family: var(--op-words); font-size: var(--op-words-size, 17px); line-height: 1.4;
  color: var(--op-soft); opacity: 0.85; transition: color 0.25s, opacity 0.25s, border-color 0.25s; text-wrap: pretty;
}
button.op-line { min-height: 44px; }
p.op-line { cursor: default; padding-top: 6px; padding-bottom: 6px; }
.op-line.is-past { opacity: 0.5; }
.op-line.is-now { color: var(--op-now); opacity: 1; border-left-color: var(--op-accent); }
.op-call { font-style: italic; }
.op-scroll.is-untimed .op-line { opacity: 0.9; }

.song-credits { padding: 24px 0 clamp(40px, 6vw, 72px); border-top: 1px solid var(--op-line); display: flex; flex-wrap: wrap; gap: 8px 40px; font-size: 15px; color: var(--op-soft); }
.song-credits p { margin: 0; }

/* On a phone the picture, its play bar and the line being sung all fit on the first screen:
   the intro and the song list move under the player, and the words box shows about four
   lines, scrolled so the lit one stays in it. */
@media (max-width: 899px) {
  .song-page main.wrap { display: flex; flex-direction: column; }
  .song-head, .song-head > div:first-child { display: contents; }
  .song-kicker { order: 1; margin-top: 18px; }
  .song-head h1 { order: 2; margin-bottom: 16px; font-size: clamp(34px, 9vw, 56px); }
  .song-page .op { order: 3; }
  .song-intro { order: 4; flex: none; margin-bottom: 16px; }
  .song-list { order: 5; margin: 0 0 28px; }
  .song-credits { order: 6; }
  .op-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .op-words { height: 224px; min-height: 0; }
  .is-wordless .op-main { max-width: none; }
  .op-stage { border-radius: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .op-line { transition: none; }
}
