/* =========================================================
   Ertak — a storybook opens into a paper pop-up; a garden party
   with a carousel and balloons. Children's birthdays.
   Built on shared/base.css; this sheet is the look.
   ========================================================= */

:root {
  --bg: #fff8ef;
  --ink: #4a3a35;
  --ink-soft: #8c7468;
  --accent: #ef8466;
  --accent-deep: #e0674a;
  --accent-soft: #ffe6da;
  --line: rgba(224, 103, 74, 0.16);
  --line-strong: rgba(224, 103, 74, 0.32);
  --surface: #fffdf9;
  --on-accent: #fffaf3;
  --shadow: 160 90 70;
  --glow: rgba(255, 252, 246, 0.95);
  --intro-bg: #fbe3d6;

  --mint: #8fd3bf;
  --butter: #ffd977;
  --sky: #9fcdef;
  --peach: #f9b49c;
  --lilac: #c9b3ea;

  --display: "Pacifico", "Nunito", cursive;
  --body: "Nunito", system-ui, sans-serif;
  --label: "Nunito", system-ui, sans-serif;
  --hand: "Caveat", "Nunito", cursive;

  --open-default: url("/styles/ertak/media/open-poster.jpg");
  --amb-poster: url("/styles/ertak/media/amb-poster.jpg");
  --close-poster: url("/styles/ertak/media/close-poster.jpg");
  --dissolve: 2s;
  --pulse: rgba(255, 255, 255, 0.95);
  --pulse-glow: rgba(255, 236, 200, 0.7);
}

/* a paper tablecloth with a few spots of confetti */
body {
  font-size: 18px;
  background:
    radial-gradient(circle at 12% 18%, rgba(143, 211, 191, 0.25) 0 3px, transparent 4px),
    radial-gradient(circle at 78% 42%, rgba(255, 217, 119, 0.35) 0 3px, transparent 4px),
    radial-gradient(circle at 36% 72%, rgba(249, 180, 156, 0.3) 0 3px, transparent 4px),
    radial-gradient(circle at 88% 88%, rgba(159, 205, 239, 0.3) 0 3px, transparent 4px),
    var(--bg);
  background-size: 260px 260px;
}

.label {
  font-weight: 800;
  letter-spacing: 0.18em;
}

/* ---------- Opening ---------- */

.intro__kicker {
  color: var(--accent-deep);
  text-shadow: 0 0 14px var(--glow);
}

.intro__to {
  font-size: clamp(30px, 8.4vw, 38px);
  color: var(--ink);
  text-shadow: 0 0 22px var(--glow), 0 0 6px var(--glow);
}

.intro__hint {
  font-weight: 800;
  letter-spacing: 0.14em;
}

/* ---------- Hero ---------- */

.hero__veil {
  background:
    radial-gradient(ellipse 85% 30% at 50% 22%, rgba(255, 252, 246, 0.72), rgba(255, 252, 246, 0) 72%),
    linear-gradient(to bottom, rgba(255, 248, 239, 0) 78%, rgba(255, 248, 239, 0.8) 93%, var(--bg) 100%);
}

.hero__kicker {
  margin: 0;
  font-family: var(--hand);
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  color: var(--accent-deep);
  text-shadow: 0 0 14px var(--glow);
  rotate: -3deg;
}

/* the name: letters hop in one after another (split by ertak.js) */
.name {
  white-space: nowrap;
  margin: 4px 0 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(64px, 19vw, 88px);
  line-height: 1.25;
  color: var(--accent-deep);
  text-shadow: 0 3px 0 #fff, 0 0 26px var(--glow), 0 0 8px var(--glow);
}

.name .ch {
  display: inline-block;
  opacity: 0;
}

.name .ch--sp {
  width: 0.3em;
}

.hero.is-in .name .ch {
  animation: hop 1.1s cubic-bezier(0.3, 1.6, 0.5, 1) both;
  animation-delay: calc(900ms + var(--i) * 110ms);
}

