:root {
  --cream: #fbf5ef;
  --paper: #fffaf5;
  --blush: #f3d6d3;
  --rose: #d77a83;
  --wine: #7a2e3b;
  --ink: #3b2a2c;
  --muted: #8a7275;
  --gold: #c9a15b;
  --shadow: 0 10px 30px rgba(122, 46, 59, 0.12);
  --serif: "Playfair Display", Georgia, serif;
  --script: "Great Vibes", cursive;
  --sans: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.6;
  overflow-x: hidden;
}

#hearts { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
header, section, footer, nav { position: relative; z-index: 1; }

/* ---------- Hero ---------- */
.hero {
  min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 48px 16px;
  background: radial-gradient(ellipse at top, #f8e3e0 0%, var(--cream) 60%);
}
.eyebrow { letter-spacing: .25em; text-transform: uppercase; font-size: .8rem; color: var(--rose); margin: 0 0 12px; }
.hero h1 { margin: 0; font-weight: 500; line-height: 1.1; }
.script { font-family: var(--script); font-size: clamp(2.6rem, 9vw, 5rem); color: var(--rose); }
.name { font-family: var(--serif); font-size: clamp(3rem, 12vw, 7rem); color: var(--wine); font-weight: 700; }
.lead { font-family: var(--serif); font-style: italic; font-size: clamp(1.05rem, 3vw, 1.35rem); max-width: 34ch; color: var(--muted); margin: 20px 0 32px; }
.btn {
  display: inline-block; padding: 14px 28px; border-radius: 999px; text-decoration: none;
  background: var(--wine); color: #fff; font-weight: 500; box-shadow: var(--shadow); transition: transform .2s;
}
.btn:hover { transform: translateY(-2px); }

/* ---------- Nav ---------- */
.dots {
  position: sticky; top: env(safe-area-inset-top, 0px); display: flex; gap: 4px; justify-content: center; flex-wrap: wrap;
  padding: 10px 12px; background: rgba(251, 245, 239, .88); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--blush); z-index: 5;
}
.dots a { color: var(--wine); text-decoration: none; font-size: .85rem; padding: 6px 10px; border-radius: 999px; }
.dots a:hover { background: var(--blush); }

/* ---------- Sections ---------- */
.section { max-width: 1080px; margin: 0 auto; padding: 88px 16px; }
.title { font-family: var(--serif); font-size: clamp(2rem, 6vw, 3rem); color: var(--wine); text-align: center; margin: 0 0 8px; }
.sub, .note { text-align: center; color: var(--muted); margin: 0 0 40px; }
.note { margin-top: 24px; font-style: italic; }
.reveal.in { animation: rise .8s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-top: 32px; }
.stat { background: var(--paper); border-radius: 20px; padding: 28px 16px; text-align: center; box-shadow: var(--shadow); }
.stat b { display: block; font-family: var(--serif); font-size: clamp(2rem, 6vw, 2.8rem); color: var(--wine); font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .9rem; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: linear-gradient(var(--blush), var(--rose), var(--blush)); transform: translateX(-50%); }
.moment { position: relative; width: 50%; padding: 0 40px 56px; }
.moment:nth-child(odd) { left: 0; text-align: right; }
.moment:nth-child(even) { left: 50%; }
.moment::after { content: "♥"; position: absolute; top: 4px; width: 28px; height: 28px; display: grid; place-items: center; background: var(--cream); color: var(--rose); font-size: 1.1rem; }
.moment:nth-child(odd)::after { right: -14px; }
.moment:nth-child(even)::after { left: -14px; }
.moment time { color: var(--rose); font-size: .8rem; letter-spacing: .15em; text-transform: uppercase; }
.moment h3 { font-family: var(--serif); color: var(--wine); margin: 4px 0 8px; font-size: 1.4rem; }
.moment p { margin: 0; color: var(--ink); }
.moment img { width: 100%; max-width: 340px; border-radius: 14px; margin-top: 14px; box-shadow: var(--shadow); cursor: zoom-in; }

