:root {
  color-scheme: dark;
  --ink: #17110f;
  --ink-2: #261b17;
  --paper: #f3e5c7;
  --paper-2: #ffeecf;
  --cream: #fff9ec;
  --red: #d43a2f;
  --red-dark: #8d201b;
  --teal: #26b99f;
  --green: #305c48;
  --blue: #2772b8;
  --gold: #f5bd3f;
  --pink: #ef7aa0;
  --shadow: 0 20px 70px rgba(0, 0, 0, .48);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-snap-type: y mandatory;
  scroll-padding-top: 0;
  background: var(--ink);
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  color: var(--cream);
  background:
    linear-gradient(90deg, rgba(212, 58, 47, .18), transparent 20%, transparent 82%, rgba(38, 185, 159, .14)),
    var(--ink);
  font-family: "Bahnschrift", "Segoe UI", Tahoma, sans-serif;
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 12%, rgba(245, 189, 63, .12) 0 1px, transparent 1px),
    radial-gradient(circle at 80% 72%, rgba(38, 185, 159, .12) 0 1px, transparent 1px);
  background-size: 18px 18px, 26px 26px;
  opacity: .65;
}

.texture {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: .12;
  mix-blend-mode: overlay;
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, .45) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, .25) 25%, transparent 25%);
  background-size: 3px 3px;
}

img {
  display: block;
  max-width: 100%;
}

.mission-bar {
  position: fixed;
  top: env(safe-area-inset-top);
  left: 50%;
  z-index: 30;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  width: min(100%, 540px);
  transform: translateX(-50%);
  padding: 12px 14px 8px;
  color: var(--cream);
  font-size: .72rem;
  font-weight: 950;
  text-transform: uppercase;
  pointer-events: none;
}

.mission-line {
  height: 5px;
  overflow: hidden;
  border: 1px solid rgba(255, 249, 236, .72);
  background: rgba(23, 17, 15, .54);
}

.mission-line span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--gold), var(--teal), var(--blue));
  transition: width .16s linear;
}

.story-shell {
  position: relative;
  z-index: 5;
  width: min(100%, 540px);
  margin: 0 auto;
  background: var(--ink);
  box-shadow: 0 0 80px rgba(0, 0, 0, .62);
}

.scene,
.story-scene,
.photo-slide,
.chapter-slide {
  position: relative;
  height: 100svh;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.intro {
  display: grid;
  align-items: end;
  padding: 84px 18px 42px;
  background: var(--ink);
}

.intro::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(23, 17, 15, .08), rgba(23, 17, 15, .90));
}

.intro-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(23, 17, 15, .10), rgba(23, 17, 15, .86)),
    url("assets/photos/story/008-AlexeyVertoletovRu_20250602_0001.jpg") center / cover;
  filter: saturate(.92) contrast(1.08);
}

.intro-copy,
.finale-card {
  position: relative;
  z-index: 2;
}

.stamp,
.chapter-kicker,
.photo-label {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border: 2px solid currentColor;
  color: var(--red);
  background: rgba(255, 249, 236, .94);
  font-size: .72rem;
  font-weight: 950;
  text-transform: uppercase;
  transform: rotate(-2deg);
}

.chapter-kicker,
.photo-label {
  color: var(--ink);
  background: var(--gold);
  border-color: var(--ink);
  box-shadow: 4px 4px 0 var(--red);
}

h1,
h2,
h3 {
  margin: 12px 0;
  font-family: Georgia, Cambria, "Times New Roman", serif;
  font-weight: 950;
  line-height: .92;
  letter-spacing: 0;
}

h1 {
  max-width: 8ch;
  font-size: 3.3rem;
  color: var(--cream);
  text-shadow: 4px 4px 0 var(--red-dark), 8px 8px 0 rgba(23, 17, 15, .64);
}

h2 {
  font-size: 2.25rem;
}

h3 {
  font-size: 2rem;
}