@keyframes hop {
  0% {
    opacity: 0;
    transform: translateY(40px) scale(0.6) rotate(-8deg);
  }
  60% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

/* the age is a balloon on a string that keeps bobbing */
.age {
  display: inline-grid;
  justify-items: center;
  margin-top: 6px;
}

.age__ball {
  position: relative;
  display: grid;
  place-content: center;
  width: 96px;
  height: 112px;
  border-radius: 50% 50% 48% 48% / 56% 56% 44% 44%;
  background: radial-gradient(circle at 34% 28%, #fff4c8 0 8%, var(--butter) 30%, #f6b94a 100%);
  box-shadow: inset -8px -10px 16px rgba(214, 140, 30, 0.35), 0 16px 26px -14px rgba(160, 100, 30, 0.6);
  color: #8a4b12;
  text-align: center;
  line-height: 1;
}

/* the knot */
.age__ball::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 14px;
  height: 10px;
  translate: -50% 0;
  background: #f6b94a;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.age__num {
  font-family: var(--display);
  font-size: 50px;
  line-height: 1;
}

.age__word {
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.age__string {
  width: 14px;
  height: 46px;
  margin-top: 6px;
  fill: none;
  stroke: rgba(138, 75, 18, 0.5);
  stroke-width: 1.4;
}

.hero.is-in .age {
  animation:
    balloonIn 1.8s cubic-bezier(0.3, 1.4, 0.5, 1) var(--age-d, 2s) both,
    bob 4s ease-in-out calc(var(--age-d, 2s) + 1.8s) infinite;
}

@keyframes balloonIn {
  from {
    opacity: 0;
    transform: translateY(120px) scale(0.6);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0) rotate(-2deg);
  }
  50% {
    transform: translateY(-8px) rotate(2deg);
  }
}

.hero__date {
  position: absolute;
  left: 50%;
  bottom: max(96px, calc(env(safe-area-inset-bottom) + 84px));
  translate: -50% 0;
  margin: 0;
  padding: 8px 20px;
  border-radius: 999px;
  background: rgba(255, 252, 246, 0.86);
  box-shadow: 0 10px 24px -14px rgb(var(--shadow) / 0.6);
  white-space: nowrap;
  font-family: var(--hand);
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
}

.hero.is-in .hero__kicker {
  animation: rise 1.6s var(--ease) 0.5s both;
}

.hero.is-in .hero__date {
  animation: rise 1.6s var(--ease) var(--date-d, 3s) both;
}

/* ---------- Balloons drifting up past the page ---------- */

.sky {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  transition: opacity 3s var(--ease-soft);
}

body.is-open .sky {
  opacity: 1;
}

.sky i {
  position: absolute;
  bottom: -90px;
  left: var(--x);
  width: var(--s);
  height: calc(var(--s) * 1.18);
  border-radius: 50% 50% 48% 48% / 56% 56% 44% 44%;
  background: radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.85) 0 7%, var(--c) 34%);
  opacity: 0.55;
  animation: ascend var(--d) linear var(--delay) infinite;
}

.sky i::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 1px;
  height: calc(var(--s) * 1.1);
  background: rgba(74, 58, 53, 0.25);
}

.sky i:nth-child(1) { --x: 6%; --s: 22px; --c: var(--peach); --d: 26s; --delay: -4s; }
.sky i:nth-child(2) { --x: 84%; --s: 18px; --c: var(--mint); --d: 31s; --delay: -17s; }
.sky i:nth-child(3) { --x: 22%; --s: 14px; --c: var(--sky); --d: 34s; --delay: -24s; }
.sky i:nth-child(4) { --x: 70%; --s: 20px; --c: var(--butter); --d: 29s; --delay: -10s; }
.sky i:nth-child(5) { --x: 46%; --s: 12px; --c: var(--lilac); --d: 38s; --delay: -31s; }

@keyframes ascend {
  0% {
    transform: translate3d(0, 0, 0) rotate(-4deg);
  }
  50% {
    transform: translate3d(24px, -60vh, 0) rotate(4deg);
  }
  100% {
    transform: translate3d(-10px, -125vh, 0) rotate(-4deg);
  }
}

/* ---------- Sections ---------- */

.title {
  font-size: clamp(38px, 11vw, 48px);
  line-height: 1.3;
  color: var(--accent-deep);
}

.divider {
  width: min(64%, 240px);
  margin-top: 6px;
}

.corner {
  width: min(40vw, 200px);
  top: -6px;
}

/* room under the balloon corner */
.invite {
  padding-top: 168px;
}

.invite__greet {
  font-family: var(--hand);
  font-size: clamp(36px, 10vw, 44px);
  font-weight: 700;
  color: var(--accent-deep);
}

.invite__text {
  font-size: 19px;
}

.parents__col {
  padding: 16px 12px;
  border-radius: 22px;
  background: var(--surface);
  border: 2px dashed var(--line-strong);
}

.parents__names {
  font-weight: 700;
  font-size: 18px;
}

.invite__quote {
  font-family: var(--hand);
  font-size: 30px;
  font-weight: 700;
  color: var(--ink-soft);
}

/* ---------- Date ---------- */

.bigdate__day {
  font-size: 128px;
  line-height: 1.15;
  color: var(--accent-deep);
  text-shadow: 4px 5px 0 var(--butter);
}

.bigdate__meta {
  font-family: var(--hand);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
}

.cal {
  border: 2px dashed var(--line-strong);
  font-weight: 700;
}

.cal__wd {
  font-weight: 800;
}

