:root {
  --cream: #fbf3dc;
  --cream-2: #f4e7c6;
  --paper: #fffaf0;
  --red: #c8331f;
  --red-dark: #9e2414;
  --mustard: #e2a33b;
  --ochre: #c4862e;
  --charcoal: #1f1c1a;
  --ink: #2a2420;
  --muted: #7a6a55;
  --line: #e3cf9f;
  --head: "Anton", Impact, "Arial Narrow", sans-serif;
  --logo: "Lilita One", "Arial Rounded MT Bold", sans-serif;
  --body: "DM Sans", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font: 400 16px/1.5 var(--body);
  color: var(--ink);
  background: #f7e2a8 linear-gradient(180deg, #e0a53a 0, #edc163 600px, #f7e2a8 1400px) no-repeat;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2 { margin: 0; font-family: var(--head); font-weight: 400; text-transform: uppercase; line-height: 1; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }

.page {
  max-width: 1080px;
  margin: 0 auto;
  background: var(--cream);
  overflow: hidden;
}
@media (min-width: 760px) {
  .page { margin: 28px auto; border-radius: 22px; box-shadow: 0 20px 50px rgba(80, 45, 0, .25); }
}

/* Buttons */
.btn {
  border: 0;
  border-radius: 999px;
  padding: .7em 1.6em;
  font-weight: 700;
  color: var(--cream);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .18);
  transition: transform .1s, filter .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn-red { background: var(--red); }
.btn-mustard { background: var(--mustard); color: var(--charcoal); }
.btn-sm { padding: .45em 1.15em; font-size: .9rem; }
.btn-wide { min-width: clamp(7rem, 22vw, 9rem); font-size: 1.05rem; }

/* Nav */
.nav {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 84px;
  padding: 16px 18px 0;
  background: var(--cream);
}
.icon-btn {
  display: grid;
  gap: 5px;
  width: 40px;
  height: 40px;
  place-content: center;
  border: 0;
  background: none;
}
.icon-btn span { display: block; width: 22px; height: 2.5px; border-radius: 2px; background: var(--charcoal); }
.menu {
  position: absolute;
  top: 76px;
  left: 14px;
  display: grid;
  min-width: 190px;
  padding: 8px;
  background: var(--paper);
  border: 2px solid var(--charcoal);
  border-radius: 12px;
  box-shadow: 4px 4px 0 var(--charcoal);
}
.menu[hidden] { display: none; }
.menu a {
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}
.menu a:hover { background: var(--cream-2); }

/* Enamel-sign badge */
.badge {
  position: absolute;
  left: 50%;
  top: 34px;
  transform: translateX(-50%);
  display: block;
  padding: 18px 16px 7px;
  background: var(--cream);
  border: 3px solid var(--red);
  border-radius: 12px;
  box-shadow: 0 0 0 3px var(--cream), 0 0 0 5px var(--charcoal), 0 8px 16px rgba(0, 0, 0, .25);
  text-align: center;
  text-decoration: none;
}
.badge-mark {
  position: absolute;
  top: -26px;
  left: 50%;
  width: 38px;
  height: 38px;
  transform: translateX(-50%);
}
.badge-text {
  display: block;
  font: 400 clamp(1.35rem, 4.6vw, 1.75rem)/.95 var(--logo);
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--red);
  text-shadow: 1.5px 1.5px 0 var(--charcoal);
}

/* Hero */
.hero {
  position: relative;
  min-height: 500px;
  display: flex;
  align-items: flex-end;
  padding: 24px 18px;
}
.hero-art {
  position: absolute;
  inset: 0;
  /* Mobile: centre on the church spire, which stays visible above the NEXT UP card. */
  background: #eab04a url(hero.jpg) 64% center / cover no-repeat;
  background-image: image-set(url(hero.avif) type("image/avif"), url(hero.jpg) type("image/jpeg"));
}
@media (min-width: 760px) {
  /* Desktop: scale up a little and anchor left so the church spire sits clear of the logo badge. */
  .hero-art { background-size: 115% auto; background-position: 0% 35%; }
}
.next { position: relative; z-index: 1; max-width: 460px; width: 100%; }
.next-label {
  display: inline-block;
  padding: 6px 14px 4px;
  font-size: clamp(2.4rem, 8vw, 3.4rem);
  color: var(--mustard);
  background: var(--charcoal);
  border-radius: 8px 8px 0 0;
  letter-spacing: .01em;
}
.next-card {
  padding: 14px 16px 16px;
  background: var(--paper);
  border-radius: 0 10px 10px 10px;
  box-shadow: 0 10px 24px rgba(40, 15, 0, .3);
}
.next-title { margin: 0 0 10px; font-size: 1.15rem; font-weight: 500; }
.countdown { display: flex; flex-wrap: wrap; gap: 8px; }
.countdown span {
  padding: 2px 10px 0;
  font: 400 clamp(1.6rem, 6.5vw, 2.1rem)/1.1 "VT323", ui-monospace, monospace;
  color: #f4b740;
  background: var(--charcoal);
  border-radius: 6px;
  text-shadow: 0 0 8px rgba(244, 183, 64, .55);
  text-transform: uppercase;
}