.lead,
.chapter-copy,
.caption,
.finale-card p,
.mission-data dd,
.mission-data dt,
.survey-field p,
.survey-option span,
.survey-result {
  line-height: 1.38;
}

.lead {
  max-width: 24rem;
  margin: 0;
  font-size: 1.08rem;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .5);
}

.start-button,
.accept-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  margin-top: 18px;
  padding: 14px 16px;
  border: 3px solid var(--ink);
  border-radius: 6px;
  color: var(--ink);
  background: var(--gold);
  box-shadow: 7px 7px 0 var(--red);
  font: inherit;
  font-size: 1rem;
  font-weight: 950;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
}

.photo-slide {
  display: grid;
  align-content: end;
  padding: 64px 14px 24px;
  background: var(--ink);
}

.photo-slide::before {
  content: "";
  position: absolute;
  inset: -28px;
  z-index: 0;
  background-image: var(--photo);
  background-position: center;
  background-size: cover;
  filter: blur(22px) saturate(1.18);
  transform: scale(1.08);
  opacity: .58;
}

.photo-slide::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(23, 17, 15, .28), rgba(23, 17, 15, .06) 26%, rgba(23, 17, 15, .88)),
    linear-gradient(90deg, rgba(212, 58, 47, .22), transparent 40%, rgba(38, 185, 159, .18));
}

.chapter-slide {
  display: grid;
  align-content: center;
  padding: 74px 18px 36px;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(212, 58, 47, .16), transparent 34%, rgba(38, 185, 159, .14)),
    repeating-linear-gradient(0deg, transparent 0 20px, rgba(23, 17, 15, .055) 20px 21px),
    var(--paper);
}

.chapter-slide::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: radial-gradient(circle, rgba(23, 17, 15, .18) 0 1px, transparent 1px);
  background-size: 8px 8px;
  opacity: .26;
  mix-blend-mode: multiply;
}

.chapter-inner {
  position: relative;
  z-index: 2;
}

.chapter-copy {
  margin: 0;
  font-size: 1.04rem;
}

.story-scene {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: stretch;
  gap: 10px;
  padding: 54px 14px max(12px, env(safe-area-inset-bottom));
  background: var(--ink);
}

.story-scene::before {
  content: "";
  position: absolute;
  inset: -28px;
  z-index: 0;
  background-image: var(--photo);
  background-position: center;
  background-size: cover;
  filter: blur(24px) saturate(1.2);
  transform: scale(1.08);
  opacity: .54;
}

.story-scene::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(23, 17, 15, .22), rgba(23, 17, 15, .05) 28%, rgba(23, 17, 15, .86)),
    linear-gradient(90deg, rgba(212, 58, 47, .22), transparent 40%, rgba(38, 185, 159, .18));
}

.scene-media {
  position: relative;
  z-index: 2;
  order: 2;
  display: grid;
  align-items: start;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 0 8px 8px 0;
}

.single-frame,
.collage-grid {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.single-frame {
  display: grid;
  align-items: start;
  justify-items: center;
}

.story-image {
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 4px solid var(--ink);
  background: var(--cream);
  box-shadow: 10px 10px 0 rgba(212, 58, 47, .9);
  transform: translateY(22px) rotate(-2deg) scale(.97);
  opacity: 0;
  transition:
    transform .58s cubic-bezier(.17, .84, .2, 1) var(--item-delay, 0ms),
    opacity .44s ease var(--item-delay, 0ms),
    box-shadow .58s ease;
}

.story-scene.active .story-image {
  transform: translateY(0) rotate(0deg) scale(1);
  opacity: 1;
}

.single-frame .story-image {
  display: grid;
  align-items: start;
  justify-items: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  padding: 8px;
}

.single-frame .story-image img {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  object-fit: contain;
  object-position: top center;
  background: var(--cream);
}

.collage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: auto;
  gap: 9px;
  align-self: start;
  align-items: start;
  height: auto;
  max-height: 100%;
}

