/* Key & Cue, curtain up (/welcome/curtain).
   A scroll-led film over the owner's seven photographs, inside the
   Playbill on Brushed Hardware world. The tokens come from welcome.css;
   this page adds only the stage ground the house sits in when the lights
   are down, and the motion.

   Without its script (curtain.js) the page is a quiet stack: each room
   full width with its one line beneath. With the script, one fixed screen
   holds every room; scrolling pushes slowly into the room in view, its
   line rises, and the room flies out upward like a drop on its lines to
   show the next, a gold hairline on the rising edge. With reduced motion
   asked for, the rooms cross-fade in place instead and nothing moves. */

:root {
  /* The house with the lights down: the stage ground under every room. */
  --stage: #11161b;
  --stage-veil: color-mix(in srgb, var(--stage) 78%, transparent);
}

body.curtain {
  background: var(--stage);
  color: var(--cream);
}

/* ── the bar: the owl and the name, and the one door ── */
.c-bar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--s3) + env(safe-area-inset-top)) var(--gutter) var(--s3);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.c-bar.is-shown > * { pointer-events: auto; }
.c-bar.is-shown, .c-bar:focus-within { opacity: 1; }
.c-bar:focus-within > * { pointer-events: auto; }
/* On the last room the foil button is the door; the bar's word steps back. */
.c-bar.is-closing .c-bar-ask { opacity: 0; pointer-events: none; }
.c-bar.is-closing .c-bar-ask:focus-visible { opacity: 1; }
.c-bar-ask { transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1); text-shadow: 0 1px 12px var(--stage); }
/* No script: the bar simply sits at the top of the stack. */
html:not(.c-film) .c-bar { position: absolute; opacity: 1; }
html:not(.c-film) .c-bar > * { pointer-events: auto; }
/* The skip link, above the house curtain. */
.curtain .skip { position: fixed; z-index: 60; }
.c-bar-brand { display: inline-flex; align-items: center; gap: 10px; border-radius: var(--radius-sm); }
.c-bar-brand img { display: block; height: auto; }
.c-bar-ask {
  color: var(--cream-bright);
  font-size: var(--t-sm);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-decoration: none;
  padding: 10px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--gold) 55%, transparent);
}
.c-bar-ask:hover { border-bottom-color: var(--gold); }
.c-bar a:focus-visible, .c-invite a:focus-visible, .c-foot a:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* ── the progress rail: seven ticks on the right, the room in hand in gold ── */
.c-rail {
  position: fixed;
  right: calc(var(--gutter) * 0.5);
  top: 50%;
  z-index: 40;
  display: none;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.c-rail.is-shown { opacity: 1; }
.c-rail li {
  width: 2px;
  height: 18px;
  border-radius: 1px;
  background: color-mix(in srgb, var(--cream) 28%, transparent);
  transition: background 0.5s, height 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.c-rail li.is-on { background: var(--gold); height: 34px; }

/* ── the house curtain: the name before the first room ── */
.c-open {
  min-height: 100svh;
  display: grid;
  place-items: center;
  text-align: center;
  background: var(--stage);
}
.c-open-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s4);
  padding: var(--s6) var(--gutter);
}
.c-owl { width: 96px; height: auto; opacity: 0.94; }
.c-open h1 { margin: 0; line-height: 0; }
.c-word { width: min(280px, 64vw); height: auto; }
.c-open-line {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 300;
  font-style: italic;
  font-size: clamp(var(--t-h2), 2vw, var(--t-display));
  letter-spacing: 0.01em;
  color: var(--nickel);
}
/* The scroll thread: a gold line that draws down, then again. */
.c-thread {
  position: absolute;
  left: 50%;
  bottom: calc(var(--s5) + env(safe-area-inset-bottom));
  width: 1px;
  height: 56px;
  background: linear-gradient(var(--gold), transparent);
  transform-origin: top;
  animation: c-thread 2.8s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
@keyframes c-thread {
  0% { transform: scaleY(0); opacity: 0; }
  30% { opacity: 1; }
  70% { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(1); opacity: 0; }
}

/* ── a room, as a quiet stack (no script, or reduced motion) ── */
.c-scene { position: relative; }
.c-fig { margin: 0; }
.c-fig img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.c-cap { padding: var(--s5) var(--gutter) var(--s7); }
.c-cap h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(var(--t-h1), 4.4vw, 64px);
  line-height: 1.08;
  letter-spacing: -0.012em;
  color: var(--cream-bright);
  text-wrap: balance;
  /* Measured in the line's own size: about two lines of it, never a column. */
  max-width: 12.5em;
}
/* A longer line is set a step smaller, so it still sits low over the room. */
.c-cap.is-long h2 { font-size: clamp(var(--t-h2), 3vw, 44px); max-width: 17em; line-height: 1.14; }
.c-cap h2 em {
  font-style: normal;
  font-weight: 600;
  color: var(--gold);
}

