/* Last Train background, dusty rose accent. Dark-only by design. Documented in DESIGN.md; keep the two in sync.
   Layout: a 12-column editorial grid. The page opens on film from a real dinner; after that, sections are
   physical objects from the dinner (the card, the letter) placed off-centre with generous space. */
:root {
  --bg: #17151c;
  --raise: #1f1c25;
  --glow: #251f29;
  --ink: #efe7e2;
  --muted: #a1979f;
  --line: #2e2a35;
  --accent: #d9a5b8;
  --paper: #231f2a;
  --paper-under: #1d1a23;
  --display: "Fraunces", Georgia, serif;
  --body: "Figtree", system-ui, sans-serif;
  --max: 1320px;
  --gutter: clamp(16px, 4vw, 56px);
  --gap: clamp(12px, 2vw, 28px);
  --section: clamp(88px, 12vw, 176px);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
/* `hidden` must always win, even over components that set their own display (e.g. .field is a grid). */
[hidden] { display: none !important; }

body {
  background: radial-gradient(110% 60% at 80% 0%, var(--glow) 0%, var(--bg) 62%) no-repeat, var(--bg);
  color: var(--ink);
  font: 400 17px/1.65 var(--body);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
a, button, input, textarea { -webkit-tap-highlight-color: transparent; }
a:focus-visible, input:focus-visible, textarea:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
footer a, .legal a { overflow-wrap: anywhere; }
img { display: block; max-width: 100%; height: auto; }

.wrap { max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.grid {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap);
  max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter);
}
.grid > * { grid-column: 1 / -1; min-width: 0; }

/* Page-level bands only; sections nested inside them (like the apply form's steps) keep no padding. */
main > section { padding-block: var(--section); }

h1, h2 { font-family: var(--display); font-weight: 300; text-wrap: balance; }
h1 { font-size: clamp(40px, 5.4vw, 78px); line-height: 1.02; letter-spacing: -.018em; }
h1 em, h2 em { font-style: italic; color: var(--accent); }
h2 { font-size: clamp(30px, 3.4vw, 46px); line-height: 1.08; letter-spacing: -.01em; margin-bottom: 22px; }

/* ---------- Header ---------- */
.topbar { display: flex; justify-content: space-between; align-items: center; padding-block: 28px; }
/* On the home page the header sits on the film instead of above it. */
.topbar.over-film { position: absolute; top: 0; left: 0; right: 0; z-index: 2; }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 500 18px var(--display); color: var(--ink); text-decoration: none; letter-spacing: .01em; }
.brand-mark { width: auto; height: 24px; }
.navlink { color: var(--ink); opacity: .8; text-decoration: none; font-size: 15px; }
.navlink:hover { opacity: 1; }
.navlink .short { display: none; }

/* ---------- Buttons and links ---------- */
.btn {
  display: inline-flex; align-items: center; padding: 15px 26px; border: 0; border-radius: 2px;
  background: var(--accent); color: var(--bg); font: 500 15px var(--body); letter-spacing: .01em;
  text-decoration: none; cursor: pointer; transition: filter .2s;
}
.btn:hover { filter: brightness(1.07); }
.textlink { color: var(--ink); font-size: 15px; text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 2px; transition: border-color .2s; }
.textlink:hover { border-color: var(--accent); }

/* ---------- Hero: film from a real dinner, full width, with the headline set on its lower edge ---------- */
.hero-film {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: clamp(620px, 94svh, 1000px); display: grid; align-items: end;
}
.hero-film video { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; }
/* Darkens the top for the header and the left for the headline (the candle shot is nearly white), keeps the
   right of the film clear, and dissolves the bottom into the page. */
.hero-film::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(to bottom, rgb(23 21 28 / .6) 0%, rgb(23 21 28 / 0) 20%, rgb(23 21 28 / 0) 45%, rgb(23 21 28 / .7) 78%, var(--bg) 100%),
    linear-gradient(to right, rgb(23 21 28 / .72) 0%, rgb(23 21 28 / .45) 38%, rgb(23 21 28 / 0) 66%);
}
/* The film covers the background glow, so the page below it is plain --bg and meets the film's last row seamlessly. */
body:has(.hero-film) { background: var(--bg); }
main > .hero-film { padding-block: 0; }
.hero-film-copy { width: 100%; padding-bottom: clamp(56px, 8vw, 120px); }
.hero-copy { grid-column: 1 / span 8; }
.hero-copy h1 { font-size: clamp(42px, 6vw, 92px); max-width: 13em; text-shadow: 0 2px 30px rgb(23 21 28 / .5); }
.lede { color: var(--ink); opacity: .84; font-size: 19px; max-width: 30em; margin-top: 24px; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 28px; margin-top: 36px; }

