/* Round 2 (T9), the home page: the room. Loaded after main.css and the kit
   (room.css), on the home page only. The scene's script is room-home.js.

   Two states, and the first one is the safety net:

   1. The plain page (no script, Reduce Motion, or GSAP failed to load): the
      hero as it always was, then the statement as a big block on black with a
      still red light behind it, then the About copy. Everything readable.
   2. .room.room-live, set by room-home.js once the scene has started: the
      statement lies over the hero, the room is pinned, and the scroll drives
      the push-in, the red light and the words switching on. */

/* ---- The statement, plain ------------------------------------------------ */

.room {
  position: relative;
}

.room__say {
  position: relative;
  overflow: hidden;
  padding: var(--rhythm-section) 0 clamp(1.5rem, 4vw, 2.5rem);
  isolation: isolate;
}

/* A still lamp from the upper left, the plain page's share of the red. */
.room__say::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -20% 20% 0 -30%;
  background: radial-gradient(closest-side, rgba(227, 6, 19, 0.34), rgba(227, 6, 19, 0.08) 55%, transparent 100%);
  pointer-events: none;
}


.room__label {
  margin-bottom: clamp(0.9rem, 2vw, 1.4rem);
}

/* Bebas at the size of the room. The two sentences are two lines (room.js
   splits them; without script they simply wrap). Left-aligned on the page
   edge: a sign on a wall, not a centred slogan. */
.room__statement.about-statement {
  margin: 0;
  max-width: none;
  /* On the page grid (.wrap), as wide as the grid allows: the longer line,
     "People make the room.", measures 7.77em of Bebas, so the size is the
     grid's width over 8 (one line each on a computer, capped where the grid
     stops growing). Phones get four lines. */
  font-size: clamp(3.3rem, calc((100vw - 3rem) / 8), 8.75rem);
  line-height: 0.88;
  letter-spacing: 0.012em;
  color: var(--text);
  text-wrap: balance;
}

/* ---- The About copy, in the room ------------------------------------------ */

/* On the grid's left line, straight under the statement: the eye drops from
   the headline into the copy, and they leave the room together. */
.room__copy {
  width: min(100%, 36rem);
  margin-top: clamp(1.75rem, 3.4vw, 2.75rem);
}

.room__copy .about-body p.copy {
  color: var(--muted-strong);
  font-size: clamp(1rem, 1.25vw, 1.12rem);
  line-height: 1.7;
}

/* The About media row after the room takes no space while it is empty. */
.room-after:has(.about-media[hidden]) {
  display: none;
}

.room-after {
  padding-top: clamp(2.5rem, 6vw, 5rem);
}

/* data-lift's fade-up on every block is the generic move round 2 drops: the
   moments that move are named ones (the room, the artists' slit, the headings
   lighting up). Everything else simply stands there. */
.page-home [data-lift],
.page-home [data-lift].is-lifted {
  opacity: 1;
  translate: none;
  animation: none;
}

/* ---- Live: the scene -------------------------------------------------------- */

.room.room-live {
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background: var(--bg);
}

.room.room-live .hero {
  position: absolute;
  inset: 0;
  min-height: 0;
  height: 100%;
  /* The pushed-in clip is its own layer, far larger than the room. When the
     pin lets go, ScrollTrigger leaves the room 0.001px off the pixel grid and
     the layer's clip rounded one row of untinted video past the room's edge.
     Clipping the hero 2px short (black there anyway) takes that row away. */
  clip-path: inset(0 0 2px 0);
}

/* The clip is pushed in by scaling the whole background, from a point low in
   the frame: toward the crowd, so a row of heads stays along the bottom while
   the trees and the sky leave the top. */
.room.room-live .hero__bg {
  transform-origin: 50% 80%;
  will-change: transform;
}

/* The floor of the room: as the scene lets go, its bottom edge dissolves into
   the page instead of leaving as a lit rectangle. */
