:root {
  color-scheme: light;
  --paper: #fff;
  --ink: #171717;
  --cipria: #bd8f89;
  --line: #d8d3d1;
  --display: Didot, "Bodoni MT", "Times New Roman", serif;
  --body: Baskerville, "Baskerville Old Face", Georgia, serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper) url("carta.svg") repeat;
  color: var(--ink);
  font: 1.25rem/1.55 var(--body);
  text-align: center;
}

.cover, main section, footer {
  padding: clamp(2.5rem, 8vw, 6rem) 1.25rem;
}

.cover {
  display: grid;
  justify-items: center;
  align-content: start;
  padding-top: clamp(1.5rem, 5vw, 3rem);
}

.monogram {
  display: block;
  width: clamp(9.2rem, 25.4vw, 15rem);
  height: auto;
  filter: brightness(0) invert(96%)
    drop-shadow(-.65px -.75px .45px #b8b5b0)
    drop-shadow(.8px .95px 0 #fff);
}

h1, h2, h3 { font-family: var(--display); font-weight: 400; }

h1 {
  margin: .45em 0;
  font-size: clamp(1.8rem, 6.15vw, 3.3rem);
  line-height: 1;
  letter-spacing: .17em;
  text-transform: uppercase;
}

.ampersand {
  display: block;
  width: .96em;
  height: auto;
  margin: .10em auto;
}

.villa {
  display: block;
  width: min(100%, 26rem);
  --reveal-opacity: .65;
  opacity: var(--reveal-opacity);
  height: auto;
  margin: 1rem auto 1.5rem;
}

.cover time, .label, nav {
  font-size: .85rem;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.cover time { font-size: 1.2rem; border-block: 1px solid var(--line); padding: .4em .8em; }
.cover p { margin: 1.65rem 0 2rem; font-size: 1.35rem; }

nav {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5rem 1.5rem;
  padding: .8rem 1rem;
}

nav::before, nav::after {
  position: absolute;
  inset-inline: 0;
  height: 1px;
  background: var(--line);
  content: "";
}

nav::before { top: 0; }
nav::after { bottom: 0; }

a { color: inherit; }
nav a { display: inline-flex; align-items: center; min-height: 44px; text-underline-offset: .38em; }

main { max-width: 55rem; margin: auto; padding-inline: 1rem; }
main section + section, main .event-details + section {
  position: relative;
}

main section + section::before, main .event-details + section::before, .site-footer::before {
  position: absolute;
  inset: 0 0 auto;
  width: min(78%, 24rem);
  height: 1px;
  margin-inline: auto;
  background:
    linear-gradient(to right, transparent, var(--cipria)) left / calc(50% - .65rem) 100% no-repeat,
    linear-gradient(to left, transparent, var(--cipria)) right / calc(50% - .65rem) 100% no-repeat;
  content: "";
}


h2 { margin: 0; font-size: clamp(1.9rem, 5vw, 3rem); }
h3 { margin: .35rem 0 0; font-size: 1.45rem; }

.program {
  max-width: 36rem;
  margin: 2rem auto 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

.program li {
  position: relative;
  margin-inline-start: 50%;
  padding: 0 0 3.1rem clamp(.85rem, 3vw, 1.5rem);
}

.program li:not(:last-child) {
  border-inline-start: 1px solid var(--cipria);
}

.program li:last-child {
  border-inline-start: 1px solid transparent;
  padding-bottom: 0;
}

.program li::before {
  position: absolute;
  inset: .675rem auto auto 0;
  transform: translate(-50%, -50%);
  width: .45rem;
  height: .45rem;
  border-radius: 50%;
  background: var(--cipria);
  content: "";
}

.program li:nth-child(even)::before {
  width: .75rem;
  height: .75rem;
}

.program-icon {
  position: absolute;
  inset: 0 calc(100% + .9rem) auto auto;
  width: 2.2rem;
  height: 2.2rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.program-hours {
  font-size: .95rem;
  letter-spacing: .08em;
}
.program time { font-variant-numeric: lining-nums; }

.button {
  display: inline-grid;
  place-items: center;
  min-height: 44px;
  padding: .6rem 1.25rem;
  border: 1px solid var(--cipria);
  background: transparent;
  color: #895751;
  font-size: 1.08rem;
  text-decoration: none;
}

@media (hover: hover) {
  .button:not(:disabled):hover {
    background: var(--cipria);
    color: #fff;
  }
}
.cover .button { margin-top: .65rem; }
.site-footer {
  display: grid;
  justify-items: center;
  gap: .5rem;
  padding-block: 2.25rem 2rem;
  position: relative;
}

.footer-monogram {
  width: 4.5rem;
  height: auto;
  filter: url("#monogram-cipria");
}

.footer-names {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.35rem, 4vw, 1.85rem);
  letter-spacing: .1em;
}

.footer-top {
  display: inline-flex;
  align-items: center;
  gap: .45em;
  min-height: 44px;
  margin-top: .6rem;
  color: #895751;
  font-size: 1rem;
  text-underline-offset: .3em;
}

@media (min-width: 960px) {
  main { max-width: 72rem; }

  .event-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3rem;
  }

  .event-details .villa {
    width: 100%;
    --reveal-opacity: .32;
  }

  #luogo > .label { margin: 0 0 .35rem; line-height: 1.5rem; }

  /* Match the space above the venue title, including the photo. */
  .event-details #programma {
    padding-top: calc(clamp(2.5rem, 8vw, 6rem) + 4.1rem + var(--portrait-size));
  }

  .event-details #programma::before { display: none; }

  #titolo-programma {
    max-width: 21rem;
    margin: 1rem auto 0;
    padding-inline-start: calc(3rem - .31em);
    white-space: nowrap;
    text-align: left;
  }

  #programma .program { max-width: 21rem; margin-top: 3rem; }
  #programma .program li { margin-inline-start: 3rem; }
}

@media (prefers-reduced-motion: no-preference) {
  nav.is-visible::before { animation: menu-enter .95s ease-out 380ms both; --menu-offset: -100%; }
  nav.is-visible::after { animation: menu-enter .95s ease-out 380ms both; --menu-offset: 100%; }

  nav.is-visible a { animation: menu-enter .85s ease-out 600ms both; }
  nav a:first-child { --menu-offset: -1.25rem; }
  nav a:last-child { --menu-offset: 1.25rem; }

  .cover > * {
    animation: soft-reveal 1.2s ease-out both;
    animation-delay: 380ms;
  }

  .cover > h1 { animation: none; }
  .cover h1 > * { animation: soft-reveal 1s ease-out 450ms both; }
  .cover h1 > .ampersand { animation-delay: 580ms; }
  .cover h1 > :last-child { animation-delay: 710ms; }
  .cover > time { animation-delay: 660ms; }
  .cover > p { animation-delay: 780ms; }
  .cover > .button { animation-delay: 900ms; }

  main section.is-visible > * {
    animation: soft-reveal 1.2s ease-out 380ms both;
  }

  #luogo.is-visible > :nth-child(2),
  #regalo.is-visible > :nth-child(2) { animation-delay: 520ms; }

  #luogo.is-visible > :nth-child(3),
  #regalo.is-visible > :nth-child(3) { animation-delay: 660ms; }

  #luogo.is-visible > :nth-child(4),
  #regalo.is-visible > :nth-child(4) { animation-delay: 780ms; }

  #luogo.is-visible > :nth-child(5) { animation-delay: 900ms; }

  #programma.is-visible .program li {
    --beat: calc(1050ms + var(--step, 0) * 370ms);
    border-inline-start-color: transparent;
  }

  #programma.is-visible .program li::before {
    animation: timeline-dot .32s ease-out var(--beat) both;
    z-index: 1;
  }

  #programma.is-visible .program li:not(:last-child)::after {
    position: absolute;
    inset: .675rem auto auto -1px;
    width: 1px;
    height: 100%;
    background: var(--cipria);
    transform-origin: top;
    animation: program-lead-in 370ms linear var(--beat) both;
    content: "";
  }

  #programma.is-visible .program li > * {
    animation: soft-reveal .75s ease-out calc(var(--beat) + 70ms) both;
  }

  #programma.is-visible .program li > h3 {
    animation-delay: calc(var(--beat) + 180ms);
  }

  .reveal-ready main section:not(.is-visible)::before,
  .reveal-ready .site-footer:not(.is-visible)::before {
    opacity: 0;
    transform: scaleX(0);
  }

  main section.is-visible::before,
  .site-footer.is-visible::before {
    animation: separator-grow 1.35s ease-out 280ms both;
  }

  .gift-copy > *, .rsvp-copy > *, .site-footer > * { --text-delay: 620ms; }
  .gift-copy > :nth-child(2), .rsvp-copy > :nth-child(2),
  .site-footer > :nth-child(2) { --text-delay: 750ms; }
  .gift-copy > :nth-child(3), .site-footer > :nth-child(3) { --text-delay: 880ms; }
  .gift-copy > :nth-child(4), .site-footer > :nth-child(4) { --text-delay: 1010ms; }
  .gift-copy > :nth-child(n+5), .site-footer > :nth-child(n+5) { --text-delay: 1140ms; }

  #regalo.is-visible .gift-copy,
  #conferma.is-visible .rsvp-copy { animation: none; }

  #regalo.is-visible .gift-copy > *,
  #conferma.is-visible .rsvp-copy > *,
  .site-footer.is-visible > * {
    animation: soft-reveal .9s ease-out var(--text-delay) both;
  }

  .event-details:has(#programma.is-visible) .program-connector path {
    stroke-dasharray: 1;
    animation: connector-draw .8s ease-in-out 180ms both;
  }

  .program li:nth-child(2) { --step: 1; }
  .program li:nth-child(3) { --step: 2; }
  .program li:nth-child(4) { --step: 3; }
  .program li:nth-child(5) { --step: 4; }
  .program li:nth-child(6) { --step: 5; }
}

