:root {
  --bg: #faf6f0;
  --surface: #ffffff;
  --text: #2e2a26;
  --muted: #7a7068;
  --accent: #8a6f4d;
  --accent-dark: #6d5639;
  --line: #e7ded2;
  --ok: #4f7a52;
  --bad: #a3483f;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --radius: 14px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: clamp(2.6rem, 9vw, 4.5rem); }
h2 { font-size: clamp(1.8rem, 5vw, 2.4rem); }
h3 { font-size: 1.4rem; font-weight: 600; }

a { color: var(--accent); }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ---------- Layout ---------- */
.topbar {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
}
.brand {
  font-family: var(--serif);
  font-size: 1.3rem;
  text-decoration: none;
  color: inherit;
}
.langs { display: flex; gap: 4px; }
.langs a {
  font-size: .8rem;
  letter-spacing: .08em;
  text-decoration: none;
  color: inherit;
  padding: 4px 8px;
  border-radius: 999px;
  opacity: .75;
}
.langs a.active { opacity: 1; border: 1px solid currentColor; }

/* On phones the top bar sits on the hero photo. */
@media (max-width: 899px) {
  .topbar:has(+ main .hero) { color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.4); }
}
.topbar:has(+ main .hero--plain) { color: #fff; }

.section { padding: 56px 16px; }
.narrow { max-width: 760px; margin: 0 auto; }
.wide { max-width: 1200px; margin: 0 auto; }
.page-min { min-height: 80vh; padding-top: 120px; }

.footer {
  text-align: center;
  padding: 40px 16px 56px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--muted);
}

/* ---------- Hero ---------- */
/* Phones: photo fills the screen, names sit in the sky above the couple.
   Desktop: split layout with the names on the left and an arched photo on the right. */