/* ---------- Album ---------- */
.drop {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  border: 2px dashed var(--rose); border-radius: 20px; padding: 28px 16px; margin-bottom: 32px;
  background: rgba(255, 250, 245, .7); cursor: pointer; transition: background .2s, transform .2s;
}
.drop.over { background: var(--blush); transform: scale(1.01); }
.drop-icon { font-size: 2rem; color: var(--rose); line-height: 1; }
.drop small { color: var(--muted); }
.gallery { columns: 3 260px; column-gap: 16px; }
.polaroid {
  break-inside: avoid; margin: 0 0 16px; background: #fff; padding: 10px 10px 14px; border-radius: 6px;
  box-shadow: var(--shadow); transform: rotate(var(--tilt, 0deg)); transition: transform .3s; position: relative;
}
.polaroid:hover { transform: rotate(0) scale(1.02); z-index: 2; }
.polaroid img { width: 100%; display: block; border-radius: 3px; cursor: zoom-in; }
.polaroid figcaption { font-family: var(--script); font-size: 1.5rem; color: var(--wine); text-align: center; margin-top: 8px; min-height: 1.5em; outline: none; }
.polaroid figcaption[contenteditable]:empty::before { content: "escribe una leyenda…"; color: #c8b5b7; }
.polaroid .date { display: block; text-align: center; font-size: .75rem; color: var(--muted); }
.polaroid .del { position: absolute; top: 16px; right: 16px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(255,255,255,.9); color: var(--wine); cursor: pointer; opacity: 0; transition: opacity .2s; font-size: 1rem; }
.polaroid:hover .del, .polaroid:focus-within .del { opacity: 1; }
.polaroid .del.armed { width: auto; padding: 0 12px; border-radius: 999px; opacity: 1; font-size: .8rem; background: var(--wine); color: #fff; }
@media (hover: none) { .polaroid .del { opacity: .85; } }
.empty { text-align: center; color: var(--muted); font-style: italic; }

/* ---------- Reason cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.card { perspective: 900px; height: 190px; border: 0; background: none; padding: 0; cursor: pointer; font: inherit; }
.card-inner { display: block; position: relative; width: 100%; height: 100%; transition: transform .7s cubic-bezier(.2,.8,.2,1); transform-style: preserve-3d; }
.card.flipped .card-inner { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; border-radius: 20px; display: grid; place-items: center; padding: 20px; backface-visibility: hidden; box-shadow: var(--shadow); }
.front { background: linear-gradient(135deg, var(--rose), var(--wine)); color: #fff; font-family: var(--serif); font-size: 1.2rem; }
.front b { display: block; font-size: 2.4rem; }
.back { background: var(--paper); color: var(--ink); transform: rotateY(180deg); font-family: var(--serif); font-style: italic; font-size: 1.05rem; text-align: center; }

/* ---------- Dreams ---------- */
.progress { max-width: 520px; height: 12px; margin: 24px auto 0; background: var(--blush); border-radius: 999px; overflow: hidden; }
.bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--rose), var(--wine)); border-radius: inherit; transition: width 1.6s ease; }
.dreams { list-style: none; padding: 0; max-width: 560px; margin: 0 auto; }
.dreams li { display: flex; align-items: center; gap: 14px; background: var(--paper); margin-bottom: 12px; padding: 16px 18px; border-radius: 16px; box-shadow: var(--shadow); }
.dreams .tick { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--rose); color: #fff; font-size: .9rem; }
.dreams li.done .tick { background: var(--rose); }
.dreams li.done span:last-child { color: var(--muted); }
.dreams small { margin-left: auto; color: var(--gold); font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }

