/* =========================================================================
   PACTIAN — Ferrule Entertainment
   ========================================================================= */

:root {
  --bg: #030304;
  --fg: #f4f1ec;
  --muted: rgba(244, 241, 236, 0.58);
  --dim: rgba(244, 241, 236, 0.3);
  --line: rgba(244, 241, 236, 0.14);
  --steel: #b8c4d6;
  --warm: #ffb784;
  --hot: #ff7a45;
  --ok: #9fe0b5;
  --bad: #ff7d6e;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);

  --font: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { background: var(--bg); -webkit-text-size-adjust: 100%; }

body {
  color: var(--fg);
  font-family: var(--font);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body.is-loading { overflow: hidden; }

::selection { background: var(--steel); color: #000; }

a:focus-visible, button:focus-visible { outline: 1px solid var(--steel); outline-offset: 4px; }

button { font: inherit; color: inherit; }

/* -------------------------------------------------------------------------
   Logo disc
   ------------------------------------------------------------------------- */

.disc {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 50%;
  background: #07080b;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14), 0 10px 30px rgba(0, 0, 0, 0.6);
}
.disc img { display: block; width: 100%; height: 100%; object-fit: cover; transform: scale(1.5); }
.disc--nav { width: 28px; height: 28px; flex: none; }
.disc--sm  { width: 24px; height: 24px; flex: none; }
.disc--xs  { width: 18px; height: 18px; flex: none; }

/* -------------------------------------------------------------------------
   Layers
   ------------------------------------------------------------------------- */

.gl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  background: var(--bg);
}

.no-gl .gl {
  background:
    radial-gradient(ellipse 40% 8% at 50% 50%, rgba(255, 170, 110, 0.35), transparent 70%),
    radial-gradient(circle at 50% 50%, #000 0 6%, rgba(255, 150, 90, 0.25) 7%, transparent 22%),
    var(--bg);
}

.flash {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 50%, #fffaf2 0%, #ffd9b0 45%, #ff9c63 100%);
}

.grain {
  position: fixed;
  inset: -50%;
  z-index: 50;
  pointer-events: none;
  opacity: 0.055;
  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='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(6) infinite;
}

@keyframes grain {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-3%, 2%); }
  40%  { transform: translate(2%, -3%); }
  60%  { transform: translate(-2%, -1%); }
  80%  { transform: translate(3%, 3%); }
  100% { transform: translate(0, 0); }
}

main { position: relative; z-index: 2; }

/* -------------------------------------------------------------------------
   Loader
   ------------------------------------------------------------------------- */

.loader {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  background: var(--bg);
  clip-path: inset(0 0 0 0);
  transition: clip-path 1.3s var(--ease-io), visibility 0s linear 1.3s;
}
.loader.is-done { clip-path: inset(0 0 100% 0); visibility: hidden; }

.loader__logo { position: relative; width: 84px; height: 84px; }
.loader__logo .disc { position: absolute; inset: 10px; }
.loader__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 55%, rgba(184, 196, 214, 0.4) 75%, #fff 100%);
  -webkit-mask: radial-gradient(circle, transparent 64%, #000 66%);
          mask: radial-gradient(circle, transparent 64%, #000 66%);
  animation: spin 1.3s linear infinite;
}

.loader__count { font-family: var(--mono); font-size: 11px; letter-spacing: 0.4em; color: var(--muted); padding-left: 0.4em; }
.loader__bar { width: 150px; height: 1px; background: var(--line); overflow: hidden; }
.loader__bar span { display: block; height: 100%; background: var(--fg); transform-origin: left; transform: scaleX(0); }

@keyframes spin { to { transform: rotate(360deg); } }

/* -------------------------------------------------------------------------
   Navigation & rail
   ------------------------------------------------------------------------- */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 4vw;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 1.2s var(--ease) 1.4s, transform 1.2s var(--ease) 1.4s;
}
.is-ready .nav { opacity: 1; transform: none; }
.nav a { pointer-events: auto; text-decoration: none; }

.nav__logo { display: flex; align-items: center; gap: 12px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.35em; color: var(--fg); }
.nav__link { font-size: 13px; color: var(--muted); transition: color 0.3s; }
.nav__link:hover { color: var(--fg); }
.nav__link span { display: inline-block; transition: transform 0.4s var(--ease); }
.nav__link:hover span { transform: translate(2px, -2px); }

.rail {
  position: fixed;
  right: 4vw;
  top: 50%;
  z-index: 60;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  opacity: 0;
  transition: opacity 1.2s var(--ease) 1.6s;
}
.is-ready .rail { opacity: 1; }
.rail__num--dim { color: var(--dim); }
.rail__track { position: relative; width: 1px; height: 110px; background: var(--line); overflow: hidden; }
.rail__track span { position: absolute; inset: 0; background: var(--fg); transform-origin: top; transform: scaleY(0); }

/* -------------------------------------------------------------------------
   Cursor
   ------------------------------------------------------------------------- */

.cursor { position: fixed; left: 0; top: 0; z-index: 150; pointer-events: none; display: none; mix-blend-mode: difference; }
.has-cursor .cursor { display: block; }
.has-cursor, .has-cursor a, .has-cursor button { cursor: none; }

.cursor__dot, .cursor__ring { position: absolute; left: 0; top: 0; border-radius: 50%; will-change: transform; }
.cursor__dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: #fff; }
.cursor__ring {
  width: 38px;
  height: 38px;
  margin: -19px 0 0 -19px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  transition: width 0.45s var(--ease), height 0.45s var(--ease), margin 0.45s var(--ease), background-color 0.45s;
}
.cursor.is-hover .cursor__ring { width: 70px; height: 70px; margin: -35px 0 0 -35px; background-color: rgba(255, 255, 255, 0.08); }

/* -------------------------------------------------------------------------
   Shared
   ------------------------------------------------------------------------- */

.pin { position: relative; --p: 0; }

.pin__stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.char { display: inline-block; overflow: hidden; vertical-align: top; }
.char > span { display: inline-block; will-change: transform; }

.intro {
  opacity: 0;
  transform: translateY(16px);
  filter: blur(6px);
  transition: opacity 1.4s var(--ease) 1.1s, transform 1.4s var(--ease) 1.1s, filter 1.4s var(--ease) 1.1s;
}
.is-ready .intro { opacity: 1; transform: none; filter: none; }

.label {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
}
.label::before { content: ""; width: 28px; height: 1px; background: var(--muted); }

.grad {
  background: linear-gradient(100deg, #ffffff 5%, #dfe6f0 40%, var(--steel) 75%, #7f8ea6 100%);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
}

[data-reveal] {
  opacity: 0;
  transform: translateY(34px);
  filter: blur(8px);
  transition: opacity 1.3s var(--ease), transform 1.3s var(--ease), filter 1.3s var(--ease);
  transition-delay: var(--d, 0s);
}
[data-reveal].in { opacity: 1; transform: none; filter: none; }

/* Step groups (flow + capabilities) */

.steps__index {
  display: flex;
  align-items: center;
  gap: 0.7em;
  margin-bottom: 26px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--dim);
}

.roll { display: inline-block; height: 1.4em; line-height: 1.4em; overflow: hidden; color: var(--fg); }
.roll__inner { display: flex; flex-direction: column; transition: transform 1s var(--ease); }
.roll__inner span { height: 1.4em; }

.steps__titles { position: relative; height: 1.14em; font-weight: 500; line-height: 1; letter-spacing: -0.05em; }

.stitle { position: absolute; left: 0; top: 0; font: inherit; white-space: nowrap; }
.stitle .char { padding-bottom: 0.1em; }
.stitle .char > span {
  transform: translateY(112%);
  transition: transform 0.85s var(--ease);
  transition-delay: calc(var(--i) * 18ms);
}
.stitle.is-active .char > span { transform: none; transition-delay: calc(var(--i) * 24ms + 0.28s); }
.stitle.is-past .char > span { transform: translateY(-112%); }

.steps__descs {
  position: relative;
  height: 3.2em;
  max-width: 420px;
  margin-top: 22px;
  font-size: clamp(15px, 1.3vw, 19px);
  font-weight: 300;
  line-height: 1.5;
  color: var(--muted);
}

.sdesc {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translateY(12px);
  filter: blur(6px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease), filter 0.7s var(--ease);
}
.sdesc.is-active { opacity: 1; transform: none; filter: none; transition-delay: 0.4s; }

.bars { display: flex; gap: 8px; width: 220px; margin-top: 40px; }
.bars span { position: relative; flex: 1; height: 1px; background: var(--line); overflow: hidden; }
.bars i { position: absolute; inset: 0; background: var(--fg); transform-origin: left; transform: scaleX(0); }

/* -------------------------------------------------------------------------
   01 · Hero
   ------------------------------------------------------------------------- */

.hero { height: 250vh; }
.hero .pin__stage { gap: 2.2vh; }

.hero__fade { opacity: calc(1 - var(--p) * 3.2); }

.hero__logo {
  position: relative;
  width: 86px;
  height: 86px;
  margin-bottom: 1.2vh;
}
.hero__logo .disc { position: absolute; inset: 0; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18), 0 0 60px rgba(184, 196, 214, 0.18); }
.hero__orbit {
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  animation: spin 40s linear infinite;
}

