/* ==========================================================================
   ACT 1. hero. Beat: tanıma. One viewport, split: words left, live stage
   right. The stage runs a four phase loop (song, question, guesses, answer)
   driven by real audio once the visitor turns it on.
   Namespace: .hero-*  /  #hero-*
   ========================================================================== */

@property --hero-c {
  syntax: "<color>";
  inherits: true;
  initial-value: #E8452F;
}

/* --------------------------------------------------------------- shell -- */

.hero {
  display: flex;
  align-items: center;
  min-block-size: 100vh;
  min-block-size: 100svh;
  padding-block: clamp(5.75rem, 13vh, 9.5rem) clamp(2.25rem, 6vh, 4.5rem);
}

.hero-wrap {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(2rem, 4.6vw, 4.5rem);
  inline-size: min(100% - 2 * var(--sc-gutter), 82rem);
}

/* ---------------------------------------------------------------- copy -- */

.hero-copy { min-inline-size: 0; }

.hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.7em;
  flex-wrap: wrap;
  margin: 0;
}
.hero-wordmark {
  font-family: var(--sc-font-display);
  font-variation-settings: "wght" 850, "wdth" 118;
  font-weight: 850;
  font-size: 1.08em;
  letter-spacing: 0.03em;
  color: var(--sc-ink);
}
.hero-eyebrow-rule {
  flex: 0 0 auto;
  inline-size: clamp(1rem, 2vw, 1.9rem);
  block-size: 1px;
  background: var(--tt-line-strong);
}

/* More air above the heading than below it. */
.hero-title {
  margin-block: clamp(1.35rem, 2.6vw, 2.3rem) clamp(0.95rem, 1.7vw, 1.35rem);
  font-size: clamp(2.6rem, 6.4vw, 5.1rem);
}
.hero-line { display: block; }

.hero-lede { color: color-mix(in oklab, var(--sc-ink) 86%, var(--sc-canvas)); }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: clamp(0.6rem, 1.1vw, 0.9rem);
  margin-block-start: clamp(1.55rem, 2.8vw, 2.4rem);
}

/* --------------------------------------------------------------- stage -- */

.hero-stage {
  position: relative;
  container-type: inline-size;
  inline-size: min(100%, calc(64svh * 1.6));
  margin-inline: auto;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 4px;
  --hero-c: var(--sc-accent);
  background:
    radial-gradient(128% 96% at 50% -6%,
      color-mix(in oklab, var(--hero-c) 12%, var(--sc-surface)) 0%,
      var(--sc-surface) 54%,
      color-mix(in oklab, var(--sc-canvas) 62%, var(--sc-surface)) 100%);
  box-shadow:
    inset 0 0 0 1px var(--tt-line),
    inset 0 1px 0 color-mix(in oklab, var(--sc-ink) 9%, transparent),
    0 34px 74px -46px hsl(var(--sc-shadow-color) / 0.95);
  transition: --hero-c 720ms linear;
}
@media (hover: hover) and (pointer: fine) {
  .hero-stage { cursor: pointer; }
}

/* the waveform. Fills the panel; the band it draws in is fixed in JS. */
.hero-wave {
  position: absolute;
  inset: 0;
  z-index: 1;
  inline-size: 100%;
  block-size: 100%;
  opacity: 1;
  transition: opacity 420ms var(--sc-ease-out);
}
.hero-stage[data-phase="c"] .hero-wave { opacity: 0.5; }
.hero-stage[data-phase="d"] .hero-wave { opacity: 0.3; }

