/* Self-hosted fonts, subset to Latin + Latin Extended-A (fonts/OFL.txt). No third-party requests. */
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/CormorantGaramond-400.woff2) format("woff2"); }
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/CormorantGaramond-600.woff2) format("woff2"); }
@font-face { font-family: "Cormorant Garamond"; font-style: italic; font-weight: 400; font-display: swap; src: url(/fonts/CormorantGaramond-400i.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/Inter-400.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/Inter-500.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/Inter-600.woff2) format("woff2"); }
@font-face { font-family: "Great Vibes"; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/GreatVibes-400.woff2) format("woff2"); }

/* ============================================================
   Hana & Borna · zimska svadba
   One committed look: deep pine ground, cream paper, antique gold,
   cranberry. No light/dark switch — the invitation looks the same
   for everyone, like the printed one.
   ============================================================ */

:root {
  --pine: #12302a;
  --pine-2: #1b423a;
  --cream: #f8f2e7;        /* cards */
  --paper: #efe5d2;        /* envelope */
  --paper-2: #e3d7bf;
  --field: #fffcf5;        /* inputs */
  --ink: #22302b;
  --ink-soft: #66706a;
  --line: #e3d8c4;
  --gold: #c9a866;         /* decorative lines and borders */
  --gold-ink: #7a5f24;     /* gold as text/links — 5.3:1 on cream */
  --gold-wash: #f3ead8;
  --berry: #8b2f3a;
  --berry-2: #6e2029;
  --on-pine: #f8f2e7;
  --on-pine-soft: #cbc3b1;
  --shadow: 0 2px 4px rgba(0, 0, 0, .14), 0 20px 48px rgba(0, 0, 0, .32);
  --radius: 16px;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --script: "Great Vibes", "Snell Roundhand", "Brush Script MT", cursive;
}

* { box-sizing: border-box; }

html { background: var(--pine); }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(120% 70% at 50% -10%, var(--pine-2), var(--pine) 65%) no-repeat, var(--pine);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
body.has-envelope { overflow: hidden; }

main, .state {
  max-width: 34rem;
  margin: 0 auto;
  padding: 4.5rem 1.25rem 4rem; /* room for the string lights */
  position: relative;
}

[hidden] { display: none !important; }

/* Snow sits above everything and never intercepts input. */
#snow { position: fixed; inset: 0; z-index: 50; pointer-events: none; }

/* ---------------------------------------------------------- typography */

.display {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.75rem, 11vw, 4.25rem);
  line-height: 1.05;
  margin: .1rem 0 .4rem;
  letter-spacing: .01em;
}

h2 {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 600;
  margin: 0 0 1rem;
  letter-spacing: .01em;
  display: flex; align-items: center; gap: .9rem;
}
/* a thin gold rule trailing every section title */
h2::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--gold), transparent); }

.kicker {
  font-family: var(--script);
  font-size: 2rem;
  line-height: 1;
  color: var(--gold);
  margin: 0;
}

.date {
  font-family: var(--serif);
  font-variant-numeric: lining-nums;
  font-size: 1.3rem;
  font-style: italic;
  color: var(--on-pine-soft);
  margin: 0;
}

.lede { font-size: 1.05rem; max-width: 26rem; margin-inline: auto; }
.muted { color: var(--ink-soft); font-size: .875rem; }
.help { color: var(--ink-soft); font-size: .825rem; margin: .15rem 0 .5rem; }

/* ---------------------------------------------------------- hero */

.hero { text-align: center; padding: 1rem 0 2.25rem; color: var(--on-pine); }

.monogram {
  font-family: var(--serif);
  font-size: 1.05rem;
  letter-spacing: .25em;
  white-space: nowrap;
  color: var(--gold);
  border: 1px solid rgba(201, 168, 102, .55);
  border-radius: 999px;
  width: 4.75rem; height: 4.75rem;
  display: grid; place-items: center;
  margin: 0 auto 1.25rem;
  text-indent: .25em;
}
.monogram.small { width: auto; height: auto; border: 0; font-size: .9rem; margin: 1rem auto 0; }

.tree { display: block; width: 8.5rem; height: auto; margin: 1.25rem auto 0; }

