/* TR Topolski — hero + chrome
   Colours sampled from the supplied design renders. */

:root {
  --ink: #080808;
  --paper: #f4f1ec;
  --gold: #c7a57e;
  --gold-soft: rgba(199, 165, 126, 0.55);
  --font: "Heebo", "Arial Hebrew", Arial, sans-serif;
  --header-h: 82px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  /* Lenis drives scrolling; native smooth-scroll fights it. */
  scroll-behavior: auto;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font);
  font-weight: 300;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Hidden by clipping, NOT by a -9999px offset.
   In an RTL document `inset-inline-start: -9999px` resolves to
   `right: -9999px`, which does not move the link off-screen — it pushes the
   document 9,999px wider. That gave the page an 11,439px scrollWidth, a
   horizontal scrollbar, and a canvas so large the compositor stopped
   painting the page at all. */
.skip-link {
  position: absolute;
  top: 0;
  inset-inline-start: 0;
  z-index: 200;
  padding: 12px 20px;
  background: var(--paper);
  color: var(--ink);
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link:focus {
  clip-path: none;
}

/* ---------- header ---------- */

.site-header {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  z-index: 60;
  height: var(--header-h);
  background: linear-gradient(to bottom, rgba(4, 4, 4, 0.92) 0%, rgba(4, 4, 4, 0.55) 55%, rgba(4, 4, 4, 0) 100%);
  pointer-events: none;
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: clamp(16px, 3vw, 48px);
  height: 100%;
  padding-inline: clamp(18px, 3.5vw, 64px);
  pointer-events: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  order: 1;
}

.brand__mark {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  color: #fff;
}

.brand__text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.brand__name {
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  color: #fff;
}

.brand__dot {
  color: var(--gold);
  padding-inline: 1px;
}

.brand__tagline {
  font-size: 8px;
  font-weight: 400;
  letter-spacing: 0.22em;
  line-height: 1;
  color: rgba(255, 255, 255, 0.72);
  direction: ltr;
}

.primary-nav {
  order: 2;
  margin-inline: auto;
}

.primary-nav ul {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.2vw, 40px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.primary-nav a {
  position: relative;
  display: inline-block;
  padding-block: 6px;
  font-size: 14px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.92);
  transition: color 0.25s ease;
}

.primary-nav a::after {
  content: "";
  position: absolute;
  inset-block-end: 0;
  inset-inline: 0;
  height: 1px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: inline-end;
  transition: transform 0.35s ease;
}

.primary-nav a:hover,
.primary-nav a:focus-visible {
  color: var(--gold);
}

.primary-nav a:hover::after,
.primary-nav a:focus-visible::after {
  transform: scaleX(1);
}

.header-utils {
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.4vw, 22px);
  flex: 0 0 auto;
  order: 3;
}

.header-utils a {
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  font-weight: 400;
  transition: color 0.25s ease;
}

.header-utils a:hover,
.header-utils a:focus-visible {
  color: var(--gold);
}

.header-utils__wa {
  display: inline-flex;
}

.header-utils__tel {
  direction: ltr;
  letter-spacing: 0.02em;
}

.nav-toggle {
  display: none;
  order: 3;
  width: 40px;
  height: 40px;
  padding: 9px 8px;
  margin-inline-start: auto;
  background: none;
  border: 0;
  cursor: pointer;
  flex-direction: column;
  justify-content: space-between;
}

.nav-toggle span {
  display: block;
  height: 1.5px;
  background: #fff;
  transition: transform 0.3s ease, opacity 0.2s ease;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(9.5px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-9.5px) rotate(-45deg);
}

/* ---------- loader ---------- */

.hero-loader {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  background: var(--ink);
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

.hero-loader.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.hero-loader__brand {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--paper);
}

.hero-loader__bar {
  position: relative;
  width: min(240px, 54vw);
  height: 1px;
  background: rgba(244, 241, 236, 0.18);
  overflow: hidden;
}

.hero-loader__bar i {
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 0;
  background: var(--gold);
  transition: width 0.25s ease;
}

.hero-loader__pct {
  font-size: 11px;
  letter-spacing: 0.28em;
  color: var(--gold-soft);
  direction: ltr;
}

/* ---------- hero stage ---------- */

.hero {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
}

.hero__stage {
  display: block;
  width: 100%;
  height: 100%;
}

/* Chapters swing from near-white marble to near-black stone, so the chrome
   cannot rely on the frame behind it.

   These were far too heavy: 42% black from the top, 62% from the bottom
   reaching HALF WAY UP the frame, and 34% along the rail edge. That is what
   made the hero look washed and muddy next to the source video -- the frames
   themselves measure identical to the masters, the scrim was doing all of the
   damage. shovalbinui.co.il, the reference, puts no scrim over its canvas at
   all.

   So they are now shallow and sit only where the chrome actually is. The nav,
   rail and captions all carry their own text-shadow, which is what should be
   doing this work. */
.hero__scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.26) 0%, rgba(0, 0, 0, 0) 11%),
    linear-gradient(to top, rgba(0, 0, 0, 0.24) 0%, rgba(0, 0, 0, 0) 17%),
    /* behind the rail, on the inline-end edge */
    linear-gradient(to left, rgba(0, 0, 0, 0.14) 0%, rgba(0, 0, 0, 0) 8%);
}