/* the one pointer light: warm, soft, mixed from the page's own two tokens */
.hero-lamp {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: screen;
  background: radial-gradient(20rem 20rem at
      calc(var(--sc-mx, 0.5) * 100%) calc(var(--sc-my, 0.5) * 100%),
      color-mix(in oklab, color-mix(in oklab, var(--sc-ink) 66%, var(--sc-accent)) 22%, transparent) 0%,
      transparent 66%);
  transition: opacity 380ms var(--sc-ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .hero-stage:hover .hero-lamp { opacity: 1; }
}

.hero-loop {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

/* the playing track's sleeve, small and dim. Never its year. */
.hero-cover {
  position: absolute;
  inset-block-start: clamp(0.7rem, 2.6cqi, 1.1rem);
  inset-inline-end: clamp(0.7rem, 2.6cqi, 1.1rem);
  inline-size: clamp(2.3rem, 9.5cqi, 3.7rem);
  block-size: auto;
  aspect-ratio: 1;
  border-radius: 2px;
  object-fit: cover;
  opacity: 0;
  filter: saturate(0.8) contrast(0.95);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--sc-ink) 16%, transparent);
  transition: opacity 480ms var(--sc-ease-out);
}
.hero-stage[data-phase="a"] .hero-cover,
.hero-stage[data-phase="b"] .hero-cover,
.hero-stage[data-phase="c"] .hero-cover { opacity: 0.24; }

/* ------------------------------------------------ phase B: the question -- */

