/* ForexIntel case study.
   A dark, high-contrast page. Newsreader carries the story in heavy display sizes,
   IBM Plex Sans carries the product. One blue accent for the chat and the signal,
   one amber for the surprise. Everything in the chat is simulated. */

@font-face {
  font-family: 'Newsreader Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(../vendor/fonts/newsreader-latin-opsz-normal.woff2) format('woff2-variations');
}
@font-face {
  font-family: 'IBM Plex Sans Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 700;
  src: url(../vendor/fonts/ibm-plex-sans-latin-wght-normal.woff2) format('woff2-variations');
}

:root {
  --bg: #07090d;
  --bg-2: #0c1017;
  --panel: #111722;
  --panel-2: #172030;
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.17);
  --ink: #f3f5f9;
  --ink-2: #b4bdcb;
  --ink-3: #8a96a9;
  --accent: #5cb8ff;
  --accent-ink: #04121f;
  --accent-soft: rgba(92, 184, 255, 0.14);
  --accent-line: rgba(92, 184, 255, 0.5);
  --warm: #ffb454;
  --warm-soft: rgba(255, 180, 84, 0.14);

  --tg-bg: #0e1621;
  --tg-head: #17212b;
  --tg-bubble: #182533;

  --serif: 'Newsreader Variable', 'Iowan Old Style', Georgia, serif;
  --sans: 'IBM Plex Sans Variable', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --bar-h: 60px;
  --gutter: clamp(18px, 4vw, 56px);
  --maxw: 1360px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 100%;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
html.motion-off { scroll-behavior: auto; }
body {
  margin: 0;
  min-width: 320px;
  overflow-x: clip;
  font-variant-numeric: tabular-nums;
}
h1, h2, p, dl, dd, ol, ul, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--accent-line); color: #fff; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.skip-link {
  position: fixed; left: 12px; top: 8px; z-index: 60;
  padding: 10px 14px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 600; text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* ---------- Shared bits ---------- */

.eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}
.eyebrow span { color: var(--accent); margin-right: 0.6em; font-weight: 600; }

.demo-tag {
  display: inline-block;
  padding: 1px 8px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  color: var(--accent);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.6;
}
.demo-note { font-size: 0.8125rem; color: var(--ink-3); }

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 13px 22px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s, transform 0.2s var(--ease-out);
}
.btn:hover { background: #8acdff; }
.btn:active { transform: scale(0.97); }
.btn--big { padding: 18px 30px; font-size: 1.125rem; }
.btn--ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-2); }
.btn--ghost:hover { background: rgba(255, 255, 255, 0.06); border-color: var(--ink-3); }
.foot a { color: var(--ink-2); }
.link-btn {
  background: none; border: 0; padding: 4px 2px;
  color: var(--ink-3); font-size: 0.8125rem; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}
.link-btn:hover { color: var(--ink); }

.ccy {
  display: inline-block;
  padding: 0 6px;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1.6;
  vertical-align: 1px;
}
.tag {
  display: inline-block;
  margin-left: 4px;
  padding: 0 7px;
  border-radius: 5px;
  background: var(--warm-soft);
  color: var(--warm);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.6;
  vertical-align: 1px;
}

/* ---------- Top bar ---------- */

.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 40;
  display: flex; align-items: center; gap: 28px;
  height: var(--bar-h);
  padding-inline: var(--gutter);
  background: rgba(7, 9, 13, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.bar__brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; letter-spacing: -0.01em; }