.count-5.collage-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.count-2.collage-grid {
  grid-template-columns: 1fr;
}

.count-3.collage-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.collage-grid .story-image {
  display: grid;
  align-items: start;
  justify-items: center;
  min-height: 0;
  padding: 0;
  aspect-ratio: 4 / 3;
}

.count-2 .story-image {
  aspect-ratio: 16 / 10;
}

.count-2 .story-image.tall {
  aspect-ratio: 4 / 5;
}

.collage-grid .story-image img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  object-position: top center;
  background: var(--cream);
}

.collage-grid .story-image.tall {
  aspect-ratio: 3 / 4;
}

.collage-grid .story-image.wide {
  aspect-ratio: 3 / 2;
}

.count-3 .story-image:first-child.wide,
.count-5 .story-image:first-child.wide {
  grid-column: 1 / -1;
}

.scene-meta {
  position: relative;
  z-index: 3;
  order: 1;
  display: grid;
  gap: 8px;
  margin: 0;
  padding-right: 0;
}

.story-scene.active .caption {
  transform: translateX(0);
  opacity: 1;
}

.collage-scene .photo-title {
  font-size: 1.34rem;
}

.collage-scene .caption {
  max-width: 100%;
}

.photo-frame {
  position: relative;
  z-index: 2;
  display: grid;
  align-items: center;
  justify-items: center;
  width: 100%;
  min-height: 56svh;
  max-height: 72svh;
  margin: 0 auto;
  padding: 8px;
  border: 4px solid var(--ink);
  background: var(--cream);
  box-shadow: 10px 10px 0 rgba(212, 58, 47, .9);
  transform: translateY(22px) rotate(-2deg) scale(.97);
  transition: transform .58s cubic-bezier(.17, .84, .2, 1), box-shadow .58s ease, clip-path .58s ease;
  clip-path: polygon(0 7%, 100% 0, 100% 94%, 0 100%);
}

.photo-slide.is-wide .photo-frame {
  min-height: 43svh;
  max-height: 58svh;
}

.photo-frame img {
  width: 100%;
  max-height: calc(72svh - 16px);
  object-fit: contain;
  background: var(--ink);
  filter: saturate(.96) contrast(1.03);
  transition: transform .72s ease, filter .72s ease;
}

.photo-slide.is-wide .photo-frame img {
  max-height: calc(58svh - 16px);
}

.photo-slide.active .photo-frame {
  transform: translateY(0) rotate(var(--tilt, 0deg)) scale(1);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}

.photo-slide.active .photo-frame img {
  transform: scale(1.012);
  filter: saturate(1.04) contrast(1.04);
}

.photo-meta {
  position: relative;
  z-index: 3;
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.photo-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.photo-number {
  padding: 5px 8px;
  color: var(--ink);
  background: var(--teal);
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--red);
  font-size: .72rem;
  font-weight: 950;
}

.photo-title {
  margin: 0;
  color: var(--cream);
  font-size: clamp(1.2rem, 4.3svh, 1.48rem);
  line-height: 1.06;
  padding-bottom: 2px;
  text-shadow: 3px 3px 0 var(--red-dark), 6px 6px 0 rgba(23, 17, 15, .55);
}

.caption {
  position: relative;
  margin: 0;
  max-width: 92%;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 6px;
  box-shadow: 6px 6px 0 var(--red);
  font-size: clamp(.82rem, 2.25svh, .94rem);
  line-height: 1.26;
  font-weight: 850;
  transform: translateX(-16px);
  opacity: 0;
  transition: transform .5s ease .08s, opacity .5s ease .08s;
}

.caption::after {
  content: "";
  position: absolute;
  left: 24px;
  top: -12px;
  width: 18px;
  height: 18px;
  background: var(--cream);
  border-left: 3px solid var(--ink);
  border-top: 3px solid var(--ink);
  transform: rotate(45deg);
}