[dir="rtl"] .hero__scrim {
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.26) 0%, rgba(0, 0, 0, 0) 11%),
    linear-gradient(to top, rgba(0, 0, 0, 0.24) 0%, rgba(0, 0, 0, 0) 17%),
    linear-gradient(to right, rgba(0, 0, 0, 0.14) 0%, rgba(0, 0, 0, 0) 8%);
}

/* On a phone the scrim comes off entirely.

   The frames measure identical to the masters, so anything laid over them is
   the only thing standing between the visitor and the video -- and on a small
   screen the chrome is a logo, a hamburger and the chapter numbers, all of
   which already carry their own text-shadow. shovalbinui.co.il, the reference
   the client is matching against, puts nothing over its canvas on any screen.

   Desktop keeps a shallow version because the full nav bar sits across the top
   of the frame there. */
@media (max-width: 900px) {
  .hero__scrim,
  [dir="rtl"] .hero__scrim {
    background: none;
  }
}

.hero__noscript {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--ink);
  z-index: 10;
}

/* The scroll track. Height is set from JS. */
.scroll-stage {
  position: relative;
  z-index: 0;
  pointer-events: none;
}

/* ---------- chapter rail ---------- */

/* Rail lives on the inline-END edge. Captions are right-aligned RTL and sit
   bottom-inline-start; putting the rail on the same side made the last few
   numbers land on top of the caption — badly so on a phone, where 14 items
   span most of the viewport height. Opposite edges keep them clear of each
   other at every size. */
.chapter-rail {
  position: fixed;
  inset-inline-end: clamp(14px, 2.5vw, 44px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 9px;
  align-items: flex-end;
}

.chapter-rail__item {
  padding: 2px 0;
  background: none;
  border: 0;
  cursor: pointer;
  color: rgba(244, 241, 236, 0.62);
  transition: color 0.3s ease, transform 0.3s ease;
}

.chapter-rail__item i {
  font-family: var(--font);
  font-size: 10px;
  font-style: normal;
  font-weight: 500;
  letter-spacing: 0.14em;
  direction: ltr;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.75);
}

.chapter-rail__item:hover,
.chapter-rail__item:focus-visible {
  color: var(--paper);
}

.chapter-rail__item.is-active {
  color: var(--gold);
  transform: translateX(3px);
}

/* ---------- captions ---------- */

.captions {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
}

.caption {
  position: absolute;
  inset-inline: clamp(24px, 7vw, 120px);
  inset-block-end: clamp(64px, 11vh, 128px);
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}

.caption.is-on {
  opacity: 1;
  transform: none;
}

.caption__kicker {
  display: block;
  margin-block-end: 12px;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.24em;
  color: var(--gold);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.8);
}

.caption__title {
  margin: 0;
  font-size: clamp(30px, 5.4vw, 74px);
  font-weight: 200;
  line-height: 1.08;
  letter-spacing: -0.015em;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55), 0 1px 40px rgba(0, 0, 0, 0.4);
}

.caption__title span {
  display: block;
}

/* ---------- scroll cue ---------- */

/* Bottom inline-end corner: clear of the right-aligned caption, and clear of
   the rail, which is vertically centred. */
.scroll-cue {
  position: fixed;
  inset-inline-end: clamp(24px, 5vw, 64px);
  inset-block-end: clamp(24px, 5vh, 48px);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  letter-spacing: 0.24em;
  color: rgba(244, 241, 236, 0.7);
  transition: opacity 0.6s ease;
}

.scroll-cue.is-hidden {
  opacity: 0;
}

.scroll-cue i {
  display: block;
  width: 1px;
  height: 34px;
  background: linear-gradient(to bottom, var(--gold), rgba(199, 165, 126, 0));
  animation: cue 2.1s ease-in-out infinite;
  transform-origin: top;
}

@keyframes cue {
  0%   { transform: scaleY(0.2); opacity: 0.3; }
  50%  { transform: scaleY(1);   opacity: 1; }
  100% { transform: scaleY(0.2); opacity: 0.3; }
}

/* ---------- fallback page ---------- */

.plain-page {
  max-width: 760px;
  margin: 0 auto;
  padding: calc(var(--header-h) + 48px) 24px 80px;
  line-height: 1.7;
}

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
  .primary-nav ul {
    gap: 16px;
  }

  .primary-nav a {
    font-size: 13px;
  }
}

@media (max-width: 900px) {
  :root {
    --header-h: 66px;
  }

  .nav-toggle {
    display: flex;
  }

  .header-utils {
    order: 2;
    margin-inline-start: auto;
  }

  .primary-nav {
    position: fixed;
    inset: 0;
    z-index: -1;
    margin: 0;
    padding: calc(var(--header-h) + 32px) 32px 40px;
    background: rgba(8, 8, 8, 0.97);
    backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
  }

  .primary-nav.is-open {
    z-index: 55;
    opacity: 1;
    visibility: visible;
  }

  .primary-nav ul {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .primary-nav a {
    font-size: 22px;
    font-weight: 300;
    padding-block: 12px;
  }

  .chapter-rail {
    gap: 6px;
    inset-inline-end: 12px;
  }

  .chapter-rail__item i {
    font-size: 9px;
  }

  .caption {
    inset-inline: 22px;
    inset-block-end: 84px;
  }

  .caption__kicker {
    font-size: 10px;
    letter-spacing: 0.2em;
  }

  .scroll-cue span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-cue i {
    animation: none;
  }

  .caption {
    transition-duration: 0.01ms;
  }
}
