/* ============================================================
   PROF ENERGY · Advent calendar
   ============================================================ */
:root {
  --navy-900: #071330;
  --navy-800: #0b1b3f;
  --navy-700: #13306b;
  --navy-600: #1d4593;
  --red-600: #d3122a;
  --red-500: #ec2337;
  --red-700: #a00b1d;
  --gold: #ffd27a;
  --frost: #f4f8ff;
  --ink: #0e214a;
  --radius-card: 18px;
  --frame-w: 520px;
  --gap: clamp(10px, 3.2vw, 16px);
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #fff;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--navy-900);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- Desktop stage (sides) ---------- */
.stage {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse at center, rgba(7, 19, 48, .35), rgba(7, 19, 48, .85) 70%),
    url("../img/bg-wide.jpg") center / cover no-repeat;
  filter: blur(6px) saturate(1.1);
  transform: scale(1.05);
}

/* ---------- App frame ---------- */
.app {
  position: relative;
  width: 100%;
  max-width: var(--frame-w);
  min-height: 100dvh;
  margin: auto;
  background: var(--navy-800) url("../img/bg-tall.jpg") center top / cover no-repeat;
  overflow-x: clip;
  isolation: isolate;
}

@media (min-width: 640px) {
  .app {
    margin: 20px auto;
    min-height: auto;
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    border-radius: 32px;
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, .12),
      0 30px 80px rgba(0, 0, 0, .55),
      0 0 120px rgba(255, 200, 120, .12);
  }
}

.snow {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100vw, var(--frame-w));
  height: 100dvh;
  pointer-events: none;
  z-index: 0;
}

.view {
  position: relative;
  z-index: 1;
  padding: max(18px, env(safe-area-inset-top)) clamp(14px, 4.5vw, 26px) 28px;
}

/* ---------- Hero ---------- */
.hero { text-align: center; }

.brandline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 18px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 16px;
  border: 2px solid rgba(255, 255, 255, .9);
  border-radius: 999px;
  background: rgba(7, 19, 48, .35);
  backdrop-filter: blur(4px);
}
.logo__txt {
  font-weight: 900;
  font-size: 13px;
  line-height: 1;
  letter-spacing: .04em;
  text-align: left;
}
.logo__globe { width: 26px; height: 26px; color: #dfe8ff; }
.brandline__sep { width: 2px; height: 26px; background: var(--red-500); border-radius: 2px; }
.brandline__for {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* Red ribbon title */
.ribbon {
  position: relative;
  margin: 0 auto;
  width: fit-content;
  max-width: 100%;
  padding: 0 18px;
  font-size: inherit;
  outline: none;
}
.ribbon__body {
  position: relative;
  z-index: 1;
  display: block;
  padding: 10px 22px 12px;
  background: linear-gradient(180deg, var(--red-500), var(--red-600) 55%, var(--red-700));
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(160, 11, 29, .45), inset 0 1px 0 rgba(255, 255, 255, .35);
  font-style: italic;
  font-weight: 900;
  font-size: clamp(17px, 5.2vw, 25px);
  line-height: 1.15;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .18);
}
.ribbon__num { font-size: 1.45em; margin-right: .1em; vertical-align: -0.06em; }
.ribbon::before,
.ribbon::after {
  content: "";
  position: absolute;
  top: 10px;
  bottom: -8px;
  width: 34px;
  background: var(--red-700);
  z-index: 0;
}
.ribbon::before { left: 0; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 40% 50%); }
.ribbon::after  { right: 0; clip-path: polygon(0 0, 100% 0, 60% 50%, 100% 100%, 0 100%); }

.hero__sub {
  margin: 14px 0 0;
  font-weight: 600;
  font-style: italic;
  font-size: clamp(13px, 3.6vw, 15px);
  text-shadow: 0 1px 6px rgba(0, 0, 0, .5);
}

.status {
  margin: 14px auto 0;
  width: fit-content;
  max-width: 100%;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(7, 19, 48, .55);
  border: 1px solid rgba(255, 210, 122, .35);
  backdrop-filter: blur(6px);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  color: var(--gold);
}
.status:empty { display: none; }

/* ---------- Grid ---------- */
.grid {
  list-style: none;
  margin: 30px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: var(--gap);
  row-gap: calc(var(--gap) + 22px);
  padding-top: 18px;
}
.grid > li { width: calc((100% - 2 * var(--gap)) / 3); }

