:root {
  --navy: #012748;
  --navy-2: #0c3a66;
  --ink: #0b2a4a;
  --gold: #f2b65a;
  --cream: #fff3d4;
  --orange: #f07a1a;
  --snow: #69a3c2;          /* matches the bottom edge of fg.webp */

  --cols: 6;
  --gap: clamp(6px, 1vw, 16px);
  --grid-w: clamp(640px, min(72vw, (100svh - 150px) * 1.5), 1000px);

  /* foreground image width; height follows its 2268 × 1044 ratio */
  --fg-w: 100vw;
  --fg-h: calc(var(--fg-w) * 0.4603);
  --snow-line: calc(var(--fg-h) * 0.585);        /* where the snow ridge starts in fg.webp */
  --overlap: calc(var(--grid-w) / var(--cols) * .10); /* how far the snow covers the last row */

  --tab-h: 46px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--snow);
  color: #fff;
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.stage {
  position: relative;
  isolation: isolate;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--snow);
}

.stage__bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  background-color: var(--snow);
  background-image: url("../img/bg.webp");
  background-repeat: no-repeat;
  background-position: center top;
  background-size: max(100%, 100svh * 1.54) auto;
}

.stage__bg::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: calc(max(64.94vw, 100svh) - 28svh);
  bottom: 0;
  background: linear-gradient(to bottom, rgba(105, 163, 194, 0) 0, var(--snow) 28svh);
}