@keyframes soft-reveal {
  from { opacity: 0; transform: translateY(.25rem); }
  to { opacity: var(--reveal-opacity, 1); transform: translateY(0); }
}

@keyframes timeline-dot {
  from { opacity: 0; transform: translate(-50%, -50%) scale(.35); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes separator-grow {
  from { opacity: 0; transform: scaleX(0); }
  to { opacity: 1; transform: scaleX(1); }
}

@keyframes connector-draw {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}


@keyframes menu-enter {
  from { opacity: 0; transform: translateX(var(--menu-offset, 0px)); }
  to { opacity: 1; transform: translateX(0); }
}

#conferma .button { margin-top: 1.25rem; }

.cover-portrait, .venue-portrait {
  display: none;
}

@media (min-width: 960px) {
  :root { --portrait-size: clamp(12rem, 20vw, 17rem); }

  .cover {
    position: relative;
    max-width: 76rem;
    margin-inline: auto;
  }

  .cover > .cover-portrait {
    display: block;
    position: absolute;
    inset-block-start: 34%;
    width: var(--portrait-size);
    margin: 0;
    animation-delay: 660ms;
  }

  .cover > .cover-portrait--silvia { inset-inline-end: 6%; inset-block-start: 39%; }
  .cover > .cover-portrait--steven { inset-inline-start: 6%; inset-block-start: 26%; }

  .venue-portrait {
    display: block;
    width: var(--portrait-size);
    margin: 0 auto 2.25rem;
  }


}
.cover-portrait--silvia img {
  object-position: center top;
  transform: scale(1.66);
  transform-origin: 3% 33%;
}

.cover-portrait--steven img {
  transform: scale(1.12);
  transform-origin: 51% 44%;
}

.cover-portrait__frame {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  outline: 1px solid var(--cipria);
  outline-offset: 9px;
  border-radius: 50%;
  color: #565252;
  font-style: italic;
}

.cover-portrait__frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}


@media (min-width: 960px) {
  .event-details {
    position: relative;
    isolation: isolate;
  }

  .event-details .villa {
    position: absolute;
    z-index: -1;
    inset-inline-start: -3%;
    inset-block-start: 66%;
    translate: 0 -50%;
    width: 67%;
    max-width: none;
    margin: 0;
    --reveal-opacity: .34;
    filter: contrast(1.22);
    mask-image: linear-gradient(to right, transparent, #000 10%, #000 61%, transparent 86%);
  }
}

nav a { text-decoration-color: var(--cipria); }

.program {
  position: relative;
}

.program::before {
  position: absolute;
  inset-inline-start: 50%;
  inset-block-end: calc(100% - .35rem);
  width: 1px;
  height: 1.75rem;
  background: var(--cipria);
  transform-origin: top;
  content: "";
}

.program-connector { display: none; }

@media (min-width: 960px) {
  .program::before { display: none; }

  .program-connector {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    fill: none;
    stroke: var(--cipria);
    stroke-width: 1;
    stroke-linecap: round;
  }
}

@media (prefers-reduced-motion: no-preference) {
  #programma.is-visible .program::before {
    animation: program-lead-in .45s ease-out 150ms both;
  }
}

@keyframes program-lead-in {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

@media (min-width: 960px) {
  body { container-type: inline-size; }

  #regalo {
    display: grid;
    width: 100cqw;
    margin-inline: calc(50% - 50cqw);
    padding-inline: 0 clamp(2rem, 8vw, 8rem);
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    align-items: center;
    gap: clamp(1.5rem, 4vw, 4rem);
    overflow-x: clip;
    overflow-y: visible;
  }

  .gift-copy { align-self: start; padding-top: clamp(1rem, 4vw, 3rem); text-align: left; }

}

.gift-photos {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 122.29852 / 145.50187;
  margin-inline-start: -1.25rem;
}

.gift-photos figure {
  position: absolute;
  width: var(--photo-size);
  inset-inline-start: var(--photo-x);
  inset-block-start: var(--photo-y);
  margin: 0;
}

.gift-photos .cover-portrait__frame {
  position: relative;
  outline-offset: clamp(3px, .45vw, 7px);
}

.gift-photos .cover-portrait__frame img {
  position: absolute;
  inset: var(--crop-y) auto auto var(--crop-x);
  width: var(--crop-width);
  height: var(--crop-height);
}

.gift-photos figure:nth-child(1) { --photo-size: 37.6129%; --photo-x: 22.0514%; --photo-y: 41.2032%; }
.gift-photos figure:nth-child(2) { --photo-size: 27.8008%; --photo-x: 26.9575%; --photo-y: 14.3995%; }
.gift-photos figure:nth-child(3) { --photo-size: 32.7069%; --photo-x: 56.0855%; --photo-y: 23.6777%; }
.gift-photos figure:nth-child(4) { --photo-size: 26.1655%; --photo-x: 62.3086%; --photo-y: 54.4956%; }
.gift-photos figure:nth-child(5) { --photo-size: 29.4362%; --photo-x: 40.4803%; --photo-y: 73.8663%; }
.gift-photos figure:nth-child(6) { --photo-size: 26.1655%; --photo-x: 0.0000%; --photo-y: 26.7933%; }
.gift-photos figure:nth-child(7) { --photo-size: 27.8008%; --photo-x: 0.0607%; --photo-y: 0.0000%; }
.gift-photos figure:nth-child(8) { --photo-size: 26.1655%; --photo-x: 73.8345%; --photo-y: 78.0072%; }
.gift-photos figure:nth-child(9) { --photo-size: 22%; --photo-x: 53.4059%; --photo-y: 2.6269%; }
.gift-photos figure:nth-child(10) { --photo-size: 23%; --photo-x: 13.6787%; --photo-y: 73.0757%; }
.gift-photos figure:nth-child(11) { --photo-size: 22%; --photo-x: -2.8836%; --photo-y: 55.1387%; }

@media (max-width: 959px) {
  #regalo {
    width: 100vw;
    margin-inline: calc(50% - 50vw);
    overflow-x: clip;
  }

  .gift-photos {
    width: 112vw;
    margin: 0 0 2.5rem calc(50% - 56vw);
  }
}