/* ── the invitation ── */
.c-invite { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s4); max-width: 34ch; }
.c-invite-note { margin: 0; color: var(--nickel); font-size: var(--t-sm); }
.c-invite-note a { color: var(--cream); text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--gold) 60%, transparent); margin-left: 6px; }
.c-invite-note a:hover { text-decoration-color: var(--gold); }

.c-foot {
  position: relative;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s4);
  padding: var(--s4) var(--gutter) calc(var(--s4) + env(safe-area-inset-bottom));
  background: var(--stage);
  color: var(--nickel-dim);
  font-size: var(--t-micro);
  letter-spacing: 0.02em;
}
.c-foot a { color: var(--nickel); text-decoration: none; }
.c-foot a:hover { color: var(--cream); }

/* ══ The film (curtain.js sets html.c-film) ═════════════════════════
   One fixed screen. Every room's figure is pinned full-bleed in it, the
   earliest on top; a room's section is only scroll length now. The script
   writes, per room: --lift (0 to 1, the room flying out), --push (0 to 1,
   the slow move in), and the caption's --in and --out. */
html.c-film .c-rail { display: flex; }
html.c-film .c-open {
  position: relative;
  min-height: 160svh;
  display: block;
  background: none;
}
html.c-film .c-open-stage {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 100lvh;
  z-index: 20;
  justify-content: center;
  background: var(--stage);
  transform: translate3d(0, calc(var(--lift, 0) * -100%), 0);
  will-change: transform;
}
html.c-film .c-open-stage > :not(.c-thread) {
  transform: translateY(calc(var(--lift, 0) * -6vh));
  opacity: calc(1 - var(--lift, 0) * 1.6);
}
html.c-film .c-scene { height: 230svh; }
html.c-film .c-scene.c-last { height: 190svh; }
/* Every room stays in the page for a screen reader; a room not in hand is
   simply not painted (flown out above, or waiting unseen). The room in hand
   flies out by a composited move, so an iPad never re-rasters it. */