.room.room-live::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  /* 2px past the edge: the pushed-in clip is opaque right down to the room's
     bottom, and a rounding gap let one line of it through. */
  bottom: -2px;
  /* Under the statement (3): the words leave lit, only the room fades. */
  z-index: 2;
  height: 38%;
  background: linear-gradient(to bottom, transparent, var(--bg));
  opacity: var(--room-floor, 0);
  pointer-events: none;
}

/* The statement over the room, on the page's left edge, a little under the
   middle: where the eye lands once the wordmark has flown to the header. */
.room.room-live .room__say {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  padding: var(--header-height) 0 clamp(2rem, 6vh, 4rem);
  overflow: visible;
  pointer-events: none;
}

.room.room-live .room__say::before {
  display: none;
}

.room.room-live .room__say-inner {
  padding-top: 2vh;
}

.room.room-live .room__statement {
  text-shadow: 0 0.04em 0.5em rgba(0, 0, 0, 0.45);
}

/* The overlay lets scroll and clicks through to the page; the copy's link
   takes them back. */
.room.room-live .room__copy {
  pointer-events: auto;
}

/* ---- One left line ----------------------------------------------------------
   The statement set the page's left edge; every heading after it keeps it,
   instead of the centred headings of the live page. */
.page-home .section-head--center {
  justify-items: start;
  max-width: none;
  margin-inline: 0;
  text-align: left;
}

.page-home .mail-cta {
  justify-items: start;
  max-width: none;
  text-align: left;
}

.page-home .mail-cta h2 {
  text-wrap: balance;
}

.page-home .mail-cta .copy,
.page-home .mail-cta .hero-mail-form {
  margin-inline: 0;
}

/* ---- The artists ----------------------------------------------------------- */

/* The heading belongs to the photos: on the same screen, close above them. */
.page-home #residents .section-head--center {
  margin-bottom: clamp(1.25rem, 2.6vw, 2rem);
}

.page-home #residents .resident-cards {
  margin-top: 0;
}

/* Out of the room and among the people: the two portraits as large as the
   content allows, the name set into the bottom of the frame, and the red as a
   rim of light that comes on as each one opens. */
.page-home .resident-cards {
  max-width: none;
  gap: clamp(1rem, 2.4vw, 2rem);
}

.page-home .resident-card {
  position: relative;
  align-items: stretch;
}

.page-home .resident-card__img-wrap {
  aspect-ratio: 4 / 5;
  border: 0;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 1px rgba(255, 26, 40, 0.18), 0 2.5rem 6rem -2rem rgba(227, 6, 19, 0.45);
}

.page-home .resident-card__img-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(3, 3, 3, 0.82) 0%, rgba(3, 3, 3, 0.2) 34%, transparent 55%);
  pointer-events: none;
}

.page-home .resident-card__name {
  position: absolute;
  z-index: 1;
  left: clamp(1rem, 2.4vw, 1.75rem);
  bottom: clamp(0.6rem, 1.6vw, 1.2rem);
  font-size: clamp(3rem, 6.4vw, 6rem);
  line-height: 0.9;
  letter-spacing: 0.02em;
  text-align: left;
}

@media (max-width: 640px) {
  /* Bigger on a phone, four lines filling the width, in the middle of the
     screen where the thumb has carried you. */
  .room__statement.about-statement {
    font-size: min(18vw, 5rem);
  }

  .room.room-live .room__beam {
    width: 62vw;
  }

  .room.room-live .room__say {
    align-items: flex-start;
    padding-top: calc(var(--header-height) + 4vh);
  }

  .room.room-live .room__say-inner {
    padding-top: 0;
  }

  .room__copy {
    margin-top: 1.25rem;
  }

  .room__copy .about-body p.copy {
    font-size: 0.95rem;
    line-height: 1.6;
  }

  .page-home .resident-card__name {
    font-size: clamp(3.4rem, 17vw, 4.5rem);
  }
}