/* ---------- Card (window) ---------- */
.card {
  --glow: rgba(255, 214, 140, .55);
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  width: 100%;
  aspect-ratio: 1 / .92;
  padding: 26px 6px 10px;
  border: 2px solid rgba(255, 255, 255, .95);
  border-radius: var(--radius-card);
  background:
    radial-gradient(120% 80% at 50% 0%, #fff 0 40%, transparent 70%),
    linear-gradient(180deg, #ffffff 0%, #e6eefb 70%, #d3e0f5 100%);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, .25),
    0 0 22px var(--glow),
    0 10px 22px rgba(0, 0, 0, .35),
    inset 0 -6px 14px rgba(120, 150, 200, .25);
  transition: transform .25s cubic-bezier(.2, .8, .3, 1.3), box-shadow .25s;
}
/* snow cap */
.card::before {
  content: "";
  position: absolute;
  left: -3px;
  right: -3px;
  top: -6px;
  height: 22px;
  border-radius: 14px 14px 50% 50% / 14px 14px 10px 10px;
  background:
    radial-gradient(circle at 12% 100%, #fff 8px, transparent 9px),
    radial-gradient(circle at 34% 110%, #fff 10px, transparent 11px),
    radial-gradient(circle at 62% 105%, #fff 9px, transparent 10px),
    radial-gradient(circle at 86% 100%, #fff 8px, transparent 9px),
    linear-gradient(#fff, #f3f7ff);
  filter: drop-shadow(0 3px 2px rgba(120, 150, 200, .35));
  pointer-events: none;
}
.card__bow {
  position: absolute;
  top: 0;
  left: 50%;
  width: 62%;
  max-width: 92px;
  transform: translate(-50%, -52%);
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .3));
  pointer-events: none;
  z-index: 2;
}
.card__date {
  font-weight: 800;
  font-size: clamp(19px, 6vw, 27px);
  letter-spacing: -.01em;
  line-height: 1;
}
.card__icon { width: clamp(24px, 8vw, 36px); height: clamp(24px, 8vw, 36px); color: var(--navy-600); }
.card__chip {
  position: absolute;
  bottom: -11px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .3);
}
.card__chip svg { width: 11px; height: 11px; }

@media (hover: hover) {
  .card:hover { transform: translateY(-4px) scale(1.03); }
}
.card:active { transform: scale(.97); }
.card:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }

/* locked */
.card.is-locked {
  --glow: rgba(160, 190, 255, .18);
  cursor: not-allowed;
  background: linear-gradient(180deg, #e9eef7 0%, #c9d4e7 100%);
}
.card.is-locked .card__date,
.card.is-locked .card__icon { opacity: .5; }
.card.is-locked .card__bow { filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .3)) saturate(.75) brightness(.92); }
.card.is-locked .card__chip { background: var(--navy-800); color: #c9d6f2; }

/* today */
.card.is-today {
  --glow: rgba(255, 205, 110, .95);
  animation: pulse 2.2s ease-in-out infinite;
}
.card.is-today .card__chip { background: linear-gradient(180deg, var(--red-500), var(--red-700)); color: #fff; }

/* opened (past) */
.card.is-open .card__chip { background: #fff; color: var(--navy-700); }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(255, 255, 255, .3), 0 0 18px var(--glow), 0 10px 22px rgba(0, 0, 0, .35), inset 0 -6px 14px rgba(120, 150, 200, .25); }
  50%      { box-shadow: 0 0 0 5px rgba(255, 220, 150, .55), 0 0 38px var(--glow), 0 10px 22px rgba(0, 0, 0, .35), inset 0 -6px 14px rgba(120, 150, 200, .25); }
}
.card.shake { animation: shake .45s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px) rotate(-2deg); }
  40% { transform: translateX(6px) rotate(2deg); }
  60% { transform: translateX(-4px) rotate(-1deg); }
  80% { transform: translateX(4px) rotate(1deg); }
}

/* ---------- Footer ---------- */
.foot {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 40px 0 0;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(7, 19, 48, .62);
  border: 1px solid rgba(255, 255, 255, .14);
  backdrop-filter: blur(8px);
  font-size: 12.5px;
  line-height: 1.45;
}
.foot svg { flex: none; width: 30px; height: 30px; color: var(--red-500); }
.foot p { margin: 0; }

/* ============================================================
   DAY VIEW
   ============================================================ */
.view--day {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding-bottom: 30px;
}

.daybar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin: calc(-1 * max(18px, env(safe-area-inset-top))) calc(-1 * clamp(14px, 4.5vw, 26px)) 16px;
  padding: max(12px, env(safe-area-inset-top)) clamp(14px, 4.5vw, 26px) 12px;
  background: linear-gradient(180deg, rgba(7, 19, 48, .92), rgba(7, 19, 48, .7));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}
.back {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 12px 7px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
}
.back svg { width: 18px; height: 18px; }
.back:hover { background: rgba(255, 255, 255, .2); }
.daybar__title { margin: 0; font-size: 15px; font-weight: 800; outline: none; text-align: center; }

.poster {
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .15);
  background: var(--navy-700);
  view-transition-name: poster;
}
.poster img { width: 100%; height: auto; }

.poster--empty {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: min(440px, 50vh);
  padding: 30px 24px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 210, 122, .25), transparent 60%),
    linear-gradient(180deg, #13306b, #0b1b3f);
}
.poster--empty .big { font-size: 64px; line-height: 1; }
.poster--empty h3 { margin: 0; font-size: 22px; font-weight: 900; font-style: italic; }
.poster--empty p { margin: 0; opacity: .8; font-size: 14px; }