/* ---------------------------------------------------------- lights */

.lights {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 80px;
  pointer-events: none; overflow: visible;
  z-index: 1;
}
#envelope .lights { z-index: 0; }
.env-wrap { position: relative; z-index: 1; transform: translateY(6vh); } /* sits just above the hill */

@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
.bulb { animation: twinkle 2.6s ease-in-out infinite; }
.tree-lights .bulb:nth-of-type(2n) { animation-delay: -.9s; }
.tree-lights .bulb:nth-of-type(3n) { animation-delay: -1.7s; animation-duration: 3.2s; }
@media (prefers-reduced-motion: reduce) { .bulb { animation: none; } }

/* photo slot — shown only when config.slika is set */
.hero-photo { margin: 1.5rem auto 0; width: min(14rem, 60vw); }
.hero-photo img {
  display: block; width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: 50%; border: 3px solid var(--gold); box-shadow: var(--shadow);
}

/* ---------------------------------------------------------- cards */

.card {
  background: var(--cream);
  border: 1px solid rgba(201, 168, 102, .35);
  border-radius: var(--radius);
  padding: 1.5rem 1.35rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.greeting .greet-line { font-family: var(--serif); font-size: 1.55rem; margin: 0 0 .5rem; }
.greeting p { color: var(--ink-soft); margin: 0 0 .6rem; }
.greeting p:last-child { margin-bottom: 0; }
.greeting strong { color: var(--ink); font-weight: 600; }

/* ---------------------------------------------------------- program */

.program { list-style: none; margin: 0; padding: 0; }
.program li {
  display: grid; grid-template-columns: 4rem 1fr; gap: .25rem 1rem;
  padding: .9rem 0; border-top: 1px solid var(--line);
}
.program li:first-child { border-top: 0; padding-top: 0; }
.program .t {
  font-family: var(--serif);
  font-variant-numeric: lining-nums tabular-nums;
  font-size: 1.2rem; color: var(--gold-ink); grid-row: span 2;
}
.program .n { font-weight: 600; }
.program .m { color: var(--ink-soft); font-size: .875rem; grid-column: 2; }
.program a, .note a { color: var(--gold-ink); }

.cal {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--line);
}
.cal .lbl { font-size: .825rem; color: var(--ink-soft); margin-right: .25rem; }
.cal-link {
  font-size: .85rem; font-weight: 500; text-decoration: none;
  color: var(--gold-ink); border: 1px solid var(--gold); border-radius: 999px;
  padding: .4rem .85rem;
}
.cal-link:hover { background: var(--gold-wash); }
.cal-link:focus-visible { outline: 2px solid var(--gold-ink); outline-offset: 2px; }

.note h2 { margin-bottom: .5rem; }
.note p { margin: 0; color: var(--ink-soft); }

/* ---------------------------------------------------------- form */

.field { margin: 0 0 1.5rem; border: 0; padding: 0; }
.field:last-of-type { margin-bottom: 1rem; }

legend, label { display: block; font-weight: 600; font-size: .95rem; padding: 0; margin-bottom: .5rem; }

.choice {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .85rem 1rem;
  border: 1px solid var(--line); border-radius: 10px;
  margin-bottom: .5rem;
  cursor: pointer; font-weight: 400;
  background: var(--field);
  transition: border-color .15s, background .15s;
}
.choice:hover { border-color: var(--gold); }
.choice:has(input:checked) { border-color: var(--gold); background: var(--gold-wash); }
.choice:has(input:focus-visible) { outline: 2px solid var(--gold-ink); outline-offset: 2px; }

.choice input { accent-color: var(--berry); margin: .3rem 0 0; flex: none; }
.choice span { display: block; }
.choice strong { display: block; font-weight: 600; }
.choice em { display: block; font-style: normal; font-size: .825rem; color: var(--ink-soft); }

.choice.big { position: relative; justify-content: center; text-align: center; font-weight: 500; padding: 1rem; }
/* Visually hidden, NOT display:none — that would drop it from the tab order
   and keyboard users could never answer the one required question. */
.choice.big input {
  position: absolute; width: 1px; height: 1px; margin: 0;
  opacity: 0; overflow: hidden; clip: rect(0 0 0 0); pointer-events: none;
}

