/* 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. Sections are physical objects from the dinner (card, house rules,
   letter) placed off-centre with generous space, rather than stacked bands of equal weight. */
: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; }
.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: headline left, the card as the hero object right ---------- */
.hero { padding-block: clamp(40px, 7vw, 104px) clamp(72px, 10vw, 144px); align-items: center; row-gap: 56px; }
.hero-copy { grid-column: 1 / span 6; }
.lede { color: var(--muted); font-size: 19px; max-width: 30em; margin-top: 28px; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 28px; margin-top: 40px; }
.hero-card { grid-column: 8 / span 5; display: grid; justify-items: center; }
.hero-card .card-stage { width: 100%; }
.card-caption { max-width: 440px; width: 100%; color: var(--muted); font-size: 14px; line-height: 1.55; margin-top: 8px; }
.card-caption b { color: var(--ink); font-weight: 500; }
.card-hint { max-width: 440px; width: 100%; margin-top: 10px; }

/* ---------- Photo band: asymmetric, the wide frame bleeds off the left edge ---------- */
.photo-band {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: var(--gap); align-items: end;
  max-width: calc(var(--max) + (100vw - var(--max)) / 2); padding-right: var(--gutter);
}
.photo { margin: 0; overflow: hidden; background: var(--raise); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo-wide { aspect-ratio: 3 / 2; }
.photo-tall { aspect-ratio: 4 / 5; margin-bottom: clamp(-96px, -6vw, -40px); }
.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-list { grid-column: 5 / span 8; 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; }

/* ---------- 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); }

/* ---------- Next table: the upcoming dinner, with one dot per seat ---------- */
.next-table {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px;
  margin-top: 44px; padding-top: 18px; border-top: 1px solid var(--line); max-width: 30em;
}
.next-label { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.next-when { font-size: 15px; color: var(--muted); }
.next-when b { font: italic 400 19px var(--display); color: var(--ink); margin-right: 8px; }
.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 .next-table { grid-column: 1 / span 8; margin-top: 48px; }
.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); }

/* ---------- 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, .hero-card, .details-lead, .details-list, .faq-title, .faq-list, .closing .next-table, .rules-copy, .rules,
  .host-portrait, .letter, .closing h2, .closing-actions, .fineprint h2, .fineprint p, .fineprint p + p { grid-column: 1 / -1; }
  .hero { row-gap: 40px; }
  .rules-copy { padding-top: 0; }
  .photo-band { grid-template-columns: 1fr; padding-right: 0; }
  .photo-tall { width: 64%; justify-self: end; margin: 0 var(--gutter) 0 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; }
  .letter-body { font-size: 17px; }
  .host-portrait { width: 88%; }
  .detail { grid-template-columns: 1fr; row-gap: 6px; padding-block: 22px; }
}