.photo-slide.active .caption {
  transform: translateX(0);
  opacity: 1;
}

.pow {
  position: absolute;
  top: 56px;
  right: 14px;
  z-index: 4;
  width: 72px;
  min-height: 30px;
  display: grid;
  place-items: center;
  padding: 5px 6px;
  color: var(--ink);
  background: var(--gold);
  border: 3px solid var(--ink);
  box-shadow: 5px 5px 0 var(--red);
  font-size: .66rem;
  font-weight: 950;
  text-transform: uppercase;
  transform: rotate(8deg) scale(.86);
  opacity: 0;
  transition: transform .46s cubic-bezier(.34, 1.56, .64, 1), opacity .36s ease;
}

.story-scene .pow {
  display: none;
}

.photo-slide.active .pow,
.story-scene.active .pow {
  transform: rotate(8deg) scale(1);
  opacity: 1;
}

.variant-1 .photo-frame {
  box-shadow: -10px 10px 0 rgba(38, 185, 159, .92);
}

.variant-2 .photo-frame {
  box-shadow: 10px 10px 0 rgba(245, 189, 63, .9);
}

.variant-3 .photo-frame {
  box-shadow: -10px 10px 0 rgba(39, 114, 184, .9);
}

.variant-4 .photo-frame {
  box-shadow: 10px 10px 0 rgba(239, 122, 160, .9);
}

.variant-5 .caption {
  margin-left: auto;
  box-shadow: -6px 6px 0 var(--teal);
}

.variant-5 .caption::after {
  left: auto;
  right: 24px;
}

.finale {
  display: grid;
  align-items: start;
  padding: 46px 14px max(10px, env(safe-area-inset-bottom));
  background:
    linear-gradient(140deg, rgba(212, 58, 47, .38), transparent 38%, rgba(245, 189, 63, .18)),
    repeating-linear-gradient(90deg, rgba(255, 249, 236, .08) 0 1px, transparent 1px 18px),
    var(--ink-2);
}

.finale-card {
  display: grid;
  gap: 7px;
  width: 100%;
  max-height: calc(100svh - 56px);
  padding: 12px;
  overflow: hidden;
  border: 3px solid var(--cream);
  background: rgba(23, 17, 15, .78);
  box-shadow: 9px 9px 0 var(--red);
}

.finale-card h2 {
  margin: 2px 0 0;
  color: var(--cream);
  font-size: clamp(1.4rem, 4.8svh, 1.88rem);
  line-height: .96;
  text-shadow: 4px 4px 0 var(--red-dark), 8px 8px 0 rgba(23, 17, 15, .52);
}

.finale-card > p:not(.stamp):not(.accepted-note) {
  margin: 0;
  font-size: clamp(.82rem, 2.05svh, .96rem);
}

.mission-data {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
}

.mission-data div {
  display: grid;
  gap: 3px;
  align-items: center;
  min-width: 0;
  padding: 7px 6px;
  border: 2px solid rgba(255, 249, 236, .42);
  background: rgba(255, 249, 236, .08);
}

.mission-data dt,
.mission-data dd {
  margin: 0;
}

.mission-data dt {
  color: var(--gold);
  font-size: .66rem;
  font-weight: 950;
  text-transform: uppercase;
}

.mission-data dd {
  color: var(--cream);
  font-size: .78rem;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.survey {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.survey-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.survey-title,
.survey-count {
  margin: 0;
  color: var(--gold);
  font-size: .74rem;
  font-weight: 950;
  text-transform: uppercase;
}

.survey-count {
  color: var(--ink);
  background: var(--gold);
  border: 2px solid var(--ink);
  padding: 3px 7px;
  box-shadow: 3px 3px 0 var(--red);
}

.survey-progress {
  height: 6px;
  border: 2px solid rgba(255, 249, 236, .55);
  background: rgba(255, 249, 236, .08);
  overflow: hidden;
}

.survey-progress span {
  display: block;
  width: 10%;
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--gold), var(--teal));
  transition: width .22s ease;
}

