/* How It Works — oDarkly faceless cinematic page */

html.lenis,
html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}

.lenis.lenis-stopped {
  overflow: hidden;
}

.lenis.lenis-scrolling iframe {
  pointer-events: none;
}

/* ── Page tokens ── */
.hiw-page {
  --hiw-glass: rgba(10, 10, 10, 0.72);
  --hiw-glass-border: rgba(255, 255, 255, 0.1);
  --hiw-accent: var(--fc-purple, #a78bfa);
  --hiw-sketch: rgba(255, 255, 255, 0.22);
  overflow-x: clip;
}

[data-theme="light"] .hiw-page {
  --hiw-glass: rgba(255, 255, 255, 0.82);
  --hiw-glass-border: rgba(9, 9, 11, 0.1);
  --hiw-sketch: rgba(9, 9, 11, 0.18);
}

/* ── Page shell ── */
.hiw-main {
  width: min(var(--lp-container, 1200px), calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(4rem, 8vw, 7rem);
}

.hiw-breadcrumb {
  margin-bottom: clamp(1rem, 3vw, 1.75rem);
}

/* ── Scroll progress ── */
.hiw-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 200;
  pointer-events: none;
  background: transparent;
}

.hiw-progress-bar {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  background: var(--hiw-accent);
  box-shadow: 0 0 12px var(--fc-purple-glow, rgba(139, 92, 246, 0.35));
}

/* ── Glass panels ── */
.hiw-glass {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
  background-color: var(--hiw-glass);
  border-radius: 20px;
  box-shadow:
    0 24px 56px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
}

[data-theme="light"] .hiw-glass {
  box-shadow:
    0 20px 48px rgba(9, 9, 11, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.hiw-glass.border-gradient::before {
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.14) 0%,
    rgba(167, 139, 250, 0.32) 42%,
    rgba(192, 132, 252, 0.22) 68%,
    rgba(255, 255, 255, 0.08) 100%
  );
}

/* ── Motion text masks ── */
html.has-motion [data-motion-text],
html.has-motion [data-reveal],
html.has-motion [data-reveal-item] {
  visibility: hidden;
}

.motion-line-mask,
.motion-word-mask {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
}

.motion-line,
.motion-word {
  display: inline-block;
  will-change: transform, opacity;
}

/* ── Display typography ── */
.hiw-display-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4.5vw, 2.75rem);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0.5rem 0 0;
  color: var(--text-main);
}

/* ── Hero ── */
.hiw-hero {
  position: relative;
  max-width: 860px;
  margin: 0 auto clamp(2.5rem, 6vw, 4.5rem);
  text-align: center;
  padding: clamp(1rem, 3vw, 2rem) 0;
}

.hiw-hero-sketches {
  position: absolute;
  inset: -2rem -1rem auto;
  height: min(280px, 38vh);
  pointer-events: none;
  overflow: visible;
}

.hiw-sketch {
  position: absolute;
  opacity: 0.85;
}

.hiw-sketch path {
  stroke: var(--hiw-sketch);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hiw-sketch--arrow {
  width: 72px;
  top: 8%;
  left: 6%;
  transform: rotate(-8deg);
}

.hiw-sketch--star {
  width: 32px;
  top: 4%;
  right: 12%;
  transform: rotate(10deg);
}

.hiw-sketch--circle {
  width: 64px;
  bottom: 18%;
  right: 6%;
  transform: rotate(-4deg);
}

.hiw-sketch--squiggle {
  width: 96px;
  bottom: 28%;
  left: 10%;
}

.hiw-sketch--spark {
  width: 28px;
  top: 20%;
  right: 2%;
}

.hiw-hero-label {
  display: inline-block;
  margin-bottom: 1rem;
}

.hiw-hero-title {
  margin: 0 0 1.25rem;
}

.hiw-hero-desc {
  max-width: 640px;
  margin: 0 auto;
  color: var(--text-muted);
  font-size: clamp(1rem, 2.2vw, 1.15rem);
  line-height: 1.75;
}

/* ── Sections ── */
.hiw-section {
  margin-bottom: clamp(3rem, 8vw, 5rem);
}

.hiw-section-head {
  max-width: 640px;
  margin-bottom: clamp(2rem, 5vw, 3rem);
}

.hiw-section-desc {
  margin: 0.75rem 0 0;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.7;
}

/* ── Timeline (per-row rail — dots stay aligned with cards) ── */
.hiw-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(1.25rem, 3vw, 1.75rem);
  max-width: 900px;
  margin-inline: auto;
}

.hiw-step-row {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: clamp(1rem, 3vw, 1.75rem);
  align-items: stretch;
}

.hiw-step-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 1.75rem;
}

