:root {
  --ink: #e9f1f5;
  --foam: #9cc3d8;
  --rust: #e0674d;
  --serif: 'Akzidenz-Grotesk Pro', 'Helvetica Neue', Arial, sans-serif;
  --sans: 'Manrope', system-ui, sans-serif;
  --wide: 'Akzidenz-Grotesk Pro', 'Helvetica Neue', Arial, sans-serif;
  --hand: 'Manrope', system-ui, sans-serif;
  --p: 0; /* прогресс погружения 0..1, задаётся из iceberg.js */
}

html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: clip; }

* { box-sizing: border-box; }
body.ice-page {
  margin: 0;
  background: #031019;
  color: var(--ink);
  font: 17px/1.5 var(--sans);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- фон: фотография айсберга, медленно уплывающая вверх ---------- */
.ice-bg { position: fixed; inset: 0; overflow: hidden; z-index: 0; }
.ice-bg__img {
  position: absolute; left: 0; right: 0; top: 0;
  height: 175vh;
  background:
    url('/static/img/iceberg.jpg') center top / cover no-repeat,
    linear-gradient(180deg, #bcd6e6 0%, #7fa9c4 22%, #1f5576 30%, #0c3049 60%, #041521 100%);
  transform: translate3d(0, calc(var(--p) * -75vh), 0) scale(calc(1.06 - var(--p) * .06));
  transform-origin: 50% 0;
  will-change: transform;
}
.ice-bg__shade {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 90% at 50% 40%, transparent 30%, rgba(1, 8, 14, .85) 100%),
    linear-gradient(180deg, rgba(4, 22, 35, 0) 0%, rgba(2, 12, 20, .95) 100%);
  opacity: calc(.25 + var(--p) * .85);
}
.ice-bg__grain {
  position: absolute; inset: -50%;
  opacity: calc(.08 + var(--p) * .25);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); } 40% { transform: translate(2%, -4%); }
  60% { transform: translate(-4%, -1%); } 80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}

/* ---------- навигация и глубиномер ---------- */
.ice-home {
  position: fixed; top: 18px; left: 20px; z-index: 20;
  font: 600 14px var(--hand); color: var(--ink); text-decoration: none;
  text-shadow: 0 1px 10px rgba(0,0,0,.5);
}
.depth {
  position: fixed; right: 22px; top: 50%; translate: 0 -50%;
  z-index: 20;
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
  text-align: right;
}
.depth__track { width: 2px; height: 34vh; background: rgba(233,241,245,.2); position: relative; }
.depth__fill { position: absolute; left: 0; top: 0; width: 100%; height: calc(var(--p) * 100%); background: var(--ink); }
.depth__fill::after { content: ''; position: absolute; bottom: -5px; left: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 14px var(--foam); }
.depth__value { font: 700 15px var(--wide); font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.depth__name { font: 600 14px var(--hand); color: var(--foam); max-width: 160px; }

/* ---------- контент ---------- */
.ice { position: relative; z-index: 2; }
.ice__intro {
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 0 clamp(20px, 8vw, 140px);
  text-shadow: 0 2px 30px rgba(3, 16, 25, .55);
}
.ice__kicker { font: 700 12px var(--wide); letter-spacing: .24em; text-transform: uppercase; margin: 0; }
.ice__intro h1 { font: 700 clamp(64px, 12vw, 190px)/.86 var(--wide); letter-spacing: -.05em; margin: 18px 0; }
.ice__intro h1 em { font: 500 .62em var(--serif); letter-spacing: -.01em; }
.ice__intro p:last-child { font: 600 17px var(--hand); max-width: 26ch; }

.lvl {
  position: relative;
  min-height: 120vh;
  padding: 18vh clamp(20px, 8vw, 140px) 14vh;
}
.lvl::before {
  /* граница уровня — тонкая линия, как на мем-схемах */
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(233,241,245,.45) 20%, rgba(233,241,245,.45) 80%, transparent);
}
.lvl__head { max-width: 760px; margin-bottom: 9vh; }
.lvl__num { font: 700 13px var(--wide); letter-spacing: .3em; color: var(--foam); }
.lvl__head h2 { font: 500 clamp(48px, 8vw, 120px)/.95 var(--serif); margin: 8px 0 6px; }
.lvl__head p { font: 600 16px var(--hand); margin: 0; color: var(--foam); }

.lvl__facts {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 4vh 3vw;
  max-width: 1200px;
}
.fact {
  position: relative;
  padding: 18px 24px;
  max-width: 380px;
  background: rgba(233, 241, 245, .09);
  border: 1px solid rgba(233, 241, 245, .2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 4px;
  margin-top: calc(mod(var(--j), 3) * 5vh);
  opacity: 0;
  translate: 0 60px;
  filter: blur(6px);
  transition: opacity 1.6s ease, translate 2s cubic-bezier(.16, 1, .3, 1), filter 1.6s ease;
  transition-delay: calc(var(--j) * 140ms);
}
.fact.is-in { opacity: 1; translate: 0 0; filter: none; }
.fact__text { display: block; font: 600 22px/1.25 var(--serif); font-size: 24px; }
.fact__note { display: block; margin-top: 6px; font: 600 14px var(--hand); color: var(--foam); }

/* чем глубже — тем страннее */
.lvl:nth-of-type(1) .fact { background: rgba(255,255,255,.22); border-color: rgba(255,255,255,.4); }
.lvl:nth-of-type(1) .fact__text { color: #0b2232; text-shadow: none; }
.lvl:nth-of-type(1) .fact__note { color: #1f5576; }
.lvl:nth-of-type(n+4) .fact { background: rgba(2, 10, 16, .35); border-color: rgba(156,195,216,.15); }
.lvl:nth-of-type(n+5) .lvl__head h2 { font-family: var(--wide); font-style: normal; font-weight: 900; letter-spacing: -.04em; }
.lvl:nth-of-type(n+5) .fact__text { font: 400 16px/1.5 ui-monospace, 'SFMono-Regular', Menlo, monospace; letter-spacing: .02em; }
.lvl:last-of-type { min-height: 140vh; }
.lvl:last-of-type .lvl__head h2 { color: var(--rust); text-shadow: 0 0 30px rgba(224,103,77,.35); animation: flicker 6s infinite; }
.lvl:last-of-type .fact { border-color: rgba(224,103,77,.3); }
@keyframes flicker { 0%, 92%, 100% { opacity: 1; } 93% { opacity: .3; } 94% { opacity: 1; } 96% { opacity: .5; } }

.ice__end {
  position: relative; min-height: 90vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
}
.ice__end p { font: 500 clamp(40px, 6vw, 80px) var(--serif); margin: 0; }
.ice__end .ice__end-small { font: 600 17px var(--hand); color: var(--foam); margin-top: 10px; }
.ice__up {
  margin-top: 50px;
}

@media (prefers-reduced-motion: reduce) {
  .fact { opacity: 1; translate: none; filter: none; transition: none; }
  .ice-bg__grain, .lvl:last-of-type .lvl__head h2 { animation: none; }
}
@media (max-width: 640px) {
  .depth { right: 10px; }
  .depth__track { height: 22vh; }
  .depth__name { display: none; }
  .lvl { padding-right: 56px; }
  .ice__intro { padding-right: 56px; }
  .fact { margin-top: 0; max-width: 100%; }
}
.ice__credit { position: absolute; bottom: 18px; font-size: 11px; opacity: .45; }