.intro-logo {
  opacity: 0;
  transform: scale(0.6);
  filter: blur(10px);
  transition: opacity 1.4s var(--ease) 0.15s, transform 1.6s var(--ease) 0.15s, filter 1.4s var(--ease) 0.15s;
}
.is-ready .intro-logo { opacity: 1; transform: none; filter: none; }

.hero__eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--muted);
  padding-left: 0.42em;
}

.hero__title {
  font-size: clamp(68px, 16vw, 260px);
  font-weight: 500;
  line-height: 0.92;
  white-space: nowrap;
  letter-spacing: calc(-0.05em + var(--p) * 0.55em);
  transform: scale(calc(1 + var(--p) * 0.14));
  opacity: calc(1 - var(--p) * 1.45);
  filter: blur(calc(var(--p) * 16px));
  text-shadow: 0 0 60px rgba(0, 0, 0, 0.35);
}
.hero__title .char { padding: 0.04em 0.005em 0.06em; }
.hero__title .char > span {
  transform: translateY(112%);
  transition: transform 1.6s var(--ease);
  transition-delay: calc(var(--i) * 75ms + 0.35s);
}
.is-ready .hero__title .char > span { transform: none; }

.hero__sub { font-size: clamp(16px, 1.55vw, 22px); font-weight: 300; letter-spacing: -0.01em; color: var(--muted); }

