/* ============================================================
   72 Cloud Tech — showcase layer (index only)
   3D tilt, pinned rails, odometers, cursor work.
   Loads after styles.css and never changes the palette.
   ============================================================ */

/* ---------- Scroll progress ---------- */

.progress {
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: transparent;
  overflow: hidden;
}
.progress i {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--flare);
  transform: scaleX(0);
  transform-origin: left;
}

/* ---------- Custom cursor ---------- */

.cursor, .cursor-dot {
  position: fixed;
  top: 0; left: 0;
  z-index: 200;
  pointer-events: none;
  border-radius: 50%;
  mix-blend-mode: difference;
  will-change: transform;
}
.cursor {
  width: 30px; height: 30px;
  margin: -15px 0 0 -15px;
  border: 1px solid #fff;
  transition: width .22s ease, height .22s ease, margin .22s ease, opacity .22s ease, background .22s ease;
}
.cursor-dot {
  width: 5px; height: 5px;
  margin: -2.5px 0 0 -2.5px;
  background: #fff;
}
.cursor.is-link { width: 58px; height: 58px; margin: -29px 0 0 -29px; background: rgba(255, 255, 255, 0.14); }
.cursor.is-drag { width: 74px; height: 74px; margin: -37px 0 0 -37px; }
.cursor.is-hidden { opacity: 0; }

.cursor-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #fff;
  opacity: 0;
  transition: opacity .2s ease;
}
.cursor.is-drag .cursor-label { opacity: 1; }

html.cursor-on, html.cursor-on * { cursor: none !important; }
/* Real controls keep their real cursor — the ring hides over them instead. */
html.cursor-on input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="submit"]),
html.cursor-on textarea { cursor: text !important; }
html.cursor-on input[type="range"] { cursor: ew-resize !important; }
@media (hover: none), (pointer: coarse) {
  .cursor, .cursor-dot { display: none; }
}

/* ---------- Split type reveal ---------- */

.sp-word { display: inline-block; vertical-align: top; }
.sp-ch {
  display: inline-block;
  transform: translateY(1.05em) rotate(4deg);
  opacity: 0;
  transition: transform .9s cubic-bezier(.16, 1, .3, 1), opacity .9s cubic-bezier(.16, 1, .3, 1);
}
.sp-ready .sp-ch { transform: none; opacity: 1; }

/* ---------- Hero ---------- */

.hero { position: relative; isolation: isolate; overflow: hidden; }
.hero > .wrap { position: relative; z-index: 2; }

.hero-dots {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  opacity: 0.9;
}

.hero-glow {
  position: absolute;
  z-index: 1;
  width: 46vw; height: 46vw;
  max-width: 620px; max-height: 620px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--flare) 16%, transparent), transparent 62%);
  filter: blur(10px);
  pointer-events: none;
  transform: translate3d(-50%, -50%, 0);
  opacity: 0;
  transition: opacity .6s ease;
}
.hero-glow.on { opacity: 1; }

/* ---------- 3D tilt primitives ---------- */

[data-tilt] {
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform .5s cubic-bezier(.16, 1, .3, 1);
}
[data-tilt].is-live { transition: none; }

.glare {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  transition: opacity .35s ease;
  background: radial-gradient(
    520px circle at var(--gx, 50%) var(--gy, 50%),
    var(--glare, rgba(255, 255, 255, 0.5)),
    transparent 58%
  );
}
[data-tilt]:hover > .glare, .is-live > .glare { opacity: 1; }

/* ---------- Hero deck (3D browser mockup) ---------- */

.deck { margin-top: clamp(44px, 6vw, 84px); }

/* ------------------------------------------------------------
   The deck builds itself.

   The first three seconds are the argument: the frame lands, the
   chrome fills, the content rules wipe in, the numbers run, then
   the chips arrive. It's the page demonstrating the claim in the
   headline rather than describing it.

   Driven by .is-built on .deck, added on load. Without JS — or
   with reduced motion — the whole thing is simply already there.
   ------------------------------------------------------------ */

