/* Juke Box. S'appuie sur les variables de style.css. */
:root { --console: 60px; }

.page-juke { padding-bottom: var(--console); }
.page-juke main { overflow-x: clip; }

/* Ouverture */
.juke-hero-inner {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline;
  padding-top: calc(var(--header) + clamp(16px, 2.2vw, 36px));
  padding-bottom: clamp(12px, 1.4vw, 24px);
}
.juke-kicker, .juke-lede { font-size: 16px; font-weight: 500; }
.juke-kicker { transition: opacity 0.4s; }
.juke-kicker:hover { opacity: 0.6; }
.juke-lede { text-align: right; }
.juke-hero h1 {
  grid-column: 1 / -1;
  overflow: hidden;
  padding-left: 0.12em;
  margin-left: -0.12em;
  padding-bottom: 0.22em;
  margin-bottom: -0.14em;
  font-size: clamp(84px, 17.5vw, 400px); line-height: 0.92; letter-spacing: -0.03em;
}
.juke-hero h1 span { display: block; }

/* Sélection : une ligne par pièce */
.piece {
  --m: 1;
  display: grid;
  grid-template-columns: 40px clamp(84px, 6.6vw, 128px) minmax(0, 1fr) minmax(170px, 17%) minmax(130px, 11%);
  grid-template-areas: "code plate title by action";
  column-gap: clamp(16px, 2vw, 32px);
  align-items: center;
  padding-block: 12px;
  border-top: 1px solid var(--line);
}
.piece:last-child { border-bottom: 1px solid var(--line); }

.piece-code { grid-area: code; font-size: 15px; font-weight: 500; }
.piece-plate { grid-area: plate; margin: 0; clip-path: inset(calc((1 - var(--m)) * 100%) 0 0 0); }
.piece-title { grid-area: title; font-family: var(--serif); font-size: clamp(34px, 4.3vw, 84px); line-height: 1.04; letter-spacing: -0.015em; text-wrap: balance; }
.piece-by { grid-area: by; font-size: 15px; line-height: 1.35; color: var(--ink-soft); opacity: calc((var(--m) - 0.5) * 2); }
.piece-action { grid-area: action; justify-self: end; opacity: calc((var(--m) - 0.6) * 2.5); }

.piece-title a { display: inline-block; opacity: calc(0.1 + var(--m) * 0.9); translate: calc((1 - var(--m)) * 4vw) 0; }
.piece-title span {
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size 1.1s var(--slow);
}
.piece-title a:hover span, .piece-title a:focus-visible span { background-size: 100% 1px; }

