/* Julian & Mateo, Lisbon. One-page love letter. Edit :root to restyle. */
:root {
  --blush: #EFD3CB;
  --blush-2: #F7E6E0;
  --olive: #5E6541;
  --olive-d: #40462E;
  --ink: #1F2A3A;
  --paper: #FCF8F2;
  --wax: #8E2F35;
  --rule: #D8C6BD;
  --muted: #6C6A64;

  --serif: "Cormorant Garamond", Georgia, serif;
  --script: "Mrs Saint Delafield", "Brush Script MT", cursive;
  --sans: "Karla", system-ui, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --gutter: clamp(1rem, 5vw, 4rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 1.0625rem/1.65 var(--sans); color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, h4 { margin: 0; font-weight: 400; }
h2 { font: italic 400 clamp(2.4rem, 5.4vw, 4.4rem)/1 var(--serif); letter-spacing: -.01em; }
p { margin: 0 0 1em; }
a { color: inherit; }
.wrap { width: min(1180px, 100% - var(--gutter) * 2); margin-inline: auto; }
:focus-visible { outline: 2px solid var(--wax); outline-offset: 3px; }
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 1rem; top: 1rem; z-index: 99; background: var(--paper); padding: .5rem 1rem; }
.hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Bar ---------- */
.bar { position: fixed; inset: 0 0 auto; z-index: 40; display: flex; justify-content: space-between; align-items: center; padding: .9rem var(--gutter); color: var(--blush-2); transition: background-color .4s, color .4s, box-shadow .4s; }
.bar.is-solid { background: rgba(252, 248, 242, .92); color: var(--ink); box-shadow: 0 1px 0 var(--rule); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.bar__mono { font: italic 500 1.6rem/1 var(--serif); text-decoration: none; }
.bar__mono span { font-family: var(--script); font-style: normal; font-size: 1.5em; margin: 0 .05em; vertical-align: -.12em; }
.bar__nav { display: flex; gap: clamp(.8rem, 2.4vw, 2rem); align-items: center; font-size: .95rem; }
.bar__nav a { text-decoration: none; padding: .3rem 0; border-bottom: 1px solid transparent; transition: border-color .3s; }
.bar__nav a:hover { border-color: currentColor; }
.bar__rsvp { border: 1px solid currentColor !important; border-radius: 99px; padding: .35rem 1rem !important; }

/* ---------- Hero desk ---------- */
.desk {
  --w: min(600px, 86vw, calc((100svh - 230px) / 1.12));
  min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding: 6rem var(--gutter) 2.2rem; gap: 1.4rem; color: var(--blush-2);
  background:
    radial-gradient(120% 80% at 50% 30%, rgba(255,255,255,.08), transparent 60%),
    repeating-linear-gradient(90deg, rgba(0,0,0,.035) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(0deg, rgba(255,255,255,.03) 0 1px, transparent 1px 4px),
    var(--olive-d);
  overflow: hidden;
}
.desk__to { font: italic 400 clamp(1.1rem, 2vw, 1.45rem)/1.3 var(--serif); text-align: center; max-width: 30ch; margin: 0 0 auto; padding-top: 1rem; opacity: .9; }
.desk__hint { font-size: .9rem; margin: 0; opacity: .8; min-height: 1.4em; }
.desk__hint .when-open, .is-opened .desk__hint .when-closed { display: none; }
.is-opened .desk__hint .when-open { display: inline; }

/* ---------- Envelope ---------- */
.env { position: relative; width: var(--w); aspect-ratio: 700 / 450; perspective: 1600px; margin-top: calc(var(--w) * .46); }
.env__inside { position: absolute; inset: 0; border-radius: 4px; background: repeating-linear-gradient(135deg, var(--olive) 0 6px, #6A7249 6px 12px); box-shadow: 0 30px 60px -20px rgba(0,0,0,.55); }
.env__pocket { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.env__pocket svg { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 -1px 1px rgba(80,40,30,.12)); }
.env__pocket .p-l, .env__pocket .p-r { fill: #EBC9C0; }
.env__pocket .p-b { fill: var(--blush); }
.env__address { position: absolute; left: 50%; bottom: 13%; transform: translateX(-50%); margin: 0; width: 70%; text-align: center; color: var(--ink); font: italic 400 clamp(.8rem, 2.1vw, 1.15rem)/1.35 var(--serif); }
.env__stamp { position: absolute; right: 5%; bottom: 8%; width: 12%; aspect-ratio: 4/5; padding: 4px; background: var(--paper); transform: rotate(4deg); box-shadow: 0 2px 4px rgba(0,0,0,.15); }
.env__stamp img { width: 100%; height: 100%; object-fit: cover; }
.env__flap { position: absolute; left: 0; right: 0; top: 0; height: 66.7%; z-index: 4; transform-origin: 50% 0; transform: rotateX(0deg); transition: transform .75s var(--ease), z-index 0s .38s; }
.env__flap svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 3px 3px rgba(60,30,20,.2)); }
.env__flap path { fill: #F2D8D0; }

.seal { position: absolute; z-index: 6; left: 50%; top: 64%; width: clamp(64px, 17%, 104px); aspect-ratio: 1; padding: 0; border: 0; background: none; cursor: pointer; transform: translate(-50%, -50%); transition: top .75s var(--ease), transform .75s var(--ease); filter: drop-shadow(0 4px 6px rgba(40,10,10,.35)); }
.seal svg { width: 100%; height: 100%; display: block; }
.seal__wax { fill: var(--wax); }
.seal__ring { fill: none; stroke: #6E1F26; stroke-width: 4; }
.seal text { font: italic 500 34px var(--serif); fill: #C9777B; }
.seal:hover { transform: translate(-50%, -50%) scale(1.06); }
.env:not(.is-open) .seal { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { filter: drop-shadow(0 4px 14px rgba(239,211,203,.55)); } }

/* The card (letter) */
.card { position: absolute; left: 4%; top: 5%; width: 92%; height: 90%; z-index: 2; display: grid; grid-template-columns: 46% 1fr; gap: 5%; padding: 3.2%; background: var(--paper); color: var(--ink); border-radius: 2px; box-shadow: 0 18px 40px -18px rgba(0,0,0,.45); }
.card__photo { margin: 0; overflow: hidden; }
.card__photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 100%; }
.card__text { display: flex; flex-direction: column; justify-content: center; text-align: center; container-type: inline-size; }
.card__kicker { font: italic 400 max(10px, 6.2cqi)/1.2 var(--serif); margin: 0 0 3cqi; color: var(--muted); }
.card__names { font: 400 17cqi/0.95 var(--script); color: var(--ink); display: flex; flex-direction: column; align-items: center; }
.card__amp { font-size: .55em; line-height: .9; color: var(--olive); }
.card__line { font: italic 400 max(10px, 7cqi)/1.2 var(--serif); margin: 3cqi 0 4cqi; }
.card__date { font: 600 max(9px, 5.4cqi)/1.3 var(--sans); letter-spacing: .02em; margin: 0; }
.card__place { font: italic 400 max(10px, 6.4cqi)/1.3 var(--serif); margin: 0; color: var(--olive); }

.env.is-open .env__flap { transform: rotateX(180deg); z-index: 1; }
.env.is-open .seal { top: -62%; transform: translate(-50%, -50%) rotate(-14deg); }
.env.is-open .card { animation: card-out 1.5s .25s var(--ease) both; }
.env.is-closing .card { animation: card-in .9s var(--ease) both; }
@keyframes card-out {
  0% { transform: translateY(0); z-index: 2; }
  45% { transform: translateY(-64%); z-index: 2; }
  46% { z-index: 5; }
  100% { transform: translateY(-6%) rotate(-1.6deg) scale(1.05); z-index: 5; }
}
@keyframes card-in {
  0% { transform: translateY(-6%) rotate(-1.6deg) scale(1.05); z-index: 5; }
  50% { transform: translateY(-64%); z-index: 5; }
  51% { z-index: 2; }
  100% { transform: translateY(0); z-index: 2; }
}

/* ---------- Letter ---------- */
.letter { background: var(--blush); padding: clamp(4rem, 9vw, 8rem) var(--gutter); }
.letter__sheet { position: relative; width: min(760px, 100%); margin: 0 auto; padding: clamp(2.5rem, 6vw, 5rem) clamp(1.5rem, 6vw, 5rem) clamp(3rem, 6vw, 5rem); background: var(--paper); box-shadow: 0 30px 60px -30px rgba(90,40,30,.35); }
.letter__salute { font: 400 clamp(2.8rem, 6vw, 4rem)/1 var(--script); margin-bottom: 1.2rem; }
.letter__body p { font: italic 400 clamp(1.25rem, 2.2vw, 1.5rem)/1.6 var(--serif); max-width: 34ch; }
.letter__sign { font: italic 400 1.3rem/1.2 var(--serif); margin: 2rem 0 0; }
.letter__names { font: 400 clamp(3rem, 7vw, 4.6rem)/1 var(--script); color: var(--olive-d); margin: 0; }

.postmark { position: absolute; right: clamp(1rem, 4vw, 3rem); top: clamp(1rem, 4vw, 2.5rem); width: clamp(120px, 20vw, 170px); aspect-ratio: 1; color: var(--wax); transform: rotate(-10deg); opacity: .9; }
.postmark svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.postmark circle { fill: none; stroke: currentColor; stroke-width: 3; }
.postmark circle + circle { stroke-width: 1.5; }
.postmark text { font: 600 15px var(--sans); letter-spacing: .12em; fill: currentColor; }
.postmark__num { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; margin: 0; }
.postmark__num b { font: 500 clamp(2rem, 4vw, 2.8rem)/1 var(--serif); }
.postmark__num span { font: italic 400 .95rem/1 var(--serif); }

.stamp { position: absolute; right: clamp(-2rem, -3vw, -1rem); bottom: clamp(-3rem, -5vw, -2rem); width: clamp(150px, 26vw, 240px); margin: 0; padding: 12px; background: #fff;
  -webkit-mask: radial-gradient(circle, #0000 4px, #000 4.5px) -7px -7px / 14px 14px, linear-gradient(#000 0 0) content-box;
          mask: radial-gradient(circle, #0000 4px, #000 4.5px) -7px -7px / 14px 14px, linear-gradient(#000 0 0) content-box;
  filter: drop-shadow(0 10px 18px rgba(60,20,20,.28)); }
.stamp img { aspect-ratio: 700/860; object-fit: cover; width: 100%; }
.stamp--tilt { transform: rotate(5deg); }

/* ---------- Days ---------- */
.days { padding: clamp(4.5rem, 10vw, 9rem) 0; background: var(--paper); }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem 3rem; margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.head p { margin: 0; max-width: 30ch; color: var(--muted); }
.itin { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1.6fr 1fr; border-top: 1px solid var(--ink); }
.itin__day { padding: 1.6rem clamp(1rem, 2.4vw, 2.2rem) 2rem; border-right: 1px solid var(--rule); }
.itin__day:first-child { padding-left: 0; }
.itin__day:last-child { border-right: 0; padding-right: 0; }
.itin__day--big { background: var(--blush-2); }
.itin h3 { font: italic 400 1.35rem/1.2 var(--serif); color: var(--muted); margin-bottom: 1.4rem; }
.itin__dow { display: block; font: 400 2.9rem/1 var(--script); color: var(--olive-d); }
.itin__item { display: grid; grid-template-columns: 4.6rem 1fr; gap: .8rem; padding: .9rem 0; border-top: 1px dashed var(--rule); }
.itin__item time { font: italic 500 1.2rem/1.4 var(--serif); color: var(--wax); }
.itin h4 { font: 600 1rem/1.4 var(--sans); margin-bottom: .2rem; }
.itin__item p { font-size: .95rem; margin: 0; color: #3C4450; }
.itin__dress { margin: 2.5rem 0 0; max-width: 60ch; font: italic 400 1.3rem/1.5 var(--serif); }
.itin__dress b { font-style: normal; font-weight: 500; }

/* ---------- Travel ---------- */
.travel { background: var(--olive-d); color: var(--blush-2); padding-bottom: clamp(4rem, 9vw, 8rem); }
.travel__photo { margin: 0; height: clamp(300px, 56vh, 620px); overflow: hidden; }
.travel__photo img { width: 100%; height: 100%; object-fit: cover; object-position: 60% 45%; }
.travel__grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(2.5rem, 6vw, 6rem); margin-top: clamp(3rem, 6vw, 5rem); }
.travel h2 { font-size: clamp(2.2rem, 4.2vw, 3.4rem); margin-bottom: 2rem; }
.route { margin: 0; }
.route div { display: grid; grid-template-columns: 5rem 1fr; gap: 1rem; padding: 1rem 0; border-top: 1px solid rgba(247,230,224,.22); }
.route dt { font: italic 500 1.3rem/1.3 var(--serif); color: var(--blush); }
.route dd { margin: 0; color: rgba(247,230,224,.85); }
.stays { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.stays li { padding: 1.4rem 1.5rem; background: rgba(247,230,224,.07); border-left: 3px solid var(--blush); }
.stays h3 { font: italic 500 1.5rem/1.2 var(--serif); margin-bottom: .4rem; }
.stays p { margin: 0 0 .6rem; color: rgba(247,230,224,.82); font-size: .96rem; }
.stays a { font-size: .9rem; font-weight: 600; text-underline-offset: 4px; }

/* ---------- Reply ---------- */
.reply { background: var(--blush); padding: clamp(4.5rem, 10vw, 9rem) 0; }
.reply__wrap { display: grid; grid-template-columns: .8fr 1.2fr; gap: clamp(2.5rem, 6vw, 6rem); align-items: start; }
.reply__intro h2 { margin-bottom: 1rem; }
.reply__intro p { font: italic 400 1.3rem/1.5 var(--serif); max-width: 26ch; }
.reply__ps { font-size: 1.15rem !important; color: var(--olive-d); margin-top: 2rem; }
.rcard { position: relative; background: var(--paper); padding: clamp(1.8rem, 4vw, 3rem); display: grid; gap: 1.3rem; box-shadow: 0 30px 60px -30px rgba(90,40,30,.4); outline: 1px solid var(--rule); outline-offset: -12px; }
.f { display: grid; gap: .35rem; border: 0; margin: 0; padding: 0; min-width: 0; }
.f > span, .f legend { font: italic 500 1.1rem/1.2 var(--serif); color: var(--olive-d); padding: 0; }
.f input, .f select, .f textarea { width: 100%; font: 400 1rem/1.4 var(--sans); color: var(--ink); background: transparent; border: 0; border-bottom: 1px solid var(--ink); border-radius: 0; padding: .45rem 0; }
.f textarea { resize: vertical; border: 1px solid var(--rule); padding: .6rem; }
.f input:focus, .f select:focus, .f textarea:focus { outline: none; border-color: var(--wax); box-shadow: 0 1px 0 var(--wax); }
.f--choice { display: flex; flex-wrap: wrap; gap: .6rem 1rem; }
.f--choice legend { width: 100%; margin-bottom: .5rem; }
.f--choice label { position: relative; cursor: pointer; }
.f--choice input { position: absolute; opacity: 0; }
.f--choice span { display: inline-block; padding: .6rem 1.1rem; border: 1px solid var(--ink); border-radius: 99px; font: italic 500 1.15rem/1 var(--serif); transition: background-color .3s, color .3s; }
.f--choice input:checked + span { background: var(--ink); color: var(--paper); }
.f--choice input:focus-visible + span { outline: 2px solid var(--wax); outline-offset: 2px; }
.f-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.send { justify-self: start; margin-top: .4rem; padding: 1rem 1.8rem; border: 0; border-radius: 99px; background: var(--wax); color: var(--paper); font: 600 1rem/1 var(--sans); cursor: pointer; transition: transform .3s var(--ease), background-color .3s; }
.send:hover { background: #7A242A; transform: translateY(-2px); }
.rcard__status { margin: 0; font: italic 500 1.2rem/1.4 var(--serif); color: var(--olive-d); min-height: 1.4em; }

/* ---------- Footer ---------- */
.foot { background: var(--ink); color: var(--blush-2); text-align: center; padding: 4rem var(--gutter) 3rem; }
.foot p { margin: 0 0 .4rem; }
.foot__names { font: 400 clamp(3.2rem, 8vw, 5.5rem)/1.1 var(--script); color: var(--blush); }
.foot__credit { font-size: .85rem; opacity: .7; margin-top: 1.5rem !important; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .itin { grid-template-columns: 1fr; }
  .itin__day, .itin__day:first-child, .itin__day:last-child { padding: 1.5rem 1.2rem; border-right: 0; border-bottom: 1px solid var(--rule); }
  .travel__grid, .reply__wrap { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .bar__nav a:not(.bar__rsvp) { display: none; }
  .desk { --w: 88vw; padding-top: 5rem; justify-content: center; gap: 2rem; }
  .desk__to { margin-bottom: 1rem; }
  .card { grid-template-columns: 1fr; grid-template-rows: 48% 1fr; gap: 4%; left: 6%; width: 88%; height: 150%; top: 5%; }
  .env.is-open .card { animation-name: card-out-m; }
  .env.is-closing .card { animation-name: card-in-m; }
  .card__names { font-size: 15cqi; flex-direction: row; gap: .2em; justify-content: center; }
  .card__kicker { display: none; }
  .card__photo img { object-position: 50% 46%; }
  .card__line { margin: 1cqi 0 2cqi; }
  .env { margin-top: calc(var(--w) * .62); }
  .env.is-open .seal { top: -56%; }
  .postmark { position: relative; right: auto; top: auto; margin: -1rem 0 1.5rem auto; }
  .stamp { position: relative; right: auto; bottom: auto; margin: 2rem 0 -4rem auto; width: 62%; }
  .f-row { grid-template-columns: 1fr; }
  .itin__item { grid-template-columns: 4.2rem 1fr; }
}
@keyframes card-out-m {
  0% { transform: translateY(-18%) scale(.9); z-index: 5; opacity: 0; }
  100% { transform: translateY(-34%) rotate(-1.4deg) scale(1.02); z-index: 5; opacity: 1; }
}
@keyframes card-in-m {
  0% { transform: translateY(-34%) rotate(-1.4deg) scale(1.02); z-index: 5; opacity: 1; }
  100% { transform: translateY(-18%) scale(.9); z-index: 5; opacity: 0; }
}
.env:not(.is-open):not(.is-closing) .card { visibility: hidden; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