@media (prefers-reduced-motion: no-preference) {
  .deck.is-armed .win {
    opacity: 0;
    transform: translateZ(0) translateY(26px) scale(.985);
  }
  .deck.is-armed .win-bar > *,
  .deck.is-armed .win-k,
  .deck.is-armed .win-h,
  .deck.is-armed .win-p { opacity: 0; }
  .deck.is-armed .win-line { transform: scaleX(0); }
  /* Opacity only — these carry translateZ for their depth in the stage. */
  .deck.is-armed .float { opacity: 0; }

  .deck.is-built .win {
    opacity: 1;
    transform: translateZ(0);
    transition: opacity .5s ease, transform .8s cubic-bezier(.16, 1, .3, 1);
  }

  .deck.is-built .win-bar > * {
    opacity: 1;
    transition: opacity .4s ease var(--d, 0ms);
  }
  .deck.is-built .win-bar > *:nth-child(1) { --d: 380ms; }
  .deck.is-built .win-bar > *:nth-child(2) { --d: 430ms; }
  .deck.is-built .win-bar > *:nth-child(3) { --d: 480ms; }
  .deck.is-built .win-bar > *:nth-child(4) { --d: 560ms; }
  .deck.is-built .win-bar > *:nth-child(5) { --d: 700ms; }

  .deck.is-built .win-k { opacity: 1; transition: opacity .45s ease 620ms; }
  .deck.is-built .win-h { opacity: 1; transition: opacity .5s ease 720ms; }
  .deck.is-built .win-p { opacity: 1; transition: opacity .5s ease 800ms; }

  /* Content rules wipe out from the left, one cell after another. */
  .deck.is-built .win-line {
    transform: scaleX(1);
    transform-origin: left;
    transition: transform .55s cubic-bezier(.16, 1, .3, 1) var(--d, 900ms);
  }
  .deck.is-built .win-cell:nth-child(1) .win-line:nth-of-type(1) { --d: 900ms; }
  .deck.is-built .win-cell:nth-child(1) .win-line:nth-of-type(2) { --d: 960ms; }
  .deck.is-built .win-cell:nth-child(1) .win-line:nth-of-type(3) { --d: 1020ms; }
  .deck.is-built .win-cell:nth-child(2) .win-line:nth-of-type(1) { --d: 980ms; }
  .deck.is-built .win-cell:nth-child(2) .win-line:nth-of-type(2) { --d: 1040ms; }
  .deck.is-built .win-cell:nth-child(2) .win-line:nth-of-type(3) { --d: 1100ms; }
  .deck.is-built .win-cell:nth-child(3) .win-line:nth-of-type(1) { --d: 1060ms; }
  .deck.is-built .win-cell:nth-child(3) .win-line:nth-of-type(2) { --d: 1120ms; }
  .deck.is-built .win-cell:nth-child(3) .win-line:nth-of-type(3) { --d: 1180ms; }

  /* The chips are the last thing to land. */
  .deck.is-built .float {
    opacity: 1;
    transition: opacity .55s ease var(--d, 1200ms);
  }
  .deck.is-built .float--a { --d: 1240ms; }
  .deck.is-built .float--b { --d: 1360ms; }
  .deck.is-built .float--c { --d: 1480ms; }

  /* Bars and gauge hold until the frame has actually landed. */
  .deck.is-armed .bars i { animation-play-state: paused; }
  .deck.is-built .bars i { animation-play-state: running; }
}

.deck-stage {
  position: relative;
  transform: perspective(1400px);
}

.win {
  position: relative;
  z-index: 2;
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: 0 50px 90px -46px color-mix(in srgb, var(--shade) 50%, transparent);
  overflow: hidden;
  transform: translateZ(0);
}

