/* ---------- Tokeni ---------- */
:root {
  --fundal: #F3E0DC; /* roz pal, fundalul paginii */
  --salvie: #E4E9DE; /* rămâne pentru stările din formular */
  --hartie: #FBFAF6;
  --frunza: #33463A;
  --frunza-stins: rgba(51, 70, 58, .74);
  --roz: #DDB0AC;
  --bujor: #B9736F;
  --bujor-inchis: #A35E5B; /* fundal de buton: contrast 4.6:1 cu hârtia */
  --aur: #B39A62;
  --eroare: #8F3F3C;

  --script: 'Pinyon Script', 'Snell Roundhand', 'Apple Chancery', cursive;
  --serif: 'Spectral', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;

  --gutter: clamp(1.5rem, 6vw, 4rem);
  --seal: clamp(104px, 28vw, 148px);
  --fibre: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .2 0 0 0 0 .27 0 0 0 0 .23 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--fundal);
}
html.is-locked { overflow: hidden; }

body {
  margin: 0;
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(1.0625rem, .98rem + .45vw, 1.1875rem);
  line-height: 1.68;
  color: var(--frunza);
  background: var(--fundal);
  text-align: center;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }
.defs { position: absolute; }

h2, h3, p, dl, dd, ol, fieldset, legend { margin: 0; padding: 0; }
ol { list-style: none; }
fieldset { border: 0; min-width: 0; }

h2 {
  font-weight: 300;
  font-style: italic;
  font-size: clamp(1.7rem, 1.35rem + 1.6vw, 2.2rem);
  line-height: 1.2;
  letter-spacing: -.005em;
}
h3 {
  font-weight: 400;
  font-size: 1.22em;
  line-height: 1.3;
}

