@font-face {
  font-family: "PT Sans Narrow";
  src: url("fonts/pt-sans-narrow.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light;
  --red: #c51f29;
  --cream: #f7f7e8;
  --ink: #080907;
  --green: #24551f;
  --yellow: #ffed94;
  --gap: 10px;
  --radius: 39px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 280px;
  min-height: 100svh;
  background: var(--red);
  color: var(--ink);
  font-family: "PT Sans Narrow", sans-serif;
}

.icon-library {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.invitation {
  width: min(690px, calc(100% - 40px));
  margin-inline: auto;
  padding-block: clamp(100px, 20.4vw, 184px) 60px;
}

.poster {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
}

.tile {
  min-width: 0;
  border-radius: var(--radius);
  background: var(--cream);
}

.headline {
  --toast-cycle: 3.8s;
  position: relative;
  isolation: isolate;
  grid-column: span 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  padding: 18px 34px;
  background: var(--ink);
  color: var(--cream);
}

h1 {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  row-gap: 4px;
  width: 100%;
  margin: 0;
  font-family: inherit;
  font-size: clamp(32px, 7.6vw, 68px);
  font-weight: 400;
  line-height: 1;
  text-transform: uppercase;
}

h1 span {
  display: block;
}

h1 span:first-child {
  grid-column: 1 / -1;
  letter-spacing: 0.03em;
}

.party-name {
  text-transform: none;
}

.headline-bottom {
  grid-column: 1;
  grid-row: 2;
  margin-top: 0;
  font-size: 0.68em;
  line-height: 1.1;
}

.headline h1 {
  grid-area: 1 / 1;
  position: relative;
  z-index: 1;
}

.headline-fireworks {
  position: absolute;
  inset: 0;
  display: none;
  z-index: 0;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

.headline-firework {
  position: absolute;
  display: block;
  height: auto;
  color: #ffe59b;
}

.headline-firework:nth-child(1) {
  --firework-duration: 6.2s;
  --firework-delay: -0.5s;
  top: 5%;
  left: 4%;
  width: 20%;
}

.headline-firework:nth-child(2) {
  --firework-duration: 7.4s;
  --firework-delay: -3.1s;
  top: 1%;
  left: 42%;
  width: 14%;
  color: #fff3ca;
  transform: rotate(15deg);
}

.headline-firework:nth-child(3) {
  --firework-duration: 6.8s;
  --firework-delay: -5.4s;
  top: 7%;
  right: 1%;
  width: 24%;
  transform: rotate(-12deg);
}

.headline-firework:nth-child(4) {
  --firework-duration: 8.3s;
  --firework-delay: -1.7s;
  bottom: 6%;
  left: 1%;
  width: 13%;
  color: #fff3ca;
  transform: rotate(8deg);
}

.headline-firework:nth-child(5) {
  --firework-duration: 7.1s;
  --firework-delay: -4.8s;
  bottom: 1%;
  left: 39%;
  width: 21%;
  transform: rotate(-18deg);
}

.headline-firework:nth-child(6) {
  --firework-duration: 7.8s;
  --firework-delay: -6.9s;
  bottom: 4%;
  right: 6%;
  width: 12%;
  color: #fff3ca;
  transform: rotate(20deg);
}

.firework-spray {
  transform-box: view-box;
  transform-origin: 50px 50px;
  opacity: 0;
}

@keyframes headline-salute {
  0% {
    transform: scale(0.05);
    opacity: 0;
  }
  12% {
    transform: scale(0.35);
    opacity: 0.7;
  }
  34% {
    transform: scale(0.85);
    opacity: 0.45;
  }
  54%, 100% {
    transform: scale(1.15);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .headline-fireworks {
    display: block;
  }

  .firework-spray {
    animation: headline-salute var(--firework-duration) ease-out var(--firework-delay) infinite;
  }
}

.toast-art {
  grid-area: 1 / 1;
  align-self: end;
  justify-self: end;
  width: 35%;
  min-width: 0;
  z-index: 1;
  line-height: 0;
  pointer-events: none;
}

.toast-scene {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.toast-glass {
  transform-box: view-box;
}

.toast-glass-left {
  transform-origin: 51px 103px;
  transform: rotate(-9deg);
}

.toast-glass-right {
  transform-origin: 109px 103px;
  transform: rotate(9deg);
}

.toast-bubbles circle {
  opacity: 0.75;
}

.toast-flash,
.toast-star {
  transform-box: view-box;
  transform-origin: 80px 38px;
  opacity: 0;
}

.toast-burst {
  filter: drop-shadow(0 0 1.2px rgb(255 220 120 / 0.65));
}

.toast-star:nth-child(1) {
  --burst-x: -34px;
  --burst-y: -15px;
}

.toast-star:nth-child(2) {
  --burst-x: -27px;
  --burst-y: -30px;
}

.toast-star:nth-child(3) {
  --burst-x: -15px;
  --burst-y: -42px;
}

.toast-star:nth-child(4) {
  --burst-x: -3px;
  --burst-y: -26px;
}

.toast-star:nth-child(5) {
  --burst-x: 9px;
  --burst-y: -43px;
}

.toast-star:nth-child(6) {
  --burst-x: 25px;
  --burst-y: -33px;
}

.toast-star:nth-child(7) {
  --burst-x: 38px;
  --burst-y: -16px;
}

.toast-star:nth-child(8) {
  --burst-x: 30px;
  --burst-y: -3px;
}

.toast-star:nth-child(9) {
  --burst-x: 20px;
  --burst-y: 10px;
}

.toast-star:nth-child(10) {
  --burst-x: -23px;
  --burst-y: 8px;
}

.toast-star:nth-child(11) {
  --burst-x: -38px;
  --burst-y: -2px;
}

.toast-star:nth-child(12) {
  --burst-x: 4px;
  --burst-y: -52px;
}

.toast-star:nth-child(13) {
  --burst-x: -42px;
  --burst-y: -24px;
}

.toast-star:nth-child(14) {
  --burst-x: 41px;
  --burst-y: -29px;
}

.toast-star:nth-child(15) {
  --burst-x: -8px;
  --burst-y: -47px;
}

.toast-star:nth-child(16) {
  --burst-x: 33px;
  --burst-y: -39px;
}

.toast-star:nth-child(17) {
  --burst-x: -31px;
  --burst-y: -40px;
}

.toast-star:nth-child(18) {
  --burst-x: 7px;
  --burst-y: 14px;
}

@keyframes toast-left {
  0%, 16%, 55%, 100% {
    transform: rotate(-9deg);
  }
  30%, 32% {
    transform: rotate(6deg);
  }
}

@keyframes toast-right {
  0%, 16%, 55%, 100% {
    transform: rotate(9deg);
  }
  30%, 32% {
    transform: rotate(-6deg);
  }
}

@keyframes toast-spark {
  0%, 29% {
    transform: translate(0, 0) scale(0.15);
    opacity: 0;
  }
  32% {
    transform: translate(0, -3px) scale(0.85);
    opacity: 1;
  }
  48%, 100% {
    transform: translate(var(--burst-x), var(--burst-y)) scale(0.25);
    opacity: 0;
  }
}

@keyframes toast-flash {
  0%, 29%, 36%, 100% {
    transform: scale(0.3);
    opacity: 0;
  }
  31% {
    transform: scale(1.2);
    opacity: 0.9;
  }
}

@keyframes champagne-rise {
  0% {
    transform: translateY(2px);
    opacity: 0;
  }
  25%, 65% {
    opacity: 0.85;
  }
  100% {
    transform: translateY(-13px);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .toast-glass-left {
    animation: toast-left var(--toast-cycle) ease-in-out infinite;
  }

  .toast-glass-right {
    animation: toast-right var(--toast-cycle) ease-in-out infinite;
  }

  .toast-star {
    animation: toast-spark var(--toast-cycle) ease-out infinite;
  }

  .toast-flash {
    animation: toast-flash var(--toast-cycle) ease-out infinite;
  }

  .toast-bubbles circle {
    animation: champagne-rise 3.4s linear infinite;
  }

  .toast-bubbles circle:nth-child(2n) {
    animation-delay: -1.8s;
  }

  .toast-bubbles circle:nth-child(3n) {
    animation-delay: -0.8s;
  }

  .toast-bubbles circle:nth-child(4n) {
    animation-delay: -2.6s;
  }
}

.art-tile {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  color: var(--red);
}

.illustration {
  display: block;
  width: 40%;
  height: 40%;
}

.forest {
  position: relative;
  color: var(--green);
  overflow: hidden;
}

.snow-scene {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

.snowfall-layer {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.snow-caps,
.snow-ground {
  fill: #fff;
}

.snowflakes {
  display: none;
  fill: #bbd7ea;
  stroke: #a9c9df;
  stroke-width: 0.15;
}

@keyframes snowfall {
  0% {
    opacity: 0;
    transform: translate(0, -5px);
  }
  8%, 92% {
    opacity: 0.85;
  }
  100% {
    opacity: 0;
    transform: translate(var(--snow-drift, 5px), 110px);
  }
}

@keyframes snow-settle {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: no-preference) {
  .snowflakes {
    display: inline;
  }

  .snowflake {
    animation: snowfall 11s linear infinite;
  }

  .snowflake:nth-child(3n) {
    --snow-drift: -6px;
    animation-duration: 13s;
  }

  .snowflake:nth-child(3n + 1) {
    --snow-drift: 8px;
    animation-duration: 10s;
  }

  .snowflake:nth-child(2n) {
    animation-delay: -5s;
  }

  .snowflake:nth-child(3n) {
    animation-delay: -9s;
  }

  .snowflake:nth-child(4n + 1) {
    animation-delay: -2s;
  }

  .snowflake:nth-child(5n) {
    animation-delay: -7s;
  }

  .snow-cap,
  .snow-ground {
    animation: snow-settle 60s linear both;
  }
}

.info-tile {
  --tile-heading-font-size: clamp(18px, 2.6vw, 24px);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows:
    minmax(0, 1fr)
    auto
    minmax(0, 1fr);
  justify-items: center;
  align-items: center;
  gap: clamp(8px, 1.2vw, 12px);
  aspect-ratio: 1;
  min-height: 210px;
  padding: 28px clamp(14px, 2.5vw, 20px);
  color: var(--red);
  text-align: center;
  overflow-wrap: anywhere;
}

.info-tile p,
.info-tile h2 {
  margin: 0;
}

.tile-heading {
  grid-row: 1;
  align-self: start;
  font-size: var(--tile-heading-font-size);
  font-weight: 700;
  line-height: 1.15;
  text-wrap: balance;
}

/* Центр двух строк совпадает с центром однострочных заголовков. */
.tile-heading-two-lines {
  display: flex;
  align-items: center;
  justify-content: center;
  block-size: 1.15em;
}

.gift-icon {
  position: absolute;
  display: block;
  width: 18px;
  height: auto;
  visibility: hidden;
  color: var(--green);
  opacity: 0.32;
}

.gift-icon:nth-child(2n) {
  color: var(--red);
}

.santa-tile,
.disco-tile,
.late-entertainment-tile {
  position: relative;
  isolation: isolate;
}

.santa-tile > .tile-heading,
.santa-tile > .tile-value,
.santa-tile > .tile-note,
.disco-tile > .tile-heading,
.disco-tile > .tile-value,
.disco-tile > .tile-note,
.late-entertainment-tile > .tile-heading,
.late-entertainment-tile > .tile-value,
.late-entertainment-tile > .tile-note {
  position: relative;
  z-index: 1;
}

/* Декоративный слой не участвует в раскладке текста. */
.gift-decor,
.disco-decor {
  position: absolute;
  inset: 0;
  display: block;
  z-index: 0;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

.disco-ball {
  position: absolute;
  display: block;
  width: 18px;
  height: auto;
  aspect-ratio: 1;
  visibility: hidden;
  color: var(--green);
  opacity: 0.32;
}

.disco-ball:nth-child(2n) {
  color: var(--red);
}

.tile-value {
  grid-row: 2;
  font-size: clamp(34px, 5.4vw, 48px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}

.tile-note {
  grid-row: 3;
  align-self: end;
  font-size: clamp(14px, 1.8vw, 16px);
  line-height: 1.25;
  text-wrap: balance;
}

/* Двухстрочная подпись центрируется относительно соседних однострочных. */
.tile-note-two-lines {
  display: flex;
  align-items: center;
  justify-content: center;
  block-size: 1.25em;
}

.party-guest-peek {
  position: absolute;
  inset: 0;
  display: block;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

/* Наклон и обрезка за краем создают эффект выглядывающей фигуры. */
.party-guest-figure {
  position: absolute;
  left: -34%;
  bottom: 20%;
  display: block;
  width: 51%;
  max-width: 140px;
  aspect-ratio: 240 / 254;
  transform: rotate(40deg);
  transform-origin: 50% 100%;
}

/* Совмещаем лицо с исходной вырезкой, продолжение свитера выходит за рамку. */
.party-guest-figure img {
  position: absolute;
  left: -4.513%;
  top: -0.253%;
  display: block;
  width: 108.314%;
  height: auto;
}

.info-illustration {
  grid-row: 2;
  display: block;
  width: clamp(44px, 8vw, 68px);
  height: auto;
  aspect-ratio: 1;
}

.date-tile {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  aspect-ratio: 1;
  padding: 20px;
  text-align: center;
  text-transform: uppercase;
}

.date-tile p {
  margin: 0;
}

.weekday {
  width: 100%;
  padding: 9px 12px;
  border-radius: 99px;
  background: var(--red);
  color: var(--cream);
  font-size: clamp(14px, 2.5vw, 21px);
}

.day {
  padding-top: 5px;
  font-size: clamp(56px, 9.5vw, 85px);
  line-height: 1.05;
}

.month {
  font-size: clamp(21px, 3.5vw, 30px);
  line-height: 1.1;
}

.ticket {
  --ticket-block-inset: 25px;
  --ticket-line-gap: 6px;
  --ticket-cat-width: clamp(64px, 12vw, 104px);
  grid-column: span 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  padding: var(--ticket-block-inset) 31px 0;
  background: var(--cream);
  color: var(--ink);
  text-align: center;
  font-size: 16px;
  line-height: 1.15;
  --notch-size: 29px;
  mask-image: radial-gradient(circle at 0 50%, transparent var(--notch-size), #000 calc(var(--notch-size) + 1px)),
    radial-gradient(circle at 100% 50%, transparent var(--notch-size), #000 calc(var(--notch-size) + 1px));
  mask-composite: intersect;
}

.ticket-copy {
  grid-area: 1 / 1;
  align-self: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--ticket-line-gap);
  min-width: 0;
  padding-bottom: var(--ticket-block-inset);
}

.ticket-intro {
  display: flex;
  flex-direction: column;
  gap: var(--ticket-line-gap);
  max-width: 100%;
  margin: 0;
  font-size: clamp(18px, 2.7vw, 20px);
  line-height: 1.1;
}

.ticket-cat {
  grid-area: 1 / 1;
  display: block;
  align-self: end;
  justify-self: end;
  width: var(--ticket-cat-width);
  height: auto;
}

.ticket-message,
.ticket-copy address {
  max-width: calc(100% - 2 * var(--ticket-cat-width));
  margin: 0;
  font: inherit;
}

/* Время сбора и адрес опущены ещё на три строковых интервала. */
.ticket-copy .ticket-arrival {
  margin-top: calc(var(--ticket-line-gap) + 3lh);
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .poster > .tile,
  .poster > .ticket {
    transition: transform 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  .poster > .tile:hover,
  .poster > .ticket:hover {
    z-index: 1;
    transform: scale(1.025);
  }
}

.is-ready .tile,
.is-ready .ticket {
  animation: appear 650ms ease-out both;
}

.is-ready .poster > :nth-child(n + 3) {
  animation-delay: 80ms;
}

.is-ready .poster > :nth-child(n + 6) {
  animation-delay: 160ms;
}

.is-ready .poster > :nth-child(n + 8) {
  animation-delay: 240ms;
}

@keyframes appear {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 599px) {
  :root {
    --gap: 8px;
    --radius: 29px;
  }

  .invitation {
    width: min(430px, calc(100% - 28px));
    padding-block: 96px 32px;
  }

  .poster {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "headline headline"
      "fee santa"
      "disco forest"
      "date date"
      "ticket ticket"
      "alcohol food"
      "late late";
  }

  .info-tile,
  .forest {
    aspect-ratio: auto;
    min-height: 210px;
  }

  .fee-tile {
    grid-area: fee;
  }

  .santa-tile {
    grid-area: santa;
  }

  .disco-tile {
    grid-area: disco;
  }

  .forest {
    grid-area: forest;
  }

  .alcohol-tile {
    grid-area: alcohol;
  }

  .late-entertainment-tile {
    grid-area: late;
  }

  .late-entertainment-tile .party-guest-figure {
    left: 0;
    transform: translateX(-66.6667%) rotate(40deg);
  }

  .headline {
    grid-area: headline;
    min-height: 200px;
    padding: 24px;
  }

  h1 {
    font-size: clamp(36px, 10.6vw, 51px);
  }

  .date-tile {
    grid-area: date;
    aspect-ratio: auto;
    padding: 20px;
  }

  .weekday {
    width: auto;
    padding-inline: 25px;
    font-size: 18px;
  }

  .day {
    font-size: 78px;
  }

  .month {
    font-size: 28px;
  }

  .ticket {
    --ticket-block-inset: 26px;
    grid-area: ticket;
    min-height: 200px;
    padding: var(--ticket-block-inset) 34px 0;
    --notch-size: 21px;
  }

  .desktop-break {
    display: none;
  }

  .food-tile {
    grid-area: food;
  }
}

@media (prefers-reduced-motion: reduce) {
  .is-ready .tile,
  .is-ready .ticket {
    animation: none;
  }
}