.choice-pair { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.choice-pair .choice { margin-bottom: 0; }
@media (max-width: 26rem) { .choice-pair { grid-template-columns: 1fr; } }

textarea, input[type="number"], input[type="text"] {
  width: 100%; font: inherit; color: var(--ink);
  background: var(--field); border: 1px solid var(--line); border-radius: 10px;
  padding: .7rem .85rem; resize: vertical;
}
textarea:focus, input[type="number"]:focus, input[type="text"]:focus {
  outline: 2px solid var(--gold-ink); outline-offset: -1px; border-color: var(--gold);
}

/* Growing list of companions: one input per person. */
.names { display: grid; gap: .5rem; }
.name-row { display: flex; gap: .5rem; }
.name-row input { flex: 1; min-width: 0; }
.name-row .remove {
  flex: none; width: 2.75rem;
  font: inherit; font-size: 1.35rem; line-height: 1;
  color: var(--ink-soft); background: transparent;
  border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.name-row .remove:hover { color: var(--berry); border-color: var(--berry); }
.name-row .remove:focus-visible { outline: 2px solid var(--gold-ink); outline-offset: 2px; }

.inline-num { display: flex; align-items: center; gap: .75rem; margin-top: .75rem; }
.inline-num label { margin: 0; }
.inline-num input { width: 5.5rem; }

.counter { font-size: .825rem; color: var(--gold-ink); margin: .5rem 0 0; min-height: 1.25rem; }

.form-error {
  color: var(--berry); font-size: .875rem;
  background: rgba(139, 47, 58, .08); border: 1px solid rgba(139, 47, 58, .3);
  border-radius: 8px; padding: .7rem .85rem; margin: 0 0 1rem;
}

.btn {
  display: block; width: 100%;
  font: inherit; font-weight: 600;
  color: var(--on-pine); background: var(--berry);
  border: 1px solid var(--berry-2); border-radius: 10px;
  padding: .85rem 1rem; cursor: pointer;
  transition: background .15s, opacity .15s;
}
.btn:hover { background: var(--berry-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn.ghost { color: var(--gold-ink); background: transparent; border-color: var(--gold); }
.btn.ghost:hover { background: var(--gold-wash); }

.deadline-note { text-align: center; margin: .85rem 0 0; }

/* ---------------------------------------------------------- summary */

.summary { text-align: center; }
.summary h2 { justify-content: center; }
.summary h2::after { display: none; }

.check {
  width: 3rem; height: 3rem; display: grid; place-items: center;
  margin: 0 auto 1rem; border-radius: 999px;
  background: var(--gold-wash); border: 1px solid var(--gold);
  color: var(--berry); font-size: 1.4rem;
}

.summary-list { text-align: left; margin: 1.25rem 0 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.summary-list div { display: grid; grid-template-columns: 9rem 1fr; gap: 1rem; padding: .5rem 0; }
.summary-list dt { color: var(--ink-soft); font-size: .875rem; }
.summary-list dd { margin: 0; white-space: pre-line; }
@media (max-width: 26rem) { .summary-list div { grid-template-columns: 1fr; gap: .1rem; } }

/* ---------------------------------------------------------- envelope */

#envelope {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center; padding: 1.25rem;
  background: radial-gradient(120% 70% at 50% -10%, var(--pine-2), var(--pine) 65%);
  transition: opacity .6s ease;
}
#envelope.leaving { opacity: 0; pointer-events: none; }

.env-wrap { text-align: center; color: var(--on-pine); }

.env {
  position: relative;
  width: min(88vw, 22rem); aspect-ratio: 1.5 / 1;
  margin: 0 auto 1.75rem;
  perspective: 1200px;
  cursor: pointer;
}
.env > * { position: absolute; }

.env-back {
  inset: 0; z-index: 0;
  background: var(--paper-2);
  border: 1px solid rgba(201, 168, 102, .5); border-radius: 8px;
  box-shadow: var(--shadow);
}

.env-card {
  left: 6%; right: 6%; top: 8%; bottom: 8%; z-index: 1;
  background: var(--cream);
  border: 1px solid var(--gold); border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
  display: grid; place-items: center; text-align: center; padding: .5rem;
  transition: transform .8s cubic-bezier(.2, .7, .2, 1) .35s;
}
.env-card .s { font-family: var(--script); color: var(--gold-ink); font-size: 1.3rem; line-height: 1; }
.env-card .n { font-family: var(--serif); color: var(--ink); font-size: 1.45rem; line-height: 1.1; margin-top: .25rem; }
.env.open .env-card { transform: translateY(-62%) scale(1.06); }

/* side + bottom flaps, in front of the card; the notch is where the top flap sits */
.env-front {
  inset: 0; z-index: 2;
  background: linear-gradient(180deg, #e9dfc9 0%, var(--paper) 55%);
  border-radius: 8px;
  clip-path: polygon(0 0, 50% 55%, 100% 0, 100% 100%, 0 100%);
}

.env-to {
  left: 8%; right: 8%; bottom: 11%; z-index: 2;
  font-family: var(--script); font-size: 1.45rem; line-height: 1.1;
  color: var(--gold-ink); text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.env-flap {
  left: 0; right: 0; top: 0; height: 56%; z-index: 3;
  background: linear-gradient(180deg, #ede3ce, #e0d3ba);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  transition: transform .7s cubic-bezier(.4, 0, .2, 1), z-index 0s .3s;
}
.env.open .env-flap { transform: rotateX(180deg); z-index: 0; }

.env-seal {
  left: 50%; top: 56%; z-index: 4;
  width: 3.3rem; height: 3.3rem;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #b04452, var(--berry) 55%, var(--berry-2));
  box-shadow: 0 3px 10px rgba(0, 0, 0, .35), inset 0 0 0 2px rgba(255, 255, 255, .1);
  color: var(--on-pine);
  display: grid; place-items: center;
  font-family: var(--serif); font-weight: 600; font-size: .95rem; letter-spacing: .1em;
  transition: transform .35s ease, opacity .35s ease;
}
.env.open .env-seal { transform: translate(-50%, -50%) scale(1.3); opacity: 0; }


/* --- Envelope scene: hill + firs (app.js), Santa skiing along the bottom (config.santa) --- */

.terrain, .trees { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.terrain { z-index: 0; }
.trees { z-index: 1; }   /* after .santa in the DOM → he skis behind the trees */

.santa {
  position: absolute; left: 0; top: 0;
  width: 120px; height: 90px;
  opacity: 0; pointer-events: none; z-index: 1;
}
#envelope.with-santa .santa { animation: ski 26s linear .8s infinite; }

/* the envelope settles onto the scene */
#envelope .env { animation: settle .7s cubic-bezier(.2, .8, .3, 1.15) .35s both; }
@keyframes settle {
  from { opacity: 0; transform: translateY(-28px) scale(.96); }
  to   { opacity: 1; transform: none; }
}

/* once it can be opened, the seal breathes — the only "tap me" cue there is */
.env.ready .env-seal { animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe {
  0%, 100% { box-shadow: 0 3px 10px rgba(0, 0, 0, .35), 0 0 0 0 rgba(201, 168, 102, .0), inset 0 0 0 2px rgba(255, 255, 255, .1); }
  50%      { box-shadow: 0 3px 10px rgba(0, 0, 0, .35), 0 0 0 12px rgba(201, 168, 102, .22), inset 0 0 0 2px rgba(255, 255, 255, .1); }
}
.env:focus-visible { outline: 2px solid var(--gold); outline-offset: 6px; border-radius: 8px; }

@media (prefers-reduced-motion: reduce) {
  #envelope, .env-card, .env-flap, .env-seal { transition: none !important; }
  #envelope .env, .env.ready .env-seal { animation: none; }
}

/* ---------------------------------------------------------- misc */

.state { text-align: center; padding-top: 5rem; color: var(--on-pine); }
.state .lede, .state .muted { color: var(--on-pine-soft); }

.spinner {
  width: 1.75rem; height: 1.75rem; margin: 0 auto 1rem;
  border: 2px solid rgba(201, 168, 102, .3); border-top-color: var(--gold);
  border-radius: 999px; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

.footer { text-align: center; padding-top: 1rem; color: var(--on-pine-soft); font-size: .875rem; }