.hero-marks {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.hero-q {
  position: absolute;
  inset-block-start: var(--q-y, 52%);
  inset-inline-start: var(--q-x, 50%);
  margin: 0;
  font-family: var(--sc-font-display);
  font-variation-settings: "wght" 640, "wdth" 82;
  font-weight: 640;
  font-size: calc(var(--q-s, 8) * 1cqi);
  line-height: 1;
  color: var(--sc-ink);
  opacity: 0;
  will-change: transform, opacity;
  animation: hero-q-rise var(--q-dur, 2000ms) cubic-bezier(0.28, 0.62, 0.3, 1) both;
}
@keyframes hero-q-rise {
  0% {
    opacity: 0;
    transform: translate3d(-50%, -50%, 0) rotate(var(--q-r0, 0deg)) scale(0.78);
  }
  16% { opacity: var(--q-o, 0.5); }
  66% { opacity: var(--q-o, 0.5); }
  100% {
    opacity: 0;
    transform: translate3d(calc(-50% + var(--q-dx, 0px)), calc(-50% + var(--q-dy, -120px)), 0)
               rotate(var(--q-r1, 0deg)) scale(1);
  }
}

/* -------------------------------------------------- phase C: the guesses -- */

.hero-years {
  position: absolute;
  inset: 0;
  z-index: 2;
}
.hero-year {
  position: absolute;
  inset-block-start: var(--y-y, 50%);
  inset-inline-start: var(--y-x, 50%);
  font-size: clamp(1.7rem, 11cqi, 4.15rem);
  font-variation-settings: "wght" 780, "wdth" 74;
  font-weight: 780;
  line-height: 1;
  color: var(--sc-ink);
  white-space: nowrap;
  opacity: 0;
  will-change: transform, opacity;
  animation: hero-year-land 520ms var(--sc-ease-out) var(--y-delay, 0ms) both;
}
@keyframes hero-year-land {
  0%   { opacity: 0; transform: translate3d(-50%, calc(-50% - 0.28em), 0) scale(0.9); }
  62%  { opacity: 1; transform: translate3d(-50%, -50%, 0) scale(1.05); }
  100% { opacity: 1; transform: translate3d(-50%, -50%, 0) scale(1); }
}

/* the strike. A transform reveal, so nothing lays out twice. */
.hero-year::after {
  content: "";
  position: absolute;
  inset-inline: -0.06em;
  inset-block-start: 0.52em;
  block-size: 0.055em;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: 0 50%;
}

/* ------------------------------------------------- phase D: the answer --- */

.hero-year--wrong {
  animation: hero-year-fall 620ms var(--sc-ease-out) var(--y-delay, 0ms) both;
}
.hero-year--wrong::after {
  animation: hero-strike 240ms var(--sc-ease-out) both;
}
@keyframes hero-year-fall {
  0%   { opacity: 1;    transform: translate3d(-50%, -50%, 0) scale(1) rotate(0deg); }
  22%  { opacity: 0.72; transform: translate3d(-50%, -50%, 0) scale(1) rotate(0deg); }
  100% { opacity: 0.14; transform: translate3d(-50%, calc(-50% + 0.26em), 0) scale(0.9) rotate(var(--y-rot, 0deg)); }
}
@keyframes hero-strike {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

.hero-year--right {
  z-index: 1;
  animation: hero-year-stamp 660ms cubic-bezier(0.2, 0.9, 0.24, 1) both;
}
.hero-year--right.is-gold {
  color: var(--tt-gold);
  font-variation-settings: "wght" 900, "wdth" 78;
  font-weight: 900;
}
@keyframes hero-year-stamp {
  0% {
    transform: translate3d(-50%, -50%, 0) scale(1);
  }
  46% {
    transform: translate3d(calc(-50% + var(--y-dx, 0px)), calc(-50% + var(--y-dy, 0px)), 0) scale(1.34);
  }
  72% {
    transform: translate3d(calc(-50% + var(--y-dx, 0px)), calc(-50% + var(--y-dy, 0px)), 0) scale(1.12);
  }
  100% {
    opacity: 1;
    transform: translate3d(calc(-50% + var(--y-dx, 0px)), calc(-50% + var(--y-dy, 0px)), 0) scale(1.2);
  }
}

/* the card that resolves under the answer */
.hero-card {
  position: absolute;
  inset-block-end: clamp(0.7rem, 3cqi, 1.15rem);
  inset-inline-start: 50%;
  inline-size: min(84%, 24rem);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(0.55rem, 2.4cqi, 0.9rem);
  margin: 0;
  padding: clamp(0.5rem, 2.1cqi, 0.78rem);
  opacity: 0;
  transform: translate3d(-50%, 0.5rem, 0) scale(0.97);
  transition: opacity 300ms var(--sc-ease-out), transform 460ms var(--sc-ease-out);
}
.hero-card.is-on {
  opacity: 1;
  transform: translate3d(-50%, 0, 0) scale(1);
}
.hero-card-cover {
  inline-size: clamp(2rem, 8cqi, 3rem);
  block-size: auto;
  aspect-ratio: 1;
  border-radius: 2px;
  object-fit: cover;
  box-shadow: 0 1px 2px hsl(var(--sc-shadow-color) / 0.35);
}
.hero-card-lines {
  display: grid;
  gap: 0.1em;
  min-inline-size: 0;
}
.hero-card-lines > span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hero-card-artist {
  font-family: var(--sc-font-display);
  font-variation-settings: "wght" 760, "wdth" 104;
  font-weight: 760;
  font-size: clamp(0.72rem, 3.1cqi, 0.98rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--tt-paper-ink);
}
.hero-card-track {
  font-size: clamp(0.66rem, 2.7cqi, 0.86rem);
  line-height: 1.3;
  color: var(--tt-paper-ink);
}
.hero-card-album {
  font-size: clamp(0.6rem, 2.35cqi, 0.75rem);
  line-height: 1.3;
  color: var(--tt-paper-soft);
}

/* ------------------------------------------------------ the play control -- */

.hero-play {
  position: absolute;
  z-index: 6;
  inset-block-start: clamp(0.7rem, 2.6cqi, 1.1rem);
  inset-inline-start: clamp(0.7rem, 2.6cqi, 1.1rem);
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  min-block-size: 2.25rem;
  padding: 0.4rem 0.85rem 0.4rem 0.6rem;
  border: 0;
  border-radius: var(--sc-r-pill);
  background: color-mix(in oklab, var(--sc-canvas) 74%, transparent);
  backdrop-filter: blur(8px);
  color: color-mix(in oklab, var(--sc-ink) 92%, var(--sc-canvas));
  cursor: pointer;
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--sc-ink) 40%, transparent);
  transition: transform 150ms var(--sc-ease-out),
              background-color 150ms linear,
              box-shadow 150ms linear;
}
.hero-play-icon { display: flex; flex: 0 0 auto; }
.hero-play-icon svg { inline-size: 1.05rem; block-size: 1.05rem; }
.hero-play-icon-off { display: none; }
.hero-play[data-on="1"] .hero-play-icon-on { display: none; }
.hero-play[data-on="1"] .hero-play-icon-off { display: block; }
.hero-play-label {
  font-family: var(--sc-font-text);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1;
  white-space: nowrap;
}
@media (hover: hover) and (pointer: fine) {
  .hero-play:hover {
    background: color-mix(in oklab, var(--sc-surface) 92%, var(--sc-ink));
    box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--sc-ink) 62%, transparent);
    transform: translateY(-1px);
  }
}
.hero-play:focus-visible {
  outline: 2px solid var(--sc-accent);
  outline-offset: 3px;
}
.hero-play:active { transform: translateY(1px) scale(0.985); }
.hero-play[data-on="1"] {
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--sc-accent) 74%, transparent);
}

