/* New Yorker-inspired theme — Caslon body, Fell display, ink on paper. */

:root {
  --paper: #fdfdf8;
  --ink: #1a1712;
  --ink-soft: #3b372e;
  --grey: #6f6a5c;
  --faint: #ddd6c2;
  --error: #8f2d2b;

  --font-display:
    "IM Fell English", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --font-sc: "IM Fell English", "Iowan Old Style", Georgia, serif;
  --font-body: "Libre Caslon Text", Georgia, "Times New Roman", serif;
}

/* Dark mode — ink and paper swap, contrast preserved. */
[data-theme="dark"] {
  --paper: #16130e;
  --ink: #ece5d3;
  --ink-soft: #cfc6ae;
  --grey: #a39c88;
  --faint: #3a352a;
  --error: #e0807d;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.02rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
  /* Sticky footer layout: header top, footer bottom, main fills the middle. */
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Main content is vertically centered when shorter than the viewport. */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: safe center;
}

::selection {
  background: var(--ink);
  color: var(--paper);
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 0.6em;
  font-weight: 400;
}
p {
  margin: 0 0 1em;
}

.muted {
  color: var(--grey);
  font-size: 0.95em;
}

/* Small-caps labels reuse the display face so the page loads only two families. */
.masthead-topline,
.masthead-nav,
.kicker,
.btn,
.count-label,
.strip-item h3,
.card > h3:first-child,
.form label,
.form legend,
.rsvp-table thead th,
.site-footer {
  font-variant: small-caps;
}
.req {
  color: var(--ink);
}
.link {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--ink);
}
.link:hover {
  background: var(--ink);
  color: var(--paper);
}

/* --- masthead --- */
.masthead {
  position: relative;
  text-align: center;
  padding: 1.15rem 1.25rem 1.05rem;
  border-bottom: 4px double var(--ink);
  background: var(--paper);
}
.theme-toggle {
  position: fixed;
  top: 0.9rem;
  right: 1rem;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: 50%;
  color: var(--ink);
  padding: 0.5rem;
  cursor: pointer;
}
.theme-toggle:hover {
  background: var(--ink);
  color: var(--paper);
}
.theme-toggle .icon {
  display: block;
}
.theme-toggle .icon[hidden] {
  display: none;
}
.masthead-topline {
  font-family: var(--font-sc);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  color: var(--grey);
  margin: 0 0 0.55rem;
}
.nameplate {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 5vw, 2.8rem);
  line-height: 1.1;
  color: var(--ink);
  text-decoration: none;
  display: inline-block;
}
a.nameplate:hover {
  text-decoration: underline;
  text-underline-offset: 0.25em;
}
.masthead-nav {
  margin-top: 0.6rem;
  font-family: var(--font-sc);
  font-size: 0.86rem;
  letter-spacing: 0.16em;
}
.masthead-nav a {
  color: var(--ink);
  text-decoration: none;
  margin: 0 0.55rem;
}
.masthead-nav a:hover {
  text-decoration: underline;
  text-underline-offset: 0.25em;
}
.masthead-nav .nav-dot {
  color: var(--grey);
}

/* --- kickers, rules, fleurons --- */
.kicker {
  font-family: var(--font-sc);
  font-size: 0.82rem;
  letter-spacing: 0.26em;
  color: var(--grey);
  margin: 0 0 1.2rem;
  text-align: center;
}
.rule-double {
  border: none;
  border-top: 4px double var(--ink);
  width: 180px;
  margin: 1.7rem auto;
}
.fleuron {
  text-align: center;
  font-size: 1.05rem;
  margin: 2.2rem 0;
  color: var(--ink);
}
.fleuron-inline {
  margin: 0 0.5em;
}

/* --- buttons --- */
.btn {
  display: inline-block;
  padding: 0.72rem 2rem;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-sc);
  font-size: 0.92rem;
  letter-spacing: 0.14em;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}
.btn-solid {
  background: var(--ink);
  color: var(--paper);
}
.btn-solid:hover {
  background: var(--ink-soft);
  border-color: var(--ink-soft);
}
.btn-outline:hover {
  background: var(--ink);
  color: var(--paper);
}
.btn-full {
  width: 100%;
}
.btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

