/* =========================================================================
   ESSOR — The Brand Atelier / scroll storyboard
   Palette taken from the brand (brand.js), not invented.

   Two presentations, one DOM:
     • default            → scenes flow as ordinary sections (no-JS, reduced motion, SEO)
     • html.cinematic     → scenes stack in a sticky stage, driven by scroll
   ========================================================================= */

:root {
  --ink: #14112b;
  --violet: #5b2eff;
  --coral: #ff7a45;
  --cream: #fff6ec;
  --lilac: #e9e3ff;
  --muted: #7a7594;
  --white: #ffffff;

  --hairline: rgba(20, 17, 43, 0.14);

  --font: 'Readex Pro', Tahoma, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  /* Scroll length per weight unit — the one knob for the whole journey. */
  --unit-vh: 120;
  --pad: 5rem;
  color-scheme: light;
}

@media (max-width: 1023px) { :root { --pad: 2rem; } }
@media (max-width: 767px)  { :root { --unit-vh: 90; --pad: 1.25rem; } }

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--ink); }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  direction: rtl;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.12; text-wrap: balance; font-weight: 700; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; border-radius: 8px; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }

/* ---------------------------------------------------------------- nav --- */

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.9rem var(--pad);
  background: rgba(255, 246, 236, 0.84);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--hairline);
  transition: opacity 0.35s var(--ease), background-color 0.45s var(--ease),
    border-color 0.45s var(--ease), color 0.45s var(--ease);
}

/* Over the dark scenes the bar inverts rather than punching a light hole. */
.nav[data-tone='light'] {
  background: rgba(20, 17, 43, 0.4);
  border-bottom-color: rgba(255, 255, 255, 0.16);
  color: var(--cream);
}

.wordmark { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; }
.wordmark b { color: var(--coral); }

.nav-links { display: flex; gap: 1.4rem; font-size: 0.9rem; }
.nav-links a { color: inherit; opacity: 0.68; transition: opacity 0.2s; }
.nav-links a:hover { opacity: 1; }

.nav-cta {
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  background: var(--coral);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.86rem;
  white-space: nowrap;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}
.nav-cta:hover { background: var(--ink); color: var(--cream); }

@media (max-width: 860px) { .nav-links { display: none; } }

/* ------------------------------------------------------- story: shared --- */

.story { position: relative; background: var(--ink); }

.scene { position: relative; }

.scene > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  /* No CSS filter here: a full-viewport filter pass would re-run every frame. */
}

/* Legibility scrim, tinted to the scene's own tone. */
.scene::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.scene[data-tone='light']::after {
  background: linear-gradient(
      to top,
      rgba(20, 17, 43, 0.9) 0%,
      rgba(20, 17, 43, 0.52) 32%,
      rgba(20, 17, 43, 0.08) 66%,
      rgba(20, 17, 43, 0) 84%
    ),
    linear-gradient(to left, rgba(20, 17, 43, 0.62) 0%, rgba(20, 17, 43, 0) 58%);
}
.scene[data-tone='dark']::after {
  background: linear-gradient(
      to top,
      rgba(255, 246, 236, 0.92) 0%,
      rgba(255, 246, 236, 0.58) 34%,
      rgba(255, 246, 236, 0.1) 68%,
      rgba(255, 246, 236, 0) 86%
    ),
    linear-gradient(to left, rgba(255, 246, 236, 0.68) 0%, rgba(255, 246, 236, 0) 58%);
}

.copy { position: relative; z-index: 2; }
.copy-inner { width: 100%; max-width: 1280px; margin-inline: auto; }
.scene[data-tone='light'] .copy { color: var(--cream); }
.scene[data-tone='dark'] .copy { color: var(--ink); }

.overline {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 1.1rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--coral);
}
.overline i { display: block; width: 2.4rem; height: 1px; background: var(--coral); transform-origin: right center; }

.headline { font-size: clamp(2.3rem, 6.2vw, 5.4rem); letter-spacing: -0.03em; margin-bottom: 1rem; }
.headline span { display: block; overflow: hidden; }
.headline span > i { display: block; font-style: normal; }
.headline span:last-child > i { color: var(--coral); }

.note { max-width: 44ch; font-size: clamp(0.95rem, 1.5vw, 1.1rem); line-height: 1.8; opacity: 0.82; }

/* ------------------------------------------------ scene 08: the offer --- */

.plans {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 2rem;
  background: var(--hairline);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  overflow: hidden;
  max-width: 980px;
}
.plan { background: rgba(255, 246, 236, 0.96); padding: 1.4rem 1.3rem; color: var(--ink); }
.plan h3 { font-size: 1.05rem; margin-bottom: 0.2rem; }
.plan .from { font-size: 0.78rem; color: var(--muted); margin-bottom: 0.9rem; }
.plan .from b { color: var(--violet); font-size: 1.15rem; }
.plan ul { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--hairline); }
.plan li { font-size: 0.82rem; line-height: 1.5; padding: 0.5rem 0; color: var(--muted); border-bottom: 1px solid var(--hairline); }
.plan li:last-child { border-bottom: 0; }

.offer {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.1rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: var(--coral);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 600;
}

@media (max-width: 767px) {
  .plans { grid-template-columns: 1fr; }
  .plan { padding: 1rem; }
}

/* A scene whose copy is a panel, not a statement: centre it and step the
   headline down so the table is never crowded by it. */
html.cinematic .scene[data-layout='panel'] .copy { align-items: center; }
.scene[data-layout='panel'] .headline {
  font-size: clamp(1.8rem, 3.8vw, 3.2rem);
  margin-bottom: 0.4rem;
}

