/* Homepage: the wordmark in the viewfinder, then a stack of tapes. */

.home-hero {
  max-width: calc(var(--wide) + 2 * var(--gutter));
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem) var(--gutter) 0;
}

.home-hero__frame {
  --corner: 1.75rem;
  --corner-weight: 3px;
  --corner-inset: clamp(0.75rem, 2vw, 1.125rem);
  display: grid;
  gap: 1.5rem;
  min-height: min(32rem, 66svh);
  grid-template-rows: auto 1fr auto;
  /* Side padding follows the screen width, not the text size, so large text keeps its room. */
  padding: max(clamp(1.75rem, 5vw, 3.25rem), var(--corner-clearance)) min(clamp(1.75rem, 5vw, 3.25rem), 5vw);
}

/* Let the contents wrap to the frame's width instead of pushing past it. */
.home-hero__frame > * {
  min-width: 0;
}

/* On phones the wordmark is small, so the frame shouldn't be mostly empty. */
@media (max-width: 40rem) {
  .home-hero__frame {
    min-height: 21rem;
  }
}

.home-hero__body {
  align-self: center;
}

.home-hero__osd {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 0;
  font-size: 1.25rem;
  color: var(--ink-muted);
}

.home-hero__rec {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  color: var(--ink);
}

.home-hero__rec::before {
  content: "";
  width: 0.65em;
  height: 0.65em;
  border-radius: 50%;
  background: var(--rec);
  animation: rec-blink 1s steps(1) 3;
}

@keyframes rec-blink {
  50% { opacity: 0; }
}

.home-hero__title {
  margin: 0;
  /* Capped by the screen width too, so the wordmark always fits, even with large text. */
  font-size: min(clamp(3rem, 0.5rem + 11vw, 11rem), 13vw);
  font-weight: 800;
  line-height: 1;
}

.home-hero__dek {
  max-width: 30rem;
  margin: 1rem 0 0;
  font-size: clamp(1.25rem, 1.05rem + 0.6vw, 1.5rem);
  line-height: 1.45;
}

.home-hero__stamp {
  justify-self: end;
  margin: 0;
  font-size: 1.25rem;
  color: var(--ink-muted);
}

/* The newest take, "in the deck": inside the first screen, so even people who
   never scroll see it and can play it. The wordmark gives it some room. */

.home-hero--deck .home-hero__title {
  font-size: min(clamp(2.75rem, 0.5rem + 8vw, 8rem), 12vw);
}

.home-hero__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem 2rem;
}

/* The deck can shrink to the frame's width, and wraps rather than overflowing. */
.home-hero__foot > * {
  min-width: 0;
}

.now-playing {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: start;
  gap: 0.5rem;
  max-width: 34rem;
  padding: 1.25rem min(1.5rem, 4vw) 1.5rem;
  border-radius: 0.6rem;
  background: rgb(0 0 0 / 0.35);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.14);
}

.now-playing__osd {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5em;
  margin: 0;
  font-size: 1.125rem;
}

.now-playing__light {
  width: 0.65em;
  height: 0.65em;
  border-radius: 50%;
  background: var(--rec);
  box-shadow: 0 0 0.4em rgb(255 70 50 / 0.7);
  animation: rec-blink 2s steps(1) infinite;
}

.now-playing__title {
  margin: 0.25rem 0 0;
  font-family: var(--font-display);
  font-size: min(clamp(1.75rem, 1.2rem + 2vw, 3rem), max(9vw, 1.25rem));
  font-stretch: 85%;
  font-weight: 750;
  line-height: 1.02;
  text-wrap: balance;
}

.now-playing__summary {
  max-width: 30rem;
  margin: 0;
  color: var(--ink-muted);
}

.now-playing__play {
  margin-top: 0.75rem;
  text-decoration: none;
}

/* The shelf: tapes stacked on their sides, spines out. */

.shelf {
  max-width: calc(var(--wide) + 2 * var(--gutter));
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 6rem) var(--gutter) clamp(3rem, 7vw, 5rem);
}

.shelf__head {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
}

.shelf__heading {
  margin: 0;
  font-family: var(--font-display);
  /* On phones with large text, stays above body text but below the page title. */
  font-size: min(clamp(1.75rem, 1.3rem + 1.5vw, 2.5rem), max(9vw, 1.25rem));
  font-stretch: 85%;
  font-weight: 750;
  line-height: 1;
}