/* the day is a little red balloon */
.cal__d.is-day::before {
  width: 34px;
  height: 38px;
  border-radius: 50% 50% 48% 48% / 56% 56% 44% 44%;
  background: radial-gradient(circle at 34% 28%, #ffd8c8 0 10%, var(--accent) 40%, var(--accent-deep));
  box-shadow: 0 8px 14px -6px rgb(var(--shadow) / 0.6);
  animation: bob 3s ease-in-out infinite;
}

/* four pastel candies */
.cd__row {
  gap: 10px;
}

.cd__cell {
  border: 0;
  padding: 14px 0 10px;
  border-radius: 22px;
  background: var(--c);
}

.cd__cell:nth-child(1) { --c: #ffe3d6; }
.cd__cell:nth-child(2) { --c: #dff3ec; }
.cd__cell:nth-child(3) { --c: #fff1c9; }
.cd__cell:nth-child(4) { --c: #e2effb; }

.cd__num {
  font-family: var(--body);
  font-weight: 800;
  font-size: 34px;
  line-height: 1.1;
  color: var(--ink);
}

.cd__unit {
  font-weight: 800;
}

.cd__past {
  font-size: 34px;
  color: var(--accent-deep);
}

/* ---------- Buttons ---------- */

.btn {
  border-width: 2px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.btn--solid {
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  box-shadow: 0 6px 0 #c9553b, 0 14px 22px -10px rgb(var(--shadow) / 0.7);
}

.btn--solid:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 #c9553b, 0 8px 16px -10px rgb(var(--shadow) / 0.7);
}

/* ---------- Program: every stop gets its own colour ---------- */

.tl__time {
  font-family: var(--hand);
  font-size: 26px;
  font-weight: 700;
  padding-top: 6px;
}

.tl::before {
  border-left: 2px dashed var(--line-strong);
  background: none;
  width: 0;
  left: 83px;
}

.tl__ico {
  border: 0;
  background: var(--c, var(--accent-soft));
  color: var(--ink);
}

.tl:nth-child(4n + 1) .tl__ico { --c: #ffe3d6; }
.tl:nth-child(4n + 2) .tl__ico { --c: #dff3ec; }
.tl:nth-child(4n + 3) .tl__ico { --c: #fff1c9; }
.tl:nth-child(4n + 4) .tl__ico { --c: #e2effb; }

.tl__title {
  font-weight: 800;
  font-size: 19px;
}

.detail {
  border: 2px dashed var(--line-strong);
}

/* ---------- Venue ---------- */

.venue__name {
  font-size: 34px;
  line-height: 1.35;
  color: var(--accent-deep);
}

.mapcard {
  border: 2px dashed var(--line-strong);
}

/* ---------- Gifts: candy-coloured cards ---------- */

.ccard {
  color: var(--ink);
  border: 3px solid #fff;
}

.ccard::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 86% 18%, rgba(255, 255, 255, 0.7) 0 14px, transparent 15px),
    radial-gradient(circle at 76% 34%, rgba(255, 255, 255, 0.45) 0 6px, transparent 7px);
}

.ccard--uzcard {
  background: linear-gradient(135deg, #ffd9c9, #f9b49c);
}

.ccard--humo {
  background: linear-gradient(135deg, #d4f0e6, #8fd3bf);
}

.ccard--visa {
  background: linear-gradient(135deg, #dcebfb, #9fcdef);
}

.copy {
  border-width: 2px;
}

/* ---------- Answer ---------- */

.reply {
  border: 2px dashed var(--line-strong);
}

.sent__title {
  color: var(--accent-deep);
  line-height: 1.3;
}

/* ---------- Closing ---------- */

.closing__veil {
  background:
    linear-gradient(to bottom, var(--bg) 0%, rgba(255, 248, 239, 0.6) 8%, rgba(255, 248, 239, 0) 22%),
    radial-gradient(ellipse 80% 16% at 50% 19%, rgba(255, 250, 244, 0.6), transparent 75%),
    linear-gradient(to top, var(--bg) 0%, rgba(255, 248, 239, 0) 14%);
}

.closing__wait {
  line-height: 1.3;
  color: var(--accent-deep);
  text-shadow: 0 3px 0 #fff, 0 0 24px var(--glow);
}

.closing__names {
  font-weight: 800;
  color: var(--ink);
  text-shadow: 0 0 12px var(--glow);
}

.footer__sign {
  font-family: var(--hand);
  font-size: 26px;
  font-weight: 700;
}

/* ---------- Small and wide screens ---------- */

@media (max-height: 700px) and (max-aspect-ratio: 3/4) {
  .hero__text {
    top: max(6%, calc(env(safe-area-inset-top) + 50px));
  }

  .name {
    font-size: clamp(54px, 16vw, 70px);
  }

  .age__ball {
    width: 80px;
    height: 94px;
  }

  .age__num {
    font-size: 42px;
  }

  .age__string {
    height: 28px;
  }
}

@media (min-aspect-ratio: 3/4) {
  .name {
    font-size: min(88px, 9vh);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sky {
    display: none;
  }

  .hero.is-in .name .ch,
  .hero.is-in .age,
  .cal__d.is-day::before {
    animation: fade 1.2s ease both;
  }
}
