/*
 * One family (EB Garamond), two styles: italic is the romantic voice
 * (names, sign-offs), roman carries the information. Three colors, one column,
 * whitespace instead of boxes and rules. 20px base for older guests.
 */

@font-face {
  font-family: "EB Garamond";
  src: url("/fonts/eb-garamond-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("/fonts/eb-garamond-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  --paper: #fbf8f2;
  --ink: #2a2622;
  --ink-soft: #6b6259;
}

* { box-sizing: border-box; }

html { font-size: 125%; -webkit-text-size-adjust: 100%; } /* 20px */

body {
  margin: 0;
  font-family: "EB Garamond", Garamond, "Times New Roman", serif;
  font-weight: 400;
  line-height: 1.7;
  color: var(--ink);
  background: var(--paper);
  text-align: center;
}

p { margin: 0 0 1em; text-wrap: pretty; }
h1, h2 { font-weight: 400; font-style: italic; margin: 0; }

a, .link {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  text-decoration-color: var(--ink-soft);
}
/* Text-styled button: same look as links, comfortable tap area. */
.link {
  font: inherit;
  background: none;
  border: 0;
  padding: 0.6rem 0.4rem;
  cursor: pointer;
}
:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }

.soft { color: var(--ink-soft); }

.card,
.container {
  max-width: 26rem;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 0;
}

.names {
  margin: 1.2rem 0 0;
  font-size: clamp(2.6rem, 12vw, 3.6rem);
  line-height: 1.1;
  letter-spacing: 0.01em;
}
/* Home: the traced lettering of the invitation instead of set type. The
   flourish reaches the edges of the column, as on the card. */
.names-drawn { margin: 0.4rem 0 1.6rem; line-height: 0; }
.names-art {
  display: block;
  width: calc(100% + 3rem);
  height: auto;
  margin: 0 -1.5rem;
  color: var(--ink);
}
@media (prefers-reduced-motion: no-preference) {
  .names-art { opacity: 0; animation: appear 1.6s ease-out .1s forwards; }
}
@keyframes appear { to { opacity: 1; } }
.names .pair { display: inline-block; } /* "e Martina" never splits */
.names .and { font-size: 0.7em; color: var(--ink-soft); }

.lead {
  margin: 0.6rem 0 0;
  font-size: 1.15rem;
  line-height: 1.4;
}
/* Small secondary links: calendar, maps, copy IBAN. */
.lead .cal,
.small {
  font-size: 0.8rem;
  color: var(--ink-soft);
}
/* Calendar link sits right under the date it belongs to. */
.lead .cal {
  display: block;
  margin-top: 0.15rem;
}

.block { margin: 2.6rem 0 0; }
.block p:last-child { margin-bottom: 0; }
.block h2 { font-size: 1.25rem; margin-bottom: 0.8rem; }

/* Programme: one text style throughout (same size, color, roman);
   only the spacing tells the groups apart. */
.program { margin-top: 1.6rem; }
.venue { margin: 0; line-height: 1.5; }
.venue span { display: block; }
.then { margin: 0.6rem 0; }

