/* BRAINDANCE · Why BRAINDANCE (Zašto BRAINDANCE)
   The only light section. On Off-white, lime is never text: only a fill behind Obsidian text or inside a node.
   A sticky diagram connects the four principles into one system as they scroll past. */

.why { position: relative; z-index: 2; background: var(--text); color: var(--obsidian); --ink-2: #4a4a45; --rule: rgba(9, 9, 9, .14); }

/* opening: a dark curtain shrinks downward from the lime line that ends Services */
.why-curtain { position: absolute; left: 0; right: 0; top: 0; height: 100vh; z-index: 5; background: var(--obsidian); transform: scaleY(calc(1 - var(--r, 1))); transform-origin: bottom; pointer-events: none; }
.why-bg { position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(to right, rgba(9, 9, 9, .05) 1px, transparent 1px); background-size: calc((min(100vw, 1440px) - 2 * var(--gutter)) / 12) 100%; background-position: calc(50% - min(100vw, 1440px) / 2 + var(--gutter)) 0; }

/* headline */
.why-head { position: relative; z-index: 2; padding-top: clamp(96px, 10vw, 152px); display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 24px; }
.why-title { grid-column: 1 / -1; margin: 0; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 24px; font-family: var(--font-display); font-weight: 800; font-stretch: 104%; font-size: clamp(40px, 5vw, 76px); line-height: .96; letter-spacing: -.04em; }
.why-title .row { display: block; overflow: hidden; padding-bottom: .1em; white-space: nowrap; }
.why-title .row > span { display: inline-block; transition: transform 900ms var(--ease-out); }
.why-title .r1 { grid-column: 1 / -1; }
.why-title .r2 { grid-column: 3 / -1; }
.why-title .r2 > span { transition-delay: 120ms; }
.why-title mark { color: var(--obsidian); background: linear-gradient(var(--lime), var(--lime)) 0 60% / 100% 78% no-repeat; padding: 0 .08em; margin: 0 -.04em; transition: background-size 600ms var(--ease-out) 600ms; }
.why-lead { grid-column: 7 / -1; margin: 48px 0 0; max-width: 44ch; font-size: clamp(18px, 1.4vw, 21px); line-height: 1.6; font-weight: 500; color: var(--ink-2); transition: opacity 700ms var(--ease-out) 150ms, transform 700ms var(--ease-out) 150ms; }

.js .why-title:not(.is-in) .row > span { transform: translateY(108%); }
.js .why-title:not(.is-in) mark { background-size: 0 78%; }
.js .why-lead:not(.is-in), .js .why-next:not(.is-in) { opacity: 0; transform: translateY(24px); }

/* system */
.why-system { position: relative; z-index: 2; margin-top: clamp(80px, 9vw, 140px); display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 24px; align-items: start; }
.why-diagram-wrap { grid-column: 1 / span 5; position: sticky; top: calc(var(--header-h) + max(24px, (100vh - var(--header-h) - min(40vw, 480px)) / 2)); }
.why-diagram { display: block; width: min(100%, 480px); height: auto; overflow: visible; }
.why-diagram .segs line { stroke: var(--obsidian); stroke-width: 2; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 700ms cubic-bezier(.22, 1, .36, 1); }
.why-diagram .segs line.on { stroke-dashoffset: 0; }
.why-diagram .node rect { fill: var(--text); stroke: rgba(9, 9, 9, .4); stroke-width: 2; transform-box: fill-box; transform-origin: center; transition: fill 400ms var(--ease-out), stroke 400ms var(--ease-out), transform 500ms cubic-bezier(.22, 1, .36, 1); }
.why-diagram .node text { font-family: var(--font-mono); font-size: 13px; letter-spacing: .08em; fill: var(--ink-2); text-anchor: middle; }
.why-diagram .node.is-on rect { fill: var(--lime); stroke: var(--obsidian); }
.why-diagram .node.is-current rect { transform: scale(1.45); }
.why-diagram .node.is-hover rect { stroke: var(--obsidian); transform: scale(1.3); }
.why-diagram .node { cursor: default; }
.center-logo { opacity: var(--lo, .1); transition: opacity 700ms var(--ease-out); }

.why-list { grid-column: 7 / -1; list-style: none; margin: 0; padding: 0; }
.why-list li { position: relative; padding: clamp(56px, 9vh, 96px) 0; border-top: 1px solid var(--rule); display: grid; grid-template-columns: 56px minmax(0, 1fr); column-gap: 16px; row-gap: 12px; opacity: .35; transition: opacity 500ms var(--ease-out); }
.why-list li:last-child { border-bottom: 1px solid var(--rule); }
.why-list li.is-active, .why-list li.is-hover { opacity: 1; }
.why-list .wn { grid-row: 1 / span 2; font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: .1em; color: var(--ink-2); padding-top: .9em; }
.why-list li.is-active .wn { color: var(--obsidian); }
.why-list h3 { margin: 0; font-family: var(--font-display); font-weight: 800; font-stretch: 104%; font-size: clamp(28px, 2.8vw, 42px); line-height: 1.05; letter-spacing: -.03em; }
.why-list p { margin: 0; max-width: 40ch; font-size: 17px; line-height: 1.6; color: var(--ink-2); }

/* exit */
.why-exit { position: relative; z-index: 2; padding-block: clamp(96px, 10vw, 152px) clamp(48px, 5vw, 72px); }
.why-next { margin: 0; font-family: var(--font-display); font-weight: 700; font-stretch: 104%; font-size: clamp(24px, 2.4vw, 36px); letter-spacing: -.02em; transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out); }
.why-next span { display: inline-block; margin-left: 8px; animation: cue 2.4s var(--ease-in-out) infinite; }