/* --- hero (cover) --- */
.hero {
  text-align: center;
  padding: 4.2rem 1.25rem 3.2rem;
  max-width: 880px;
  margin: 0 auto;
}
.cover-carousel {
  position: relative;
  /* Fixed 3:4 frame — every carousel photo is 3024x4032. Sized here in
     CSS alone, so the space is reserved before any photo loads and the
     page never shifts: full column width, capped so the height never
     exceeds 70% of the viewport (52.5vh = 70vh * 3/4). */
  aspect-ratio: 3 / 4;
  width: min(100%, 52.5vh);
  margin: 0 auto 2.4rem;
  border: 1px solid var(--ink);
  overflow: hidden;
}
.cover-carousel .cover-photo {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  border: none;
  /* Fills the fixed frame; every photo is 3:4, so nothing is cropped
     in practice. Also keeps the no-JS fallback (first photo only)
     undistorted. */
  object-fit: cover;
  opacity: 0;
  transition: opacity 1s ease;
}
/* Without JS, show the first photo. JS sets inline opacity on every photo
   when it takes over, which overrides this. */
.cover-carousel .cover-photo:first-of-type {
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  .cover-carousel .cover-photo {
    transition: none;
  }
}
.cover-name {
  font-family: var(--font-display);
  font-size: clamp(3rem, 9vw, 5.4rem);
  line-height: 1.04;
  margin: 0 0 0.8rem;
}
.amp {
  font-style: italic;
}
.cover-name .amp {
  padding: 0 0.08em;
}
.date-line {
  font-family: var(--font-display);
  font-size: 1.7rem;
  margin-bottom: 0.25rem;
}
.venue-line {
  color: var(--grey);
  font-style: italic;
  margin-bottom: 0.5rem;
}

.rsvp-cta {
  text-align: center;
  padding: 0.5rem 1.25rem 4rem;
}

/* --- strip --- */
.strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  max-width: 920px;
  margin: 0 auto;
  padding: 0.5rem 1.25rem 3.5rem;
  text-align: center;
}
.strip-item {
  padding: 0 1.5rem;
}
.strip-item + .strip-item {
  border-left: 1px solid var(--ink);
}
.strip-item h3 {
  font-family: var(--font-sc);
  font-weight: 400;
  font-size: 1rem;
  letter-spacing: 0.24em;
  color: var(--grey);
  margin: 0 0 0.5rem;
}
.strip-item p {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin: 0;
}

/* --- pages --- */
.page {
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
}
.page.narrow {
  max-width: 880px;
}
.page.wide {
  max-width: 1080px;
}

/* --- 404 page --- */
.not-found {
  text-align: center;
}
.cat-404 {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 52vh;
  margin: 0 auto 1.5rem;
  border: 1px solid var(--ink);
}
.photo-credit {
  margin-top: 2rem;
  font-size: 0.8rem;
}
.page-title {
  font-family: var(--font-display);
  font-size: 2.7rem;
  text-align: center;
  margin: 0 0 0.5rem;
}
.page-sub {
  text-align: center;
  color: var(--grey);
  font-style: italic;
  margin: 0 0 2.2rem;
}
.page-actions {
  text-align: center;
  margin-top: 2.2rem;
}

.standfirst {
  font-size: 1.14rem;
  line-height: 1.75;
  color: var(--ink-soft);
  margin: 0 0 2.4rem;
  text-align: justify;
  hyphens: auto;
}
.dropcap::first-letter {
  font-family: var(--font-display);
  font-size: 3.4em;
  float: left;
  line-height: 0.82;
  padding: 0.08em 0.14em 0 0;
}

/* --- boxed sections (replaces cards) --- */
.card {
  background: var(--paper);
  border: 1px solid var(--ink);
  padding: 1.9rem 2rem;
  margin-bottom: 2rem;
}
.card > h3:first-child {
  font-family: var(--font-sc);
  font-weight: 400;
  font-size: 0.95rem;
  letter-spacing: 0.24em;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 0.75rem;
  margin-bottom: 1.3rem;
}
.card .success-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  letter-spacing: 0;
  border: none;
  padding: 0;
}

.schedule {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}
.schedule li {
  display: flex;
  flex-direction: column;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--faint);
}
.schedule li:last-child {
  border-bottom: none;
}
.schedule strong {
  font-family: var(--font-body);
}
.note {
  color: var(--grey);
  font-style: italic;
  margin-bottom: 0;
}