.stage__snow {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.stage__header {
  position: relative;
  z-index: 2;
  padding: max(env(safe-area-inset-top, 0px), clamp(18px, 3vw, 36px)) 16px clamp(14px, 2.2vw, 28px);
  text-align: center;
}

.logo {
  display: inline-block;
  vertical-align: top;
}

.logo img {
  display: block;
  width: auto;
  height: clamp(30px, 3.2vw, 46px);
  filter: drop-shadow(0 2px 10px rgba(0, 20, 50, .45));
}

.calendar {
  position: relative;
  z-index: 2;
  width: var(--grid-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: var(--gap);
}

.day {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  perspective: 900px;
  container-type: inline-size;
  -webkit-tap-highlight-color: transparent;
  animation: day-in .7s cubic-bezier(.2, .8, .2, 1.1) backwards;
  animation-delay: calc(var(--i, 0) * 35ms + 150ms);
}

.day__body {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

.day__inner {
  position: absolute;
  inset: 5% 5.5% 6.5% 5.5%;
  display: grid;
  place-items: center;
  border-radius: 13%;
  background:
    radial-gradient(circle at 50% 42%, #fff6dd 0%, #f9d58c 38%, #e59a3c 75%, #b5621c 100%);
  box-shadow:
    inset 0 0 0 2.2cqi rgba(110, 50, 0, .35),
    inset 0 5cqi 10cqi rgba(90, 35, 0, .45);
  opacity: 0;
  transition: opacity .35s ease .2s;
}

.day__inner svg {
  width: 42%;
  height: auto;
  filter: drop-shadow(0 1cqi 1.5cqi rgba(120, 50, 0, .45));
}

.day__inner-num {
  position: absolute;
  bottom: 8%;
  right: 10%;
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 700;
  font-variant-numeric: lining-nums;
  font-size: 11cqi;
  color: #8a4210;
  opacity: .8;
}

.day__door {
  position: absolute;
  inset: 0;
  transform-origin: 6% 50%;
  transform-style: preserve-3d;
  transition: transform .85s cubic-bezier(.2, .75, .25, 1);
}

.day__door img {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 1.5cqi 2.5cqi rgba(0, 12, 35, .35));
  transition: filter .3s ease;
}

.day__num {
  position: absolute;
  inset: 5% 5.5% 6.5% 5.5%;
  display: grid;
  place-items: center;
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 800;
  font-variant-numeric: lining-nums;
  font-size: 34cqi;
  line-height: 1;
  color: var(--cream);
  -webkit-text-stroke: 1.8cqi rgba(74, 32, 4, .82);
  paint-order: stroke fill;
  text-shadow:
    0 1cqi 0 rgba(74, 32, 4, .9),
    0 2.2cqi 3.5cqi rgba(0, 14, 38, .6),
    0 0 6cqi rgba(255, 205, 130, .4);
  pointer-events: none;
}

.day__lock {
  position: absolute;
  top: 55%;
  right: 2%;
  width: 14cqi;
  transform: translateY(-50%);
  filter: drop-shadow(0 .8cqi 1cqi rgba(0, 10, 30, .4));
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: none;
}

.day__lock svg { display: block; width: 100%; height: auto; }

.day.is-locked { cursor: default; }
.day.is-locked .day__lock { opacity: 1; }
.day.is-locked .day__door img {
  filter: drop-shadow(0 1.5cqi 2.5cqi rgba(0, 12, 35, .35)) saturate(.9) brightness(.94);
}

@media (hover: hover) {
  .day:not(.is-locked):not(.is-open):hover .day__door {
    transform: translateY(-2cqi) scale(1.035);
  }
  .day:not(.is-locked):not(.is-open):hover .day__door img {
    filter: drop-shadow(0 3cqi 4cqi rgba(0, 12, 35, .4)) drop-shadow(0 0 3cqi rgba(255, 210, 130, .55));
  }
}

.day:focus-visible { outline: none; }
.day:focus-visible .day__door img {
  filter: drop-shadow(0 0 0 #fff) drop-shadow(0 0 1.2cqi #fff) drop-shadow(0 0 3cqi var(--gold));
}

.day.is-today:not(.is-open) .day__door img {
  animation: today-glow 2.2s ease-in-out infinite;
}

.day.is-open .day__inner { opacity: 1; }
.day.is-open .day__door { transform: rotateY(-74deg); }
.day.is-open .day__num { opacity: 0; transition: opacity .2s ease; }

.day.is-shaking .day__body { animation: shake .45s ease; }

.ground {
  position: relative;
  z-index: 3;
  flex: 1 0 auto;
  min-height: var(--fg-h);
  margin-top: calc((var(--snow-line) + var(--overlap)) * -1);
  background:
    url("../img/fg.webp") center top / var(--fg-w) auto no-repeat,
    linear-gradient(to bottom, transparent calc(var(--fg-h) - 6px), var(--snow) calc(var(--fg-h) - 6px));
  pointer-events: none;
}

.partners {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 10;
  width: min(920px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  align-items: center;
  translate: -50% calc(100% - var(--tab-h));
  transition: translate .55s cubic-bezier(.2, .8, .2, 1);
}

.partners.is-open { translate: -50% 0; }

.partners__toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  height: var(--tab-h);
  margin-bottom: -1px;
  padding: 0 14px 0 26px;
  border: 0;
  border-radius: 18px 18px 0 0;
  background: linear-gradient(180deg, #ffa24a 0%, var(--orange) 55%, #d9620f 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 230, 190, .55),
    inset 0 -2px 0 rgba(130, 50, 0, .25),
    0 -6px 20px rgba(0, 20, 50, .25);
  color: #fff;
  font: 600 13px/1 "Poppins", system-ui, sans-serif;
  letter-spacing: .14em;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(120, 45, 0, .45);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.partners__toggle::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: -7px;
  height: 14px;
  border-radius: 10px 14px 8px 12px / 8px 10px 6px 8px;
  background:
    radial-gradient(14px 9px at 22% 100%, #fff 60%, transparent 62%),
    radial-gradient(18px 10px at 64% 100%, #fff 60%, transparent 62%),
    linear-gradient(180deg, #ffffff, #e4f1fa);
  box-shadow: 0 2px 3px rgba(0, 40, 80, .2);
  pointer-events: none;
}

.partners__toggle:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.partners__arrow {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .22);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35);
  transition: rotate .4s ease;
}

.partners:not(.is-open) .partners__arrow svg { animation: nudge 1.8s ease-in-out infinite; }
.partners.is-open .partners__arrow { rotate: 180deg; }

.partners__panel {
  width: 100%;
  padding: 22px clamp(14px, 2.5vw, 28px) max(env(safe-area-inset-bottom, 0px), 22px);
  border-radius: 22px 22px 0 0;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(242, 182, 90, .2), transparent 60%),
    linear-gradient(180deg, rgba(15, 62, 107, .96), rgba(6, 34, 66, .98));
  border-top: 2px solid var(--orange);
  box-shadow: 0 -18px 50px rgba(0, 15, 40, .4);
  backdrop-filter: blur(6px);
}

.partners__list {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: clamp(8px, 1vw, 12px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.partner {
  display: grid;
  place-items: center;
  aspect-ratio: 3 / 2;
  padding: 14% 12%;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(0, 10, 30, .25);
  text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease;
}

.partner:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0, 10, 30, .35); }
.partner:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.partner img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.partner__ph {
  font-size: 12px;
  font-weight: 500;
  color: #7d97ad;
}

.modal {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100svh - 32px);
  padding: 44px 0 0;
  border: 0;
  background: transparent;
  color: #fff;
  overflow: visible;
}

.modal::backdrop {
  background: rgba(2, 14, 32, .62);
  backdrop-filter: blur(4px);
}

.modal__card {
  position: relative;
  max-height: calc(100svh - 76px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 60px 32px 32px;
  border-radius: 24px;
  text-align: center;
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(242, 182, 90, .22), transparent 60%),
    linear-gradient(180deg, #0f3e6b 0%, #0a2a4c 100%);
  box-shadow:
    0 0 0 1px rgba(242, 182, 90, .35),
    0 30px 80px rgba(0, 0, 0, .5);
}

.modal[open] .modal__card { animation: modal-in .45s cubic-bezier(.2, .8, .2, 1.1); }
.modal[open] .modal__badge { animation: badge-in .45s cubic-bezier(.2, .8, .2, 1.1); }

.modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  cursor: pointer;
  transition: background .2s ease;
}

.modal__close:hover { background: rgba(255, 255, 255, .2); }
.modal__close:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.modal__badge {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 50%;
  display: grid;
  place-items: center;
  align-content: center;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  transform: translateX(-50%);
  background: radial-gradient(circle at 50% 35%, #ffd58f, #f07a1a 70%, #c4560b);
  box-shadow: 0 10px 30px rgba(240, 122, 26, .45), inset 0 -4px 8px rgba(120, 40, 0, .35);
}

.modal__day {
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 700;
  font-variant-numeric: lining-nums;
  font-size: 36px;
  line-height: 1;
  color: #fff7e6;
  text-shadow: 0 2px 0 rgba(120, 50, 0, .5);
}

.modal__badge small {
  margin-top: 2px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #fff3dc;
}

.modal__title {
  margin: 0 0 14px;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(24px, 4vw, 30px);
  line-height: 1.2;
  color: #fbe4b0;
}

.modal__gift {
  position: relative;
  width: min(100%, 44svh * 4 / 3);
  margin: 18px auto 22px;
}

.modal__gift-stage {
  position: relative;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  padding: 6%;
  overflow: hidden;
  border-radius: 18px;
  background: #fff;
  box-shadow:
    0 0 0 3px rgba(242, 182, 90, .9),
    0 0 0 7px rgba(242, 182, 90, .18),
    0 18px 40px rgba(0, 0, 0, .35),
    0 0 60px rgba(255, 200, 120, .25);
}

.modal__gift-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(11, 42, 74, .06), inset 0 -18px 40px rgba(11, 42, 74, .06);
  pointer-events: none;
}

.modal__gift-stage img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.modal[open] .modal__gift-stage img { animation: gift-pop .7s cubic-bezier(.2, .9, .25, 1.25) .15s backwards; }

.modal__gift-label {
  position: absolute;
  z-index: 1;
  top: -13px;
  left: 50%;
  translate: -50% 0;
  padding: 6px 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffa24a, var(--orange));
  box-shadow: 0 6px 14px rgba(240, 122, 26, .45), inset 0 1px 0 rgba(255, 230, 190, .6);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
}

.modal__gift-caption {
  margin-top: 12px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 243, 212, .85);
}

.modal__text {
  font-size: 15px;
  line-height: 1.65;
  color: rgba(255, 255, 255, .86);
}

.modal__text p { margin: 0 0 12px; }
.modal__text p:last-child { margin-bottom: 0; }

.modal__cta {
  display: inline-block;
  margin-top: 22px;
  padding: 14px 28px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff9a3d, var(--orange));
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(240, 122, 26, .4);
  transition: transform .2s ease, box-shadow .2s ease;
}

.modal__cta:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(240, 122, 26, .5); }
.modal__cta:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