.bar__brand em { font-style: normal; font-weight: 400; font-size: 0.8125rem; color: var(--ink-3); padding-left: 10px; border-left: 1px solid var(--line-2); }
.bar__mark { width: 26px; height: 26px; }
.bar__mark .m-dim { fill: #566176; }
.bar__mark .m-acc { fill: var(--accent); }
.bar__nav { display: flex; gap: 22px; margin-left: auto; font-size: 0.875rem; }
.bar__nav a { color: var(--ink-2); text-decoration: none; padding: 6px 2px; white-space: nowrap; transition: color 0.2s; }
.bar__brand, .motion-toggle { white-space: nowrap; }
@media (max-width: 1100px) {
  .bar { gap: 18px; }
  .bar__brand em { display: none; }
  .bar__nav { gap: 16px; }
}
.bar__nav a:hover { color: var(--ink); }
.motion-toggle {
  background: none; border: 1px solid var(--line-2); border-radius: 999px;
  padding: 5px 12px; font-size: 0.8125rem; color: var(--ink-2); cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.motion-toggle:hover { color: var(--ink); border-color: var(--ink-3); }
.progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; }
.progress i { display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  max-width: var(--maxw);
  margin-inline: auto;
  min-height: 100svh;
  padding: calc(var(--bar-h) + 40px) var(--gutter) 56px;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  align-items: center;
  gap: clamp(24px, 4vw, 64px);
}
.hero__copy { position: relative; display: grid; gap: 26px; }

.hl {
  font-family: var(--serif);
  font-weight: 650;
  font-size: clamp(2.7rem, 5.6vw, 5.6rem);
  line-height: 1;
  letter-spacing: -0.025em;
  font-variation-settings: 'opsz' 72;
}
.hl > span { display: block; text-wrap: balance; }
.hl__noise { position: relative; color: var(--ink-3); width: fit-content; }
.hl__noise::before,
.hl__noise::after {
  content: attr(data-text);
  position: absolute; inset: 0;
  pointer-events: none;
  transition: transform 1.4s var(--ease-out), opacity 1.2s;
}
.hl__noise::before { color: var(--accent); opacity: 0.55; transform: translate(-5px, 2px); }
.hl__noise::after { color: var(--warm); opacity: 0.4; transform: translate(5px, -2px); }
.is-clear .hl__noise::before,
.is-clear .hl__noise::after { opacity: 0; transform: none; }
.hl__clear { color: var(--ink); margin-top: 0.16em; }

.lede { max-width: 36rem; font-size: 1.1875rem; color: var(--ink-2); }
.lede b { color: var(--ink); font-weight: 600; }
.hero__go { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.hero__hint { font-size: 0.875rem; color: var(--ink-3); }

.hero__visual {
  position: relative;
  display: grid; place-items: center;
  width: 100%; max-width: 560px;
  aspect-ratio: 1 / 1;
  margin-inline: auto;
  --w: 560px; --h: 560px;
  overflow: clip;
}
.hero__chips { position: absolute; inset: 0; }
.hchip {
  position: absolute; left: 50%; top: 50%;
  padding: 6px 11px;
  border-radius: 9px;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  font-size: 0.75rem; color: var(--ink-2);
  white-space: nowrap;
  transform: translate(-50%, -50%) translate(calc(var(--sx) * var(--w)), calc(var(--sy) * var(--h))) rotate(var(--r));
  transition: transform 1.25s var(--ease-in-out) var(--d), opacity 0.9s ease var(--d);
}
.hchip span { display: block; animation: drift 7s ease-in-out infinite alternate; animation-delay: var(--d); }
@keyframes drift { from { transform: translate(-2px, -3px); } to { transform: translate(3px, 3px); } }
.is-converged .hchip {
  opacity: 0;
  transform: translate(-50%, -50%) translate(0, calc(var(--ey) * var(--h))) rotate(0deg) scale(0.2);
}
.hero__card {
  position: relative; z-index: 2;
  width: min(94%, 400px);
  opacity: 0;
  transform: translateY(18px) scale(0.96);
  transition: opacity 0.8s ease 1.1s, transform 1s var(--ease-out) 1.1s;
}
.is-converged .hero__card { opacity: 1; transform: none; }
.hero__note {
  position: absolute; z-index: 3; left: 0; right: 0; bottom: 0;
  text-align: center; font-size: 0.75rem; color: var(--ink-3);
}
.link-btn[data-hero-replay] { position: absolute; z-index: 3; right: 0; top: 0; }

/* ---------- Telegram-inspired bubble ---------- */

.msg, .bubble {
  background: var(--tg-bubble);
  border-radius: 5px 18px 18px 18px;
  padding: 12px 14px 11px;
  color: var(--ink);
  font-size: 0.875rem;
  line-height: 1.45;
}
.bubble { padding: 16px 18px 14px; font-size: 0.9375rem; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4); }
.msg__kicker { font-size: 0.75rem; color: var(--accent); font-weight: 600; letter-spacing: 0.02em; margin-bottom: 4px; }
.msg__title { font-weight: 600; font-size: 0.9375rem; }
.msg__when { color: var(--ink-2); margin-top: 2px; }
.msg__when b { color: var(--ink); }
.msg__foot { margin-top: 8px; font-size: 0.75rem; color: var(--ink-3); }

.figs { display: flex; gap: 24px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.figs dt { font-size: 0.6875rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; }
.figs dd { font-size: 1.125rem; font-weight: 600; }

.digest { margin-top: 6px; }
.digest > div { display: grid; grid-template-columns: 2.3rem 1fr; gap: 6px; padding-top: 10px; padding-bottom: 8px; border-top: 1px solid var(--line); }
.digest dt { font-size: 0.75rem; font-weight: 600; color: var(--accent); }
.digest dd { font-weight: 500; }
.digest small { display: block; color: var(--ink-3); font-size: 0.75rem; font-weight: 400; }

.mchips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mchips li { padding: 3px 9px; border-radius: 7px; background: rgba(255, 255, 255, 0.06); font-size: 0.8125rem; font-weight: 500; }
.mchips span { color: var(--ink-3); font-weight: 400; margin-right: 4px; }

/* the surprise card */
.flow { display: grid; grid-template-columns: 0.9fr 0.9fr 1fr 1.25fr; margin-top: 10px; border-block: 1px solid var(--line); }
.flow li { position: relative; padding: 8px 9px 9px; min-width: 0; }
.flow li + li { border-left: 1px solid var(--line); }
.flow li + li::before {
  content: ''; position: absolute; left: -5px; top: 11px; width: 8px; height: 8px;
  border-top: 1.5px solid var(--ink-3); border-right: 1.5px solid var(--ink-3);
  transform: rotate(45deg); background: var(--tg-bubble);
  clip-path: polygon(0 0, 100% 0, 100% 100%);
}
.flow span { display: block; font-size: 0.6875rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; }
.flow b { display: block; font-size: 1rem; font-weight: 650; line-height: 1.2; margin-top: 2px; overflow-wrap: anywhere; }
.flow .is-surprise { background: var(--warm-soft); }
.flow .is-surprise span { color: var(--ink-2); }
.flow .is-surprise b { color: var(--warm); }
.flow .is-read b { font-size: 0.8125rem; line-height: 1.25; }
.flow .is-pos b, .flow .is-neg b { color: var(--accent); }
.flow .is-flat b { color: var(--ink-2); }
.read { margin-top: 10px; color: var(--ink-2); font-size: 0.8125rem; }
.dir { margin-top: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.dir span { flex-basis: 100%; font-size: 0.6875rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; }
.dir b { padding: 3px 9px; border-radius: 7px; background: rgba(255, 255, 255, 0.07); font-size: 0.8125rem; font-weight: 600; }
.dir b i { font-style: normal; color: var(--accent); margin-left: 3px; }
.dir em { font-style: normal; font-size: 0.8125rem; color: var(--ink-2); }

/* ---------- Story: stage and steps ---------- */

.story { position: relative; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }

.stage {
  position: sticky;
  top: var(--bar-h);
  z-index: 5;
  height: clamp(340px, 54svh, 480px);
  border-radius: 0 0 24px 24px;
  background: var(--bg-2);
  overflow: hidden;
}
.stage__tag {
  position: absolute; z-index: 4; top: 12px; left: 16px; right: 16px;
  font-size: 0.75rem; color: var(--ink-3);
  display: flex; align-items: center; gap: 8px;
}

.view {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 44px 16px 14px;
  opacity: 0; visibility: hidden;
  transform: scale(0.95);
  transition: opacity 0.5s ease, transform 0.7s var(--ease-out), visibility 0s linear 0.5s;
}
.stage[data-view='pile'] .view--pile,
.stage[data-view='news'] .view--news,
.stage[data-view='phone'] .view--phone,
.stage[data-view='archive'] .view--archive,
.stage[data-view='pipe'] .view--pipe {
  opacity: 1; visibility: visible; transform: none;
  transition-delay: 0s;
}

/* pile */
.pile { position: relative; flex: 1 1 auto; width: 100%; max-width: 600px; min-height: 0; }
.pchip {
  position: absolute; left: var(--x); top: var(--y);
  width: max-content; max-width: calc(100% - var(--x));
  padding: 6px 10px;
  border-radius: 9px;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  font-size: 0.75rem; line-height: 1.3; color: var(--ink-2);
  transform: rotate(var(--r));
  transition: opacity 0.5s, filter 0.5s, transform 0.6s var(--ease-out), background 0.4s, border-color 0.4s, color 0.4s;
}
.stage[data-focus='matters'] .pchip:not([data-q='matters']),
.stage[data-focus='changed'] .pchip:not([data-q='changed']),
.stage[data-focus='seen'] .pchip:not([data-q='seen']) { opacity: 0.2; filter: blur(1.2px); }
.stage[data-focus='matters'] .pchip[data-q='matters'],
.stage[data-focus='changed'] .pchip[data-q='changed'],
.stage[data-focus='seen'] .pchip[data-q='seen'] {
  background: var(--accent-soft); border-color: var(--accent-line); color: var(--ink);
  transform: rotate(0deg) scale(1.06); z-index: 2;
}
.qbar { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding-top: 10px; }
.qbar button {
  padding: 7px 14px; border-radius: 999px;
  background: transparent; border: 1px solid var(--line-2);
  color: var(--ink-2); font-size: 0.8125rem; cursor: pointer;
  transition: background 0.25s, border-color 0.25s, color 0.25s;
}
.qbar button:hover { color: var(--ink); border-color: var(--ink-3); }
.qbar button[aria-pressed='true'] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--ink); }

/* phone + rail */
.view--phone { justify-content: flex-start; gap: 10px; }
.rail { position: relative; flex: none; width: 100%; max-width: 440px; height: 62px; }
.rail__week, .rail__event { position: absolute; inset: 0; transition: opacity 0.5s, transform 0.7s var(--ease-out); }
.rail[data-mode='event'] .rail__week { opacity: 0; transform: translateY(-8px) scaleX(0.92); pointer-events: none; }
.rail[data-mode='week'] .rail__event { opacity: 0; transform: translateY(8px) scaleX(1.06); pointer-events: none; }

.rail__week ol { display: grid; grid-template-columns: repeat(5, 1fr); height: 100%; }
.rail__week li { position: relative; display: grid; justify-items: center; align-content: start; gap: 5px; text-align: center; }
.rail__week li::before { content: ''; position: absolute; top: 24px; left: -50%; right: 50%; height: 2px; background: var(--line-2); transition: background 0.5s; }
.rail__week li:first-child::before { display: none; }
.rail__week .d { font-size: 0.75rem; font-weight: 600; color: var(--ink-3); transition: color 0.4s; }
.rail__week i { position: relative; z-index: 1; width: 12px; height: 12px; margin-top: 3px; border-radius: 50%; background: var(--bg-2); border: 2px solid var(--ink-3); transition: background 0.4s, border-color 0.4s, box-shadow 0.4s; }
.rail__week em { font-style: normal; font-size: 0.6875rem; line-height: 1.2; color: var(--ink-3); padding-inline: 2px; transition: color 0.4s; }
.rail__week li.is-key i { border-color: var(--warm); }
.rail__week li.is-done::before, .rail__week li.is-now::before { background: var(--accent); }
.rail__week li.is-done i { background: var(--accent); border-color: var(--accent); }
.rail__week li.is-now i { background: var(--accent); border-color: #fff; box-shadow: 0 0 0 5px var(--accent-soft); }
.rail__week li.is-now .d, .rail__week li.is-now em { color: var(--ink); }

.axis { position: relative; height: 2px; margin: 16px 8px 0; background: var(--line-2); border-radius: 2px; }
.axis__fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent); border-radius: 2px; transition: width 0.9s var(--ease-out); }
.rail[data-pos='pre'] .axis__fill { width: 6%; }
.rail[data-pos='read'] .axis__fill { width: 100%; }
.rail__event ol { display: grid; grid-template-columns: 1.1fr 1fr 1fr; margin-top: 8px; padding-inline: 8px; gap: 8px; }
.rail__event li { position: relative; font-size: 0.6875rem; line-height: 1.3; color: var(--ink-3); transition: color 0.4s; }
.rail__event li::before { content: ''; position: absolute; left: 0; top: -17px; width: 10px; height: 10px; border-radius: 50%; background: var(--bg-2); border: 2px solid var(--ink-3); transition: background 0.4s, border-color 0.4s; }
.rail__event li b { display: block; font-size: 0.75rem; color: var(--ink-2); }
.rail__event li.is-on::before { background: var(--accent); border-color: var(--accent); }
.rail__event li.is-on b { color: var(--ink); }
.rail__event li[data-node='read'].is-on::before { background: var(--warm); border-color: var(--warm); }

