/* ---------------------------------------------------------------
   Our First Meetup.
   Opening screen, then a receipt. Built at 390px first.
   --------------------------------------------------------------- */

/* Self-hosted so first paint never waits on a font CDN. Headings only. */
@font-face {
  font-family: "Instrument Serif";
  src: url("/fonts/instrument-serif-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

:root {
  --paper: #efe8da;
  --card: #fffdf7;
  --ink: #221f1a;
  --muted: #736b59;
  --faint: #a49a85;
  --rule: #d8cfba;
  --accent: #b3402a;
  --accent-soft: #f6e4de;

  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --serif: "Instrument Serif", ui-serif, Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --pad: 22px;
  --bottom-safe: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

/* Display rules further down out-specify the UA's [hidden] rule, so restate it */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  /* The intro links are real anchors to #receipt. Letting the browser do the
     navigation means the tap still works if scripts never run. */
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--paper);
  background-image: radial-gradient(rgba(120, 100, 70, 0.07) 1px, transparent 1px);
  background-size: 4px 4px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

/* ========================== opening screen ========================== */

.intro {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh; /* fallback first */
  min-height: 100svh; /* iOS: the toolbar must not push content off screen */
  overflow: hidden;
  padding: 40px 26px calc(40px + var(--bottom-safe));
  text-align: center;
}

.intro-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
}

.intro-date {
  margin: 0;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}

.intro-line {
  margin: 22px 0 34px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.2rem, 11vw, 3.1rem);
  line-height: 1.06;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-wrap: balance;
}

/* .btn is declared further down, so this needs the extra class to win */
.intro .btn.intro-open {
  display: inline-block;
  width: auto;
  min-width: 200px;
  padding-inline: 34px;
  text-decoration: none;
}

.cue {
  display: flex; /* block-level so it sits under the button, not beside it */
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin: 18px auto 0;
  color: var(--faint);
  text-decoration: none;
}

.cue svg {
  animation: bob 2.4s ease-in-out infinite;
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(-2px);
  }
  50% {
    transform: translateY(3px);
  }
}

/* staggered entrance, driven entirely by CSS so it works without scripts */
.fade {
  animation: fade-up 0.6s cubic-bezier(0.2, 0.7, 0.3, 1) both;
  animation-delay: var(--delay, 0ms);
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ------------------------------ petals ------------------------------ */

.petals {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  transition: opacity 0.6s ease;
}

.petals.gone {
  opacity: 0;
}

.petal {
  position: absolute;
  top: -12vh;
  left: var(--x);
  width: var(--size);
  height: var(--size);
  background: var(--accent);
  border-radius: 70% 0 70% 0;
  opacity: 0;
  will-change: transform, opacity;
  animation: petal-fall var(--dur) linear var(--delay) infinite;
}

/* transform and opacity only — nothing here touches layout or paint */
@keyframes petal-fall {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: var(--alpha);
  }
  82% {
    opacity: var(--alpha);
  }
  100% {
    transform: translate3d(var(--drift), 125vh, 0) rotate(var(--spin));
    opacity: 0;
  }
}

.petals.paused .petal {
  animation-play-state: paused;
}

/* ============================ the ticket ============================ */

.ticket {
  max-width: min(460px, calc(100% - 28px));
  margin: 0 auto calc(44px + var(--bottom-safe));
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 4px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 14px 34px -18px rgba(60, 45, 20, 0.45);
  scroll-margin-top: 14px;
}

.ticket > section {
  padding: 26px var(--pad);
}

/* dashed perforation, with a notch bitten out of each edge */
.perf {
  position: relative;
  height: 26px;
}

.perf::before,
.perf::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 20px;
  height: 20px;
  margin-top: -10px;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: inset 0 0 0 1px var(--rule);
}

.perf::before {
  left: -11px;
}

.perf::after {
  right: -11px;
}

.perf span {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 50%;
  border-top: 2px dashed var(--rule);
}

/* ----------------------------- typography ----------------------------- */

.eyebrow {
  margin: 0 0 14px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.eyebrow.quiet {
  color: var(--faint);
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.7rem, 15vw, 3.5rem);
  line-height: 0.98;
  letter-spacing: -0.015em;
}

h2 {
  margin: 0 0 18px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.7rem;
  line-height: 1.1;
}

.tagline {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 30ch;
}

/* ----------------------------- header rows ----------------------------- */

.stub {
  margin: 24px 0 0;
  border-top: 1px solid var(--rule);
}

.row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
}

.row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.row dt {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--faint);
  white-space: nowrap;
}

.row dd {
  margin: 0 0 0 auto;
  text-align: right;
  font-size: 0.95rem;
  line-height: 1.35;
}

.row dd.mono {
  font-family: var(--mono);
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  color: var(--accent);
}

/* ----------------------------- itinerary ----------------------------- */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.leg {
  display: grid;
  grid-template-columns: 56px 13px 1fr;
  column-gap: 12px;
}

.leg-time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  padding-top: 3px;
  white-space: nowrap;
}

.leg-rail {
  position: relative;
}

.leg-rail::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: -6px;
  width: 1px;
  background: var(--rule);
}