.going-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  background: var(--ochre);
  color: var(--cream);
}
.going { display: flex; align-items: center; gap: 10px; white-space: nowrap; font-size: 1.1rem; font-weight: 500; }
.dots { display: flex; }
.dots i {
  width: 30px;
  height: 30px;
  margin-left: -8px;
  border: 2px dashed rgba(251, 243, 220, .8);
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
}
.dots i:first-child { margin-left: 0; }
@media (max-width: 360px) { .dots { display: none; } }

/* Main */
.main { padding: 36px 18px 44px; display: grid; gap: 44px; }
.main h2 { font-size: clamp(2rem, 6vw, 2.6rem); color: var(--red); margin-bottom: 16px; }
.center { text-align: center; }
.muted { color: var(--muted); margin: 14px 0 0; font-size: .95rem; }
.two-col { display: grid; gap: 44px; }
@media (min-width: 760px) {
  .main { padding: 44px 34px 52px; }
  .two-col { grid-template-columns: 1fr 1fr; gap: 34px; }
  .hero { padding: 34px; min-height: clamp(380px, 44vw, 470px); }
  .going-bar { padding: 16px 34px; }
}

/* Event cards */
.events { display: grid; gap: 12px; }
.event {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 10px 12px 10px 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.date {
  display: grid;
  place-items: center;
  height: 64px;
  background: var(--mustard);
  border-radius: 9px;
  color: var(--charcoal);
  line-height: 1;
}
.date small { font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.date b { font: 400 1.8rem/1 var(--head); }
.event h3 { margin: 0 0 2px; font-size: 1.05rem; }
.event p { margin: 0; color: var(--muted); font-size: .9rem; }
.empty { padding: 18px; background: var(--paper); border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); }

/* Calendar */
.cal { background: var(--paper); border: 2px solid var(--mustard); border-radius: 12px; overflow: hidden; }
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  background: var(--mustard);
  font-weight: 700;
  color: var(--charcoal);
}
.cal-nav { width: 34px; height: 34px; border: 0; border-radius: 50%; background: none; font-size: 1.5rem; line-height: 1; color: var(--charcoal); }
.cal-nav:hover { background: rgba(255, 255, 255, .35); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-grid > * {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1.15;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: .95rem;
}
.cal-grid > :nth-child(7n) { border-right: 0; }
.cal-grid > :nth-last-child(-n+7) { border-bottom: 0; }
.cal-grid .dow { aspect-ratio: auto; padding: 6px 0; background: var(--cream-2); font-size: .8rem; font-weight: 700; }
.cal-grid .sun { color: var(--red); }
.cal-grid .out { color: #cbbb9c; }
.cal-grid .today span { display: grid; place-items: center; width: 2em; height: 2em; border: 2px solid var(--charcoal); border-radius: 50%; }
.cal-grid .has { font-weight: 700; background: #fbe9bf; }
.cal-grid .has::after {
  content: "";
  position: absolute;
  bottom: 14%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
}

/* Polaroids */
.polaroids { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(10px, 3vw, 26px); max-width: 780px; margin: 0 auto; }
.polaroid {
  margin: 0;
  padding: 8px 8px 0;
  background: #fff;
  box-shadow: 0 6px 14px rgba(60, 35, 0, .18);
}
.polaroid:nth-child(1) { transform: rotate(-1.5deg); }
.polaroid:nth-child(3) { transform: rotate(1.5deg); }
.photo {
  aspect-ratio: 4 / 3;
  background:
    repeating-linear-gradient(135deg, transparent 0 12px, rgba(196, 134, 46, .1) 12px 24px),
    var(--cream-2);
}
.polaroid figcaption { padding: 10px 0 14px; }

/* Crew */
.crew { display: grid; grid-template-columns: repeat(7, 1fr); gap: clamp(6px, 2vw, 16px); justify-items: center; }
.crew li { width: 100%; max-width: 76px; }
.avatar {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border: 2px dashed var(--ochre);
  border-radius: 50%;
  background: var(--cream-2);
}

/* Footer */
.footer { padding: 22px 18px 18px; background: var(--charcoal); color: var(--cream); }
.footer-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.footer-title { font-family: var(--body); font-weight: 700; font-size: 1.35rem; text-transform: none; }
.footer-btns { display: flex; gap: 10px; }
.est {
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px solid rgba(251, 243, 220, .25);
  text-align: center;
  font-size: .78rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  opacity: .85;
}
@media (min-width: 760px) { .footer { padding: 26px 34px 20px; } }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* People: initials in the going bar and the crew strip */
.dots i.p {
  display: grid;
  place-items: center;
  border: 2px solid var(--cream);
  background: var(--red);
  color: var(--cream);
  font: 700 .7rem/1 var(--body);
}
.avatar.has {
  display: grid;
  place-items: center;
  border: 2px solid var(--ochre);
  background: var(--mustard);
  color: var(--charcoal);
  font: 400 clamp(1rem, 4vw, 1.6rem)/1 var(--head);
}
.crew .name { display: block; margin-top: 6px; font-size: .85rem; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn.is-set { background: var(--charcoal); }
.account-btn { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Dialogs and forms */
.modal {
  width: min(440px, calc(100% - 24px));
  max-height: calc(100% - 24px);
  padding: 22px 20px 20px;
  border: 0;
  border-radius: 16px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(30, 15, 0, .45);
}
.modal::backdrop { background: rgba(31, 28, 26, .6); }
.modal h2 { font-size: 2.1rem; color: var(--red); margin-bottom: 14px; }
.modal-x {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--muted);
}
.modal-x:hover { background: var(--cream-2); }
.modal form { display: grid; gap: 12px; }
.modal label { display: grid; gap: 4px; font-size: .88rem; font-weight: 700; }
.modal input:not([type=checkbox], [type=radio]) {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: 400 1rem var(--body); /* 16px stops iOS zooming in */
  color: var(--ink);
}
.modal input:focus { border-color: var(--mustard); outline: 2px solid var(--mustard); outline-offset: 0; }
.modal .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.checks { margin: 0; padding: 0; border: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.checks legend { padding: 0; margin-bottom: 6px; font-size: .88rem; font-weight: 700; }
.modal .check { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: .95rem; }
.check input { width: 18px; height: 18px; accent-color: var(--red); }
.fine { margin: 0; font-size: .82rem; color: var(--muted); }
.form-error { margin: 0; min-height: 1.2em; color: var(--red-dark); font-size: .9rem; font-weight: 700; }
.form-error:empty { min-height: 0; }
.btn-block { width: 100%; padding: .8em; font-size: 1rem; }
.btn:disabled { opacity: .6; cursor: wait; }
.switch { margin: 14px 0 0; text-align: center; font-size: .92rem; color: var(--muted); }
.link { border: 0; padding: 0; background: none; color: var(--red); font-weight: 700; text-decoration: underline; }
.rsvp-event { margin: -6px 0 16px; font-weight: 500; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; padding: 0; border: 0; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; }
.seg span {
  display: block;
  padding: 12px 4px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: #fff;
  text-align: center;
  font-size: 1rem;
  cursor: pointer;
}
.seg input:checked + span { border-color: var(--red); background: var(--red); color: var(--cream); }
.seg input:focus-visible + span { outline: 3px solid var(--mustard); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.form-ok { margin: 0; color: #2f6b2f; font-size: .92rem; font-weight: 700; }
.form-ok:empty { display: none; }
.add-event { margin-top: 12px; }
.event .notes { margin-top: 4px; color: var(--ink); font-size: .88rem; }
.event .added { margin-top: 2px; font-size: .8rem; }
.event .added .link { font-size: inherit; }
.modal textarea { width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; font: 400 1rem var(--body); color: var(--ink); resize: vertical; }
.link.danger { justify-self: center; color: var(--red-dark); }

/* Event cards open the detail view */
.event[data-detail] { cursor: pointer; }
.event.has-thumb { grid-template-columns: 64px 1fr 48px auto; }
.event .thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; }
.form-photos { display: flex; gap: 8px; }
.form-photos:empty { display: none; }
.form-photo { position: relative; }
.form-photo img { display: block; width: 84px; height: 84px; border-radius: 10px; object-fit: cover; }
.photo-x { position: absolute; top: -8px; right: -8px; width: 26px; height: 26px; border: 0; border-radius: 50%; background: var(--charcoal); color: var(--cream); font-size: 1.1rem; line-height: 1; }
.modal input[type=file] { padding: 8px; font-size: .9rem; }
.detail { padding-top: 0; overflow-x: hidden; }
.detail-hero { display: block; width: calc(100% + 40px); max-width: none; margin: 0 -20px 16px; aspect-ratio: 16 / 10; object-fit: cover; }
.detail h2 { margin-top: 18px; }
.detail-hero + h2 { margin-top: 0; }
.detail h3 { margin: 18px 0 4px; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.detail p { margin: 0; }
.detail-when { font-weight: 700; }
.detail-place { margin: 2px 0 10px !important; }
.detail .pre { white-space: pre-line; }
.detail-photo { display: block; width: 100%; margin-top: 18px; border-radius: 12px; }
.detail-actions { display: flex; align-items: center; gap: 16px; margin: 20px 0 8px; }
.detail .added { color: var(--muted); font-size: .85rem; }
.detail .modal-x { z-index: 1; background: var(--paper); }
.detail a.btn { display: inline-block; text-decoration: none; }
.event picture, .detail picture { display: block; }
.detail picture + h2 { margin-top: 0; }