.modal__partner {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, .12);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .6);
}

.modal__partner a {
  display: grid;
  place-items: center;
  width: 160px;
  height: 64px;
  padding: 10px 16px;
  border-radius: 12px;
  background: #fff;
}

.modal__partner img { max-width: 100%; max-height: 100%; object-fit: contain; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + 20px + env(safe-area-inset-bottom, 0px));
  z-index: 20;
  max-width: calc(100vw - 32px);
  padding: 12px 20px;
  border-radius: 999px;
  background: rgba(1, 26, 52, .92);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
  color: #fff;
  font-size: 14px;
  text-align: center;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.partners.is-open ~ .preview-badge { display: none; }

.preview-badge {
  position: fixed;
  left: 12px;
  bottom: calc(var(--tab-h) + 12px);
  z-index: 20;
  padding: 6px 12px;
  border-radius: 999px;
  background: #ffd400;
  color: #111;
  font-size: 12px;
  font-weight: 600;
}

@keyframes day-in {
  from { opacity: 0; transform: translateY(24px) scale(.9); }
  to   { opacity: 1; transform: none; }
}

@keyframes today-glow {
  0%, 100% { filter: drop-shadow(0 1.5cqi 2.5cqi rgba(0, 12, 35, .35)) drop-shadow(0 0 0 rgba(255, 214, 130, 0)); }
  50%      { filter: drop-shadow(0 1.5cqi 2.5cqi rgba(0, 12, 35, .35)) drop-shadow(0 0 5cqi rgba(255, 214, 130, .95)); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4%) rotate(-2deg); }
  40% { transform: translateX(4%) rotate(2deg); }
  60% { transform: translateX(-3%) rotate(-1deg); }
  80% { transform: translateX(2%); }
}