.phone {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
  width: 100%; max-width: 400px;
  background: var(--tg-bg);
  border: 1px solid var(--line-2);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}
.phone__head { flex: none; display: flex; align-items: center; gap: 10px; padding: 9px 14px; background: var(--tg-head); border-bottom: 1px solid var(--line); }
.phone__head b { display: block; font-size: 0.875rem; line-height: 1.2; }
.phone__head small { display: block; font-size: 0.6875rem; color: var(--ink-3); }
.avatar { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, #5cb8ff, #2b7fd0); color: var(--accent-ink); font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.03em; }
.chat {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 8px;
  padding: 12px 10px 10px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 34px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 34px);
}
.chat .msg { align-self: flex-start; width: 94%; flex: none; transition: opacity 0.5s, filter 0.5s; animation: msg-in 0.6s var(--ease-out) backwards; }
.chat .msg.is-hidden { display: none; }
.chat .msg.is-old { opacity: 0.45; }
@keyframes msg-in { from { opacity: 0; transform: translateY(16px) scale(0.97); } }

/* news */
.news { width: 100%; max-width: 620px; }
.news__cols { display: grid; grid-template-columns: 1.5fr 1fr 1.6fr; gap: 12px; padding: 0 12px 8px; font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3); }
.news__rows { display: grid; gap: 7px; }
.nrow {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1.6fr;
  grid-template-areas: 'src verdict chips' 'head verdict chips';
  column-gap: 12px; align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  opacity: 0; transform: translateX(-16px);
  transition: opacity 0.5s, transform 0.6s var(--ease-out), border-color 0.5s, background 0.5s;
}
.nrow__src { grid-area: src; font-size: 0.6875rem; color: var(--ink-3); }
.nrow__head { grid-area: head; font-size: 0.8125rem; font-weight: 500; line-height: 1.3; }
.nrow__verdict { grid-area: verdict; font-size: 0.75rem; color: var(--ink-3); line-height: 1.3; opacity: 0; transition: opacity 0.4s; }
.nrow__verdict b { display: block; font-size: 0.8125rem; color: var(--ink); }
.nrow__chips { grid-area: chips; display: flex; flex-wrap: wrap; gap: 4px; opacity: 0; transition: opacity 0.4s; }
.nrow__chips li { padding: 1px 7px; border-radius: 6px; background: rgba(255, 255, 255, 0.07); font-size: 0.6875rem; font-weight: 500; }
.nrow.is-keep .nrow__verdict b { color: var(--accent); }
.nrow.is-drop .nrow__chips li { color: var(--ink-3); background: transparent; border: 1px dashed var(--line-2); }
.stage[data-view='news'] .nrow { opacity: 1; transform: none; transition-delay: calc(var(--i) * 170ms + 250ms); }
.stage[data-view='news'] .nrow__verdict { opacity: 1; transition-delay: calc(var(--i) * 170ms + 700ms); }
.stage[data-view='news'] .nrow__chips { opacity: 1; transition-delay: calc(var(--i) * 170ms + 1100ms); }
.stage[data-view='news'] .nrow.is-drop { opacity: 0.55; }
.stage[data-view='news'] .nrow.is-lead { border-color: var(--accent-line); background: var(--accent-soft); }
.news__foot { margin-top: 10px; padding-inline: 4px; font-size: 0.75rem; color: var(--ink-3); }

