/* archive.css: the archive (T10d). Loaded after main.css and alive.css, on
   archive.html only. Its script is archive.js, which builds the roll and the
   list of nights from the CMS.

   The page, top to bottom:
   1. The hero: the page's own "Past nights", "Archive" and its line of text,
      low on the first screen over Axel's glow, the first photo showing under
      it.
   2. The roll: every photo, one after another, on black. Each carries its
      night's name in its own corner (it sticks to the foot of the screen
      while its photo is there), and the photo's number, 003 / 042, on the
      right of it.
   3. The end: the roll's black fades back into the page, then the footer.
      Or, when its switch in the CMS is on, the nights: a plain list, name,
      city, date, Axel's words (off by default, archive.html).

   The roll is round 2's (tag version/round2) made calm, after Teletech's
   archive: no stacking, no red edge, no snapping, no name flying in. The one
   movement is light, the site's own: each photo comes up out of the dark as
   it enters, the way every heading turns from grey to white. */

/* A photo above the screen that finds its shape would move the page; archive.js
   holds the view still itself (the browser's scroll anchoring would add the
   same correction a second time, and Safari has none). */
html:has(.arc-page) {
  overflow-anchor: none;
}

/* ---- 1. The hero -------------------------------------------------------- */
/* Most of the first screen, the words at its foot like the home page's
   wordmark; the top of the first photo shows below, so the page says what
   comes next without a "scroll" cue. */
.arc-hero {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 82svh;
  padding-bottom: clamp(2.5rem, 7vw, 4.5rem);
}

.arc-hero h1 {
  margin: 0.05em 0 0.12em;
  font-size: clamp(4.25rem, 14vw, 11rem);
  line-height: 0.86;
}

.arc-hero .copy {
  max-width: 34rem;
}

@media (max-width: 640px) {
  .arc-hero {
    min-height: 74svh;
  }
}

/* ---- 2. The roll -------------------------------------------------------- */
.arc-roll {
  position: relative;
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
  background: #000;
  /* Room held for the photos while the CMS answers, so the footer does not
     sit up under the hero and then drop away. */
  min-height: 100svh;
}

/* Axel's glow goes down into the black of the roll instead of stopping at a
   line (round 2's fix). */
.arc-roll::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: min(16rem, 30svh);
  background: linear-gradient(to bottom, transparent, #000);
  pointer-events: none;
}

/* One photo. Its height comes from its shape (data-fit, archive.js):
   fill     one screen, the photo cropped to fill it; on a phone every photo,
            however wide, the way Teletech's archive does it
   natural  full width at the photo's own height (a panorama on a computer)
   whole    one screen, the whole photo on black (a poster on a computer) */
.arc-slide {
  position: relative;
  height: 100svh;
}

.arc-slide[data-fit="natural"] {
  height: auto;
  aspect-ratio: var(--ratio, 1.5);
  max-height: 100svh;
}

.arc-slide__figure {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  margin: 0;
}

/* The photo's frame. It opens nothing (the viewer is gone), so no pointer. */
.arc-slide__frame {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #000;
}

.arc-slide__photo {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: 50% 45%;
}

.arc-slide[data-fit="whole"] .arc-slide__photo {
  object-fit: contain;
  object-position: 50% 50%;
}

/* The dark a photo comes up out of. Still page: not there at all. */
.arc-slide__shade {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
}

/* The corner. It sits at the foot of its own photo and sticks to the foot of
   the screen while the photo reaches below it, so the name always stands on
   the photo it belongs to: the one filling the screen, or, on a phone, the
   one at the bottom. The name and the date on the left, the photo's number
   on the right of the date's line, so name and number ride on one photo.
   The corner's box is only its words: archive.js reads its height to know
   when a photo has enough of itself on the screen to take the corner. */
.arc-slide__corner {
  position: sticky;
  z-index: 1;
  bottom: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.3rem 1rem;
  margin: 0;
  /* Lined up with the page's column (.wrap), both edges. */
  padding: 0 var(--gutter-right) max(1.15rem, var(--inset-bottom)) var(--gutter-left);
  pointer-events: none;
}

/* A soft shade behind the words keeps them readable on any photo. It fades up
   from the photo's foot to 3.5rem above the name, outside the corner's box,
   so it does not count in the height archive.js reads. */