/* ---------- Photos and clips ---------- */
.photo { margin: 0; overflow: hidden; background: var(--raise); }
.photo img, .photo video { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo-placeholder {
  display: grid; align-content: end; gap: 8px; padding: clamp(16px, 3vw, 32px);
  background: repeating-linear-gradient(135deg, var(--raise) 0 14px, #221f29 14px 15px);
  border: 1px dashed #4a4252;
}
.photo-file { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.photo-shot { font-size: 14px; color: var(--muted); max-width: 46ch; }

/* ---------- Details: a statement of purpose, then principles in a ruled list offset to the right ---------- */
.details { row-gap: clamp(48px, 7vw, 96px); }
.details-lead {
  grid-column: 1 / span 9;
  font: 300 clamp(28px, 3.3vw, 46px)/1.22 var(--display); letter-spacing: -.01em; text-wrap: pretty;
}
.details-lead em { font-style: italic; color: var(--accent); }
.details { align-items: start; }
.details-clip { grid-column: 1 / span 4; aspect-ratio: 4 / 5; }
.details-list { grid-column: 6 / span 7; border-bottom: 1px solid var(--line); }
.detail {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); column-gap: var(--gap);
  padding-block: 26px; border-top: 1px solid var(--line);
}
.detail dt { font: 400 clamp(20px, 1.9vw, 24px)/1.3 var(--display); }
.detail dd { color: var(--muted); font-size: 16px; }

/* ---------- The card: copy left, the metal card right ---------- */
.card-section { align-items: center; row-gap: 32px; }
.card-copy { grid-column: 1 / span 5; }
.card-copy p { color: var(--muted); max-width: 34ch; }
.card-object { grid-column: 7 / span 6; display: grid; justify-items: center; }
.card-object .card-stage { width: 100%; }

/* ---------- House rules: copy left, a printed rules card right ---------- */
.rules-section { align-items: start; row-gap: 40px; }
.rules-copy { grid-column: 1 / span 5; padding-top: 24px; }
.rules-copy p { color: var(--muted); max-width: 36ch; }
.rules {
  grid-column: 7 / span 6; padding: clamp(36px, 5vw, 64px) clamp(24px, 4vw, 56px);
  border-block: 3px double var(--line);
}
.rules-title { text-align: center; font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); margin-bottom: 40px; }
.rules-list { list-style: none; counter-reset: rule; display: grid; gap: 30px; }
.rules-list li { counter-increment: rule; display: grid; grid-template-columns: 2.4em minmax(0, 1fr); column-gap: 12px; row-gap: 4px; }
.rules-list li::before { content: counter(rule, upper-roman) "."; grid-row: 1 / span 2; font: italic 400 18px/1.35 var(--display); color: var(--accent); text-align: right; }
.rules-list b { font: 400 clamp(21px, 2vw, 25px)/1.3 var(--display); }
.rules-list span { color: var(--muted); font-size: 15px; }

/* ---------- Host: portrait and letter overlap by one column ---------- */
.host { align-items: start; isolation: isolate; overflow-x: clip; }
.host-portrait { grid-column: 1 / span 5; grid-row: 1; margin: 0; }
.host-portrait img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: 40% 30%; }
.host-portrait figcaption { margin-top: 12px; font-size: 13px; color: var(--muted); }
/* The letter is the top sheet of a small stack: dark paper a shade above the page, with two sheets
   peeking out underneath at slight angles. */
.letter {
  grid-column: 5 / span 8; grid-row: 1; position: relative; margin-top: clamp(56px, 10vw, 160px);
  background: var(--paper); color: var(--ink);
  padding: clamp(28px, 5vw, 72px); box-shadow: 0 30px 70px -30px rgba(0, 0, 0, .7);
}
.letter::before, .letter::after {
  content: ""; position: absolute; inset: 0; z-index: -1; background: var(--paper-under);
  box-shadow: 0 20px 50px -30px rgba(0, 0, 0, .6);
}
.letter::before { transform: rotate(-2.2deg) translate(-10px, 6px); }
.letter::after { transform: rotate(1.6deg) translate(10px, 12px); }
.letter-from { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-bottom: 26px; }
.letter-body { font: 400 19px/1.7 var(--display); max-width: 36em; }
.letter-body p + p { margin-top: 18px; }
.letter-sign { margin-top: 32px; display: grid; gap: 2px; }
.signature { width: clamp(230px, 30vw, 320px); height: auto; margin-block: 4px 6px; }
.signed-name { font-size: 14px; color: var(--muted); }

