/* Cena de fin de año · Carrara Argentina
   Tokens and grain are taken from carrara.is so the invitation sits in the same family. */

@font-face { font-family: "Portrait"; src: url("fonts/Portrait-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Portrait"; src: url("fonts/Portrait-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --marmol: #edebea;
  --grafite: #2d2a2a;
  --ardesia: #59534f;
  --nuvola: #9a938e;
  --ember: #eb4e19;
  --cielo: #b2cded;
  --lemon: #ffff80;
  --moss: #a2c59b;
  --wine: #3a120d;
  --burg: #6b2018;
  --cream: #f7f3ea;

  --serif: Portrait, Georgia, serif;
  --sans: Manrope, system-ui, sans-serif;
  --mono: "Courier Prime", ui-monospace, monospace;
  --hand: Caveat, "Segoe Script", cursive;

  --mat: 12px;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9 0.45' numOctaves='1' seed='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='200' intercept='-127'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--marmol);
  color: var(--grafite);
  font-family: var(--sans);
  font-weight: 500;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color .9s ease, color .9s ease;
}
body.dark { background: var(--wine); color: var(--marmol); }

/* paper grain (same mask the site uses) and the white mat */
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background-color: var(--burg); opacity: .07;
  -webkit-mask-image: var(--grain); mask-image: var(--grain);
}
body.dark .grain { opacity: .12; }
.mat { position: fixed; inset: 0; z-index: 60; pointer-events: none; border: var(--mat) solid #fff; }

.logo { position: fixed; top: 30px; left: 34px; z-index: 55; color: var(--grafite); transition: color .9s ease; display: block; line-height: 0; }
body.dark .logo { color: var(--marmol); }

main { position: relative; z-index: 2; }
.chapter { position: relative; }
#ch1 { height: 560svh; }
#ch2 { height: 700svh; }
#ch3 { height: 340svh; }
#ch4 { height: 480svh; }
.stage {
  position: sticky; top: 0; height: 100svh; overflow: hidden;
  display: grid; place-items: center;
}

h1 { font-family: var(--serif); font-weight: 700; letter-spacing: -.02em; margin: 0; line-height: 1.02; }

/* ---------- 01 · envelope ---------- */
.hint {
  position: absolute; left: 50%; bottom: 8svh; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 0;
  font-size: 14px; letter-spacing: .02em; color: var(--ardesia);
}
.hint i { width: 1px; height: 44px; background: repeating-linear-gradient(to bottom, var(--ardesia) 0 2px, transparent 2px 6px); animation: drip 1.8s ease-in-out infinite; }
@keyframes drip { 0%,100% { transform: translateY(0); opacity: .9 } 50% { transform: translateY(8px); opacity: .4 } }

.env { position: relative; width: min(88vw, 620px); aspect-ratio: 3 / 2; }
.env > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.env-back { filter: drop-shadow(0 22px 34px rgba(45,42,42,.14)); }
.env-paper { fill: rgba(250,249,246,.92); stroke: rgba(89,83,79,.14); stroke-width: 1; }
.petal { fill: rgba(255,255,255,.5); stroke: rgba(89,83,79,.22); stroke-width: 1; }
.petal.mid { fill: rgba(255,255,255,.4); }

.card {
  position: absolute; left: 50%; top: 50%;
  width: min(74vw, 340px); aspect-ratio: 5 / 7;
  color: var(--grafite);
}
.card-paper {
  position: absolute; inset: 0; background: var(--cream); filter: url(#rough);
  box-shadow: 0 14px 34px rgba(45,42,42,.2);
}
.card-paper::after { content: ""; position: absolute; inset: 0; background-color: var(--burg); opacity: .05; -webkit-mask-image: var(--grain); mask-image: var(--grain); }
.card-body {
  position: absolute; inset: 0; padding: 9% 10% 10%;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; text-align: center;
}
.card-brand { margin: 0; font-size: 13px; letter-spacing: .02em; color: var(--ardesia); }
.card-title { font-size: clamp(2.1rem, 11vw, 2.9rem); }
.card-hand { margin: -.4em 0 0; font-family: var(--hand); font-size: 25px; line-height: 1; color: var(--burg); transform: rotate(-3deg); }
.card-when { display: flex; flex-direction: column; gap: 6px; }
.when-date { margin: 0; font-family: var(--serif); font-size: 1.3rem; line-height: 1.2; }
.when-sub { margin: 0; font-family: var(--mono); font-size: 13px; letter-spacing: .02em; color: var(--ardesia); }

/* ---------- 02 · people ---------- */
.stage-people { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 4svh 4vw; }

.people {
  --pw: min(14.5vw, 18.5svh); --gx: 3vw;
  display: flex; flex-wrap: wrap; justify-content: center; align-content: flex-start;
  width: calc(4 * var(--pw) + 3 * var(--gx) + 2px);
  gap: 3.2svh var(--gx);
}
.pol {
  margin: 0; position: relative; width: var(--pw); background: var(--cream); color: var(--grafite);
  --pad: calc(var(--pw) * .06); padding: var(--pad) var(--pad) 0; box-shadow: 0 1px 2px rgba(0,0,0,.35), 0 12px 24px rgba(0,0,0,.32), inset 0 0 0 1px rgba(120,100,70,.12); transform: rotate(var(--r, 0deg));
}
.photo { position: relative; aspect-ratio: 5 / 6; overflow: hidden; background: #d6cfc3; }
.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 28%; filter: grayscale(1) sepia(.55) contrast(1.18) brightness(.96); }
.photo::after { /* halftone and grain over every face */
  content: ""; position: absolute; inset: 0; pointer-events: none; mix-blend-mode: multiply; opacity: .5;
  background:
    radial-gradient(circle, rgba(60,40,25,.55) .7px, transparent 1.3px) 0 0 / 3.4px 3.4px,
    var(--grain);
}
.photo.ph::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle, #8b8176 1px, transparent 1.6px) 0 0 / 4.5px 4.5px;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 120'%3E%3Ccircle cx='50' cy='46' r='21'/%3E%3Cpath d='M10 120C10 84 28 74 50 74S90 84 90 120Z'/%3E%3C/svg%3E") center bottom / 78% auto no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 120'%3E%3Ccircle cx='50' cy='46' r='21'/%3E%3Cpath d='M10 120C10 84 28 74 50 74S90 84 90 120Z'/%3E%3C/svg%3E") center bottom / 78% auto no-repeat;
}
.cap { padding: calc(var(--pw) * .08) 1px calc(var(--pw) * .1); }
.cap b { display: block; font-family: var(--sans); font-weight: 700; font-size: 13px; letter-spacing: .01em; color: var(--grafite); }
.cap span { display: block; margin-top: 4px; font-family: var(--hand); font-size: 20px; line-height: 1; color: var(--grafite); }

/* ---------- 03 · place ---------- */
.place { position: relative; display: flex; align-items: center; justify-content: center; width: min(92vw, 940px); }
.roa { margin: 0; width: min(36vw, 380px); transform: rotate(-2.2deg); filter: drop-shadow(0 16px 26px rgba(0,0,0,.4)); }
.roa-img { position: relative; aspect-ratio: 387 / 516; background: #1b110d; }
.roa-img img { width: 100%; height: 100%; object-fit: cover; display: block; filter: sepia(.22) saturate(.9) contrast(1.06); }
.roa-fold {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(90deg, transparent 49.6%, rgba(255,255,255,.2) 50%, rgba(0,0,0,.18) 50.4%, transparent 51%),
    linear-gradient(0deg, transparent 49.6%, rgba(255,255,255,.16) 50%, rgba(0,0,0,.15) 50.4%, transparent 51%);
}
.roa-grain { position: absolute; inset: 0; pointer-events: none; background-color: #f1e3cf; opacity: .12; -webkit-mask-image: var(--grain); mask-image: var(--grain); }

.vellum {
  position: relative; z-index: 2; width: min(34vw, 340px); margin-left: -64px; padding: 30px 30px 32px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.1); backdrop-filter: blur(14px) saturate(1.1);
  box-shadow: 0 18px 40px rgba(0,0,0,.28); transform: rotate(1.4deg); color: #fff;
}
.vellum::after { content: ""; position: absolute; inset: 0; pointer-events: none; background-color: #fff; opacity: .08; -webkit-mask-image: var(--grain); mask-image: var(--grain); }
.v-name { margin: 0 0 14px; font-family: var(--serif); font-weight: 700; font-size: clamp(1.9rem, 3.2vw, 2.5rem); line-height: 1.05; letter-spacing: -.02em; }
.v-line { margin: 0; font-size: 16px; line-height: 1.45; }
.v-line.dim { opacity: .7; margin-top: 2px; }
.v-line.gap { margin-top: 1.2em; }
.dotted { display: inline-block; margin-top: 1.5em; font-size: 14px; color: inherit; text-decoration: underline dotted 1px; text-underline-offset: .22em; }

/* ---------- 04 · the year ---------- */
.stage-year { display: block; }
.stipple {
  position: absolute; left: 50%; top: 5svh; transform: translateX(-50%); white-space: nowrap;
  font-family: var(--serif); font-weight: 700; font-size: clamp(7rem, 23vw, 21rem); line-height: .8; letter-spacing: -.03em;
  color: transparent; -webkit-text-stroke: 1.2px var(--nuvola);
  background: radial-gradient(circle, var(--nuvola) 1.1px, transparent 1.8px) 0 0 / 7px 7px;
  -webkit-background-clip: text; background-clip: text;
  -webkit-mask-image: linear-gradient(180deg, #000 20%, rgba(0,0,0,.25) 100%); mask-image: linear-gradient(180deg, #000 20%, rgba(0,0,0,.25) 100%);
  opacity: .8; pointer-events: none; user-select: none;
}
.year-copy { position: absolute; left: 50%; top: 45svh; transform: translateX(-50%); width: min(88vw, 640px); text-align: center; }
.year-line { margin: 0 auto; max-width: 21em; font-family: var(--serif); font-weight: 400; font-size: clamp(1.45rem, 2.9vw, 2.2rem); line-height: 1.25; letter-spacing: -.01em; }

.tag {
  position: absolute; width: 214px; padding: 20px 16px 20px; transform: rotate(var(--r, 0deg));
  font-family: var(--mono); font-size: 12.5px; line-height: 1.5; color: var(--grafite);
}
.tag::before { content: ""; position: absolute; inset: 0; background: var(--paper); filter: url(#rough); box-shadow: 0 8px 18px rgba(45,42,42,.16); z-index: -1; }
.tag.ink { color: var(--cream); }
.tag p { margin: 6px 0 0; }
.tag { isolation: isolate; }
.sign { position: absolute; left: 0; right: 0; bottom: 7svh; margin: 0; text-align: center; font-family: var(--hand); font-size: clamp(30px, 4vw, 44px); color: var(--burg); transform: rotate(-2deg); }

.foot { position: relative; z-index: 2; display: flex; justify-content: space-between; gap: 16px; padding: 22px 36px 36px; font-size: 14px; color: var(--ardesia); border-top: 1px dotted var(--nuvola); }

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  .logo { top: 26px; left: 28px; }
  .people { --pw: min(25vw, 15svh); --gx: 4.5vw; width: calc(3 * var(--pw) + 2 * var(--gx) + 2px); gap: 2svh var(--gx); }
  .cap b { font-size: 11.5px; }
  .cap span { font-size: 14.5px; line-height: .95; }

  .place { flex-direction: column; }
  .roa { width: min(62vw, 280px); }
  .vellum { width: min(76vw, 340px); margin: -64px 0 0 10vw; padding: 24px; }

  .year-copy { top: 27svh; }
  .stipple { top: 7svh; }
  .year-line { font-size: 1.3rem; }
  .tag { width: 43vw; padding: 18px 12px 16px; font-size: 10.5px; line-height: 1.45; }
  .foot { flex-direction: column; gap: 4px; padding: 18px 28px 32px; }
  
}
@media (prefers-reduced-motion: reduce) { .hint i { animation: none; } }