.why-teaser { position: relative; z-index: 3; height: clamp(96px, 10vw, 160px); margin-bottom: -2px; background: var(--obsidian); color: var(--text); clip-path: inset(calc((1 - var(--u, 1)) * 100%) 0 0 0); padding-top: clamp(40px, 5vw, 72px); }

.next-up-dark { border-top: 0; }

/* mobile strip (hidden elsewhere) */
.why-strip { display: none; }

/* tablet */
@media (max-width: 1023px) {
  .why-title { font-size: clamp(36px, 6.4vw, 60px); }
  .why-title .row { white-space: normal; }
  .why-title .r2 { grid-column: 2 / -1; }
  .why-lead { grid-column: 3 / -1; }
  .why-diagram-wrap { grid-column: 1 / span 5; top: calc(var(--header-h) + 24px); }
  .why-list { grid-column: 6 / -1; }
  .why-list li { grid-template-columns: 1fr; }
  .why-list .wn { grid-row: auto; padding-top: 0; }
}

/* mobile: compact sticky strip replaces the diagram */
@media (max-width: 639px) {
  .why-head { display: block; padding-top: 72px; }
  .why-title { display: block; font-size: clamp(32px, 9.6vw, 44px); line-height: 1; }
  .why-lead { margin-top: 24px; font-size: 17px; }
  .why-strip { display: block; position: sticky; top: calc(var(--header-h) + env(safe-area-inset-top, 0px)); z-index: 4; margin-top: 48px; background: rgba(245, 245, 242, .94); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-block: 1px solid var(--rule); }
  .strip-row { display: flex; align-items: center; gap: 8px; height: 52px; }
  .sn { font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: .06em; padding: 4px 6px; border: 1.5px solid rgba(9, 9, 9, .35); color: var(--ink-2); transition: background-color 400ms var(--ease-out), border-color 400ms, color 400ms; }
  .sn.is-on { background: var(--lime); border-color: var(--obsidian); color: var(--obsidian); }
  .sl { flex: 1; height: 2px; background: var(--rule); position: relative; overflow: hidden; }
  .sl::after { content: ""; position: absolute; inset: 0; background: var(--obsidian); transform: scaleX(0); transform-origin: left; transition: transform 600ms cubic-bezier(.22, 1, .36, 1); }
  .sl.on::after { transform: scaleX(1); }
  .strip-logo { width: 34px; height: auto; margin-left: 8px; opacity: var(--lo, .15); transition: opacity 600ms var(--ease-out); }
  .why-system { display: block; margin-top: 0; }
  .why-diagram-wrap { display: none; }
  .why-list li { min-height: 60vh; align-content: center; padding: 48px 0; }
  .why-list h3 { font-size: clamp(28px, 8.4vw, 36px); }
}

/* reduced motion: final state */
@media (prefers-reduced-motion: reduce) {
  .why-curtain { display: none; }
  .js .why-title:not(.is-in) .row > span, .js .why-lead:not(.is-in), .js .why-next:not(.is-in) { opacity: 1; transform: none; }
  .js .why-title:not(.is-in) mark { background-size: 100% 78%; }
  .why-teaser { clip-path: none; }
}

/* English headline is longer: smaller type so "...what comes next." stays on one line */
html[lang="en"] .why-title { font-size: clamp(38px, 4.5vw, 68px); }