/* --- forms --- */
.form .field {
  margin-bottom: 2.25rem;
}
.form label,
.form legend {
  display: block;
  font-family: var(--font-sc);
  font-size: 0.86rem;
  letter-spacing: 0.1em;
  margin-bottom: 0.35rem;
}
.form fieldset {
  border: none;
  padding: 0;
  margin: 0 0 1.35rem;
}
.form input[type="text"],
.form input[type="email"],
.form input[type="tel"],
.form input[type="password"],
.form select,
.form textarea {
  width: 100%;
  padding: 0.6rem 0.1rem;
  border: none;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  font-family: var(--font-body);
  font-size: 1.05rem;
  background: transparent;
  color: var(--ink);
}
.form textarea {
  border: 1px solid var(--ink);
  padding: 0.7rem 0.8rem;
}
.form input:focus,
.form select:focus,
.form textarea:focus {
  outline: none;
  border-bottom-width: 2px;
}
.form textarea:focus {
  border-width: 1px;
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
.radio,
.check {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.4rem 0;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 1rem;
  letter-spacing: 0;
}
.radio input,
.check input {
  accent-color: var(--ink);
  width: 1.05rem;
  height: 1.05rem;
}

/* --- segmented option buttons (styled radio groups) --- */
.segmented {
  display: flex;
  border: 1px solid var(--ink);
}
.seg-option {
  flex: 1 1 0;
  position: relative;
  display: flex;
  margin: 0;
  cursor: pointer;
}
.seg-option + .seg-option {
  border-left: 1px solid var(--ink);
}
.seg-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.seg-option span {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3.2rem;
  padding: 0.6rem 0.75rem;
  text-align: center;
  font-variant: small-caps;
  letter-spacing: 0.08em;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}
.seg-option:hover span {
  background: var(--faint);
}
/* selected state: highlight the whole option box */
.seg-option:has(input:checked),
.seg-option input:checked + span {
  background: var(--ink);
  color: var(--paper);
}
.seg-option:has(input:checked):hover,
.seg-option:hover input:checked + span {
  background: var(--ink);
}
.seg-option input:focus-visible + span {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.form-error {
  color: var(--error);
  border: 1px solid var(--error);
  padding: 0.7rem 0.9rem;
  margin-bottom: 1rem;
  font-style: italic;
}
.success {
  text-align: center;
}

/* --- admin --- */
.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.table-wrap {
  overflow-x: auto;
}
.rsvp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  background: var(--paper);
}
.rsvp-table th,
.rsvp-table td {
  text-align: left;
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid var(--faint);
  vertical-align: top;
  max-width: 220px;
  overflow-wrap: break-word;
}
.rsvp-table thead th {
  font-family: var(--font-sc);
  font-weight: 400;
  letter-spacing: 0.1em;
  font-size: 0.82rem;
  white-space: nowrap;
  border-bottom: 3px double var(--ink);
}
.rsvp-table tbody tr:last-child td {
  border-bottom: none;
}

/* --- admin: groups --- */
.group-share {
  margin-top: 1.2rem;
  overflow-wrap: break-word;
}
.group-share .btn-small {
  margin-left: 0.6rem;
}
.btn-small {
  font-size: 0.72rem;
  padding: 0.3rem 0.7rem;
}
.groups-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.6rem;
}
.groups-table th,
.groups-table td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--faint);
  font-size: 0.92rem;
}
.groups-table code {
  font-family: ui-monospace, monospace;
  font-size: 0.85em;
  background: var(--faint);
  padding: 0.1rem 0.4rem;
}

/* --- footer --- */
.site-footer {
  text-align: center;
  padding: 1.9rem 1.25rem;
  border-top: 4px double var(--ink);
  font-family: var(--font-sc);
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  color: var(--grey);
}
.site-footer p {
  margin: 0;
}

/* --- responsive --- */
@media (max-width: 640px) {
  .hero {
    padding: 3rem 1.25rem 2.5rem;
  }
  .count-num {
    font-size: 1.6rem;
  }
  .strip {
    grid-template-columns: 1fr;
    gap: 1.4rem;
  }
  .strip-item + .strip-item {
    border-left: none;
    border-top: 1px solid var(--ink);
    padding-top: 1.4rem;
  }
  .field-row {
    grid-template-columns: 1fr;
  }
  .card {
    padding: 1.4rem 1.2rem;
  }
  .page-title {
    font-size: 2.1rem;
  }
}