.win-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--ink);
  color: color-mix(in srgb, var(--paper) 55%, transparent);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.win-bar i { width: 8px; height: 8px; border-radius: 50%; background: color-mix(in srgb, var(--paper) 28%, transparent); }
.win-bar i:first-child { background: var(--flare); }
.win-url {
  flex: 1;
  margin-left: 10px;
  text-transform: none;
  letter-spacing: 0.06em;
  color: color-mix(in srgb, var(--paper) 70%, transparent);
}
.win-live { display: flex; align-items: center; gap: 8px; color: var(--paper); }
.win-live::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--flare);
  animation: pulse 2.4s infinite;
}

.win-body {
  display: grid;
  gap: 1px;
  background: var(--line);
  padding: 0;
}

.win-row {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1px;
  background: var(--line);
}

.win-cell {
  background: var(--paper);
  padding: clamp(14px, 1.8vw, 26px);
  min-width: 0;
}
.win-cell--ink { background: var(--ink); color: var(--paper); }
.win-cell--tint { background: var(--paper-2); }

.win-k {
  display: block;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--flare);
  margin-bottom: 12px;
}
.win-h {
  font-size: clamp(1.1rem, 2.2vw, 1.9rem);
  line-height: 1;
  letter-spacing: -0.04em;
  font-weight: 700;
}
.win-h em { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--flare); }
.win-p { font-size: 0.82rem; color: var(--ink-soft); margin-top: 10px; line-height: 1.45; }
.win-cell--ink .win-p { color: color-mix(in srgb, var(--paper) 62%, transparent); }

.bars { display: flex; align-items: flex-end; gap: 5px; height: 62px; margin-top: 14px; }
.bars i {
  flex: 1;
  background: var(--ink);
  height: var(--h, 40%);
  transform-origin: bottom;
  animation: barGrow 1.1s cubic-bezier(.16, 1, .3, 1) backwards;
  animation-delay: calc(var(--n, 0) * 70ms);
}
.bars i:nth-child(even) { background: var(--flare); }
.win-cell--ink .bars i { background: color-mix(in srgb, var(--paper) 35%, transparent); }
.win-cell--ink .bars i:nth-child(even) { background: var(--flare); }
@keyframes barGrow { from { transform: scaleY(0); } }

.win-line { display: block; height: 6px; background: var(--line); margin-bottom: 7px; }
.win-line--s { width: 58%; }
.win-line--m { width: 82%; }
.win-cell--ink .win-line { background: color-mix(in srgb, var(--paper) 20%, transparent); }

.gauge { display: grid; place-items: center; gap: 10px; }
.gauge svg { width: 76px; height: 76px; display: block; }
.gauge .track { fill: none; stroke: color-mix(in srgb, var(--paper) 20%, transparent); stroke-width: 6; }
.gauge .val {
  fill: none;
  stroke: var(--flare);
  stroke-width: 6;
  stroke-linecap: butt;
  stroke-dasharray: 201;
  stroke-dashoffset: 201;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dashoffset 1.6s cubic-bezier(.16, 1, .3, 1);
}
.gauge.on .val { stroke-dashoffset: 4; }
.gauge b {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--paper) 55%, transparent);
}

/* Floating chips at different depths */
.float {
  position: absolute;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--paper);
  border: 1px solid var(--ink);
  padding: 11px 14px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  box-shadow: 0 26px 44px -26px color-mix(in srgb, var(--shade) 60%, transparent);
  white-space: nowrap;
}
.float b { font-weight: 400; color: var(--flare); }
.float--a { top: -20px; left: 4%; transform: translateZ(90px); }
.float--b { bottom: -22px; right: 6%; transform: translateZ(120px); background: var(--ink); color: var(--paper); border-color: var(--ink); }
.float--c { top: 34%; right: -14px; transform: translateZ(70px); }
@media (max-width: 760px) { .float { display: none; } }

/* ---------- Ribbons (crossing marquees) ---------- */

