/* Time machine and outro, plus scene-specific light and motion. */

/* Time machine */
.time-page {
  min-height: 100%;
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.time-page .story-heading h1 {
  font-size: clamp(35px, 6vw, 58px);
}
.average-year {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: clamp(18px, 3.5vh, 32px);
}
.average-year__number {
  color: var(--lime);
  font-family: var(--title);
  font-size: clamp(82px, 16vw, 160px);
  line-height: 0.78;
  font-weight: 800;
  letter-spacing: -0.07em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 52px rgba(194, 255, 115, 0.1);
}
.average-year__label {
  margin-top: 13px;
  color: rgba(245, 238, 226, 0.64);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.average-year__span {
  margin-top: 7px;
  color: rgba(245, 238, 226, 0.6);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.average-year__span span {
  color: rgba(245, 238, 226, 0.22);
}
.decade-tabs {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 5px;
  margin-top: clamp(18px, 3.5vh, 30px);
  width: 100%;
}
.decade-tab {
  flex: 1 1 0;
  min-width: 0;
  height: 38px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0 4px;
  border: 1px solid rgba(245, 238, 226, 0.19);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.025);
  color: rgba(245, 238, 226, 0.66);
  font-family: var(--mono);
  font-size: 10px;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}
.decade-tab__label {
  line-height: 1;
  white-space: nowrap;
}
.decade-tab:hover {
  border-color: rgba(245, 238, 226, 0.4);
}
.decade-tab.is-active {
  border-color: transparent;
  background: var(--era);
  color: #111;
}
.decade-card {
  --era: #aaa4ff;
  width: 100%;
  margin-top: 18px;
  padding: 18px 18px 15px;
  overflow: hidden;
  border-radius: 14px;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--era) 94%, white),
    color-mix(in srgb, var(--era) 76%, #20202b)
  );
  background-clip: padding-box;
  color: #141316;
  text-align: left;
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.3);
}
.decade-card__top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  font-size: 9px;
  letter-spacing: 0.1em;
}
.decade-card__label {
  font-family: var(--title);
  font-size: 28px;
  line-height: 0.9;
  font-weight: 700;
  letter-spacing: -0.035em;
  text-transform: none;
  opacity: 0.9;
}
.decade-card__share {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.38);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: none;
  white-space: nowrap;
  opacity: 1;
}
.decade-card__share strong {
  font-family: var(--title);
  font-size: 15px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.decade-card__summary {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.15);
}
.decade-card__summary > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.decade-card__summary span {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.66;
}
.decade-card__artist strong {
  overflow: hidden;
  font-family: var(--title);
  font-size: clamp(22px, 4vw, 32px);
  line-height: 0.9;
  font-weight: 800;
  letter-spacing: -0.045em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.decade-card__genre {
  flex: 0 0 auto;
  max-width: 42%;
  text-align: right;
}
.decade-card__genre strong {
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.decade-card__songs {
  margin-top: 7px;
}
.decade-card__songs-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px 5px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  opacity: 0.68;
}
.era-song {
  width: 100%;
  min-height: 34px;
  display: grid;
  grid-template-columns: 16px 28px minmax(0, 1fr) 36px 16px;
  gap: 8px;
  align-items: center;
  padding: 2px;
  border: 0;
  border-top: 1px solid rgba(0, 0, 0, 0.11);
  background: transparent;
  color: inherit;
  text-align: left;
  transition: background 150ms ease;
}
.era-song:hover,
.era-song.is-playing {
  background: rgba(255, 255, 255, 0.17);
}
.era-song__rank {
  color: rgba(0, 0, 0, 0.5);
  font-size: 9px;
}
.era-song__cover {
  width: 28px;
  height: 28px;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.12);
}
.era-song__cover img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.era-song__meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.era-song__meta strong,
.era-song__meta small {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.era-song__meta strong {
  font-size: 11.5px;
  line-height: 1.05;
  font-weight: 750;
}
.era-song__meta small {
  font-size: 9.5px;
  line-height: 1.05;
  opacity: 0.66;
}
.era-song__plays {
  text-align: right;
  font-size: 10px;
  opacity: 0.72;
  font-variant-numeric: tabular-nums;
}
.era-song__action {
  display: grid;
  place-items: center;
  color: rgba(0, 0, 0, 0.62);
}
.era-song__action svg {
  width: 10px;
  height: 10px;
  fill: currentColor;
}
.era-song__action .era-song__eq {
  display: none;
  height: 11px;
  color: #111;
}
.era-song.is-playing .era-song__play {
  display: none;
}
.era-song.is-playing .era-song__eq {
  display: inline-flex;
}
.decade-card__stats {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.14);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.72;
}
.decade-card__stats span {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  white-space: nowrap;
}
.decade-card__stats strong {
  font-family: var(--title);
  font-size: 14px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/* Outro */
.outro-page {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.outro-page__logo {
  width: clamp(230px, 34vw, 340px);
}
.outro-page > .eyebrow {
  margin-top: 35px;
  color: rgba(245, 238, 226, 0.68);
}
.outro-page__title {
  margin: 13px 0 0;
  color: var(--cream);
  font-family: var(--title);
  font-size: clamp(42px, 7.7vw, 78px);
  line-height: 0.9;
  font-weight: 700;
  letter-spacing: -0.06em;
}
.outro-page .story-copy {
  margin-top: 17px;
  text-align: center;
}
.outro-summary {
  width: min(640px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 31px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.outro-summary > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 12px;
}
.outro-summary > div:nth-child(odd) {
  border-right: 1px solid var(--line-soft);
}
.outro-summary > div:nth-child(-n + 2) {
  border-bottom: 1px solid var(--line-soft);
}
.outro-summary span {
  color: rgba(245, 238, 226, 0.7);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.outro-summary strong {
  display: -webkit-box;
  overflow: hidden;
  color: rgba(245, 238, 226, 0.94);
  font-family: var(--title);
  font-size: clamp(15px, 2.2vw, 19px);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.025em;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.outro-page__actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 26px;
}
.outro-page .source-note {
  margin-top: 25px;
  color: rgba(245,238,226,.55);
}

/* Scene-specific background balance */
.scene--cover .scene__image {
  filter: blur(22px) saturate(1.3) brightness(0.54);
}
.scene--hero-song .scene__image {
  filter: blur(26px) saturate(1.3) brightness(0.5);
}
.scene--outro .scene__image {
  filter: blur(24px) saturate(1.35) brightness(0.54);
}

@media (max-width: 760px) {
  .time-page .story-heading h1 {
    font-size: clamp(32px, 9vw, 45px);
  }
  .average-year {
    margin-top: 16px;
  }
  .average-year__number {
    font-size: clamp(72px, 24vw, 118px);
  }
  .average-year__label {
    margin-top: 8px;
  }
  .average-year__span {
    margin-top: 6px;
    font-size: 9.5px;
    letter-spacing: 0.04em;
  }
  .decade-tabs {
    gap: 4px;
    margin-top: 14px;
  }
  .decade-tab {
    flex: 1 1 0;
    min-width: 0;
    height: 36px;
    gap: 1px;
    padding-inline: 2px;
    font-size: 9.5px;
  }
  .decade-card {
    margin-top: 12px;
    padding: 12px 14px 10px;
  }
  .decade-card__share {
    padding: 3px 7px;
    font-size: 9px;
  }
  .decade-card__share strong {
    font-size: 14px;
  }
  .decade-card__summary {
    gap: 10px;
    margin-top: 7px;
    padding-bottom: 6px;
  }
  .decade-card__artist strong {
    font-size: 23px;
  }
  .decade-card__genre strong {
    font-size: 13px;
  }
  .era-song {
    grid-template-columns: 14px 26px minmax(0, 1fr) 32px 14px;
    gap: 6px;
    min-height: 31px;
  }
  .era-song__cover {
    width: 26px;
    height: 26px;
  }
  .era-song__meta strong {
    font-size: 10.5px;
  }
  .era-song__meta small {
    font-size: 9px;
  }
  .era-song__plays {
    font-size: 9.5px;
  }
  .decade-card__stats {
    gap: 3px 9px;
    margin-top: 6px;
    padding-top: 6px;
    font-size: 8.5px;
  }
  .decade-card__stats strong {
    font-size: 12px;
  }
  .outro-page__logo {
    width: 215px;
  }
  .outro-page > .eyebrow {
    margin-top: 26px;
  }
  .outro-page__title {
    font-size: clamp(37px, 11vw, 54px);
  }
  .outro-summary {
    margin-top: 23px;
  }
  .outro-summary > div {
    padding: 11px 9px;
  }
  .outro-page__actions {
    margin-top: 20px;
  }
}

/* First scrobble — full-bleed intro track, based on the Wrapped intro-track screen. */
.scene--first-scrobble {
  background: #08090b;
}
.first-scrobble {
  position: absolute;
  inset: 0;
  margin: 0;
  overflow: hidden;
}
.first-scrobble__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  filter: brightness(0.63) saturate(1.1) contrast(1.05);
  transform: scale(1.03);
}
.first-scrobble__shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(4, 4, 6, 0.7) 0%, transparent 30% 48%, rgba(4, 4, 6, 0.7) 78%, #07080a 100%),
    linear-gradient(90deg, rgba(4, 4, 6, 0.5), transparent 46%),
    radial-gradient(circle at 20% 76%, rgba(255, 126, 91, 0.15), transparent 30%);
}
.first-scrobble__content {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: max(100px, 12vh);
  width: min(calc(100% - 48px), var(--content));
  transform: translateX(-50%);
}
.first-scrobble__date {
  margin: 11px 0 0;
  color: var(--orange);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.05em;
}
.first-scrobble__title {
  max-width: 760px;
  margin: 12px 0 0;
  color: var(--cream);
  font-family: var(--title);
  font-size: clamp(50px, 9vw, 96px);
  line-height: 0.86;
  font-weight: 700;
  letter-spacing: -0.06em;
  text-wrap: balance;
  text-shadow: 0 4px 44px rgba(0, 0, 0, 0.3);
}
.first-scrobble__artist {
  margin: 17px 0 0;
  color: rgba(245, 238, 226, 0.92);
  font-family: var(--title);
  font-size: clamp(22px, 3.6vw, 34px);
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.035em;
}
.first-scrobble__copy {
  margin: 12px 0 23px;
  color: rgba(245, 238, 226, 0.72);
  font-size: 12.5px;
  line-height: 1.45;
}
  to { transform: scale(1.09) translateY(-1.5%); }
}

@media (max-width: 760px) {
  .first-scrobble__content {
    bottom: max(93px, 12vh);
    width: calc(100% - 40px);
  }
  .first-scrobble__title {
    font-size: clamp(44px, 13.5vw, 66px);
  }
  .first-scrobble__copy {
    max-width: 300px;
    margin-bottom: 19px;
    font-size: 11.5px;
  }
  }

/* Release-year histogram */
.year-chart {
  width: 100%;
  margin-top: 11px;
}
.year-chart__head,
.year-chart__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: rgba(245, 238, 226, 0.64);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.year-chart__head {
  padding-bottom: 6px;
}
.year-chart__head span:first-child {
  color: rgba(245, 238, 226, 0.78);
}
.year-chart__bars {
  display: flex;
  align-items: flex-end;
  gap: 1px;
  height: 34px;
  border-bottom: 1px solid rgba(245, 238, 226, 0.16);
}
.year-bar {
  flex: 1 1 0;
  min-width: 0;
  height: var(--h);
  min-height: 2px;
  border-radius: 1px;
  background: var(--bar-color);
  opacity: 0.32;
  transition: opacity 180ms ease;
}
.year-bar.is-active {
  opacity: 0.94;
  box-shadow: 0 0 6px color-mix(in srgb, var(--bar-color) 45%, transparent);
}
.year-chart__foot {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  padding-top: 6px;
}
.year-chart__foot span {
  min-width: 0;
}
.year-chart__foot span:nth-child(2) {
  color: rgba(245, 238, 226, 0.58);
  text-align: center;
  white-space: nowrap;
}
.year-chart__foot span:last-child {
  text-align: right;
}

@media (max-width: 760px) {
  .year-chart {
    margin-top: 9px;
  }
  .year-chart__bars {
    height: 28px;
  }
  .year-chart__head,
  .year-chart__foot {
    font-size: 9px;
    letter-spacing: 0.03em;
  }
}

@media (min-width: 761px) {
  .time-page .average-year {
    margin-top: 16px;
  }
  .time-page .average-year__number {
    font-size: clamp(82px, 13.5vw, 150px);
  }
  .time-page .decade-tabs {
    margin-top: 18px;
  }
  .time-page .decade-card {
    margin-top: 14px;
  }
  .time-page .year-chart {
    margin-top: 8px;
  }
  .year-chart__bars {
    height: 27px;
  }
}

@media (max-width: 760px) and (max-height: 760px) {
  .time-page .story-heading h1 {
    font-size: clamp(28px, 9vw, 38px);
  }
  .time-page .average-year {
    margin-top: 10px;
  }
  .time-page .average-year__number {
    font-size: clamp(62px, 21vw, 96px);
  }
  .time-page .average-year__label {
    margin-top: 5px;
  }
  .time-page .average-year__span {
    margin-top: 4px;
  }
  .time-page .decade-tabs {
    margin-top: 10px;
  }
  .time-page .decade-card {
    margin-top: 10px;
  }
  .time-page .year-chart {
    margin-top: 7px;
  }
  .year-chart__bars {
    height: 22px;
  }
}

/* Shared track feature */
.track-feature__rank {
  position: absolute;
  z-index: 1;
  top: max(96px, 12vh);
  right: max(20px, calc((100vw - var(--content)) / 2));
  color: rgba(245, 238, 226, 0.12);
  font-family: var(--title);
  font-size: clamp(92px, 18vw, 190px);
  line-height: 0.7;
  font-weight: 800;
  letter-spacing: -0.08em;
  pointer-events: none;
}
.scene--hero-feature .first-scrobble__shade {
  background:
    linear-gradient(180deg, rgba(4, 4, 6, 0.7) 0%, transparent 30% 48%, rgba(4, 4, 6, 0.7) 78%, #07080a 100%),
    linear-gradient(90deg, rgba(4, 4, 6, 0.5), transparent 46%),
    radial-gradient(circle at 20% 76%, rgba(168, 162, 255, 0.18), transparent 30%);
}