.hero__scroll {
  position: absolute;
  bottom: 5vh;
  left: 50%;
  width: 60px;
  margin-left: -30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--dim);
}
.hero__scroll i { position: relative; width: 1px; height: 54px; background: var(--line); overflow: hidden; }
.hero__scroll i::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 40%;
  background: var(--fg);
  animation: drip 2.2s var(--ease-io) infinite;
}
.is-ready .hero__scroll { opacity: calc(1 - var(--p) * 6); }

@keyframes drip { 0% { transform: translateY(-100%); } 100% { transform: translateY(260%); } }

/* -------------------------------------------------------------------------
   02 · Manifesto
   ------------------------------------------------------------------------- */

.manifesto { height: 300vh; }

.manifesto__text {
  max-width: 1120px;
  padding: 0 7vw;
  font-size: clamp(30px, 4.4vw, 68px);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.03em;
  text-align: center;
  text-shadow: 0 2px 40px rgba(0, 0, 0, 0.6);
}

.w { display: inline-block; opacity: 0.14; will-change: opacity, transform; }
.w--em {
  font-style: normal;
  background: linear-gradient(100deg, #fff 0%, #dfe6f0 45%, var(--steel) 100%);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
}

/* -------------------------------------------------------------------------
   03 · Flow
   ------------------------------------------------------------------------- */

.flow { height: 460vh; }

.flow__svg {
  position: absolute;
  top: 9vh;
  left: 50%;
  width: min(1200px, 94vw);
  height: 62vh;
  transform: translateX(-50%);
  overflow: visible;
}

.wire { fill: none; stroke: rgba(244, 241, 236, 0.12); stroke-width: 1.2; }
.lit { fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; filter: url(#glow); }
.lit--back { stroke: var(--warm); }

.node__ring { fill: rgba(6, 6, 8, 0.75); stroke: rgba(244, 241, 236, 0.25); stroke-width: 1.2; transition: stroke 0.5s, fill 0.5s; }
.node.is-on .node__ring, .agent.is-sel .node__ring { stroke: #fff; fill: rgba(20, 20, 24, 0.85); }

.node__icon { fill: none; stroke: rgba(244, 241, 236, 0.75); stroke-width: 1.6; stroke-linecap: round; transition: opacity 0.4s; }
.node__check { fill: none; stroke: var(--warm); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 46; stroke-dashoffset: 46; transition: stroke-dashoffset 0.7s var(--ease); }
.node--you.is-done .node__check { stroke-dashoffset: 0; }
.node--you.is-done .node__icon { opacity: 0; }
.node__label { fill: var(--muted); font-family: var(--mono); font-size: 13px; letter-spacing: 0.25em; text-anchor: middle; text-transform: uppercase; }

.bubble { opacity: 0; }
.bubble rect { fill: rgba(255, 255, 255, 0.07); stroke: rgba(255, 255, 255, 0.14); }
.bubble text { fill: var(--fg); font-family: var(--font); font-size: 17px; }

.pact__orbit {
  fill: none;
  stroke: rgba(255, 255, 255, 0.28);
  stroke-dasharray: 2 9;
  transform-box: view-box;
  transform-origin: 600px 320px;
  animation: spin 24s linear infinite;
}
.pact__pulse { fill: none; stroke: #fff; stroke-width: 1.2; opacity: 0; transform-box: view-box; transform-origin: 600px 320px; }
.node--pact.is-on .pact__pulse { animation: ping 1.6s var(--ease) infinite; }
.pact__rim { fill: none; stroke: rgba(255, 255, 255, 0.35); stroke-width: 1.2; }

@keyframes ping { 0% { opacity: 0.7; transform: scale(1); } 100% { opacity: 0; transform: scale(1.9); } }

.agent { transition: opacity 0.6s var(--ease); }
.agent.is-dim { opacity: 0.28; }
.agent__prog { fill: none; stroke: var(--warm); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 238.76; stroke-dashoffset: 238.76; }
.agent__mono { fill: var(--fg); font-family: var(--mono); font-size: 14px; text-anchor: middle; }
.agent__name { fill: var(--fg); font-family: var(--font); font-size: 19px; }
.agent__status { fill: var(--dim); font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; }
.agent__status.is-live { fill: var(--warm); }

.packet { opacity: 0; }
.packet__core { fill: #fff; }
.packet__halo { fill: rgba(255, 255, 255, 0.18); }
.packet.is-back .packet__core { fill: var(--warm); }
.packet.is-back .packet__halo { fill: rgba(255, 183, 132, 0.25); }
.ghost { fill: rgba(255, 255, 255, 0.5); opacity: 0; }

.steps--flow { position: absolute; left: 8vw; bottom: 7vh; width: min(760px, 84vw); }
.steps--flow .steps__titles { font-size: clamp(34px, 4.4vw, 70px); }

/* -------------------------------------------------------------------------
   04 · Capabilities
   ------------------------------------------------------------------------- */

.caps { height: 400vh; }
.caps .pin__stage { align-items: flex-start; }
.steps--caps { margin-left: 8vw; width: min(600px, 84vw); }
.steps--caps .steps__titles { font-size: clamp(58px, 8.6vw, 140px); }

/* -------------------------------------------------------------------------
   05 · Routing preview
   ------------------------------------------------------------------------- */

.iface {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr minmax(0, 560px);
  align-items: center;
  gap: 6vw;
  padding: 22vh 10vw 18vh 8vw;
}

.iface__title, .modes__title, .away__title {
  font-size: clamp(46px, 6.2vw, 100px);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.iface__lead, .modes__lead, .away__lead {
  max-width: 420px;
  margin-top: 26px;
  font-size: clamp(16px, 1.3vw, 19px);
  font-weight: 300;
  line-height: 1.55;
  color: var(--muted);
}

.chat {
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: linear-gradient(180deg, rgba(22, 22, 26, 0.5), rgba(8, 8, 10, 0.64));
  -webkit-backdrop-filter: blur(26px) saturate(150%);
          backdrop-filter: blur(26px) saturate(150%);
  box-shadow: 0 50px 120px -30px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.chat__head { display: flex; align-items: center; gap: 12px; padding: 16px 22px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); font-size: 14px; }
.chat__head b { font-weight: 500; }

.chat__status {
  display: flex;
  align-items: center;
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.chat__body { display: flex; flex-direction: column; gap: 18px; min-height: 330px; padding: 26px 22px; }

.msg { max-width: 88%; font-size: 15px; line-height: 1.6; opacity: 0; transform: translateY(10px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
.msg.show { opacity: 1; transform: none; }
.msg--user { align-self: flex-end; padding: 12px 16px; border-radius: 16px 16px 4px 16px; border: 1px solid rgba(255, 255, 255, 0.06); background: rgba(255, 255, 255, 0.07); }
.msg--ai { align-self: flex-start; display: flex; gap: 12px; width: 88%; color: rgba(244, 241, 236, 0.92); }
.msg--ai .disc { margin-top: 2px; }
.msg__content { flex: 1; min-width: 0; }

.caret { display: inline-block; width: 7px; height: 1.05em; margin-left: 3px; vertical-align: -3px; background: var(--steel); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.dots { display: inline-flex; gap: 5px; padding-top: 8px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: dot 1.2s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: 0.15s; }
.dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot { 0%, 100% { transform: translateY(0); opacity: 0.4; } 40% { transform: translateY(-4px); opacity: 1; } }

.route {
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.25);
}
.route__head {
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.route__row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 11px 14px;
  font-size: 14px;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}
.route__row.show { opacity: 1; transform: none; }
.route__row + .route__row { border-top: 1px solid rgba(255, 255, 255, 0.05); }
.route__task { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: 0.06em; }

.state {
  display: inline-flex;
  align-items: center;
  min-width: 76px;
  justify-content: flex-end;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--dim);
}
.state--working { color: var(--warm); }
.state--done { color: var(--ok); }

.chat__input {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 16px 16px;
  padding: 12px 12px 12px 18px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.28);
  font-size: 14.5px;
  color: var(--dim);
}
.chat__input button { width: 32px; height: 32px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.1); color: var(--fg); font-size: 14px; }

/* -------------------------------------------------------------------------
   06 · Hardware & access
   ------------------------------------------------------------------------- */

.modes { position: relative; min-height: 100vh; padding: 20vh 8vw 18vh; }
.modes__head { margin-bottom: 7vh; }

.modes__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; max-width: 1180px; }

.panel {
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 26px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: linear-gradient(180deg, rgba(22, 22, 26, 0.5), rgba(8, 8, 10, 0.66));
  -webkit-backdrop-filter: blur(24px) saturate(140%);
          backdrop-filter: blur(24px) saturate(140%);
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.modes__grid .panel:nth-child(2) { --d: 0.12s; }

.panel__top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.panel__title { font-family: var(--mono); font-size: 11px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--muted); }

.panel__note {
  min-height: 1.5em;
  font-size: 14.5px;
  font-weight: 300;
  color: var(--muted);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease), filter 0.35s var(--ease);
}
.panel__note.is-swap { opacity: 0; transform: translateY(6px); filter: blur(4px); }

.seg {
  position: relative;
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.35);
}
.seg button {
  position: relative;
  z-index: 1;
  padding: 8px 15px;
  border: 0;
  border-radius: 999px;
  background: none;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.4s var(--ease);
}
.seg button.is-on { color: #000; }
.seg__thumb {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 0;
  border-radius: 999px;
  background: var(--fg);
  transition: transform 0.6s var(--ease), width 0.6s var(--ease);
}

.chips { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.chipviz {
  padding: 18px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(0, 0, 0, 0.25);
  transition: border-color 0.5s var(--ease), background-color 0.5s var(--ease);
}
.chipviz.is-on { border-color: rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.03); }

.chipviz__die {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  aspect-ratio: 1;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
}
.chipviz__die::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
}
.chipviz__die i {
  border-radius: 2px;
  background: var(--fg);
  opacity: 0.07;
  transition: opacity 0.5s;
}
.chipviz.is-on .chipviz__die i { animation: flick var(--dur, 1.4s) var(--d, 0s) ease-in-out infinite; }

@keyframes flick {
  0%, 100% { opacity: 0.12; }
  50% { opacity: var(--peak, 0.85); }
}

.chipviz__meta { display: flex; justify-content: space-between; align-items: baseline; margin-top: 16px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em; color: var(--muted); }
.chipviz__meta b { font-weight: 500; color: var(--fg); letter-spacing: 0.05em; font-variant-numeric: tabular-nums; }
.chipviz__meter { height: 2px; margin-top: 10px; background: var(--line); border-radius: 2px; overflow: hidden; }
.chipviz__meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--steel), #fff); transition: width 0.9s var(--ease); }

.perms { list-style: none; display: flex; flex-direction: column; }
.perms li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 2px;
  font-size: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.perms li:first-child { border-top: 1px solid rgba(255, 255, 255, 0.06); }

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}
.pill.is-flip { animation: flip 0.5s var(--ease); }
.pill[data-s="allow"] { color: var(--ok); }
.pill[data-s="ask"]   { color: var(--warm); }
.pill[data-s="read"]  { color: var(--steel); }
.pill[data-s="block"] { color: var(--bad); }

@keyframes flip {
  0% { transform: rotateX(90deg); opacity: 0; }
  100% { transform: none; opacity: 1; }
}

/* -------------------------------------------------------------------------
   07 · Horizon
   ------------------------------------------------------------------------- */

.horizon { height: 320vh; }

.horizon__title {
  padding: 0 5vw;
  font-size: clamp(46px, 8vw, 150px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.05em;
  text-align: center;
  opacity: var(--a, 0);
  transform: scale(var(--s, 1));
  filter: blur(calc(var(--b, 0) * 1px));
  text-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
  will-change: transform, opacity, filter;
}

.horizon__meter {
  position: absolute;
  bottom: 8vh;
  left: 50%;
  display: flex;
  align-items: baseline;
  gap: 0.8em;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0;
}
.horizon__meter b { min-width: 4.5ch; font-size: 14px; font-weight: 500; letter-spacing: 0.05em; text-align: right; color: var(--fg); font-variant-numeric: tabular-nums; }
.horizon__meter sub { font-size: 0.75em; letter-spacing: 0; }

/* -------------------------------------------------------------------------
   08 · Away (phone)
   ------------------------------------------------------------------------- */

.away {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6vw;
  padding: 18vh 12vw 16vh 8vw;
}

.replay {
  margin-top: 34px;
  padding: 0;
  border: 0;
  background: none;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--dim);
  cursor: pointer;
  transition: color 0.3s;
}
.replay:hover { color: var(--fg); }

.phone-wrap { perspective: 1400px; }

.phone {
  position: relative;
  width: 300px;
  height: 610px;
  padding: 11px;
  border-radius: 48px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(160deg, #15171c, #060709 60%);
  box-shadow:
    0 60px 120px -30px rgba(0, 0, 0, 0.9),
    0 0 0 6px rgba(255, 255, 255, 0.02),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transform-style: preserve-3d;
  will-change: transform;
}

.phone__notch {
  position: absolute;
  top: 22px;
  left: 50%;
  z-index: 3;
  width: 92px;
  height: 26px;
  margin-left: -46px;
  border-radius: 20px;
  background: #000;
}

.phone__screen {
  position: relative;
  height: 100%;
  overflow: hidden;
  border-radius: 38px;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(184, 196, 214, 0.14), transparent 60%),
    linear-gradient(180deg, #0c0e13, #050608);
  display: flex;
  flex-direction: column;
}

.phone__bar { display: flex; justify-content: space-between; align-items: center; padding: 16px 26px 0; font-size: 13px; font-weight: 500; }
.phone__sig { display: inline-flex; align-items: flex-end; gap: 2px; height: 10px; }
.phone__sig i { width: 3px; background: var(--fg); border-radius: 1px; }
.phone__sig i:nth-child(1) { height: 4px; }
.phone__sig i:nth-child(2) { height: 7px; }
.phone__sig i:nth-child(3) { height: 10px; }

.toast {
  position: absolute;
  top: 50px;
  left: 12px;
  right: 12px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(30, 32, 38, 0.82);
  -webkit-backdrop-filter: blur(16px);
          backdrop-filter: blur(16px);
  font-size: 13px;
  transform: translateY(-160%);
  opacity: 0;
  transition: transform 0.8s var(--ease), opacity 0.6s var(--ease);
}
.toast.show { transform: none; opacity: 1; }
.toast b { display: block; font-weight: 500; }
.toast div span { color: var(--muted); font-size: 12px; }
.toast__icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 9px;
  background: rgba(159, 224, 181, 0.15);
  color: var(--ok);
  font-size: 13px;
}

.call { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 104px 20px 0; }

.call__avatar { position: relative; width: 96px; height: 96px; }
.call__avatar .disc { position: absolute; inset: 0; z-index: 1; }
.ripple { position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.35); opacity: 0; }
.phone[data-state="ringing"] .ripple { animation: ripple 2.4s var(--ease) infinite; }
.phone[data-state="ringing"] .ripple:nth-child(2) { animation-delay: 0.8s; }
.phone[data-state="ringing"] .ripple:nth-child(3) { animation-delay: 1.6s; }
@keyframes ripple { 0% { transform: scale(1); opacity: 0.6; } 100% { transform: scale(2.3); opacity: 0; } }

.call__name { margin-top: 22px; font-size: 26px; font-weight: 500; letter-spacing: -0.02em; }
.call__state { margin-top: 4px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); font-variant-numeric: tabular-nums; }