/* ---------- Letter ---------- */
.envelope {
  display: block; margin: 40px auto 0; width: min(340px, 100%); aspect-ratio: 3 / 2; position: relative; border: 0; cursor: pointer;
  background: linear-gradient(160deg, #f1cfcb, #e7b5b1); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; font: inherit;
}
.envelope .flap { position: absolute; inset: 0 0 auto 0; height: 60%; background: #e3a9a6; clip-path: polygon(0 0, 100% 0, 50% 100%); transform-origin: top; transition: transform .6s; }
.envelope .seal { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); width: 56px; height: 56px; border-radius: 50%; background: var(--wine); color: #fff; display: grid; place-items: center; font-size: 1.4rem; box-shadow: 0 4px 10px rgba(0,0,0,.2); animation: beat 1.6s infinite; }
.envelope .hint { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; color: var(--wine); font-family: var(--script); font-size: 1.6rem; }
.envelope.open .flap { transform: rotateX(180deg); }
@keyframes beat { 0%,100% { transform: translate(-50%,-50%) scale(1); } 15% { transform: translate(-50%,-50%) scale(1.12); } 30% { transform: translate(-50%,-50%) scale(1); } }
.paper {
  max-width: 680px; margin: 40px auto 0; background: var(--paper); padding: clamp(28px, 6vw, 56px); border-radius: 6px; box-shadow: var(--shadow);
  font-family: var(--serif); font-size: 1.15rem; line-height: 1.85; animation: unfold .9s ease both;
  background-image: repeating-linear-gradient(transparent 0 calc(1.85em - 1px), rgba(215,122,131,.15) calc(1.85em - 1px) 1.85em);
}
.paper p { margin: 0 0 1em; }
.paper .sign { font-family: var(--script); font-size: 2rem; color: var(--wine); text-align: right; margin: 0; }
@keyframes unfold { from { opacity: 0; transform: translateY(30px) scaleY(.6); } to { opacity: 1; transform: none; } }

/* ---------- Footer ---------- */
.footer { text-align: center; padding: 48px 16px 64px; color: var(--muted); }
.footer a { color: var(--wine); }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; background: rgba(30, 14, 18, .92); z-index: 20; display: flex; align-items: center; justify-content: center; padding: 16px; }
.lightbox[hidden] { display: none; }
.lightbox figure { margin: 0; text-align: center; max-width: 100%; }
.lightbox img { max-width: 100%; max-height: 80svh; border-radius: 6px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.lightbox figcaption { color: #fbe9ea; font-family: var(--script); font-size: 1.9rem; margin-top: 10px; }
.lb-close, .lb-nav { position: absolute; background: rgba(255,255,255,.12); color: #fff; border: 0; cursor: pointer; border-radius: 50%; width: 48px; height: 48px; font-size: 1.8rem; line-height: 1; }
.lb-close { top: 16px; right: 16px; }
.lb-nav { top: 50%; transform: translateY(-50%); }
.prev { left: 12px; } .next { right: 12px; }

/* ---------- Mobile ---------- */
@media (max-width: 700px) {
  .timeline::before { left: 14px; }
  .moment, .moment:nth-child(even), .moment:nth-child(odd) { width: 100%; left: 0; text-align: left; padding: 0 0 44px 44px; }
  .moment:nth-child(odd)::after, .moment:nth-child(even)::after { left: 0; right: auto; }
  .section { padding: 64px 16px; }
  .card { height: 170px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Portrait + album years ---------- */
.portrait { width: clamp(150px, 38vw, 220px); aspect-ratio: 1; object-fit: cover; object-position: center 25%; border-radius: 50%; border: 6px solid #fff; box-shadow: 0 0 0 2px var(--rose), var(--shadow); margin-bottom: 24px; animation: float 6s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-8px); } }
.album-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 24px; margin: -16px 0 24px; color: var(--wine); font-size: .95rem; }
.album-stats b { font-family: var(--serif); font-size: 1.3rem; }
.years { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 24px; }
.years a { text-decoration: none; color: var(--wine); border: 1px solid var(--rose); padding: 4px 14px; border-radius: 999px; font-size: .9rem; }
.years a:hover { background: var(--blush); }
.year-head { font-family: var(--script); color: var(--rose); font-size: 3rem; text-align: center; margin: 40px 0 16px; column-span: all; scroll-margin-top: 60px; }
.year-head small { display: block; font-family: var(--sans); font-size: .85rem; color: var(--muted); margin-top: -6px; }
.year-group { columns: 3 260px; column-gap: 16px; }
.gallery { columns: auto; }
#album { overflow-x: clip; }
@media (max-width: 700px) { .polaroid { transform: rotate(calc(var(--tilt, 0deg) / 2)); margin-inline: 6px; } }
.section { scroll-margin-top: 100px; }

/* ---------- Projects ---------- */
.projects { display: grid; grid-template-columns: 1.2fr auto 1fr; gap: 20px; align-items: center; }
.project { background: var(--paper); border-radius: 22px; padding: 28px 24px; box-shadow: var(--shadow); text-align: center; }
.project h3 { font-family: var(--serif); font-size: 2rem; margin: 4px 0 8px; color: var(--wine); }
.project h3 a { color: inherit; }
.project p { margin: 0; color: var(--ink); }
.p-label { font-size: .75rem; letter-spacing: .2em; text-transform: uppercase; color: var(--rose); }
.project.hers { background: linear-gradient(150deg, #fff, #fbe4e1); padding: 44px 28px; border: 2px solid var(--blush); }
.project.hers h3 { font-size: 2.6rem; }
.mine { display: grid; gap: 16px; }
.together { text-align: center; color: var(--wine); }
.together span { display: block; font-size: 2.4rem; color: var(--rose); animation: pulse 1.6s infinite; }
.together b { font-family: var(--script); font-weight: 400; font-size: 1.9rem; line-height: 1.1; }
@keyframes pulse { 0%,100% { transform: scale(1); } 15% { transform: scale(1.2); } 30% { transform: scale(1); } }
@media (max-width: 760px) { .projects { grid-template-columns: 1fr; } }

/* ---------- Album tabs + owner ---------- */
.tabs { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin: -12px 0 20px; }
.tabs button { font: inherit; border: 0; background: var(--paper); color: var(--wine); padding: 10px 18px; border-radius: 999px; cursor: pointer; box-shadow: var(--shadow); }
.tabs button span { opacity: .6; font-size: .85em; }
.tabs button[aria-selected="true"] { background: var(--wine); color: #fff; }
.owner { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 18px; margin: -18px 0 28px; color: var(--muted); font-size: .9rem; }
.owner label { display: inline-flex; align-items: center; gap: 6px; color: var(--wine); cursor: pointer; }
.owner input { accent-color: var(--wine); }
.proud { grid-column: 1 / -1; text-align: center; font-family: var(--script); font-size: clamp(1.8rem, 5vw, 2.6rem); color: var(--wine); margin: 16px 0 0; line-height: 1.3; }