.hiw-step-dot {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bg-0, #000);
  border: 1px solid var(--fc-border);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  transition:
    border-color 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    color 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    background 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.hiw-step-row.is-active .hiw-step-dot {
  border-color: var(--hiw-accent);
  color: var(--hiw-accent);
  box-shadow: 0 0 0 4px var(--fc-purple-soft, rgba(167, 139, 250, 0.14));
}

.hiw-step-row.is-complete .hiw-step-dot {
  border-color: var(--hiw-accent);
  color: var(--bg-0, #000);
  background: var(--hiw-accent);
}

.hiw-step-connector {
  flex: 1;
  width: 2px;
  min-height: clamp(1.25rem, 3vw, 2rem);
  margin: 0.5rem 0;
  background: var(--fc-border);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}

.hiw-step-connector::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--hiw-accent);
  transform-origin: top center;
  transform: scaleY(var(--hiw-connector-fill, 0));
  border-radius: 2px;
  box-shadow: 0 0 8px var(--fc-purple-glow, rgba(139, 92, 246, 0.35));
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.hiw-step-row.is-complete .hiw-step-connector::after {
  --hiw-connector-fill: 1;
}

.hiw-step-row.is-active .hiw-step-connector::after {
  --hiw-connector-fill: 0.55;
}

/* ── Step cards ── */
.hiw-step {
  padding: clamp(1.35rem, 3.5vw, 2rem);
  border: 1px solid var(--hiw-glass-border);
  transition:
    border-color 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.hiw-step-row.is-active .hiw-step {
  border-color: rgba(167, 139, 250, 0.35);
  box-shadow:
    0 0 0 1px var(--fc-purple-soft, rgba(167, 139, 250, 0.14)),
    0 16px 40px rgba(0, 0, 0, 0.2);
}

.hiw-step-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.hiw-step-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.hiw-step-icon path {
  stroke: var(--hiw-sketch);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.hiw-step-row.is-active .hiw-step-sketch,
.hiw-step-icon .fc-sketch-draw--accent {
  stroke: var(--hiw-accent);
}

.hiw-step-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hiw-accent);
}

.hiw-step-title {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 3vw, 1.65rem);
  font-weight: 400;
  letter-spacing: -0.015em;
  color: var(--text-main);
  line-height: 1.2;
}

.hiw-step-desc {
  margin: 0;
  max-width: 52ch;
  color: var(--text-muted);
  font-size: 0.98rem;
  line-height: 1.7;
}

/* ── Formats ── */
.hiw-formats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1rem, 3vw, 1.5rem);
  max-width: 900px;
  margin-inline: auto;
}

.hiw-format {
  padding: clamp(1.35rem, 3vw, 1.75rem);
  border: 1px solid var(--hiw-glass-border);
}

.hiw-format-meta {
  margin: 0 0 0.5rem;
  color: var(--hiw-accent) !important;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hiw-format h3 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.2rem, 2.5vw, 1.45rem);
  color: var(--text-main);
}

.hiw-format ul {
  display: grid;
  gap: 0.55rem;
  padding-left: 1.15rem;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ── CTA ── */
.hiw-cta {
  max-width: 720px;
  margin: clamp(3rem, 8vw, 5rem) auto 2.5rem;
  text-align: center;
  padding: clamp(2rem, 5vw, 3rem);
  border: 1px solid var(--hiw-glass-border);
}

.hiw-cta .hiw-display-title {
  margin: 0 0 0.75rem;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
}

.hiw-cta p {
  margin: 0 0 1.5rem;
  color: var(--text-muted);
  max-width: 480px;
  margin-inline: auto;
  line-height: 1.65;
}

.hiw-cta .fc-btn {
  margin-top: 0.25rem;
}

/* ── Next link ── */
.hiw-next-link {
  max-width: 900px;
  margin: 0 auto;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  html.has-motion [data-motion-text],
  html.has-motion [data-reveal],
  html.has-motion [data-reveal-item] {
    visibility: visible;
  }

  .hiw-progress-bar {
    transform: none !important;
    transition: none;
  }

  .fc-sketch-draw {
    stroke-dashoffset: 0 !important;
  }

  .hiw-step,
  .hiw-step-dot,
  .hiw-step-connector::after {
    transition: none;
  }
}

/* ── Tablet ── */
@media (max-width: 768px) {
  .hiw-formats-grid {
    grid-template-columns: 1fr;
    max-width: 520px;
  }

  .hiw-hero-sketches .hiw-sketch--squiggle,
  .hiw-hero-sketches .hiw-sketch--arrow {
    opacity: 0.45;
  }

  .hiw-step-row {
    grid-template-columns: 44px 1fr;
    gap: 0.85rem;
  }

  .hiw-step-dot {
    width: 36px;
    height: 36px;
    font-size: 0.62rem;
  }

  .hiw-step-rail {
    padding-top: 1.35rem;
  }
}

/* ── Mobile ── */
@media (max-width: 480px) {
  .hiw-main {
    width: calc(100% - 1.25rem);
  }

  .hiw-step {
    padding: 1.15rem;
  }

  .hiw-step-icon {
    width: 36px;
    height: 36px;
  }

  .hiw-cta {
    padding: 1.5rem 1.15rem;
  }
}