a { color: inherit; text-decoration-color: var(--bujor); text-underline-offset: .22em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--frunza);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- Ilustrațiile botanice (generate în script.js) ---------- */
.bot-stem, .bot-leaf, .bot-rib, .bot-stalk {
  fill: none;
  stroke: var(--frunza);
  stroke-width: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.bot-leaf { fill: rgba(51, 70, 58, .085); }
.bot-rib { stroke-width: .7; opacity: .7; }
.bot-petal { fill: var(--roz); stroke: var(--bujor); stroke-width: .8; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.bot-heart { fill: var(--aur); }
.bot-berry { fill: var(--roz); stroke: var(--bujor); stroke-width: .8; vector-effect: non-scaling-stroke; }

/* stările finale sunt cele implicite; animațiile pornesc doar din „from”, deci fără animație totul e deja desenat */
.draw {
  stroke-dasharray: 1 1.1;
  animation: draw var(--t, .7s) cubic-bezier(.4, 0, .3, 1) var(--d, 0s) backwards;
}
.bot-leaf.draw {
  animation:
    draw var(--t, .7s) cubic-bezier(.4, 0, .3, 1) var(--d, 0s) backwards,
    tint 1s ease-out var(--d, 0s) backwards;
}
.pop {
  transform-box: fill-box;
  transform-origin: center;
  animation: pop .8s cubic-bezier(.2, .8, .3, 1.25) var(--d, 0s) backwards;
}
/* tulpina crește uniform, ca frunzele să apară chiar în urma vârfului */
.bot-stem.draw { animation-timing-function: linear; }
/* ornamentele de sub hero așteaptă până ajung pe ecran */
.await .draw, .await .pop { animation-play-state: paused; }
@keyframes draw { from { stroke-dashoffset: 1; } }
@keyframes tint { from { fill-opacity: 0; } }
@keyframes pop { from { transform: scale(0) rotate(-50deg); opacity: 0; } }

/* ---------- Calcul și sigiliul ---------- */
.veil {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  cursor: pointer;
  animation: veil-gone .01s linear 2.75s forwards;
}
.veil__half {
  --dir: -1;
  position: relative;
  flex: 1 1 50%;
  overflow: hidden;
  background: var(--fibre), rgba(248, 248, 243, .8);
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
  animation: part 1.65s cubic-bezier(.76, 0, .24, 1) 1.05s forwards;
  will-change: transform;
}
.veil__half--right { --dir: 1; }
/* umbra fină de pe muchia unde se întâlnesc foile */
.veil__half::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0; right: 0;
  width: 46px;
  background: linear-gradient(to left, rgba(51, 70, 58, .13), rgba(51, 70, 58, 0));
}
.veil__half--right::after { right: auto; left: 0; transform: scaleX(-1); }

.veil__thread {
  position: absolute;
  top: 50%; left: 0; right: 0;
  height: 1px;
  background: var(--aur);
  box-shadow: 0 1px 1px rgba(51, 70, 58, .18);
  opacity: .8;
}
.veil__seal {
  position: absolute;
  top: 50%;
  right: calc(var(--seal) / -2);
  width: var(--seal);
  height: var(--seal);
  margin-top: calc(var(--seal) / -2);
  z-index: 1;
  filter: drop-shadow(0 3px 5px rgba(70, 35, 32, .35));
  animation: seal-in .75s cubic-bezier(.2, .9, .3, 1.15) backwards;
}
.veil__half--right .veil__seal { right: auto; left: calc(var(--seal) / -2); }

@keyframes seal-in { from { opacity: 0; transform: scale(1.3); } }
@keyframes part { to { transform: translateX(calc(var(--dir) * 104%)); } }
@keyframes veil-gone { to { visibility: hidden; } }
@keyframes veil-fade { to { opacity: 0; visibility: hidden; } }

/* până se încarcă fonturile, totul așteaptă în prima stare */
.fonts-wait .veil, .fonts-wait .veil *,
.fonts-wait .hero, .fonts-wait .hero * { animation-play-state: paused !important; }

/* click pe calc = sari peste animație */
.reveal-skip .veil { display: none; }
.reveal-skip .hero, .reveal-skip .hero * { animation-delay: 0s !important; animation-duration: .01s !important; }

/* ---------- Fundalul și foaia ---------- */
.ground { display: none; }
@media (min-width: 1180px) {
  .ground { display: block; }
  .ground__branch {
    position: fixed;
    bottom: -20px;
    width: clamp(150px, 15vw, 230px);
    height: auto;
    opacity: .42;
    overflow: visible;
  }
  .ground__branch--left { left: clamp(1rem, 5vw, 6rem); }
  .ground__branch--right { right: clamp(1rem, 5vw, 6rem); transform: scaleX(-1); }
}

.sheet {
  position: relative;
  max-width: 45rem;
  margin: clamp(.6rem, 3vw, 3rem) auto;
  width: calc(100% - 2 * clamp(.6rem, 3vw, 3rem));
  background: var(--fibre), var(--hartie);
  border-radius: 3px;
  box-shadow: 0 1px 0 rgba(120, 72, 66, .07), 0 28px 60px -34px rgba(120, 72, 66, .34);
  isolation: isolate;
}

/* lianele de pe margini, care cresc în jos odată cu derularea (vezi buildVines în script.js) */
.vine {
  position: absolute;
  left: 0;
  z-index: -1;
  overflow: visible;
  pointer-events: none;
  opacity: .78;
}
.vine--right { left: auto; right: 0; transform: scaleX(-1); }
.vine__stem { stroke-dasharray: 1 1.1; stroke-dashoffset: 1; transition: stroke-dashoffset .35s linear; }
.vine__tip { opacity: 0; transition: transform .35s linear, opacity .3s ease-out; }
.vine__leaf {
  transform: scale(0);
  opacity: 0;
  transition: transform .8s cubic-bezier(.2, .8, .3, 1.2), opacity .4s ease-out;
}
.vine__leaf.is-grown { transform: none; opacity: 1; }

.block { padding: clamp(3rem, 9vw, 5rem) var(--gutter); }
.block > h2 { margin-bottom: 1.1em; }

.divider {
  display: block;
  width: min(15rem, 56%);
  height: auto;
  margin: 0 auto;
  overflow: visible;
}

/* jucăriile plutitoare: strat fix pe tot ecranul, sub text (z-index -1 în contextul foii) */
.toys { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.toy {
  position: absolute;
  top: 100%;
  left: var(--x);
  width: var(--s);
  height: var(--s);
  opacity: .5;
  animation: toy-rise var(--t) linear var(--d) infinite;
  will-change: transform;
}
.toy svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke: var(--frunza);
  stroke-width: 1.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: toy-sway var(--w) ease-in-out infinite alternate;
}
.toy text { fill: var(--frunza); stroke: none; }
.toy-rose { fill: var(--roz); }
.toy-paper { fill: var(--hartie); }
.toy-gold { fill: #E9D9A8; }
.toy-ink { fill: var(--frunza); stroke: none; }
@keyframes toy-rise { to { transform: translateY(calc(-100vh - var(--s) - 60px)); } }
@keyframes toy-sway {
  from { transform: translateX(-16px) rotate(-10deg); }
  to { transform: translateX(16px) rotate(10deg); }
}
@media (max-width: 640px) {
  .toy { width: calc(var(--s) * .78); height: calc(var(--s) * .78); opacity: .38; }
  .toy--center { display: none; } /* pe telefon, mijlocul rămâne liber pentru text */
}

/* ---------- Hero ---------- */
.hero {
  min-height: calc(100svh - 2 * clamp(.6rem, 3vw, 3rem));
  padding: clamp(2.5rem, 7vh, 4.5rem) clamp(.75rem, 4vw, 4rem) clamp(1.5rem, 4vh, 2.5rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.hero__intro {
  max-width: 19em;
  text-wrap: balance;
  font-style: italic;
  font-size: 1.12em;
  line-height: 1.45;
  animation: settle 1.1s ease-out 1.7s backwards;
}
.wreath {
  position: relative;
  width: min(100%, 30rem, 62svh);
  aspect-ratio: 1;
  container-type: inline-size;
  margin: clamp(.5rem, 2vh, 1.5rem) auto;
}
.wreath__art { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.name {
  position: absolute;
  inset: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--script);
  font-weight: 400;
  font-size: 17.5cqw;
  line-height: .98;
}
.name__line {
  display: block;
  padding: .06em .3em;
  animation: write 1.15s cubic-bezier(.45, 0, .3, 1) 2s backwards;
}
.name__line--first { margin-right: 9cqw; }
.name__line--second { margin-left: 8cqw; animation-delay: 2.75s; }
@keyframes write {
  from { clip-path: inset(-15% 100% -15% -5%); }
  to { clip-path: inset(-15% -5% -15% -5%); }
}

.hero__date {
  font-size: 1.28em;
  font-weight: 400;
  letter-spacing: .01em;
  animation: settle 1s ease-out 3.5s backwards;
}
.hero__place { color: var(--frunza-stins); animation: settle 1s ease-out 3.7s backwards; }

.hero__cue {
  margin-top: clamp(1.25rem, 4vh, 2.75rem);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  font-size: .92em;
  font-style: italic;
  text-decoration: none;
  color: var(--frunza-stins);
  animation: settle 1s ease-out 4.2s backwards;
}
.hero__cue svg { width: 15px; height: 23px; transition: transform .3s ease; }
.hero__cue:hover svg { transform: translateY(4px); }

@keyframes settle { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Cuvântul părinților ---------- */
.message { padding-top: clamp(2rem, 6vw, 3.5rem); }
.message__motto {
  margin-bottom: 1.5em;
  font-style: italic;
  font-size: clamp(1.3rem, 1.1rem + 1vw, 1.6rem);
  line-height: 1.5;
}
.message__motto span { display: block; text-wrap: balance; }
.message__text { max-width: 31em; margin-inline: auto; }
.message__text p { text-wrap: pretty; }
.message__text p + p { margin-top: 1em; }

.family {
  margin-top: clamp(2.25rem, 6vw, 3.25rem);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1.75rem 2rem;
}
/* părinții pe un rând întreg, nașii și moșii alături dedesubt */
.family__group:first-child { grid-column: 1 / -1; }
.family dt { font-style: italic; color: var(--frunza-stins); }
.family dd { font-size: 1.22em; font-weight: 400; line-height: 1.35; margin-top: .15em; }

/* ---------- Programul ---------- */
.event__marker { display: block; width: 3rem; height: 3rem; margin: 0 auto .6rem; overflow: visible; }
.event__stem { display: block; width: 2.6rem; height: auto; margin: 1.1rem auto .5rem; overflow: visible; }
.event__time {
  margin-top: .2rem;
  font-size: clamp(2.3rem, 1.9rem + 2vw, 2.9rem);
  font-weight: 300;
  line-height: 1.15;
  font-variant-numeric: lining-nums;
}
.event__time span { font-size: .42em; font-style: italic; vertical-align: .55em; margin-right: .35em; color: var(--frunza-stins); }
.event__place { font-weight: 400; margin-top: .35rem; }
.event__address { color: var(--frunza-stins); }
.event__map { display: inline-block; margin-top: .6rem; padding: .35rem .2rem; }

.program .button { margin-top: clamp(2.25rem, 6vw, 3rem); }

/* ---------- Butoane ---------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.25rem;
  padding: .7rem 2.1rem;
  border: 1px solid var(--bujor-inchis);
  border-radius: 999px;
  background: var(--bujor-inchis);
  color: var(--hartie);
  font: inherit;
  font-weight: 500;
  letter-spacing: .01em;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.button:hover { background: #8E4F4C; border-color: #8E4F4C; }
.button[disabled] { opacity: .65; cursor: progress; }
.button--quiet { background: transparent; color: var(--frunza); border-color: rgba(51, 70, 58, .45); font-weight: 400; }
.button--quiet:hover { background: var(--salvie); border-color: var(--frunza); }

.link {
  border: 0; background: none; padding: .4rem .2rem;
  font: inherit; color: inherit; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--bujor); text-underline-offset: .22em; text-decoration-thickness: 1px;
}

/* ---------- Formularul ---------- */
.rsvp { position: relative; overflow: hidden; }
.rsvp > h2 { margin-bottom: .45em; }
.rsvp__deadline { color: var(--frunza-stins); }

.form {
  max-width: 26rem;
  margin: clamp(2rem, 5vw, 2.75rem) auto 0;
  text-align: left;
}
.form__demo {
  margin-bottom: 1.75rem;
  padding: .7rem .95rem;
  border: 1px dashed var(--aur);
  border-radius: 6px;
  font-size: .9em;
  line-height: 1.5;
}
.field { margin-bottom: 1.85rem; }
.field label, .choice legend { display: block; font-weight: 400; margin-bottom: .3rem; }
.field__hint { display: block; font-weight: 300; font-size: .88em; font-style: italic; color: var(--frunza-stins); line-height: 1.4; }

.field input[type='text'], .field input[type='tel'] {
  width: 100%;
  min-height: 2.9rem;
  padding: .35rem .1rem;
  border: 0;
  border-bottom: 1px solid rgba(51, 70, 58, .5);
  border-radius: 0;
  background: transparent;
  font: inherit;
  font-weight: 400;
  color: inherit;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.field input[type='text']:focus, .field input[type='tel']:focus {
  outline: none;
  border-bottom-color: var(--frunza);
  box-shadow: 0 1px 0 var(--frunza);
}
.field input[aria-invalid='true'] { border-bottom-color: var(--eroare); box-shadow: 0 1px 0 var(--eroare); }
.field__error, .form__error { margin-top: .45rem; font-size: .92em; font-weight: 400; color: var(--eroare); line-height: 1.45; }
.form__error { margin: 0 0 1.25rem; }

.choice legend { margin-bottom: .7rem; }
.choice__options { display: grid; gap: .65rem; }
.choice__option { position: relative; display: block; margin: 0 !important; cursor: pointer; }
.choice__option input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.choice__option span {
  display: flex;
  align-items: center;
  gap: .8rem;
  min-height: 3.25rem;
  padding: .6rem 1.1rem;
  border: 1px solid rgba(51, 70, 58, .4);
  border-radius: 8px;
  transition: background-color .2s ease, border-color .2s ease;
}
.choice__option span::before {
  content: '';
  flex: none;
  width: 1.05rem; height: 1.05rem;
  border: 1px solid var(--frunza);
  border-radius: 50%;
  background: radial-gradient(circle, var(--bujor) 0 42%, transparent 46%) center / 0 0 no-repeat;
  transition: background-size .25s cubic-bezier(.2, .8, .3, 1.3);
}
.choice__option:hover span { border-color: var(--frunza); }
.choice__option input:checked + span { background-color: var(--salvie); border-color: var(--frunza); font-weight: 400; }
.choice__option input:checked + span::before { background-size: 100% 100%; }
.choice__option input:focus-visible + span { outline: 2px solid var(--frunza); outline-offset: 3px; }

/* detaliile apar doar dacă invitatul vine */
.form__details { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .5s cubic-bezier(.4, 0, .2, 1); }
.form__details.is-open { grid-template-rows: 1fr; }
.form__details-inner { overflow: hidden; min-height: 0; opacity: 0; transition: opacity .35s ease; padding-inline: 4px; margin-inline: -4px; }
.form__details.is-open .form__details-inner { opacity: 1; transition-delay: .15s; }

.counts { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.stepper__control {
  display: grid;
  grid-template-columns: 2.75rem 1fr 2.75rem;
  align-items: center;
  border: 1px solid rgba(51, 70, 58, .4);
  border-radius: 8px;
}
.stepper__control button {
  height: 2.9rem;
  border: 0;
  background: none;
  font: inherit;
  font-size: 1.35em;
  font-weight: 300;
  line-height: 1;
  color: inherit;
  cursor: pointer;
  border-radius: 7px;
  transition: background-color .15s ease;
}
.stepper__control button:hover { background: var(--salvie); }
.stepper__control input {
  width: 100%;
  border: 0;
  background: none;
  font: inherit;
  font-size: 1.2em;
  font-weight: 400;
  font-variant-numeric: lining-nums;
  color: inherit;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}
.stepper__control input::-webkit-outer-spin-button,
.stepper__control input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.checks { display: grid; gap: .35rem; margin-bottom: 1.85rem; }
.check { display: flex; align-items: center; gap: .8rem; min-height: 2.75rem; cursor: pointer; }
.check input {
  flex: none;
  appearance: none;
  -webkit-appearance: none;
  width: 1.3rem; height: 1.3rem;
  margin: 0;
  border: 1px solid var(--frunza);
  border-radius: 4px;
  background: transparent center / 0 no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M4.5 10.5l3.6 3.6 7.4-8' fill='none' stroke='%23FBFAF6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  cursor: pointer;
  transition: background-color .2s ease, background-size .2s ease;
}
.check input:checked { background-color: var(--frunza); background-size: 100%; }

.form__trap { position: absolute; left: -200vw; width: 1px; height: 1px; overflow: hidden; }
.form .button { width: 100%; }

/* ---------- Mulțumirea ---------- */
.thanks { max-width: 26rem; margin: clamp(2rem, 5vw, 2.75rem) auto 0; animation: settle .7s ease-out backwards; }
.thanks:focus { outline: none; }
.thanks__flower { width: 4.5rem; height: 4.5rem; margin-bottom: .6rem; overflow: visible; }
.thanks h3 { font-style: italic; font-weight: 300; font-size: 1.5em; margin-bottom: .4em; }
.thanks .link { margin-top: 1.4rem; font-size: .92em; color: var(--frunza-stins); }

.petals { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.petal {
  position: absolute;
  top: -24px;
  left: var(--x);
  width: var(--s);
  height: calc(var(--s) * 1.35);
  border-radius: 80% 0 80% 0;
  background: var(--roz);
  opacity: 0;
  animation: fall var(--t) cubic-bezier(.3, .1, .6, 1) var(--d) forwards;
}
@keyframes fall {
  0% { opacity: 0; transform: translate3d(0, 0, 0) rotate(var(--r0)); }
  10% { opacity: .9; }
  80% { opacity: .85; }
  100% { opacity: 0; transform: translate3d(var(--drift), var(--fall), 0) rotate(var(--r1)); }
}

/* ---------- Încheiere ---------- */
.closing { padding-top: clamp(1.5rem, 4vw, 2.5rem); }
.closing__line { font-style: italic; font-size: 1.45em; font-weight: 300; line-height: 1.3; }
.closing__contact { margin-top: 1rem; color: var(--frunza-stins); }
.closing__contact a { white-space: nowrap; color: var(--frunza); }

/* ---------- Fără mișcare ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .veil { animation: veil-fade .5s ease .7s forwards; }
  .veil__half, .veil__seal { animation: none; }
  .hero *, .thanks, .draw, .pop { animation: none !important; }
  .vine__stem, .vine__leaf, .vine__tip { transition: none; }
  .petals { display: none; }
  .form__details, .form__details-inner, .hero__cue svg { transition: none; }
}