.survey-step-view {
  min-height: 198px;
}

.survey-field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.survey-field legend {
  display: block;
  width: 100%;
  margin: 0 0 4px;
  color: var(--cream);
  font-size: clamp(1rem, 2.55svh, 1.16rem);
  line-height: 1.05;
  font-weight: 950;
}

.survey-field p {
  margin: 0 0 8px;
  color: rgba(255, 249, 236, .78);
  font-size: .74rem;
  font-weight: 850;
}

.survey-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.survey-option {
  position: relative;
  display: grid;
  align-items: center;
  min-width: 0;
  min-height: 42px;
  padding: 8px 8px 8px 28px;
  border: 3px solid var(--ink);
  border-radius: 6px;
  color: var(--ink);
  background: var(--cream);
  box-shadow: 4px 4px 0 var(--red);
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
}

.survey-option input {
  position: absolute;
  left: 8px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--teal);
  transform: translateY(-50%);
}

.survey-option span {
  overflow-wrap: anywhere;
  font-size: .71rem;
  font-weight: 950;
  text-transform: uppercase;
}

.survey-option.checked {
  background: var(--teal);
  box-shadow: 3px 3px 0 var(--gold);
  transform: translate(2px, 2px);
}

.survey-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.survey-prev,
.survey-next,
.email-button {
  min-height: 38px;
  padding: 8px 10px;
  border: 3px solid var(--ink);
  border-radius: 6px;
  color: var(--ink);
  background: var(--paper-2);
  box-shadow: 4px 4px 0 var(--red);
  font: inherit;
  font-size: .76rem;
  font-weight: 950;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
}

.survey-next {
  background: var(--gold);
}

.survey-prev:disabled,
.survey-next:disabled,
.accept-button:disabled {
  opacity: .48;
  filter: saturate(.45);
  cursor: not-allowed;
}

.survey-result {
  min-height: 28px;
  margin: 0;
  color: rgba(255, 249, 236, .74);
  font-size: .78rem;
  font-weight: 850;
}

.email-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  background: var(--teal);
}

.email-button[hidden] {
  display: none;
}

.finale.survey-complete .survey-result {
  color: var(--gold);
}

.accept-button {
  width: 100%;
  min-height: 48px;
  margin-top: 0;
  padding: 11px 12px;
}

.button-mark {
  width: 18px;
  height: 18px;
  border: 3px solid var(--ink);
  background:
    linear-gradient(45deg, transparent 45%, var(--ink) 45% 56%, transparent 56%),
    var(--teal);
  transform: rotate(45deg);
  flex: 0 0 auto;
}

.accepted-note {
  max-height: 0;
  margin: 0;
  font-size: .82rem;
  opacity: 0;
  overflow: hidden;
  transform: translateY(8px);
  transition: max-height .35s ease, opacity .35s ease, transform .35s ease;
}

.finale.accepted .accepted-note {
  max-height: 56px;
  opacity: 1;
  transform: translateY(0);
}

.finale.accepted .accept-button {
  background: var(--teal);
  box-shadow: 7px 7px 0 var(--gold);
}

.finale.survey-sent .survey-result {
  color: var(--teal);
}

.confetti {
  position: fixed;
  top: -18px;
  z-index: 40;
  width: 9px;
  height: 16px;
  pointer-events: none;
  animation: fall 1.1s ease-in forwards;
}

@keyframes fall {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate3d(var(--drift), 105vh, 0) rotate(560deg);
    opacity: 0;
  }
}

@media (max-width: 370px) {
  h1 {
    font-size: 2.88rem;
  }

  h2 {
    font-size: 2rem;
  }

  .photo-title {
    font-size: 1.34rem;
  }
}

@media (min-width: 760px) {
  .story-shell {
    margin-block: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