/* Divider: a short dash, a small heart, a short dash. */
.heart {
  display: block;
  width: 3.3rem;
  height: auto;
  margin: 2.6rem auto 0;
}
.heart path {
  fill: none;
  stroke: var(--ink-soft);
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rsvp { margin-top: 2.2rem; }
.rsvp p { font-size: 0.95rem; line-height: 1.55; }

.iban {
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  font-variant-numeric: lining-nums;
}
.iban span { display: inline-block; white-space: nowrap; } /* wrap by halves only */

.status { display: block; font-style: italic; }

/* Gift section: tighter rhythm, IBAN details grouped together. */
.gift p { margin-bottom: 0.5em; }
.gift .bank { margin-top: 1em; line-height: 1.35; }
/* "Mostra l'IBAN": a native <details>, so it works without JS too. The summary
   looks like the other text links and goes away once the IBAN is shown. */
.gift .bank summary { display: inline-block; list-style: none; padding: 0.3rem 0.4rem; }
.gift .bank summary::-webkit-details-marker { display: none; }
.gift .bank[open] summary { display: none; }
.gift .bank .iban { margin: 0; }
.gift .copy { margin-top: 0.1rem; }
.gift .copy .link { padding: 0.3rem 0.4rem; }

.signoff {
  margin: 2.4rem 0 0;
  font-size: 1.6rem;
  font-style: italic;
}

.footer {
  max-width: 26rem;
  margin: 2.6rem auto 0;
  padding: 0 1.5rem 2rem;
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.6;
}

/* Secondary pages (404) use a simple italic title. */
.container h1,
.page-title { margin: 1.4rem 0 1rem; font-size: 2rem; }

/* ---- RSVP page (/r/<token>) ------------------------------------------- */

/* "Programma e luoghi": same size and colour as "Mostra l'IBAN". */
.more { font-size: 1rem; }

/* The invitation label ("Zia Carla", "Famiglia Rossi") is the greeting. */
.greeting {
  margin: 1.8rem 0 0.4rem;
  font-size: 1.7rem;
  line-height: 1.25;
}
.greeting:focus { outline: none; }

.thanks { font-style: italic; font-size: 1.15rem; }

.person { font-style: italic; font-size: 1.15rem; }

.people { list-style: none; margin: 1.8rem 0 0; padding: 0; }
.people li { margin: 0 0 1.2rem; line-height: 1.45; }
.people span { display: block; }

.message { white-space: pre-line; font-style: italic; }

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

.guest { margin: 1rem 0 0; }
.guest legend { padding: 0; margin: 0 auto 0.1rem; }

/* RSVP form: two titled parts separated by the small heart. */
.step { margin: 1.4rem 0 0; }
.step h2 { font-size: 1.35rem; line-height: 1.3; }
.step-hint { margin: 0.2rem 0 0; font-size: 0.85rem; }
.step .guest:first-of-type { margin-top: 0.8rem; }
/* RSVP page: the divider before the gift section, closer to both neighbours. */
.heart.before-gift { margin-top: 1.4rem; }
.heart.before-gift + .gift { margin-top: 1.1rem; }
/* Label, hint and input of a field stay together; air between fields. */
.fgroup { margin: 0.8rem 0 0; }
.fgroup > .field { margin: 0; }
.fgroup > .hint { margin: 0 0 0.1rem; }
.fgroup > .text { padding-top: 0.1rem; line-height: 1.5; }
.step-hint + .fgroup { margin-top: 0.6rem; }
/* Send button and the link below it: close to the last field, not adrift. */
#rsvp-form .submit { margin-top: 1.1rem; }
#rsvp-form .submit .primary { padding-top: 0.4rem; padding-bottom: 0.4rem; }
#app + noscript + .more, #app + .more { margin-top: 1.6rem; }

/* Yes/no: plain text options with native radios, wide tap targets. */
.choices {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: 1.6rem;
}
.choice, .check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.2rem; /* still a comfortable tap target */
  cursor: pointer;
}
input[type="radio"], input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  flex: none;
  accent-color: var(--ink);
}

.extra { margin-top: 0.3rem; }
.toggle { font-size: 0.85rem; color: var(--ink-soft); padding-top: 0.3rem; padding-bottom: 0.3rem; }
.toggle::before { content: "+ "; }
.toggle[aria-expanded="true"]::before { content: "− "; }
.diet { margin-top: 0.2rem; }
/* Checkbox list: left-aligned column, centered as a whole. */
.checks {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  font-size: 0.95rem;
  line-height: 1.35;
}