.shelf__intro {
  max-width: 28rem;
  margin: 0;
  font-size: 1rem;
  color: var(--ink-muted);
}

.shelf__list {
  display: grid;
  gap: 0.375rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.spine {
  display: block;
  padding: 0.55rem 2.75rem 0.55rem 0.55rem;
  border-radius: 0.4rem;
  background:
    linear-gradient(to right, transparent calc(100% - 2rem), rgb(255 255 255 / 0.06) calc(100% - 2rem) calc(100% - 1.85rem), transparent calc(100% - 1.85rem)),
    var(--shell);
  box-shadow:
    inset 0 0 0 1px var(--shell-edge),
    0 0.5rem 1rem -0.5rem rgb(0 0 0 / 0.35);
  color: var(--paper-ink);
  text-decoration: none;
  transition: transform 260ms cubic-bezier(0.3, 0.7, 0.2, 1);
}

a.spine:hover,
a.spine:focus-visible {
  transform: translateX(1rem);
}

a.spine:focus-visible {
  outline-offset: 4px;
}

.spine__label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "number title date"
    "number summary date";
  align-items: center;
  gap: 0.25rem 1.25rem;
  padding: 0.85rem 1.25rem 0.95rem 1rem;
  border-left: 0.9rem solid var(--tape);
  border-radius: 0.2rem;
  background: var(--paper);
  --tracking-color: var(--paper-ink);
}

.spine__number {
  grid-area: number;
  display: grid;
  justify-items: center;
  padding-right: 1.25rem;
  border-right: 1px solid var(--paper-rule);
  font-family: var(--font-display);
  font-size: 2rem;
  font-stretch: 80%;
  font-weight: 800;
  line-height: 1;
  align-self: stretch;
  align-content: center;
}

.spine__number-name {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--paper-muted);
}

.spine__title {
  grid-area: title;
  font-size: clamp(2rem, 1.6rem + 1.2vw, 2.75rem);
  text-wrap: balance;
}

.spine__summary {
  grid-area: summary;
  max-width: 34rem;
  font-size: 1rem;
  color: var(--paper-muted);
}

.spine__date {
  grid-area: date;
  font-size: 1.75rem;
  white-space: nowrap;
}

a.spine:hover .spine__title {
  text-decoration: underline;
  text-decoration-thickness: 0.05em;
  text-underline-offset: 0.15em;
}

/* Each tape's own label colour. Take 01 uses the default marigold. */
.spine--take-02 {
  --tape: #8ec5d6;
}

.spine--take-03 {
  --tape: #c2b5e8;
}

.spine--take-04 {
  --tape: #9fd3b0;
}

.spine--take-05 {
  --tape: #f0a89c;
}

/* Pulling a tape out: a short roll of tracking noise across the label. */
a.spine:hover .spine__label::after,
a.spine:focus-visible .spine__label::after {
  animation: tracking-roll 460ms steps(7) both;
}

.spine--blank {
  margin-left: 1.25rem;
}

.spine--blank .spine__label {
  grid-template-areas: "number title";
  grid-template-columns: auto minmax(0, 1fr);
  border-left-color: var(--paper-rule);
}

.spine--blank .spine__title {
  color: var(--paper-muted);
}

@media (max-width: 40rem) {
  .spine {
    padding: 0.4rem 1rem 0.4rem 0.4rem;
    background: var(--shell);
  }

  .spine--blank {
    margin-left: 0.5rem;
  }

  .spine__label {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "number"
      "title"
      "summary"
      "date";
    gap: 0.5rem;
    padding: 0.75rem 0.9rem 0.85rem 0.75rem;
    border-left-width: 0.6rem;
  }

  /* Capped by the screen width, so long words fit at large text sizes. */
  .spine__title {
    font-size: min(1.875rem, 9vw);
  }

  .spine__date {
    justify-self: start;
  }

  .spine__number {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    padding: 0;
    border: 0;
  }

  .spine--blank .spine__label {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "number"
      "title";
  }
}

@media (prefers-reduced-motion: reduce) {
  .now-playing__light,
  .home-hero__rec::before,
  a.spine:hover .spine__label::after,
  a.spine:focus-visible .spine__label::after {
    animation: none;
  }

  .spine {
    transition: none;
  }
}