.ribbons {
  position: relative;
  padding: clamp(30px, 5vw, 54px) 0;
  overflow: hidden;
}
.ribbons .marquee {
  width: 108vw;
  margin-left: -4vw;
  border-block: 1px solid var(--ink);
}
.marquee--fx .marquee-track { animation: none; will-change: transform; }
.ribbon--a { transform: rotate(-1.6deg); position: relative; z-index: 2; }
.ribbon--b {
  transform: rotate(1.4deg);
  margin-top: -14px;
  background: var(--paper);
  color: var(--ink);
  position: relative;
  z-index: 1;
}
.ribbon--b .marquee-track span i { color: var(--flare); }

/* ---------- Services list: cursor-follow preview ---------- */

.index-fx { position: relative; }

.preview {
  position: fixed;
  z-index: 90;
  top: 0; left: 0;
  width: 300px;
  margin: -108px 0 0 -150px;
  pointer-events: none;
  opacity: 0;
  transform: scale(.9);
  transition: opacity .28s ease; /* transform is driven per-frame, never transitioned */
  will-change: transform;
}
.preview.on { opacity: 1; }

.preview-inner {
  background: var(--ink);
  border: 1px solid var(--ink);
  box-shadow: 0 40px 70px -34px color-mix(in srgb, var(--shade) 70%, transparent);
  overflow: hidden;
}
.preview-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--paper) 18%, transparent);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--paper) 50%, transparent);
}
.preview-top b { color: var(--flare); font-weight: 400; }

.art {
  position: relative;
  height: 168px;
  display: grid;
  gap: 5px;
  padding: 14px;
  background: var(--ink);
}
.art i { display: block; background: color-mix(in srgb, var(--paper) 22%, transparent); }
.art i.hot { background: var(--flare); }

/* six compositions, one per service row */
.art--1 { grid-template-columns: repeat(6, 1fr); grid-auto-rows: 1fr; }
.art--1 i:nth-child(1) { grid-column: span 4; grid-row: span 2; }
.art--1 i:nth-child(2) { grid-column: span 2; grid-row: span 3; }
.art--1 i:nth-child(3) { grid-column: span 2; }
.art--1 i:nth-child(4) { grid-column: span 2; }
.art--1 i:nth-child(5) { grid-column: span 4; }

.art--2 { grid-template-columns: 1fr; align-content: center; gap: 8px; }
.art--2 i { height: 8px; }
.art--2 i:nth-child(1) { width: 92%; }
.art--2 i:nth-child(2) { width: 64%; }
.art--2 i:nth-child(3) { width: 78%; }
.art--2 i:nth-child(4) { width: 40%; }
.art--2 i:nth-child(5) { width: 86%; }
.art--2 i:nth-child(6) { width: 55%; }

.art--3 { grid-template-columns: 34px 1fr 22px; align-items: stretch; }
.art--3 i:nth-child(1) { grid-row: span 3; }
.art--3 i:nth-child(3) { grid-row: span 3; }

.art--4 { grid-template-columns: repeat(9, 1fr); align-items: end; }
.art--4 i { height: var(--h, 40%); align-self: end; }

.art--5 { grid-template-columns: repeat(4, 1fr); }
.art--5 i { border-radius: 0; }

.art--6 { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; }
.art--6 i:nth-child(5) { grid-column: span 2; }

.preview-foot {
  padding: 12px;
  border-top: 1px solid color-mix(in srgb, var(--paper) 18%, transparent);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--paper) 62%, transparent);
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
@media (max-width: 900px) { .preview { display: none; } }

/* ---------- Work cards (tilt + depth) ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: clamp(18px, 2.4vw, 30px);
}

.card {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--ink);
  padding: clamp(24px, 2.8vw, 36px);
  min-height: 340px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  --glare: color-mix(in srgb, var(--flare) 18%, transparent);
  transform: perspective(900px);
}
/* No overflow:hidden here — it would flatten preserve-3d. The art clips itself. */
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ink);
  opacity: 0;
  transition: opacity .3s ease;
  z-index: 0;
}
.card > * { position: relative; z-index: 2; }
.card > .glare, .card > .card-clip { position: absolute; inset: 0; }
.card > .glare { z-index: 6; }
.card-clip { overflow: hidden; z-index: 1; pointer-events: none; }