@keyframes nudge {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -3px; }
}

@keyframes gift-pop {
  from { opacity: 0; transform: scale(.82) translateY(10px); }
  to   { opacity: 1; transform: none; }
}

@keyframes badge-in {
  from { opacity: 0; transform: translateX(-50%) translateY(24px) scale(.8); }
  to   { opacity: 1; transform: translateX(-50%); }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(24px) scale(.94); }
  to   { opacity: 1; transform: none; }
}

@media (max-width: 900px) {
  :root {
    --cols: 4;
    --grid-w: min(92vw, 620px);
    --fg-w: 130vw;
  }
  .partners__list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  :root {
    --cols: 3;
    --gap: 4px;
    --grid-w: 94vw;
    --fg-w: 160vw;
    --tab-h: 42px;
  }
  .stage__bg { background-image: url("../img/bg-mobile.webp"); }
  .ground {
    padding-bottom: calc(var(--tab-h) + 8px);
    background:
      linear-gradient(to bottom, rgba(105, 163, 194, 0) calc(var(--fg-h) * .82), var(--snow) calc(var(--fg-h) - 2px)) center top / 100% var(--fg-h) no-repeat,
      url("../img/fg.webp") center top / var(--fg-w) auto no-repeat,
      linear-gradient(to bottom, transparent calc(var(--fg-h) - 6px), var(--snow) calc(var(--fg-h) - 6px));
  }
  .partners__toggle { font-size: 12px; padding-left: 22px; }
  .partner { border-radius: 10px; }
  .modal__card { padding: 52px 22px 26px; }
}

@media (prefers-reduced-motion: reduce) {
  .day,
  .day__door,
  .day__inner,
  .day.is-shaking .day__body,
  .partners,
  .partners__arrow,
  .modal[open] .modal__card,
  .modal[open] .modal__badge,
  .modal[open] .modal__gift-stage img { animation: none !important; transition: none !important; }
  .day.is-today:not(.is-open) .day__door img,
  .partners:not(.is-open) .partners__arrow svg { animation: none; }
  .stage__snow { display: none; }
}