.wave { display: flex; align-items: center; justify-content: center; gap: 3px; height: 26px; margin-top: 18px; opacity: 0; transition: opacity 0.5s; }
.wave i { width: 3px; height: 4px; border-radius: 2px; background: var(--steel); }
.phone[data-state="live"] .wave { opacity: 1; }
.phone[data-state="live"] .wave i { animation: wave var(--dur, 0.9s) var(--d, 0s) ease-in-out infinite alternate; }
@keyframes wave { from { height: 4px; } to { height: var(--h, 22px); } }

.call__lines { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 22px; }
.line {
  max-width: 92%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}
.line.show { opacity: 1; transform: none; }
.line--ai { align-self: flex-start; background: rgba(255, 255, 255, 0.07); border-radius: 14px 14px 14px 4px; }
.line--you { align-self: flex-end; background: rgba(184, 196, 214, 0.18); border-radius: 14px 14px 4px 14px; }

.call__actions { display: flex; justify-content: space-around; padding: 0 40px 44px; }
.cbtn {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  font-size: 22px;
  color: #fff;
  transition: transform 0.5s var(--ease), opacity 0.5s var(--ease), width 0.5s var(--ease);
}
.cbtn--no { background: #e5484d; }
.cbtn--yes { background: #30a46c; }
.phone[data-state="ringing"] .cbtn--yes { animation: nudge 1.2s ease-in-out infinite; }
.cbtn--yes.is-pressed { transform: scale(0.86); }
.phone[data-state="live"] .cbtn--yes,
.phone[data-state="ended"] .cbtn--yes { opacity: 0; transform: scale(0.4); width: 0; }
.phone[data-state="ended"] .cbtn--no { opacity: 0.35; }
@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* -------------------------------------------------------------------------
   09 · Closing
   ------------------------------------------------------------------------- */

.cta { height: 220vh; }
.cta .pin__stage { gap: 28px; }

.cta__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: calc(var(--p) * 1.5);
}

.cta__word {
  font-size: clamp(76px, 19vw, 330px);
  font-weight: 500;
  line-height: 0.86;
  letter-spacing: -0.055em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.32);
  background: linear-gradient(90deg, #fff 0 50%, transparent 50% 100%);
  background-size: 200% 100%;
  background-position: calc(100% - var(--p) * 100%) 0;
  -webkit-background-clip: text;
          background-clip: text;
}

.cta__soon, .cta .btn {
  opacity: 0;
  transform: translateY(20px);
  filter: blur(6px);
  transition: opacity 1.1s var(--ease), transform 1.1s var(--ease), filter 1.1s var(--ease);
}
.cta.is-revealed .cta__soon { opacity: 1; transform: none; filter: none; }
.cta.is-revealed .btn { opacity: 1; transform: none; filter: none; transition-delay: 0.15s; }

.cta__soon { font-size: clamp(16px, 1.5vw, 21px); font-weight: 300; color: var(--muted); }

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  overflow: hidden;
  padding: 16px 26px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.03);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  color: var(--fg);
  font-size: 14px;
  letter-spacing: 0.01em;
  text-decoration: none;
}
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--fg);
  transform: translateY(101%);
  transition: transform 0.6s var(--ease);
}
.btn:hover::before { transform: none; }
.btn > * { position: relative; transition: color 0.4s; }
.btn:hover > * { color: #000; }
.btn i { font-style: normal; }

.foot {
  position: absolute;
  bottom: 28px;
  left: 4vw;
  right: 4vw;
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}
.foot a { margin-left: 26px; color: inherit; text-decoration: none; transition: color 0.3s; }
.foot a:hover { color: var(--fg); }

/* -------------------------------------------------------------------------
   Mobile & Responsive Optimizations (< 820px)
   ------------------------------------------------------------------------- */

@media (max-width: 980px) {
  .modes__grid { grid-template-columns: 1fr; gap: 24px; }
  .away { grid-template-columns: 1fr; justify-items: center; padding: 14vh 6vw 12vh; gap: 36px; }
  .away__copy { justify-self: stretch; text-align: center; }
  .away__copy .eyebrow { justify-content: center; }
  .away__copy .replay { margin: 16px auto 0; }
}

@media (max-width: 820px), (pointer: coarse) {
  .cursor { display: none !important; }
  .has-cursor, .has-cursor a, .has-cursor button { cursor: auto !important; }

  /* Global Touch Polish & Performance */
  body { touch-action: pan-y; }
  a, button { touch-action: manipulation; }
  .grain { display: none !important; }

  /* Disable expensive backdrop blurs over real-time canvas on mobile GPUs */
  .chat, .panel, .seg, .route, .chipviz, .toast, .cta .btn {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
  .chat { background: rgba(13, 15, 22, 0.95); }
  .panel { background: rgba(11, 13, 19, 0.95); }

  /* Navigation: Compact Frosted Glass Header */
  .nav {
    padding: 12px 5vw;
    background: rgba(4, 5, 10, 0.78);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    pointer-events: auto;
  }
  .nav__logo { font-size: 11px; letter-spacing: 0.28em; gap: 8px; }
  .disc--nav { width: 22px; height: 22px; }
  .nav__link { font-size: 12px; }

  /* Rail hidden on phones */
  .rail { display: none !important; }

  /* 01 · Hero */
  .hero__title { font-size: clamp(52px, 15vw, 76px); }
  .hero__eyebrow { font-size: 10.5px; letter-spacing: 0.22em; }
  .hero__sub { font-size: 15px; }
  .hero__logo { width: 72px; height: 72px; }
  .hero__scroll { bottom: 3.5vh; }

  /* 02 · Manifesto */
  .manifesto__text {
    font-size: clamp(23px, 6.4vw, 32px);
    line-height: 1.25;
    padding: 0 6vw;
  }

  /* 03 · Flow section */
  .flow__svg {
    top: 10vh;
    height: 48vh;
    max-height: 400px;
    width: 96vw;
    left: 50%;
    transform: translateX(-50%);
  }
  .flow__svg .agent__name { font-size: 22px; font-weight: 500; }
  .flow__svg .agent__status { font-size: 13px; }
  .flow__svg .node__label { font-size: 15px; }
  .flow__svg .bubble text { font-size: 18px; }

  .steps--flow {
    left: 6vw;
    right: 6vw;
    bottom: 5vh;
    width: auto;
  }
  .steps--flow .steps__index { font-size: 11px; margin-bottom: 6px; }
  .steps--flow .steps__titles {
    font-size: clamp(22px, 6vw, 30px);
    height: auto;
    min-height: 2.4em;
    line-height: 1.1;
  }
  .steps--flow .stitle { white-space: normal; }
  .steps--flow .sdesc {
    font-size: 13.5px;
    line-height: 1.45;
  }

  /* 04 · Capabilities */
  .caps .pin__stage { justify-content: flex-start; padding-top: 15vh; }
  .steps--caps {
    margin-left: 6vw;
    margin-right: 6vw;
    width: auto;
  }
  .steps--caps .steps__titles {
    font-size: clamp(38px, 11vw, 56px);
    line-height: 1.05;
  }
  .steps--caps .sdesc {
    font-size: 14px;
    line-height: 1.5;
    max-width: 100%;
  }

  /* 05 · Interface / Chat */
  .iface {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 12vh 6vw 10vh;
  }
  .iface__head h2 { font-size: clamp(32px, 8.5vw, 44px); }
  .iface__head p { font-size: 14px; line-height: 1.5; }
  .chat { border-radius: 18px; }
  .chat__head { padding: 12px 16px; font-size: 13px; }
  .chat__body {
    padding: 16px 14px;
    min-height: 260px;
    gap: 14px;
  }
  .msg { max-width: 96%; font-size: 13.5px; }
  .msg--user { padding: 10px 14px; }
  .route__head { padding: 8px 12px; font-size: 10px; }
  .route__row { gap: 8px; padding: 8px 10px; font-size: 12.5px; }
  .route__task { font-size: 10px; }
  .state { font-size: 9.5px; min-width: 65px; }
  .chat__input { margin: 0 10px 12px; padding: 10px 12px; }
  .chat__input input { font-size: 13px; }

  /* 06 · Hardware & Modes */
  .modes { padding: 12vh 6vw 10vh; }
  .modes__head h2 { font-size: clamp(32px, 8.5vw, 44px); }
  .modes__head p { font-size: 14px; line-height: 1.5; }
  .panel { padding: 18px 14px; border-radius: 18px; }
  .panel__head { margin-bottom: 14px; }
  .seg button { padding: 6px 10px; font-size: 11.5px; }
  .chips { gap: 10px; }
  .chipviz { padding: 12px; border-radius: 14px; }
  .chipviz__die { gap: 3px; }
  .chipviz__foot { margin-top: 8px; font-size: 11px; }
  .perms li { padding: 10px 0; font-size: 12.5px; }
  .pill { padding: 4px 10px; font-size: 9.5px; letter-spacing: 0.1em; }

  /* 07 · Horizon */
  .horizon__title {
    font-size: clamp(34px, 9vw, 56px);
    padding: 0 6vw;
  }

  /* 08 · Phone (Roadmap) */
  .away {
    padding: 12vh 6vw 10vh;
    gap: 32px;
  }
  .away__copy h2 { font-size: clamp(32px, 8.5vw, 44px); }
  .away__copy p { font-size: 14px; line-height: 1.5; }
  .phone {
    width: min(280px, 82vw);
    height: auto;
    aspect-ratio: 9 / 18.5;
    max-height: 540px;
    border-radius: 36px;
  }
  .phone__notch { width: 90px; height: 20px; }
  .call { padding-top: 76px; }
  .call__avatar { width: 76px; height: 76px; }
  .call__name { font-size: 18px; margin-top: 10px; }
  .call__state { font-size: 11px; }
  .call__lines { font-size: 12.5px; max-width: 88%; margin-top: 12px; }
  .toast {
    width: calc(100% - 20px);
    left: 10px;
    top: 36px;
    padding: 8px 10px;
    font-size: 11px;
  }
  .cbtn { width: 54px; height: 54px; font-size: 19px; }

  /* 09 · Closing CTA */
  .cta__badge { font-size: 10px; padding: 6px 14px; }
  .cta__word { font-size: clamp(52px, 16vw, 84px); }
  .cta__soon { font-size: 16px; margin: 10px 0 24px; }
  .cta .btn { padding: 14px 22px; font-size: 12.5px; }
  .foot { flex-direction: column; align-items: center; gap: 10px; padding-bottom: 24px; font-size: 11px; }
  .foot a { margin: 0 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .grain, .hero__scroll i::after, .loader__ring, .hero__orbit, .pact__orbit { animation: none; }
}