.hero {
  position: relative;
  min-height: 92vh;
  min-height: 92svh;
  display: grid;
  align-items: start;
  justify-items: center;
  text-align: center;
  color: #fff;
  background: var(--accent);
  padding: 110px 16px 64px;
  overflow: hidden;
}
.hero__photo {
  position: absolute;
  inset: 0;
  background: 60% bottom / cover no-repeat;
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.5) 0%, rgba(0,0,0,.25) 40%, rgba(0,0,0,0) 65%);
}
.hero--plain { align-items: center; background: linear-gradient(160deg, #cdb79a, #8a6f4d); }
.hero--plain::after { display: none; }
.hero__inner { position: relative; z-index: 1; animation: rise 1.2s ease-out both; }
.hero h1 { margin-bottom: .2em; text-shadow: 0 2px 16px rgba(0,0,0,.3); }
.hero__date { font-family: var(--serif); font-size: 1.5rem; margin: 0; }
.hero__place { letter-spacing: .2em; text-transform: uppercase; font-size: .85rem; margin: .5em 0 0; }
.hero--invite { min-height: 85vh; min-height: 85svh; }

@media (min-width: 900px) {
  .hero:not(.hero--plain) {
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 64px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 96px 48px 48px;
    color: var(--text);
    background: var(--bg);
  }
  .hero:not(.hero--plain)::after { display: none; }
  .hero:not(.hero--plain) .hero__photo {
    position: relative;
    order: 2;
    justify-self: start;
    height: min(76svh, 720px);
    aspect-ratio: 3 / 4;
    border-radius: 999px 999px 16px 16px;
    background-position: center;
    box-shadow: 0 20px 50px rgba(60, 45, 30, .18);
  }
  .hero:not(.hero--plain) .hero__inner { justify-self: end; }
  .hero:not(.hero--plain) h1 { text-shadow: none; }
  .hero:not(.hero--plain) .kicker, .hero:not(.hero--plain) .hero__place { color: var(--accent); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

.lead { font-family: var(--serif); font-size: 1.45rem; line-height: 1.5; }
.greeting { font-family: var(--serif); font-size: 1.8rem; font-style: italic; margin: 0; }

/* ---------- Components ---------- */
.kicker {
  text-transform: uppercase;
  letter-spacing: .3em;
  font-size: .8rem;
  margin: 0 0 1em;
}

.button {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 14px 28px;
  font: 500 .95rem var(--sans);
  letter-spacing: .04em;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s;
}
.button:hover { background: var(--accent-dark); }
.button--small { padding: 6px 12px; font-size: .8rem; }
.button--ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.button--ghost:hover { background: var(--bg); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}
.card h3 { margin-bottom: .3em; }
.card p { margin: 0 0 .6em; }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.timeline { list-style: none; padding: 0; margin: 0; border-left: 1px solid var(--line); }
.timeline li { display: flex; gap: 20px; padding: 12px 0 12px 20px; position: relative; }
.timeline li::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 22px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}
.timeline__time { font-family: var(--serif); font-size: 1.35rem; min-width: 3.2em; color: var(--accent); }
.timeline strong { display: block; font-weight: 500; }

.notice {
  background: #edf3ea;
  color: var(--ok);
  border-radius: var(--radius);
  padding: 12px 16px;
  text-align: center;
}
.error { color: var(--bad); margin: .5em 0; }

/* ---------- Forms ---------- */
form label { display: block; font-weight: 500; margin: 16px 0 6px; }
input[type="text"], input:not([type]), input[type="number"], select, textarea {
  width: 100%;
  font: inherit;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: inherit;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-weight: 500; margin-bottom: 8px; padding: 0; }
.choice { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.choice legend { grid-column: 1 / -1; }
.choice label {
  margin: 0;
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 400;
}
.choice label:has(input:checked) { border-color: var(--accent); background: #f6efe5; }
label.check { display: flex; gap: 10px; align-items: center; font-weight: 400; }
.rsvp .button, .code-form .button { width: 100%; margin-top: 20px; }
.code-form { text-align: left; margin-top: 24px; }
.code-form input { text-transform: uppercase; letter-spacing: .2em; text-align: center; font-size: 1.2rem; }

/* ---------- Gallery marquee ---------- */
.gallery-section { padding-left: 0; padding-right: 0; overflow: hidden; }
.marquee { overflow: hidden; mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.marquee__track {
  display: flex;
  gap: 12px;
  width: max-content;
  animation: marquee calc(var(--count) * 6s) linear infinite;
}
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee img {
  height: clamp(200px, 38vw, 320px);
  width: auto;
  border-radius: 10px;
  object-fit: cover;
  display: block;
}
/* Track holds the images twice; shift by half (plus half a gap) for a seamless loop. */
@keyframes marquee {
  to { transform: translateX(calc(-50% - 6px)); }
}
@media (prefers-reduced-motion: reduce) {
  .marquee { overflow-x: auto; }
  .marquee__track, .hero__inner { animation: none; }
}

/* ---------- Admin ---------- */
.admin .section { padding-top: 32px; }
.stats { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: .85rem;
  color: var(--muted);
}
.stat span { display: block; font-family: var(--serif); font-size: 2rem; color: var(--text); line-height: 1.1; }
.admin-create { display: grid; gap: 12px; grid-template-columns: 2fr 1fr 1fr auto; align-items: end; margin-bottom: 24px; }
.admin-create h2 { grid-column: 1 / -1; margin: 0; }
.admin-create label { margin: 0; }
.admin-create .button { margin: 0; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 500; color: var(--muted); white-space: nowrap; }
tr.highlight { background: #fbf4e8; }
td.msg { max-width: 260px; white-space: pre-wrap; }
td.actions { white-space: nowrap; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--line); font-size: .8rem; }
.badge--yes { background: #e3eee1; color: var(--ok); }
.badge--no { background: #f5e2df; color: var(--bad); }
.link-danger { background: none; border: 0; color: var(--bad); cursor: pointer; font: inherit; padding: 0; }

@media (max-width: 700px) {
  .admin-create { grid-template-columns: 1fr; }
  .choice { grid-template-columns: 1fr; }
}