/* archive */
.view--archive { gap: 10px; }
.archive__label { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-3); }
.records { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 620px; }
.record {
  padding: 11px 13px 9px;
  border: 1px solid var(--line-2); border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
  opacity: 0; transform: translateY(16px);
  transition: opacity 0.5s, transform 0.7s var(--ease-out);
}
.stage[data-view='archive'] .record { opacity: 1; transform: none; transition-delay: calc(var(--i) * 130ms + 200ms); }
.record__src { font-size: 0.6875rem; color: var(--ink-3); padding-bottom: 7px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.record dl > div { display: flex; justify-content: space-between; gap: 10px; padding-block: 3px; font-size: 0.75rem; }
.record dt { color: var(--ink-3); }
.record dd { text-align: right; font-weight: 500; }
.record dd.ok { color: var(--accent); }
.record dd.flag { color: var(--warm); }
.record dd.muted { color: var(--ink-3); }
.archive__note { max-width: 560px; text-align: center; font-size: 0.75rem; color: var(--ink-3); }

/* pipeline */
.pipe { position: relative; display: grid; gap: 10px; width: 100%; max-width: 580px; }
.pnode {
  position: relative;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line-2); border-radius: 14px;
  background: var(--panel);
  opacity: 0; transform: translateY(14px);
  transition: opacity 0.5s, transform 0.7s var(--ease-out);
}
.stage[data-view='pipe'] .pnode { opacity: 1; transform: none; transition-delay: calc(var(--i) * 140ms + 200ms); }
.pnode + .pnode::before {
  content: ''; position: absolute; left: 25px; top: -11px; width: 2px; height: 11px;
  background: linear-gradient(var(--line-2), var(--accent));
}
.pnode__n { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--accent); font-size: 0.75rem; font-weight: 600; }
.pnode__body b { display: block; font-size: 0.9375rem; line-height: 1.25; }
.pnode__body p { font-size: 0.75rem; color: var(--ink-3); line-height: 1.35; }
.tech { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.tech li { padding: 2px 9px; border-radius: 7px; background: rgba(255, 255, 255, 0.07); font-size: 0.6875rem; font-weight: 600; white-space: nowrap; }
.pnode--end { border-color: var(--accent-line); background: var(--accent-soft); }
.pipe__foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding-top: 10px; }
.pipe__foot span { padding: 3px 11px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 0.75rem; color: var(--ink-2); }