@media (prefers-reduced-motion: no-preference) {
  #regalo.is-visible > .gift-photos { animation: none; }

  #regalo.is-visible .gift-photos figure {
    animation: soft-reveal 1.05s ease-out both;
    animation-delay: calc(380ms + var(--photo-step, 0) * 210ms);
  }

  .gift-photos figure:nth-child(2) { --photo-step: 1; }
  .gift-photos figure:nth-child(3) { --photo-step: 2; }
  .gift-photos figure:nth-child(4) { --photo-step: 3; }
  .gift-photos figure:nth-child(5) { --photo-step: 4; }
  .gift-photos figure:nth-child(6) { --photo-step: 5; }
  .gift-photos figure:nth-child(7) { --photo-step: 6; }
  .gift-photos figure:nth-child(8) { --photo-step: 7; }
  .gift-photos figure:nth-child(9) { --photo-step: 8; }
  .gift-photos figure:nth-child(10) { --photo-step: 9; }
  .gift-photos figure:nth-child(11) { --photo-step: 10; }
}

.venue-location { margin-top: .55rem; }

@media (min-width: 960px) {
  #programma { position: relative; }

  .program-label {
    position: absolute;
    margin: 0;
    translate: -50% calc(-100% - .55rem);
    white-space: nowrap;
  }
}