.card-k {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--flare);
  transform: translateZ(30px);
}
.card h3 {
  font-size: clamp(1.4rem, 2.4vw, 1.85rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 700;
  transform: translateZ(52px);
}
.card p {
  color: var(--ink-soft);
  font-size: 0.94rem;
  line-height: 1.5;
  transform: translateZ(26px);
}
.card-tags {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  transform: translateZ(38px);
}
.card-tags span {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  padding: 5px 8px;
  color: var(--ink-soft);
}

.card-art {
  position: absolute;
  right: -30px; bottom: -30px;
  width: 190px; height: 190px;
  z-index: 1;
  opacity: 0.16;
  transform: translateZ(14px);
  transition: opacity .3s ease;
}
.card-art i {
  position: absolute;
  inset: 0;
  border: 1px solid var(--ink);
}
.card-art i:nth-child(1) { transform: rotate(0deg) scale(1); }
.card-art i:nth-child(2) { transform: rotate(12deg) scale(.82); }
.card-art i:nth-child(3) { transform: rotate(24deg) scale(.64); }
.card-art i:nth-child(4) { transform: rotate(36deg) scale(.46); border-color: var(--flare); }

.card:hover { border-color: var(--ink); }
.card:hover::after { opacity: 1; }
.card:hover h3, .card:hover .card-k { color: var(--paper); }
.card:hover .card-k { color: var(--flare); }
.card:hover p { color: color-mix(in srgb, var(--paper) 70%, transparent); }
.card:hover .card-tags span { border-color: color-mix(in srgb, var(--paper) 30%, transparent); color: color-mix(in srgb, var(--paper) 70%, transparent); }
.card:hover .card-art { opacity: 0.4; }
.card:hover .card-art i { border-color: color-mix(in srgb, var(--paper) 50%, transparent); }
.card:hover .card-art i:nth-child(4) { border-color: var(--flare); }

/* ---------- Pinned horizontal rail ---------- */

.rail {
  position: relative;
  height: 460vh;
  background: var(--ink);
  color: var(--paper);
}
.rail-inner {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(20px, 3vw, 36px);
  overflow: hidden;
}

.rail-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.rail-head h2 {
  font-size: clamp(1.8rem, 4vw, 3.1rem);
  line-height: 1;
  letter-spacing: -0.04em;
  font-weight: 700;
  max-width: 16ch;
}
.rail-head em { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--flare); }
.rail-head .eyebrow { color: color-mix(in srgb, var(--paper) 50%, transparent); }
.rail-hint {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--paper) 45%, transparent);
  display: flex;
  align-items: center;
  gap: 10px;
}
.rail-hint i {
  width: 26px; height: 1px;
  background: var(--flare);
  animation: nudge 1.8s ease-in-out infinite;
}
@keyframes nudge { 50% { transform: translateX(8px); } }

.rail-track {
  display: flex;
  gap: 1px;
  padding-inline: var(--gut);
  width: max-content;
  will-change: transform;
}

.rail-panel {
  position: relative;
  width: clamp(258px, 30vw, 400px);
  min-height: min(56vh, 460px);
  background: var(--ink-2);
  border: 1px solid color-mix(in srgb, var(--paper) 18%, transparent);
  padding: clamp(20px, 2.4vw, 32px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transform-style: preserve-3d;
  transition: background .3s ease, border-color .3s ease;
}
.rail-panel:hover { background: var(--ink-3); border-color: color-mix(in srgb, var(--paper) 34%, transparent); }
.rail-panel .n {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--flare);
}
.rail-panel h3 {
  font-size: clamp(1.25rem, 2vw, 1.6rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 600;
}
.rail-panel p { font-size: 0.9rem; line-height: 1.5; color: color-mix(in srgb, var(--paper) 62%, transparent); }
.rail-panel ul { list-style: none; margin-top: auto; display: grid; gap: 7px; }
.rail-panel li {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 8px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--paper) 72%, transparent);
}
.rail-panel li::before { content: "✳"; color: var(--flare); }