/* Fields: a single underline, no boxes. */
.field {
  display: block;
  margin: 1.2rem 0 0.1rem;
  font-style: italic;
}
.hint { margin: 0; font-size: 0.8rem; color: var(--ink-soft); line-height: 1.4; }
.text {
  display: block;
  width: 100%;
  font: inherit;
  color: inherit;
  text-align: center;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--ink-soft);
  border-radius: 0;
  padding: 0.4rem 0.2rem;
  -webkit-appearance: none;
  appearance: none;
}
textarea.text { resize: vertical; line-height: 1.5; text-align: left; }
.text:focus { outline: none; border-bottom-color: var(--ink); box-shadow: 0 1px 0 var(--ink); }
.text[aria-invalid="true"] { border-bottom-color: var(--ink); }

.field-error {
  margin: 0.3rem 0 0;
  font-size: 0.9rem;
  font-style: italic;
  line-height: 1.4;
}
.field-error::before { content: "— "; }

.submit { margin: 2.2rem 0 0; }
.primary { font-size: 1.25rem; font-style: italic; padding: 0.7rem 1rem; }
.link:disabled { cursor: default; color: var(--ink-soft); }

/* Honeypot: off-screen rather than display:none, which some bots detect. */
.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

@media (min-width: 40rem) {
  .card { padding-top: 3rem; }
}

/* ---- Teddy bear and panda strolling hand in hand ----------------------- */

.stroll {
  position: relative;
  max-width: 40rem;
  height: 8rem;
  margin: 2.4rem auto 0;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
}
.walkers {
  position: absolute;
  bottom: 0.2rem;
  left: 50%;
  width: 9.6rem;
  height: auto;
  overflow: visible;
  transform: translateX(-50%); /* standing still in the middle without motion */
}
.walkers .o { fill: var(--paper); stroke: var(--ink); stroke-width: 1.15; stroke-linejoin: round; }
.walkers .f { fill: var(--ink); stroke: var(--ink); stroke-width: 1.15; stroke-linejoin: round; }
.walkers .p { fill: var(--paper); }
.walkers .eye { stroke: none; }
.walkers .muzzle { opacity: 0.14; }
.walkers .tummy { opacity: 0.08; }
.walkers .b { fill: var(--ink-soft); opacity: 0.22; } /* blush and inner ears */
.walkers .l { fill: none; stroke: var(--ink); stroke-width: 1; stroke-linecap: round; stroke-linejoin: round; }
.walkers .heart-float path {
  fill: none;
  stroke: var(--ink-soft);
  stroke-width: 2.8;
  stroke-linejoin: round;
}
.walkers .walker,
.walkers .foot,
.walkers .eyes { transform-box: fill-box; }
.walkers .walker { transform-origin: 50% 100%; }
.walkers .eyes { transform-origin: 50% 50%; }

@media (prefers-reduced-motion: no-preference) {
  .walkers {
    left: -9.6rem;
    transform: none;
    animation: stroll 24s linear infinite;
  }
  .walkers .walker { animation: waddle 0.8s ease-in-out infinite; }
  .walkers .foot { animation: step 0.8s ease-in-out infinite; }
  .walkers .foot-2 { animation-delay: -0.4s; }
  .walkers .eyes { animation: blink 4.5s infinite; }
  .walkers .walker + .walker .eyes { animation-delay: -1.7s; }
  .walkers .heart-float { animation: float 1.6s ease-in-out infinite alternate; }
}
@keyframes stroll {
  0% { left: -9.6rem; }
  85%, 100% { left: 100%; } /* short pause off-stage before walking in again */
}
/* Gentle side-to-side sway, tilting onto the foot that is on the ground. */
@keyframes waddle {
  0%, 50%, 100% { transform: rotate(0) translateY(0); }
  25% { transform: rotate(2deg) translateY(-0.8px); }
  75% { transform: rotate(-2deg) translateY(-0.8px); }
}
@keyframes step {
  0%, 50%, 100% { transform: translateY(0); }
  25% { transform: translateY(-2.5px); }
}
@keyframes blink {
  0%, 94%, 100% { transform: scaleY(1); }
  97% { transform: scaleY(0.1); }
}
@keyframes float {
  to { transform: translateY(-1.5px); }
}

/* Dietary details open: keep clear air before the next person's name. */
.guest .diet:not([hidden]) { margin-bottom: 1.2rem; }