.arc-slide__corner::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(100% + 3.5rem);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.22) 55%, transparent);
}

/* Only one corner at a time: the photo at the foot of the screen, and only
   while the roll fills that foot (archive.js puts .is-on on the roll and
   .is-foot on the photo). The shade and the number go with the name, so the
   photos above stay clean. */
.arc-slide__corner {
  opacity: 0;
  transition: opacity 0.25s ease;
}

.arc-roll.is-on .arc-slide.is-foot .arc-slide__corner {
  opacity: 1;
}

@media (min-width: 1168px) {
  .arc-slide__corner {
    padding-left: calc((100% - var(--content)) / 2);
    padding-right: calc((100% - var(--content)) / 2);
  }
}

.arc-slide__name {
  grid-column: 1 / -1;
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 1.5vw, 1.35rem);
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--text);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.6);
}

.arc-slide__when {
  grid-column: 1;
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: rgba(244, 244, 244, 0.78);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.7);
}

/* The photo's number: which photo, of how many, in the typewriter type round
   2 gave the archive's numbers, on the date's line at the column's right. */
.arc-slide__count {
  grid-column: 2;
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  font-variant-numeric: tabular-nums;
  color: rgba(244, 244, 244, 0.6);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.7);
  white-space: nowrap;
}

.arc-slide__now {
  color: var(--text);
}

/* The roll could not load, or the page has no script. */
.arc-note {
  padding-block: var(--rhythm-loose);
  color: var(--muted-strong);
}

/* ---- The light ----------------------------------------------------------
   unveil: the shade over a photo lifts as the photo comes onto the screen.
   Light only, so both of alive.js's drivers may play it (alive.css, point 4). */
@keyframes arc-unveil {
  from { opacity: 0.6; }
  to { opacity: 0; }
}

@media (prefers-reduced-motion: no-preference) {
  html.alive [data-alive="unveil"] {
    animation-name: arc-unveil;
  }
}

/* ---- 3. The end --------------------------------------------------------- */
/* After the last photo the room's light comes back: the black of the roll
   fades into the page and Axel's glow, and the footer follows, instead of the
   footer starting right under a photo. Tall enough for the glow to rise
   between the roll's fade and the glow's own fade-out above the footer
   (main.css): at the list's 16rem it stayed nearly black. The list of
   nights, when it shows, has a fade at its own top, so then this one steps
   aside. */
.arc-end {
  height: 45svh;
  background: linear-gradient(to bottom, #000, transparent);
  pointer-events: none;
}

.arc-page:has(.arc-nights-switch:not([hidden])) .arc-end,
.arc-page:not(:has(.arc-roll)) .arc-end {
  display: none;
}

/* ---- 4. The nights (its CMS switch on) ----------------------------------- */
/* After the roll the room's light comes back: the black of the roll fades
   into the page and Axel's glow. */
.arc-nights-section {
  position: relative;
  padding: var(--rhythm-section) 0 var(--rhythm-loose);
}

.arc-nights-section::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: min(16rem, 30svh);
  background: linear-gradient(to bottom, #000, transparent);
  pointer-events: none;
}

.arc-nights-section .wrap {
  position: relative;
}

.arc-nights {
  margin: clamp(1.5rem, 4vw, 2.5rem) 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border-strong);
}

/* Each night: its name and the facts on the left, Axel's words on the right.
   A phone stacks them. */
.arc-night {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 1rem clamp(2rem, 5vw, 4rem);
  padding: clamp(1.5rem, 3vw, 2.25rem) 0;
  border-bottom: 1px solid var(--border-strong);
}

.arc-night__name {
  margin: 0;
  /* An h3 in the page's outline, set like the site's h2s. */
  font-family: var(--font-display);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: clamp(1.75rem, 3.2vw, 2.6rem);
  line-height: 0.95;
  text-wrap: balance;
}

.arc-night__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0.75rem 0 0;
  color: var(--muted-strong);
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  font-variant-numeric: tabular-nums;
}

.arc-night__words {
  max-width: 38rem;
  margin: 0;
  color: var(--muted-strong);
  font-size: var(--fs-body);
  line-height: 1.65;
}

.arc-night__credit {
  margin: 0.85rem 0 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
}

@media (max-width: 760px) {
  .arc-night {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .arc-slide__corner {
    transition: none;
  }
}