.play {
  position: relative; z-index: 0;
  min-height: 44px; padding: 0 22px;
  background: none; border: 1px solid var(--ink);
  font-size: 15px; font-weight: 500; white-space: nowrap; cursor: pointer; overflow: hidden;
  transition: color 0.5s var(--slow);
}
.play::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--ink); transform: scaleY(0); transform-origin: bottom; transition: transform 0.6s var(--slow); }
.play:hover, .play.is-playing { color: #fff; }
.play:hover::before, .play.is-playing::before { transform: scaleY(1); }
.piece-action .link { font-size: 15px; white-space: nowrap; }

.plate-inner { display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 5; padding: 8px; background: #f1eee8; overflow: hidden; transition: transform 1.2s var(--slow); }
.piece-plate img { width: auto; max-width: 100%; max-height: 100%; object-fit: contain; mix-blend-mode: multiply; filter: grayscale(1); scale: calc(1.16 - var(--m) * 0.16); transition: filter 0.9s var(--slow); }
.piece:hover .piece-plate img { filter: grayscale(0); }
.piece:hover .plate-inner { transform: scale(1.04); }
#a3 .plate-inner { padding: 0; background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
#a3 .piece-plate img { width: 100%; height: 100%; max-height: none; object-fit: cover; object-position: 10% 50%; }

/* Console */
.console { position: fixed; inset: auto 0 0; z-index: 40; height: var(--console); background: rgba(255, 255, 255, 0.96); border-top: 1px solid var(--line); }
.console-progress { position: absolute; left: 0; right: 0; top: -1px; height: 1px; background: var(--ink); transform: scaleX(var(--scroll, 0)); transform-origin: left; }
.console-inner { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 24px; height: 100%; max-width: calc(var(--wrap) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.console-now { display: flex; gap: 14px; min-width: 0; font-size: 15px; font-weight: 500; }
.console-title { overflow: hidden; color: var(--ink-soft); font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.console-keys { display: flex; }
.key { position: relative; width: 44px; height: 44px; padding: 0; background: none; border: 0; color: var(--ink-soft); font-size: 14px; cursor: pointer; transition: color 0.4s; }
.key::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 7px; height: 1px; background: currentColor; transform: scaleX(0); transition: transform 0.6s var(--slow); }
.key:hover, .key[aria-current="true"] { color: var(--ink); }
.key:hover::after, .key[aria-current="true"]::after { transform: scaleX(1); }
.console-time { grid-column: 3; justify-self: end; font-size: 15px; font-variant-numeric: tabular-nums; }

/* Lecteur */
#player { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; background: var(--night); color: var(--on-night); }
#player[open] { display: flex; flex-direction: column; animation: player-in 0.7s var(--slow); }
#player::backdrop { background: var(--night); }
@keyframes player-in { from { opacity: 0; } }
.player-bar { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 12px var(--gutter); }
.player-close { min-height: 44px; padding: 0; background: none; border: 0; font-weight: 500; cursor: pointer; }
.player-body { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 0 var(--gutter) 32px; }
.player-body iframe { display: block; width: min(100%, calc((100dvh - 130px) * 16 / 9)); aspect-ratio: 16 / 9; border: 0; }
.silence { width: min(100%, 980px); text-align: center; }
.silence-time { font: 400 min(24vw, 44dvh)/1 var(--serif); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.silence-line { height: 1px; margin: 20px 0; background: var(--line-night); }
.silence-line span { display: block; height: 100%; background: var(--on-night); transform: scaleX(var(--silence, 0)); transform-origin: left; }
.silence-note { font-size: 17px; color: var(--on-night-soft); }

/* Tablette : l'auteur passe sous le titre */
@media (max-width: 1100px) {
  .piece {
    grid-template-columns: 34px 84px minmax(0, 1fr) auto;
    grid-template-areas:
      "code plate title action"
      "code plate by action";
    align-items: end;
    row-gap: 2px;
  }
  .piece-code, .piece-plate, .piece-action { align-self: center; }
  .piece-by { align-self: start; }
  .piece-title { font-size: clamp(32px, 5.4vw, 56px); }
}

/* Mobile */
@media (max-width: 640px) {
  :root { --console: 56px; }
  .juke-hero-inner { grid-template-columns: auto minmax(0, 1fr); column-gap: 16px; }
  .juke-kicker, .juke-lede { font-size: 14px; }
  .juke-kicker { white-space: nowrap; }
  .juke-lede { text-wrap: balance; }
  .piece {
    grid-template-columns: 72px minmax(0, 1fr);
    grid-template-areas:
      "plate code"
      "plate title"
      "plate by"
      "plate action";
    column-gap: 14px;
    align-items: start;
    row-gap: 0;
    padding-block: 10px;
  }
  .piece-plate { align-self: start; }
  .piece-code { font-size: 13px; align-self: start; }
  .piece-title { font-size: clamp(26px, 7.6vw, 30px); }
  .piece-by { font-size: 14px; }
  .piece-action { justify-self: start; margin-top: 6px; align-self: start; }
  .play { min-height: 44px; padding: 0 18px; }
  .console-now, .console-time { display: none; }
  .console-inner { display: flex; padding-inline: 4px; }
  .console-keys { justify-content: space-between; width: 100%; }
  .key { flex: 1; width: auto; min-width: 0; }
}

/* Téléphone à l'horizontale et petites hauteurs */
@media (max-height: 480px) {
  .silence-time { font-size: 38dvh; }
  .silence-line { margin: 10px 0; }
  .player-body { padding-bottom: 12px; }
}

/* Grands écrans */
@media (min-width: 1800px) {
  .juke-kicker, .juke-lede, .piece-by, .piece-code, .play, .piece-action .link, .console-now { font-size: 18px; }
  .piece { padding-block: 16px; }
  .play { min-height: 52px; padding: 0 30px; }
  .console-time { font-size: 18px; }
  .key { font-size: 16px; }
}

@media (min-width: 2400px) {
  .juke-kicker, .juke-lede, .piece-by, .piece-code, .play, .piece-action .link, .console-now, .console-time { font-size: 20px; }
  .key { font-size: 18px; }
}

.juke-kicker a { display: inline-block; padding-block: 3px; }