.leg:last-child .leg-rail::before {
  display: none;
}

.leg-rail::after {
  content: "";
  position: absolute;
  left: 1px;
  top: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--rule);
  background: var(--card);
}

.leg:first-child .leg-rail::after {
  border-color: var(--accent);
  background: var(--accent);
}

.leg-body {
  padding-bottom: 20px;
}

.leg:last-child .leg-body {
  padding-bottom: 0;
}

.leg-title {
  font-weight: 600;
  font-size: 0.98rem;
}

.leg-note {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.section-note {
  margin: -8px 0 20px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--muted);
}

/* ---------------------------- what to bring ---------------------------- */

.bring {
  list-style: none;
  margin: 0;
  padding: 0;
}

.bring li {
  position: relative;
  padding: 0 0 12px 26px;
  font-size: 0.95rem;
}

.bring li:last-child {
  padding-bottom: 0;
}

.bring li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--rule);
  border-radius: 3px;
}

.bring li::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 6px;
  width: 7px;
  height: 4px;
  border-left: 1.5px solid var(--accent);
  border-bottom: 1.5px solid var(--accent);
  transform: rotate(-45deg);
}

.rain {
  margin: 18px 0 0;
  text-align: center;
  font-size: 0.82rem;
  color: var(--faint);
  line-height: 1.5;
}

/* -------------------------------- rsvp -------------------------------- */

.rsvp-body {
  margin: -6px 0 22px;
  color: var(--muted);
  font-size: 0.92rem;
}

label {
  display: block;
  margin-bottom: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}

input[type="email"],
textarea {
  width: 100%;
  padding: 13px 14px;
  font-family: var(--sans);
  font-size: 16px; /* anything smaller and Safari zooms the page on focus */
  color: var(--ink);
  background: #fbf7ee;
  border: 1px solid var(--rule);
  border-radius: 3px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.5;
}

input[type="email"]:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input[type="email"]::placeholder,
textarea::placeholder {
  color: #b6ac96;
}

.hint {
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: var(--faint);
}

.actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.btn {
  display: block;
  width: 100%;
  padding: 15px 18px;
  font-family: var(--sans);
  font-size: 0.98rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  border-radius: 3px;
  border: 1px solid transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s ease, opacity 0.15s ease, transform 0.06s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  color: #fff8f2;
}

.btn-primary:hover {
  background: #9c3623;
}

.btn-secondary {
  background: transparent;
  color: var(--muted);
  border-color: var(--rule);
}

.btn-secondary:hover {
  color: var(--ink);
  border-color: var(--faint);
}

.btn[disabled] {
  opacity: 0.55;
  cursor: default;
}

.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  vertical-align: -1px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.decline {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px dashed var(--rule);
}

.decline h3 {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.3rem;
}

.decline p.lead {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.9rem;
}

.linkish {
  display: inline-block;
  margin-top: 14px;
  padding: 6px 0;
  background: none;
  border: 0;
  width: auto;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.error {
  margin: 14px 0 0;
  padding: 11px 13px;
  background: var(--accent-soft);
  border-left: 2px solid var(--accent);
  border-radius: 2px;
  font-size: 0.87rem;
  color: #7d2b1b;
}

.error:empty {
  display: none;
}

/* success state */

.done {
  text-align: center;
  padding: 8px 0 4px;
}

.stamp {
  display: inline-block;
  margin-bottom: 18px;
  padding: 7px 16px;
  border: 2px solid var(--accent);
  border-radius: 3px;
  transform: rotate(-3.5deg);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.9;
}

.done h2 {
  margin-bottom: 10px;
}

.done p {
  margin: 0 auto;
  max-width: 32ch;
  color: var(--muted);
  font-size: 0.93rem;
}

.done-actions {
  margin-top: 24px;
}

/* ------------------------------- footer ------------------------------- */

.footer {
  padding: 22px var(--pad) 26px;
  text-align: center;
}

.footer p {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--muted);
}

.calendar-footer {
  margin: 0;
}

.calendar-footer .linkish {
  font-style: normal; /* the footer line is italic, this link should not be */
}

.footer .fine {
  margin-top: 10px;
  font-family: var(--mono);
  font-style: normal;
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ------------------------------- motion ------------------------------- */

.js .reveal {
  opacity: 0;
  transform: translateY(14px);
}

.js .reveal.in {
  opacity: 1;
  transform: none;
  transition: opacity 0.55s ease, transform 0.55s cubic-bezier(0.2, 0.7, 0.3, 1);
}

@media (prefers-reduced-motion: reduce) {
  .js .reveal,
  .js .reveal.in,
  .fade {
    opacity: 1;
    transform: none;
    transition: none;
    animation: none;
  }

  .petals {
    display: none;
  }

  .cue svg {
    animation: none;
  }

  .spinner {
    animation-duration: 2s;
  }

  .btn:active {
    transform: none;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ---------------------------- wider screens ---------------------------- */

@media (min-width: 560px) {
  :root {
    --pad: 34px;
  }

  .ticket {
    max-width: 520px;
    margin-bottom: calc(60px + var(--bottom-safe));
  }

  .leg {
    grid-template-columns: 70px 13px 1fr;
  }
}