.rail-bar {
  margin-inline: var(--gut);
  height: 1px;
  background: color-mix(in srgb, var(--paper) 20%, transparent);
  position: relative;
}
.rail-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  background: var(--flare);
  transform: scaleX(0);
  transform-origin: left;
}

@media (max-width: 800px) {
  .rail { height: auto; padding: clamp(64px, 9vw, 100px) 0; }
  .rail-inner { position: static; height: auto; }
  .rail-track {
    width: auto;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    transform: none !important;
    padding-bottom: 8px;
  }
  .rail-panel { scroll-snap-align: center; flex: 0 0 78vw; transform: none !important; }
  .rail-hint i { display: none; }
}

/* ---------- Compare slider ---------- */

.compare {
  position: relative;
  border: 1px solid var(--ink);
  overflow: hidden;
  user-select: none;
  touch-action: pan-y;
  --x: 50%;
}
.cmp-pane { min-height: clamp(348px, 44vw, 480px); }
.cmp-pane--b {
  position: absolute;
  inset: 0;
  clip-path: inset(0 0 0 var(--x));
  background: var(--paper);
}

/* left: the template look */
.tpl {
  height: 100%;
  background: #ffffff;
  padding: clamp(18px, 2.6vw, 34px);
  display: grid;
  gap: 14px;
  align-content: start;
  font-family: Verdana, Geneva, sans-serif;
}
.tpl-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11px;
  color: #8b8b96;
  border-bottom: 1px solid #e6e6ee;
  padding-bottom: 12px;
}
.tpl-nav b {
  font-size: 13px;
  color: #6b46d6;
  background: linear-gradient(135deg, #7a5af8, #d16ba5);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
}
.tpl-hero {
  border-radius: 16px;
  background: linear-gradient(135deg, #7a5af8, #d16ba5);
  color: #fff;
  padding: clamp(16px, 2.4vw, 30px);
  text-align: center;
  filter: saturate(1.1);
}
.tpl-hero h4 { font-size: clamp(1rem, 2vw, 1.5rem); font-weight: 700; margin-bottom: 8px; }
.tpl-hero p { font-size: 0.78rem; opacity: 0.86; }
.tpl-hero span {
  display: inline-block;
  margin-top: 12px;
  background: #fff;
  color: #6b46d6;
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 0.72rem;
  font-weight: 700;
}
.tpl-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tpl-card {
  border: 1px solid #e6e6ee;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 6px 14px rgba(90, 80, 160, 0.09);
  display: grid;
  gap: 7px;
}
.tpl-card em { display: block; width: 26px; height: 26px; border-radius: 50%; background: #ece9ff; }
.tpl-card i { display: block; height: 6px; border-radius: 3px; background: #ecebf3; }
.tpl-card i:nth-child(3) { width: 70%; }
.tpl-foot { font-size: 9.5px; color: #a4a4b4; display: flex; justify-content: space-between; gap: 10px; }

/* right: the hand-built look */
.hand {
  height: 100%;
  background: var(--paper);
  padding: clamp(18px, 2.6vw, 34px);
  display: grid;
  gap: 14px;
  align-content: start;
}
.hand-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.hand-nav b { font-size: 11px; color: var(--ink); letter-spacing: -0.02em; text-transform: none; }
.hand-hero { display: grid; gap: 12px; }
.hand-hero h4 {
  font-size: clamp(1.2rem, 3vw, 2.4rem);
  line-height: 0.94;
  letter-spacing: -0.045em;
  font-weight: 700;
}
.hand-hero h4 em { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--flare); }
.hand-hero p { font-size: 0.84rem; color: var(--ink-soft); max-width: 34ch; }
.hand-rows { display: grid; gap: 1px; background: var(--line); border-block: 1px solid var(--line); }
.hand-row {
  background: var(--paper);
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 12px;
  align-items: baseline;
  padding: 10px 2px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.hand-row b { color: var(--ink); font-weight: 400; }
.hand-row u { text-decoration: none; color: var(--flare); }
.hand-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.cmp-tag {
  position: absolute;
  top: 14px;
  z-index: 4;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 7px 10px;
  background: var(--ink);
  color: var(--paper);
}
.cmp-tag--l { left: 14px; }
.cmp-tag--r { right: 14px; background: var(--flare); color: var(--on-flare); }

.cmp-handle {
  position: absolute;
  top: 0; bottom: 0;
  left: var(--x);
  width: 1px;
  background: var(--flare);
  z-index: 5;
  cursor: ew-resize;
}
.cmp-handle::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: -22px;
  width: 44px;
}
.cmp-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 52px; height: 52px;
  border: 1px solid var(--flare);
  background: var(--flare);
  color: var(--on-flare);
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  box-shadow: 0 14px 30px -14px color-mix(in srgb, var(--shade) 70%, transparent);
}
.cmp-handle:focus-visible { outline: none; }
.cmp-handle:focus-visible .cmp-knob { box-shadow: 0 0 0 4px color-mix(in srgb, var(--flare) 28%, transparent); }

/* ---------- Odometer stats ---------- */

.odo { display: flex; align-items: baseline; }
.odo .reel {
  position: relative;
  height: 1em;
  overflow: hidden;
  display: inline-block;
  perspective: 320px;
}
.odo .reel ul {
  list-style: none;
  display: block;
  transform: translateY(0);
  transition: transform 1.5s cubic-bezier(.16, 1, .3, 1);
  transition-delay: var(--d, 0ms);
}
.odo .reel li { height: 1em; line-height: 1; }
.odo .fixed { display: inline-block; }

/* ---------- Sticky stacking process ---------- */

.stack { display: grid; gap: clamp(18px, 2.4vw, 26px); }
.stack-card {
  position: sticky;
  top: calc(96px + var(--i, 0) * 16px);
  background: var(--paper);
  border: 1px solid var(--ink);
  padding: clamp(26px, 3.4vw, 46px);
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: clamp(18px, 3vw, 44px);
  transform-origin: top center;
  will-change: transform;
  box-shadow: 0 30px 60px -44px color-mix(in srgb, var(--shade) 50%, transparent);
}
@media (max-width: 700px) { .stack-card { grid-template-columns: 1fr; gap: 14px; } }

.stack-card .k {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--flare);
}
.stack-card h3 {
  font-size: clamp(1.5rem, 3.4vw, 2.5rem);
  line-height: 1;
  letter-spacing: -0.04em;
  font-weight: 700;
  margin-bottom: 12px;
}
.stack-card p { color: var(--ink-soft); max-width: 52ch; }
.stack-card ul { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 20px; }
.stack-card li {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  padding: 6px 9px;
  color: var(--ink-soft);
}

/* ---------- Magnetic buttons ---------- */

[data-magnetic] { will-change: transform; }
[data-magnetic] > span.mag-in { display: inline-flex; align-items: center; gap: 10px; }

/* ---------- Tilt on the coast cards ---------- */

.coast[data-tilt] { transform: perspective(1100px); --glare: color-mix(in srgb, var(--flare) 14%, transparent); position: relative; }
.coast--dark[data-tilt] { --glare: rgba(255, 255, 255, 0.16); }
.coast[data-tilt] > * { position: relative; z-index: 2; }
.coast[data-tilt] > .glare { position: absolute; inset: 0; }
.coast[data-tilt] h3 { transform: translateZ(42px); }
.coast[data-tilt] .coast-meta { transform: translateZ(24px); }

/* ---------- Section counter chrome ---------- */

.count-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin-top: clamp(24px, 3vw, 40px);
}
.count-cell { background: var(--paper); padding: clamp(20px, 2.6vw, 34px); }
.count-cell .n {
  display: flex;
  align-items: baseline;
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  line-height: 1;
  letter-spacing: -0.05em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-bottom: 14px;
}
.count-cell .n sup {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.42em;
  font-weight: 400;
  color: var(--flare);
  margin-left: 4px;
  top: -0.7em;
  position: relative;
}
.count-cell .l {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ============================================================
   Presentation layer — chapters, ink-fill, grain, joints
   ============================================================ */

/* ---------- Chapter rail ---------- */

.chapters {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 60;
  display: grid;
  gap: 11px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.chapters a {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 3px 0;
}
.chapters a i {
  display: block;
  width: 13px;
  height: 1px;
  background: var(--line);
  transition: width .3s cubic-bezier(.16, 1, .3, 1), background .3s ease;
}
.chapters a b {
  font-weight: 400;
  opacity: 0;
  transform: translateX(8px);
  transition: opacity .28s ease, transform .28s cubic-bezier(.16, 1, .3, 1);
  white-space: nowrap;
}
.chapters:hover a b { opacity: .55; transform: none; }
.chapters a:hover b, .chapters a.on b { opacity: 1; transform: none; color: var(--ink); }
.chapters a:hover i { width: 22px; background: var(--ink-soft); }
.chapters a.on i { width: 28px; background: var(--flare); }
.chapters a.on { color: var(--ink); }
@media (max-width: 1240px) { .chapters { display: none; } }

/* ---------- Lede that inks in as you read it ---------- */

.fw { color: color-mix(in srgb, var(--ink) 17%, transparent); transition: color .45s ease; }
.fw.lit { color: var(--ink-soft); }
[data-fill] { color: transparent; }

/* ---------- Paper grain ---------- */

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 150;
  pointer-events: none;
  opacity: 0.038;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}

/* ---------- Section joints ---------- */

.section { position: relative; }
.section::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: var(--line);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1.2s cubic-bezier(.16, 1, .3, 1);
}
.section.jointed::before { transform: scaleX(1); }
.section--tint::before, .section:first-of-type::before { display: none; }

/* ---------- Spotlight over the capability boards ---------- */

.board { position: relative; }
.board::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity .35s ease;
  background: radial-gradient(240px circle at var(--bx, 50%) var(--by, 50%), color-mix(in srgb, var(--flare) 16%, transparent), transparent 68%);
}
.board:hover::after { opacity: 1; }

/* ---------- Kinetic status line ---------- */

.kinetic {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.kinetic .swap {
  position: relative;
  display: inline-block;
  overflow: hidden;
  height: 1.35em;
  min-width: 0;
  flex: 1;
}
.kinetic .swap span {
  display: block;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.55em;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--flare);
  line-height: 1.35;
  transition: transform .55s cubic-bezier(.16, 1, .3, 1), opacity .55s ease;
}
.kinetic .swap span.out { transform: translateY(-100%); opacity: 0; }
.kinetic .swap span.in { transform: translateY(100%); opacity: 0; transition: none; }

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .fw { color: var(--ink-soft); transition: none; }
  .section::before { transform: scaleX(1); transition: none; }
  .chapters a i, .chapters a b { transition: none; }
  .kinetic .swap span { transition: none; }
  body::after { display: none; }
  .sp-ch { transform: none; opacity: 1; transition: none; }
  .bars i { animation: none; }
  .rail-hint i { animation: none; }
  .float { transition: none; }
  .gauge .val { transition: none; stroke-dashoffset: 4; }
  .odo .reel ul { transition: none; }
  .cursor, .cursor-dot { display: none; }
  html.cursor-on, html.cursor-on * { cursor: auto !important; }
}