/* ---------- Seat dots (event pages): one per seat, filled when taken ---------- */
.seats { display: flex; gap: 7px; }
.seat { width: 10px; height: 10px; border-radius: 50%; border: 1px solid #5a5160; }
.seat.taken { background: var(--accent); border-color: var(--accent); }

/* ---------- FAQ: same ruled list as the details section, question above answer ---------- */
.faq { padding-top: 0; }
.faq-title { grid-column: 1 / span 4; }
.faq-list { grid-column: 5 / span 8; border-bottom: 1px solid var(--line); }
.faq-item { padding-block: 24px; border-top: 1px solid var(--line); }
.faq-item dt { font: 400 clamp(19px, 1.8vw, 22px)/1.35 var(--display); margin-bottom: 6px; }
.faq-item dd { color: var(--muted); max-width: 40em; }

/* ---------- Closing ---------- */
.closing { padding-top: 0; }
.closing h2 { grid-column: 1 / span 8; font-size: clamp(34px, 4.6vw, 64px); margin-bottom: 36px; }
.closing-actions { grid-column: 1 / span 8; display: flex; flex-wrap: wrap; align-items: center; gap: 14px 28px; }
.closing-actions p { color: var(--muted); font-size: 15px; }

/* ---------- Fine print ---------- */
.fineprint { border-top: 1px solid var(--line); padding-block: 56px; row-gap: 16px; font-size: 14px; color: var(--muted); }
.fineprint h2 { grid-column: 1 / span 3; font: 500 14px var(--body); letter-spacing: 0; color: var(--ink); margin: 0; }
.fineprint p { grid-column: 4 / span 4; }
.fineprint p + p { grid-column: 8 / span 4; }
.fineprint strong { color: var(--ink); font-weight: 500; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
label { font-size: 14px; color: var(--muted); }
/* Every text-like control shares one look; :where keeps specificity at zero so components can restyle them. */
:where(input:not([type=checkbox], [type=radio], [type=hidden]), select, textarea) {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  background-color: var(--bg); border: 1px solid var(--line); border-radius: 2px; padding: 11px 14px;
}
:where(input:not([type=checkbox], [type=radio], [type=hidden]), select, textarea):focus { border-color: var(--accent); outline: none; }
textarea { resize: vertical; }
select {
  padding-right: 40px; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(-45deg, transparent 50%, var(--muted) 50%);
  background-position: right 20px center, right 15px center; background-size: 5px 5px; background-repeat: no-repeat;
}
input:-webkit-autofill, textarea:-webkit-autofill { -webkit-text-fill-color: var(--ink); box-shadow: 0 0 0 100px var(--bg) inset; caret-color: var(--ink); }
/* Rails wraps fields that have errors in div.field_with_errors; keep it out of the layout. */
.field_with_errors { display: contents; }
.field-error { color: var(--accent); font-size: 14px; }

/* ---------- Legal page ---------- */
.legal h2 { font-size: 22px; }
.legal dl { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 10px 24px; font-size: 14px; max-width: 820px; }
.legal dt { color: var(--muted); }
.legal .prose { max-width: 720px; font-size: 15px; line-height: 1.65; }
.legal .prose h3 { font: 500 17px var(--body); margin: 36px 0 10px; }
.legal .prose p + p, .legal .prose ul + p { margin-top: 12px; }
.legal .prose ul { padding-left: 20px; display: grid; gap: 8px; }
.legal .updated { color: var(--muted); font-size: 14px; margin-bottom: 20px; }

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--line); padding-block: 40px 56px; font-size: 14px; color: var(--muted); }
footer p + p { margin-top: 4px; }

/* ---------- Tablet and phone ---------- */
@media (max-width: 900px) {
  .hero-copy, .card-copy, .card-object, .details-lead, .details-list, .faq-title, .faq-list, .rules-copy, .rules,
  .host-portrait, .letter, .closing h2, .closing-actions, .fineprint h2, .fineprint p, .fineprint p + p { grid-column: 1 / -1; }
  .details-clip { grid-column: 1 / span 8; }
  .rules-copy { padding-top: 0; }
  .host-portrait { width: 78%; }
  .letter { grid-row: 2; margin-top: -72px; }
  .legal dl { grid-template-columns: 1fr; gap: 2px; }
  .legal dd { margin-bottom: 12px; }

}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .topbar { padding-block: 18px; }
  .navlink { opacity: 1; font-size: 14px; font-weight: 500; padding: 9px 16px; border: 1px solid var(--line); border-radius: 2px; }
  .navlink .long { display: none; }
  .navlink .short { display: inline; }
  .lede { font-size: 17px; }
  .hero-film { min-height: 88svh; }
  .details-clip { grid-column: 1 / span 10; }
  .letter-body { font-size: 17px; }
  .host-portrait { width: 88%; }
  .detail { grid-template-columns: 1fr; row-gap: 6px; padding-block: 22px; }
}