/* steps */
.steps { position: relative; z-index: 1; }
.step {
  min-height: 70svh;
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  gap: 16px;
  padding-block: 7svh;
  scroll-margin-top: calc(var(--bar-h) + 60svh);
}
.step h2 {
  font-family: var(--serif);
  font-weight: 650;
  font-size: clamp(2rem, 4.4vw, 3.6rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  font-variation-settings: 'opsz' 72;
  text-wrap: balance;
}
.step p { max-width: 34rem; color: var(--ink-2); font-size: 1.0625rem; }
.step .caution { padding: 14px 16px; border: 1px solid rgba(255, 180, 84, 0.35); background: var(--warm-soft); border-radius: 12px; color: var(--ink); font-size: 0.9375rem; }
.step--quote h2.quote { font-size: clamp(2.2rem, 5vw, 4.2rem); }

.questions { display: grid; gap: 10px; counter-reset: q; max-width: 34rem; }
.questions li { counter-increment: q; position: relative; padding: 4px 0 4px 44px; color: var(--ink-2); }
.questions li::before { content: counter(q); position: absolute; left: 0; top: 0; font-family: var(--serif); font-size: 1.9rem; font-weight: 650; line-height: 1; color: var(--accent); }
.questions b { color: var(--ink); }

.why { display: grid; max-width: 34rem; }
.why li { padding: 10px 0; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 0.9375rem; }
.why b { color: var(--ink); font-weight: 600; }

/* calculator */
.step--calc { min-height: 90svh; }
.calc { width: 100%; max-width: 34rem; display: grid; gap: 14px; padding: 18px; border: 1px solid var(--line-2); border-radius: 16px; background: var(--panel); }
.seg { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.seg legend { font-size: 0.75rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.1em; padding: 0; margin-bottom: 8px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span { display: block; padding: 8px 14px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 0.875rem; color: var(--ink-2); transition: background 0.2s, border-color 0.2s, color 0.2s; }
.seg label:hover span { color: var(--ink); }
.seg input:checked + span { background: var(--accent-soft); border-color: var(--accent-line); color: var(--ink); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }
.slider label { display: flex; justify-content: space-between; font-size: 0.875rem; color: var(--ink-2); }
.slider output { font-weight: 600; color: var(--ink); }
.slider input { width: 100%; margin: 10px 0 2px; accent-color: var(--accent); height: 28px; cursor: pointer; }
.slider__scale { display: flex; justify-content: space-between; font-size: 0.6875rem; color: var(--ink-3); }
.slider__scale span:nth-child(2) { color: var(--ink-2); }
.calc__line { max-width: none; font-size: 1.0625rem; font-weight: 600; color: var(--ink); }
.calc__line em { font-style: normal; color: var(--warm); }
.calc__rule { max-width: none; font-size: 0.875rem; color: var(--ink-3); }

/* ---------- Closing ---------- */

.close {
  max-width: var(--maxw);
  margin-inline: auto;
  padding: 16svh var(--gutter) 12svh;
  display: grid; gap: 28px; justify-items: start;
  border-top: 1px solid var(--line);
}
.close__title {
  font-family: var(--serif);
  font-weight: 650;
  font-size: clamp(2.4rem, 6.4vw, 6rem);
  line-height: 1;
  letter-spacing: -0.025em;
  font-variation-settings: 'opsz' 72;
  max-width: 18ch;
  text-wrap: balance;
  color: var(--ink-3);
}
.close__title span { color: var(--ink); }
.close__lede { max-width: 38rem; font-size: 1.1875rem; color: var(--ink-2); }
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); width: 100%; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.skills li { padding: 20px; border-left: 1px solid var(--line); border-top: 1px solid var(--line); margin: -1px 0 0 -1px; }
.skills b { display: block; margin-bottom: 4px; font-size: 1rem; }
.skills span { font-size: 0.875rem; color: var(--ink-2); }
.close__go { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 24px; }
.contact { color: var(--ink-3); font-size: 0.9375rem; }
.contact a { color: var(--accent); }
.notes { display: grid; gap: 6px; max-width: 40rem; }
.more { border-top: 1px solid var(--line); padding-block: 12px; }
.more summary { cursor: pointer; font-weight: 500; color: var(--ink-2); }
.more summary:hover { color: var(--ink); }
.more p { margin-top: 8px; color: var(--ink-3); font-size: 0.9375rem; }

.foot { max-width: var(--maxw); margin-inline: auto; padding: 28px var(--gutter) 48px; border-top: 1px solid var(--line); display: grid; gap: 6px; font-size: 0.8125rem; color: var(--ink-3); }
.foot code { font-size: 0.8125rem; color: var(--ink-2); }
.noscript { padding: 16px var(--gutter); background: var(--warm-soft); color: var(--ink); }

/* ---------- Wide screens: stage on the right, steps on the left ---------- */

@media (min-width: 960px) {
  .story { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); column-gap: clamp(28px, 4vw, 72px); }
  .stage {
    grid-column: 2; grid-row: 1;
    align-self: start;
    top: calc(var(--bar-h) + 16px);
    height: min(calc(100svh - var(--bar-h) - 32px), 740px);
    border-radius: 28px;
  }
  .steps { grid-column: 1; grid-row: 1; }
  .step { min-height: 92svh; scroll-margin-top: 0; }
  .step--calc { min-height: 110svh; }
  .view { padding: 48px 28px 22px; }
  .rail { height: 72px; }
  .stage__tag { top: 16px; left: 22px; }
}

/* ---------- Narrow screens ---------- */

@media (max-width: 959px) {
  .hero { grid-template-columns: 1fr; min-height: auto; padding-top: calc(var(--bar-h) + 28px); }
  .hero__visual { max-width: 460px; }
  .story { padding-inline: 0; }
  .stage { border-inline: 0; border-radius: 0 0 22px 22px; }
  .steps { padding-inline: var(--gutter); }
  .stage__tag { font-size: 0.6875rem; }
}

@media (max-width: 720px) {
  .bar { gap: 14px; }
  .bar__nav { display: none; }
  .bar__brand em { display: none; }
  .motion-toggle { margin-left: auto; }
  .lede { font-size: 1.0625rem; }
  .step { min-height: 62svh; padding-block: 5svh; }
  .step--calc { min-height: 82svh; }
  .step h2 { font-size: clamp(1.8rem, 8vw, 2.4rem); }
  .step p { font-size: 1rem; }
  .view { padding: 38px 10px 8px; }
  .rail { height: 50px; }
  .rail__week em, .rail__event li span { display: none; }
  .rail__week li::before { top: 20px; }
  .rail__week i { margin-top: 0; }
  .axis { margin-top: 12px; }
  .rail__event li::before { top: -13px; }
  .phone__head { padding: 6px 12px; }
  .avatar { width: 26px; height: 26px; }
  .chat .msg { padding: 9px 11px 8px; }
  .digest > div { padding-top: 6px; padding-bottom: 5px; }
  .figs { margin-top: 6px; padding-top: 6px; }
  .flow { grid-template-columns: 0.95fr 0.85fr 1fr 1.2fr; }
  .flow li { padding: 7px 7px 8px; }
  .flow span { font-size: 0.6875rem; letter-spacing: 0; text-transform: none; }
  .flow b { font-size: 0.9375rem; }
  .flow .is-read b { font-size: 0.75rem; }
  .chat .msg--wide .read { display: none; }
  .chat .msg--wide .msg__foot { margin-top: 6px; }
  .dir { margin-top: 6px; }
  .hl { font-size: clamp(2.2rem, 9.4vw, 2.7rem); }
  .pile { display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 8px 7px; }
  .pchip { position: static; max-width: 100%; font-size: 0.6875rem; padding: 4px 8px; }
  .pchip:nth-child(8), .pchip:nth-child(9), .pchip:nth-child(12), .pchip:nth-child(14) { display: none; }
  .qbar { padding-top: 6px; }
  .qbar button { padding: 6px 11px; font-size: 0.75rem; }
  .news__cols { display: none; }
  .news__rows { gap: 5px; }
  .nrow { grid-template-columns: 1fr 1fr; grid-template-areas: 'src verdict' 'head head' 'chips chips'; padding: 6px 10px; row-gap: 1px; }
  .nrow__verdict { text-align: right; }
  .nrow__verdict b { display: inline; margin-right: 4px; }
  .news__foot { display: none; }
  .nrow.is-drop .nrow__chips { display: none; }
  .nrow__head { font-size: 0.75rem; }
  .records { gap: 6px; }
  .record { padding: 7px 9px 5px; }
  .record__src { font-size: 0.6875rem; font-weight: 600; color: var(--ink-2); padding-bottom: 3px; margin-bottom: 2px; }
  .record .long { display: none; }
  .record dl > div { display: block; padding-block: 1px; font-size: 0.6875rem; line-height: 1.25; }
  .record dt { font-size: 0.625rem; }
  .record dd { text-align: left; }
  .archive__note { display: none; }
  .pipe { gap: 6px; }
  .pnode { padding: 6px 10px; gap: 9px; }
  .pnode__body p { display: none; }
  .pnode__body b { font-size: 0.875rem; }
  .pnode + .pnode::before { top: -7px; height: 7px; left: 22px; }
  .pipe__foot { padding-top: 4px; }
  .pipe__foot span { padding: 1px 9px; font-size: 0.6875rem; }
  .close { padding-top: 12svh; }
}

/* ---------- Motion off ---------- */

.motion-off *,
.motion-off *::before,
.motion-off *::after {
  animation: none !important;
  transition-duration: 0.01ms !important;
  transition-delay: 0s !important;
}
.motion-off .hchip span { animation: none !important; }

/* No script: plain reading order */
html:not(.js) .stage,
html:not(.js) .hero__visual { display: none; }
html:not(.js) .story { display: block; }
html:not(.js) .hero { grid-template-columns: 1fr; min-height: auto; }
