/* IVAN.FIT: WebNext signature layer (loader, entrance, scroll reveals, cursor, magnetic buttons).
   Everything here is progressive: without JS or with reduced motion the page shows as is. */

/* ---------- Loader ---------- */
.ivl { display: none; }
html.ivl-on .ivl {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center;
  background: #141414; color: #fff; will-change: transform;
}
html.ivl-on body { overflow: hidden; }
.ivl__mark {
  font-family: var(--font-display); font-weight: 800; text-transform: uppercase; line-height: .9;
  font-size: clamp(64px, 14vw, 220px); display: flex; align-items: baseline; overflow: hidden; padding-top: .08em;
}
.ivl__ch { display: inline-block; transform: translateY(105%); }
.ivl__dot { display: inline-block; width: .15em; height: .15em; margin: 0 .04em; background: #c8102e; transform: scale(0); }
.ivl__line { position: absolute; left: var(--gutter, 24px); right: var(--gutter, 24px); bottom: calc(var(--gutter, 24px) + 2px); height: 2px; background: rgb(255 255 255 / .12); }
.ivl__bar { display: block; height: 100%; background: #c8102e; transform: scaleX(0); transform-origin: 0 50%; }
.ivl__count {
  position: absolute; right: var(--gutter, 24px); bottom: calc(var(--gutter, 24px) + 16px);
  font-family: var(--font-display); font-weight: 800; font-size: clamp(48px, 8vw, 120px); line-height: .9;
  color: rgb(255 255 255 / .28); font-variant-numeric: tabular-nums;
}
.ivl__tag { position: absolute; left: var(--gutter, 24px); bottom: calc(var(--gutter, 24px) + 22px); font-size: 14px; color: rgb(255 255 255 / .6); }

/* ---------- Split headings (masked words) ---------- */
.iv-w { display: inline-block; overflow: hidden; vertical-align: top; padding: .14em .02em .04em; margin: -.14em -.02em -.04em; }
.iv-w > span { display: inline-block; will-change: transform; }
html.iv-js .iv-split .iv-w > span { transform: translateY(108%); }
html.iv-js .iv-split.is-in .iv-w > span { transform: none; transition: transform 1.1s cubic-bezier(.16, 1, .3, 1); transition-delay: calc(var(--i, 0) * 55ms); }
/* the red square full stop pops in after the words */
html.iv-js .iv-split::after { scale: 0; }
html.iv-js .iv-split.is-in::after { scale: 1; transition: scale .6s cubic-bezier(.34, 1.56, .64, 1); transition-delay: calc(var(--n, 4) * 55ms + 350ms); }

/* ---------- Fades and slides ---------- */
html.iv-js [data-iv="fade"] { opacity: 0; translate: 40px 0; }
html.iv-js [data-iv="up"] { opacity: 0; translate: 0 28px; }
html.iv-js [data-iv].is-in { opacity: 1; translate: 0 0; transition: opacity .9s ease, translate 1.1s cubic-bezier(.16, 1, .3, 1); transition-delay: var(--d, 0ms); }

/* list rows slide in from the left, one after another */
html.iv-js .iv-rows > li { opacity: 0; translate: -48px 0; }
html.iv-js .iv-rows.is-in > li { opacity: 1; translate: 0 0; transition: opacity .8s ease, translate 1.1s cubic-bezier(.16, 1, .3, 1); }
html.iv-js .iv-rows.is-in > li:nth-child(2) { transition-delay: 70ms; }
html.iv-js .iv-rows.is-in > li:nth-child(3) { transition-delay: 140ms; }
html.iv-js .iv-rows.is-in > li:nth-child(4) { transition-delay: 210ms; }

/* photographs open from the side; the picture settles from a zoom, then drifts with the scroll */
.iv-reveal { --py: 0px; --rs: 1; }
.iv-reveal img { translate: 0 var(--py); scale: var(--rs); }
html.iv-js .iv-reveal { clip-path: inset(0 100% 0 0); }
html.iv-js .iv-reveal[data-from="right"] { clip-path: inset(0 0 0 100%); }
html.iv-js .iv-reveal[data-from="bottom"] { clip-path: inset(100% 0 0 0); }
html.iv-js .iv-reveal.is-in { clip-path: inset(0 0 0 0); transition: clip-path 1.4s cubic-bezier(.77, 0, .18, 1); }
html.iv-js .iv-reveal img { --rs: 1.25; }
html.iv-js .iv-reveal.is-in img { --rs: 1; transition: scale 1.9s cubic-bezier(.16, 1, .3, 1); }
/* parallax room: the picture is a touch taller than its frame so the drift never shows an edge */
.iv-par img { --rs: 1.12; }
html.iv-js .iv-par.is-in img { --rs: 1.12; }

/* ---------- Scroll progress ---------- */
.iv-progress { position: fixed; left: 0; right: 0; top: var(--nav); height: 2px; z-index: 51; background: #c8102e; transform: scaleX(0); transform-origin: 0 50%; pointer-events: none; }

/* ---------- Header hides on the way down ---------- */
.nav { transition: transform .5s cubic-bezier(.16, 1, .3, 1); }
html.iv-nav-up .nav { transform: translateY(-100%); }
html.iv-nav-up .iv-progress { top: 0; }

/* ---------- Cursor (mouse only) ---------- */
.iv-cursor { display: none; }
@media (hover: hover) and (pointer: fine) {
  .iv-cursor {
    display: block; position: fixed; left: 0; top: 0; z-index: 1001; width: 12px; height: 12px; margin: -6px 0 0 -6px;
    border-radius: 50%; background: #fff; mix-blend-mode: difference; pointer-events: none; opacity: 0;
    transition: width .35s cubic-bezier(.16, 1, .3, 1), height .35s cubic-bezier(.16, 1, .3, 1), margin .35s cubic-bezier(.16, 1, .3, 1), opacity .3s;
    will-change: transform;
  }
  .iv-cursor.is-on { opacity: 1; }
  .iv-cursor.is-big { width: 56px; height: 56px; margin: -28px 0 0 -28px; }
  .iv-cursor.is-photo { width: 88px; height: 88px; margin: -44px 0 0 -44px; }
}

@media (prefers-reduced-motion: reduce) {
  html.ivl-on .ivl { display: none; }
  html.iv-js .iv-split .iv-w > span, html.iv-js [data-iv], html.iv-js .iv-rows > li { transform: none; opacity: 1; translate: none; }
  html.iv-js .iv-reveal { clip-path: none; }
  html.iv-js .iv-split::after { scale: 1; }
  html.iv-js .iv-reveal img { --rs: 1; }
  .iv-cursor { display: none !important; }
}

/* Lenis */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

/* ---------- Polish: results placeholders read as designed before/after cards ---------- */
#results .slot { padding: 0; border: 0; display: grid; grid-template-rows: 1fr auto; gap: var(--s-3); place-items: stretch; aspect-ratio: 4 / 5; }
.slot__pair { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; min-height: 0; }
.slot__pair > span {
  display: flex; align-items: flex-end; padding: var(--s-4); background: #e4e2de;
  font: 800 clamp(28px, 2.4vw, 44px)/.9 var(--font-display); text-transform: uppercase; color: rgb(20 20 20 / .28);
}
.slot__pair > span + span { background: #141414; color: rgb(255 255 255 / .35); }
.slot__pair > span + span::after { content: ""; width: .15em; height: .15em; background: #c8102e; display: inline-block; margin-left: .06em; }
#results .slot__label { font-size: 15px; color: var(--ink); }

/* ---------- Polish: readable sizes ---------- */
.hero__lead { font-size: clamp(17px, .3vw + 15px, 20px); line-height: 1.5; }
.field { font-size: 15px; }
.field :is(input, select) { min-height: 52px; font-size: 16px; }
.consent { font-size: 14px; }

/* ---------- Phone and tablet: sections take the height of their content ---------- */
@media (max-width: 1023px) {
  main > :is(section, .section):not(.hero), footer.closing { min-height: 0 !important; height: auto !important; }
  main > :is(section, .section):not(.hero) > .wrap, footer.closing > .wrap { height: auto !important; }
  main .fill { height: auto !important; flex: none !important; min-height: 0 !important; }
  main .grid > .frame.frame--fill { flex: none; }
  /* results: a row of cards to swipe */
  #results .grid { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); scroll-padding-inline: var(--gutter); scrollbar-width: none; }
  #results .grid::-webkit-scrollbar { display: none; }
  #results .grid > div { flex: 0 0 44%; scroll-snap-align: start; }
}

/* ---------- Phone ---------- */
@media (max-width: 639px) {
  /* a row with a description stacks: name, words, then the price under them */
  .rows > li:has(> p) { grid-template-columns: minmax(0, 1fr); }
  .rows > li:has(> p) .rows__value { grid-column: 1; grid-row: auto; text-align: left; color: var(--p-accent); font-weight: 500; }
  .rows > li:not(:has(> p)) .rows__value { white-space: normal; }
  .rows__name { font-size: 28px; }
  #results .grid > div { flex-basis: 80%; }
  .form-card { padding: var(--s-5); }
  .mo-wh__text { font-size: 40px; }
}

/* items waiting to slide in never widen the page */
html, body { overflow-x: clip; }

/* ---------- Hero light (21st.dev spotlight idea, native): a red glow follows the mouse in the black box,
   and one light sweep crosses the photograph after the loader ---------- */
main .hero.hero--photo .hero__text { position: relative; overflow: hidden; isolation: isolate; }
.hero--photo .wrap { position: relative; z-index: 2; }

/* the consent link gets a finger-sized target */
.consent { line-height: 1.9; }
.consent a { padding-block: 10px; }