/* --------------------------------------------------- scene 09: the CTA --- */

.scene-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.4rem;
  padding: 0.95rem 1.9rem;
  border-radius: 999px;
  background: var(--coral);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.95rem;
  transition: background-color 0.25s var(--ease);
}
.scene-cta:hover { background: var(--cream); }

/* ============================ default (no-JS / reduced motion) ========== */

.stage { display: contents; }

html:not(.cinematic) .scene {
  min-height: 72vh;
  display: flex;
  align-items: flex-end;
  padding: clamp(3rem, 8vh, 6rem) var(--pad);
  overflow: hidden;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
html:not(.cinematic) .scene > img { position: absolute; inset: 0; }
html:not(.cinematic) .rail,
html:not(.cinematic) .cue,
html:not(.cinematic) .loader { display: none; }

/* ================================ cinematic (JS + motion allowed) ======= */

html.cinematic .story { height: calc(var(--total-w) * var(--unit-vh) * 1vh); }

html.cinematic .stage {
  display: block;
  position: sticky;
  top: 0;
  width: 100%;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background: var(--ink);
}

/* Later scenes paint over earlier ones and fade in on top, so the frame is
   never empty mid-transition. */
html.cinematic .scene {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  will-change: opacity;
  backface-visibility: hidden;
}
html.cinematic .scene > img { will-change: transform; }

html.cinematic .copy {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 0 var(--pad) clamp(3rem, 9vh, 7rem);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  will-change: opacity, transform;
}
html.cinematic .plans,
html.cinematic .scene-cta { pointer-events: auto; }

/* Scroll-driven sub-animations read --a (the copy's own fade envelope). */
html.cinematic .overline i { transform: scaleX(clamp(0, calc(var(--a) * 1.6), 1)); }

html.cinematic .headline span { --t: clamp(0, calc((var(--a) - var(--d)) / 0.45), 1); }
html.cinematic .headline span > i { transform: translate3d(0, calc((1 - var(--t)) * 1em), 0); }

html.cinematic .note {
  --t: clamp(0, calc((var(--a) - 0.25) / 0.45), 1);
  opacity: calc(var(--t) * 0.82);
  transform: translate3d(0, calc((1 - var(--t)) * 1rem), 0);
}

html.cinematic .plans {
  --t: clamp(0, calc((var(--a) - 0.2) / 0.4), 1);
  opacity: var(--t);
  transform: translate3d(0, calc((1 - var(--t)) * 1.5rem), 0);
}
html.cinematic .offer { --t: clamp(0, calc((var(--a) - 0.3) / 0.4), 1); opacity: var(--t); }
html.cinematic .scene-cta {
  --t: clamp(0, calc((var(--a) - 0.3) / 0.4), 1);
  opacity: var(--t);
  transform: translate3d(0, calc((1 - var(--t)) * 1rem), 0);
}

/* ------------------------------------------------------------ furniture --- */

.rail {
  --p: 0;
  position: absolute;
  top: 50%;
  left: var(--pad);
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  pointer-events: none;
  z-index: 3;
  transition: color 0.45s var(--ease);
}
.rail[data-tone='light'] { color: var(--cream); }
.rail[data-tone='dark'] { color: var(--ink); }

.rail-num { font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.rail-num small { font-size: 0.7rem; opacity: 0.5; }

.rail-track { position: relative; width: 1px; height: clamp(100px, 24vh, 190px); background: currentColor; opacity: 0.3; }
.rail-fill { position: absolute; inset: 0; background: var(--coral); transform-origin: top center; transform: scaleY(var(--p)); }

.cue {
  position: absolute;
  left: 50%;
  bottom: 1.6rem;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.66rem;
  letter-spacing: 0.3em;
  color: var(--cream);
  opacity: 0.7;
  pointer-events: none;
  z-index: 3;
  transition: opacity 0.6s var(--ease);
}
.cue i { display: block; width: 1px; height: 2rem; background: linear-gradient(to bottom, var(--coral), transparent); }

@media (max-width: 767px) {
  .rail { left: auto; right: var(--pad); gap: 0.5rem; }
  .rail-num small, .cue { display: none; }
}

/* --------------------------------------------------------------- outro --- */

.outro {
  position: relative;
  z-index: 2;
  background: var(--cream);
  padding: clamp(4rem, 12vh, 9rem) var(--pad);
}
.outro-inner { max-width: 1280px; margin-inline: auto; }
.outro h2 { font-size: clamp(2rem, 5vw, 4rem); letter-spacing: -0.03em; margin-bottom: 1rem; }
.outro > .outro-inner > p { color: var(--muted); max-width: 48ch; margin-bottom: 2rem; }

.outro-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 1.7rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
  transition: transform 0.2s var(--ease), background-color 0.25s var(--ease);
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--coral); color: var(--ink); }
.btn-ghost { border: 1px solid var(--hairline); color: var(--ink); }

.foot {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  align-items: baseline;
  margin-top: clamp(3rem, 8vh, 5rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--hairline);
  font-size: 0.8rem;
  color: var(--muted);
}

/* ------------------------------------------------------------ loading --- */

.loader {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: var(--cream);
  transition: opacity 0.6s var(--ease), visibility 0.6s;
}
.loader.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-inner { width: min(360px, 76vw); }
.loader-label { font-size: 0.72rem; letter-spacing: 0.22em; color: var(--coral); }
.loader-bar { height: 2px; margin-top: 1rem; background: rgba(255, 246, 236, 0.2); overflow: hidden; }
.loader-fill { display: block; height: 100%; background: var(--coral); transform-origin: right center; transform: scaleX(0); transition: transform 0.35s var(--ease); }