.daynav {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
}
.daynav__btn {
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(7, 19, 48, .6);
  border: 1px solid rgba(255, 255, 255, .18);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.daynav__btn[aria-disabled="true"] { visibility: hidden; }

.cta-wrap {
  margin-top: 20px;
  padding: 0;
}
@media (max-width: 639px) {
  .view--day { padding-bottom: 90px; }
  .cta-wrap {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 6;
    padding: 14px 16px max(14px, env(safe-area-inset-bottom));
    background: linear-gradient(180deg, transparent, rgba(7, 19, 48, .9) 40%);
  }
}
.cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 20px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, var(--red-500), var(--red-600) 55%, var(--red-700));
  box-shadow: 0 10px 28px rgba(211, 18, 42, .55), inset 0 1px 0 rgba(255, 255, 255, .35);
  font-weight: 900;
  font-size: 17px;
  letter-spacing: .02em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform .15s;
}
.cta svg { width: 22px; height: 22px; }
.cta:hover { transform: translateY(-1px); }
.cta:active { transform: scale(.98); }

/* ============================================================
   MODAL
   ============================================================ */
.modal {
  width: min(92vw, 400px);
  padding: 30px 24px 22px;
  border: 0;
  border-radius: 26px;
  background:
    radial-gradient(120% 60% at 50% 0%, #fff 0 45%, transparent 75%),
    linear-gradient(180deg, #fff, #e8effb);
  color: var(--ink);
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
  overflow: visible;
}
.modal:modal { overscroll-behavior: contain; }
.modal::backdrop {
  background: rgba(4, 10, 28, .65);
  backdrop-filter: blur(4px);
  overflow: hidden;
  overscroll-behavior: contain;
}
.modal[open] { animation: pop .3s cubic-bezier(.2, .9, .3, 1.25); }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(.94); } }

.modal__close-form { position: absolute; top: 10px; right: 10px; margin: 0; }
.modal__x {
  width: 36px; height: 36px;
  border: 0; border-radius: 50%;
  background: rgba(14, 33, 74, .08);
  font-size: 24px; line-height: 1;
  color: var(--ink);
  cursor: pointer;
}
.modal__badge {
  width: 64px; height: 64px;
  margin: -62px auto 10px;
  display: grid; place-items: center;
  font-size: 32px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff6b78, var(--red-600) 55%, var(--red-700));
  box-shadow: 0 8px 20px rgba(211, 18, 42, .5), 0 0 0 4px #fff;
}
.modal__title { margin: 0 0 8px; font-size: 22px; font-weight: 900; font-style: italic; }
.modal__text { margin: 0 0 12px; font-size: 14px; line-height: 1.45; color: #3a4a6b; }
.modal__offer {
  margin: 0 0 18px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(211, 18, 42, .08);
  color: var(--red-700);
  font-size: 13px;
  font-weight: 700;
}
.modal__offer:empty { display: none; }
.modal__actions { display: grid; gap: 10px; }
.action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 15px;
  text-decoration: none;
  color: #fff;
  transition: transform .15s, filter .15s;
}
.action:hover { filter: brightness(1.08); transform: translateY(-1px); }
.action svg { width: 20px; height: 20px; flex: none; }
.action--phone { background: linear-gradient(180deg, var(--red-500), var(--red-700)); }
.action--mail  { background: linear-gradient(180deg, var(--navy-600), var(--navy-800)); }
.action--tg    { background: linear-gradient(180deg, #2fa8e8, #1c86c4); }
.action--wa    { background: linear-gradient(180deg, #2fcf6a, #1ca850); }
.modal__note { margin: 14px 0 0; font-size: 12px; color: #6b7a99; }
.modal__note:empty { display: none; }

/* ============================================================
   TOAST & DEMO
   ============================================================ */
.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  max-width: min(90vw, 420px);
  padding: 12px 18px;
  border-radius: 14px;
  background: rgba(7, 19, 48, .95);
  border: 1px solid rgba(255, 210, 122, .4);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 50;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.demo {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 40;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .95);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
}
.demo label { display: flex; gap: 6px; align-items: center; }
.demo select { font: inherit; padding: 3px 4px; border-radius: 6px; }

/* ============================================================
   MOTION
   ============================================================ */
::view-transition-old(root),
::view-transition-new(root) { animation-duration: .35s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation: none !important; }
  .snow { display: none; }
}

/* demo panel offset on narrow screens */
@media (max-width: 1100px) {
  .demo { top: auto; bottom: 96px; right: 50%; transform: translateX(50%); }
  .has-demo .view--calendar { padding-bottom: 90px; }
}

/* desktop: шире рамка, 4 окошка в ряд (4/4/3), всё помещается на экран */
@media (min-width: 640px) {
  :root { --frame-w: 600px; --gap: 16px; }
  .grid > li { width: calc((100% - 3 * var(--gap)) / 4); }
  .card__date { font-size: 24px; }
  .card__icon { width: 30px; height: 30px; }
  .ribbon__body { font-size: 24px; }
}
.brandline__for, .logo { text-shadow: 0 1px 6px rgba(0, 0, 0, .8); }