html.c-film .c-fig {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 100lvh;
  z-index: var(--z, 1);
  overflow: hidden;
  background: var(--stage);
  opacity: 0;
  transform: translate3d(0, calc(var(--lift, 0) * -100%), 0);
}
html.c-film .c-scene.is-live .c-fig { opacity: 1; will-change: transform; }
html.c-film .c-fig img {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  object-position: var(--focus, 50% 50%);
  /* The slow move in: from just over full size, closer as the room is read. */
  transform: scale(calc(1.02 + var(--push, 0) * 0.1)) translate3d(0, calc(var(--push, 0) * -1%), 0);
  transform-origin: var(--focus, 50% 50%);
}
/* The light falls off toward the line, so cream type reads on any room. */
html.c-film .c-fig::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--stage) 52%, transparent) 0%, transparent 22%, transparent 48%, color-mix(in srgb, var(--stage) 72%, transparent) 100%),
    radial-gradient(120% 70% at 18% 100%, color-mix(in srgb, var(--stage) 55%, transparent), transparent 60%);
  pointer-events: none;
}
/* The rising edge: a gold hairline riding the bottom of the room in flight. */
html.c-film .c-fig::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  z-index: 2;
  background: linear-gradient(90deg, transparent, var(--gold) 18%, var(--gold) 82%, transparent);
  opacity: calc(var(--lift, 0) * 30);
  box-shadow: 0 0 18px color-mix(in srgb, var(--gold) 45%, transparent);
}
html.c-film .c-cap {
  position: fixed;
  left: var(--gutter);
  bottom: calc(clamp(56px, 12vh, 120px) + env(safe-area-inset-bottom));
  z-index: 30;
  padding: 0;
  max-width: calc(100vw - var(--gutter) * 2 - 40px);
  pointer-events: none;
  opacity: calc(var(--in, 0) - var(--out, 0));
  /* --foot: how far the footer has come up under the last line. */
  transform: translate3d(0, calc((1 - var(--in, 0)) * 28px - var(--out, 0) * 18px - var(--foot, 0px)), 0);
}
html.c-film .c-scene.is-live .c-cap { pointer-events: auto; will-change: opacity, transform; }
html.c-film .c-cap h2 { text-shadow: 0 1px 24px color-mix(in srgb, var(--stage) 60%, transparent); }
html.c-film .c-invite { max-width: calc(100vw - var(--gutter) * 2 - 40px); }

@media (max-width: 620px) {
  .c-rail { right: 8px; gap: 8px; }
  .c-rail li { height: 12px; }
  .c-rail li.is-on { height: 24px; }
  html.c-film .c-cap { bottom: calc(72px + env(safe-area-inset-bottom)); }
  .c-bar-brand img + img { width: 96px; }
}

/* ── The film is paged: one room a move ──
   The film plays its own scroll, so the browser's smooth scrolling must not
   ease it a second time. The arrow is the one way on, at the foot of the
   screen; the gold thread it replaces stays only for the no-script page. */
html.c-film { scroll-behavior: auto; }
html.c-film .c-thread { display: none; }
.c-next {
  position: fixed;
  left: 50%;
  bottom: calc(var(--s4) + env(safe-area-inset-bottom));
  z-index: 45;
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: -26px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--gold) 70%, transparent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--stage) 45%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: var(--gold);
  cursor: pointer;
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1), transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), background 0.2s, color 0.2s;
}
.c-next[hidden] { display: none; }
.c-next:hover { background: color-mix(in srgb, var(--gold) 18%, var(--stage)); color: var(--cream-bright); }
.c-next:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.c-next svg { animation: c-nudge 2.6s cubic-bezier(0.65, 0, 0.35, 1) infinite; }
/* While the move plays, and on the last room, the arrow steps aside. */
.c-next.is-moving, .c-next.is-end { opacity: 0; transform: translateY(8px); pointer-events: none; }
@keyframes c-nudge {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(3px); }
}
@media (max-width: 620px) {
  /* Clear of the line, which sits low on the left on a phone. */
  .c-next { left: auto; right: var(--gutter); margin-left: 0; bottom: calc(var(--s3) + env(safe-area-inset-bottom)); width: 48px; height: 48px; }
}

/* Reduced motion: the rooms cross-fade in place; nothing moves or scales. */
@media (prefers-reduced-motion: reduce) {
  .c-thread { animation: none; transform: none; opacity: 0.8; }
  .c-next svg { animation: none; }
  html.c-film .c-fig { transform: none; }
  html.c-film .c-scene.is-live .c-fig { opacity: calc(1 - var(--lift, 0)); }
  html.c-film .c-fig::before { display: none; }
  html.c-film .c-fig img { transform: none; }
  html.c-film .c-cap { transform: translate3d(0, calc(var(--foot, 0px) * -1), 0); }
  html.c-film .c-open-stage { transform: none; opacity: calc(1 - var(--lift, 0)); }
  html.c-film .c-open-stage > :not(.c-thread) { transform: none; }
}