.button { border-radius: 999px; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

main section { scroll-margin-top: 1rem; }

.venue-location a {
  font-style: normal;
  display: inline-block;
  margin-top: .45rem;
  color: #895751;
  font-size: 1rem;
  text-underline-offset: .25em;
}

.rsvp-form {
  width: min(100%, 30rem);
  margin: 1.75rem auto 0;
  text-align: left;
}

.rsvp-form label { display: block; margin: .8rem 0 .25rem; }

.rsvp-form :is(input, select, textarea) {
  width: 100%;
  padding: .55rem .7rem;
  border: 1px solid var(--line);
  border-radius: .55rem;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

.rsvp-form textarea { resize: vertical; }

.rsvp-details {
  min-inline-size: 0;
  margin: 1.4rem 0 0;
  padding: 0;
  border: 0;
}

.rsvp-details legend { padding: 0; font-style: italic; }
.rsvp-form button { font-family: inherit; }
.rsvp-form button:disabled { opacity: .65; }
#rsvp-preview-note { font-size: .95rem; }

.cover-portrait .cover-portrait__frame { transform: scaleX(-1); }

.closing-photo {
  position: relative;
  width: min(84%, 17.5rem);
  aspect-ratio: 1;
  margin: 0 auto 1.75rem;
  overflow: hidden;
  border-radius: 50%;
  outline: 1px solid var(--cipria);
  outline-offset: 9px;
}

.closing-photo img {
  position: absolute;
  width: 208%;
  height: auto;
  max-width: none;
  inset: -107% auto auto -85%;
}

.closing p { margin: .5rem 0 1.25rem; }

.rsvp-copy { margin-top: 2rem; }

@media (min-width: 960px) {
  #conferma {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: center;
    gap: clamp(2rem, 6vw, 5rem);
  }

  .rsvp-copy { margin-top: 0; }
}

@media (min-width: 960px) {
  #regalo::before { inset-block-start: 2rem; }
}

.svg-definitions { position: absolute; }
#rsvp-transfer-info { margin: 0 0 .55rem; font-size: 1rem; }

.program h3 { font-size: 1.38rem; }

@media (min-width: 600px) and (max-width: 1279px) {
  main h2 { font-size: clamp(1.85rem, 4vw, 2.6rem); }
  .cover h1 { font-size: clamp(1.8rem, 5.5vw, 3rem); }
}

@media (max-width: 959px) {
  .cover {
    --cover-portrait-size: clamp(7.5rem, 34vw, 15rem);
    --cover-portrait-top: calc(50% - var(--cover-portrait-size) / 2 - clamp(1.25rem, 4.5vw, 2.25rem));
    position: relative;
    overflow-x: clip;
  }

  .cover > .cover-portrait {
    display: block;
    position: absolute;
    width: var(--cover-portrait-size);
    margin: 0;
    animation-delay: 660ms;
  }

  .cover-portrait--steven {
    inset-inline-start: calc(-.25 * var(--cover-portrait-size));
    inset-block-start: var(--cover-portrait-top);
  }

  .cover-portrait--silvia {
    inset-inline-end: calc(-.25 * var(--cover-portrait-size));
    inset-block-start: calc(var(--cover-portrait-top) + clamp(2.5rem, 9vw, 4.5rem));
  }

  .cover-portrait .cover-portrait__frame { outline-offset: 5px; }
}

.footer-names {
  display: flex;
  align-items: center;
  gap: .55em;
  letter-spacing: .17em;
  text-transform: uppercase;
}

.footer-names img { width: .9em; height: auto; }

.footer-countdown:not([hidden]) {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(.65rem, 4vw, 1.85rem);
  margin-top: 1.2rem;
  color: #895751;
  font-size: .8rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.footer-countdown strong {
  display: grid;
  place-items: center;
  width: clamp(3.1rem, 12vw, 4.5rem);
  aspect-ratio: 1;
  margin: 0 auto .4rem;
  border: 1px solid var(--cipria);
  border-radius: 50%;
  font: clamp(1.5rem, 5vw, 2.15rem)/1 var(--display);
  font-variant-numeric: tabular-nums;
}

.cover p em { letter-spacing: .055em; }

.gift-label { margin: 0 0 .45rem; }

@media (min-width: 960px) {
  nav {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--paper) url("carta.svg") repeat;
  }

  main section { scroll-margin-top: 5.5rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .cover-portrait .cover-portrait__frame {
    animation: portrait-float 4.8s ease-in-out 1.15s infinite;
  }

  .cover-portrait--silvia .cover-portrait__frame { animation-delay: 1.75s; }
}

@keyframes portrait-float {
  0%, 100% { transform: translateY(0) scaleX(-1); }
  50% { transform: translateY(-.7rem) scaleX(-1); }
}