/* pause everything continuous when the act is off screen or the tab is hidden */
.hero-stage.is-paused .hero-q,
.hero-stage.is-paused .hero-year,
.hero-stage.is-paused .hero-year::after {
  animation-play-state: paused;
}

/* --------------------------------------------------------------- 860px -- */

@media (max-width: 860px) {
  .hero {
    align-items: start;
    padding-block: clamp(5rem, 11vh, 7rem) clamp(2rem, 5vh, 3.25rem);
  }
  .hero-wrap {
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(1.5rem, 4.5vw, 2.5rem);
  }
  .hero-stage {
    /* stable ratio when stacked, so nothing jumps as the loop runs */
    aspect-ratio: 5 / 4;
    inline-size: min(100%, calc(52svh * 1.25));
  }
}

/* --------------------------------------------------------------- 620px -- */

@media (max-width: 620px) {
  .hero { padding-block-start: clamp(4.75rem, 10vh, 6rem); }
  .hero-title {
    /* Two lines at 390px: 2.6rem floor would still fit, but this leaves the
       stage room. 10.4vw = 40.6px at 390. */
    font-size: clamp(2.4rem, 10.4vw, 3.1rem);
    margin-block: clamp(1rem, 4vw, 1.5rem) clamp(0.7rem, 2.8vw, 1rem);
  }
  .hero-lede { font-size: 1.02rem; line-height: 1.46; }
  .hero-actions { margin-block-start: 1.35rem; gap: 0.55rem; }
  .hero-actions .tt-cta { padding: 0.85em 1.15em; }
  .hero-stage {
    aspect-ratio: 7 / 6;
    inline-size: min(100%, calc(50svh * 1.18));
  }
}

/* ------------------------------------------------------- coarse pointer -- */

@media (pointer: coarse) {
  .hero-play { min-block-size: 44px; min-inline-size: 44px; padding-inline: 0.9rem 1rem; }
  .hero-lamp { display: none; }
}

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

@media (prefers-reduced-motion: reduce) {
  .hero-lamp { display: none; }

  /* no drift, no rotation: the marks only cross-fade where they stand */
  .hero-q {
    transform: translate3d(-50%, -50%, 0);
    animation-name: hero-q-hold;
    animation-timing-function: linear;
  }
  @keyframes hero-q-hold {
    0%   { opacity: 0; }
    18%  { opacity: var(--q-o, 0.5); }
    70%  { opacity: var(--q-o, 0.5); }
    100% { opacity: 0; }
  }

  /* the four years become a settled block: nothing falls, nothing travels */
  .hero-years {
    inset: 20% 7% 27% 7%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-content: center;
    justify-items: center;
    align-items: center;
    gap: 6% 5%;
  }
  .hero-year {
    position: static;
    transform: none;
    animation: hero-year-appear 240ms linear var(--y-delay, 0ms) both;
  }
  @keyframes hero-year-appear {
    from { opacity: 0; }
    to   { opacity: 1; }
  }
  .hero-year--wrong {
    animation: hero-year-dim 260ms linear both;
  }
  .hero-year--wrong::after { animation: none; transform: scaleX(1); }
  @keyframes hero-year-dim {
    from { opacity: 1; }
    to   { opacity: 0.22; }
  }
  .hero-year--right {
    animation: hero-year-appear 240ms linear both;
  }

  .hero-card { transform: translate3d(-50%, 0, 0); }
  .hero-card.is-on { transform: translate3d(-50%, 0, 0); }

  .hero-wave,
  .hero-cover,
  .hero-play { transition-duration: 180ms; }
}
