/* Paralife — page-specific styles.
   Load order: portfolio.css → portfolio-components.css → this file. */

#runway { height: 400vh; }

/* Clears the fixed header panel once it settles over the tech rows. */
#tech-content { padding-top: 72px; }

#header-panel { padding: 24px 32px 16px; width: min(560px, 60vw); }

#title-overlay {
  display: block;
  margin: 0 auto;
  font-family: 'Major Mono Display', monospace;
  font-size: clamp(20px, 3.5vw, 42px);
  color: #0cc;
  letter-spacing: 0.05em;
}

#subtitle {
  font-size: clamp(12px, 1.3vw, 16px);
  color: rgba(255, 255, 255, 0.3);
  margin-top: 4px;
  letter-spacing: 0.12em;
}

/* -- Opening narrative ------------------------------------------------- */
#opening-story,
#opening-visuals {
  position: fixed;
  inset: 0;
  z-index: 10;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.opening-line {
  position: absolute;
  isolation: isolate;
  margin: 0;
  opacity: 0;
  font-size: clamp(18px, 2.5vw, 28px);
  line-height: 1.4;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.8);
  will-change: opacity, transform;
}

.opening-line::before {
  content: '';
  position: absolute;
  inset: -0.55em -0.8em;
  z-index: -1;
  background: rgba(3, 8, 10, 0.76);
  border-radius: 8px;
  box-shadow:
    0 14px 36px rgba(0, 0, 0, 0.34),
    inset 0 0 0 1px rgba(0, 204, 204, 0.10);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.opening-line[data-beat="world"] {
  left: 8vw;
  right: 8vw;
  top: 42%;
  transform: translateY(-50%);
  text-align: center;
  font-size: clamp(20px, 3vw, 36px);
  color: rgba(255, 180, 100, 0.85);
}

.opening-line[data-beat="perception"] {
  left: 50%;
  top: 72%;
  width: min(560px, 60vw);
  transform: translate(-50%, -50%);
  text-align: center;
  color: rgba(255, 200, 140, 0.85);
}

.opening-line[data-beat="emergence"] {
  left: 50%;
  bottom: 16%;
  width: min(720px, 80vw);
  transform: translateX(-50%);
  text-align: center;
  color: rgba(200, 220, 200, 0.85);
}

#morph-frame {
  fill: rgba(0, 204, 204, 0.03);
  stroke: rgba(0, 204, 204, 0.35);
  stroke-width: 1;
  stroke-dasharray: 5 5;
}

.content-surface {
  fill: rgba(3, 8, 10, 0.72);
  stroke: rgba(0, 204, 204, 0.14);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

#network-surface { fill: rgba(3, 8, 10, 0.58); }
#inset-surface { fill: rgba(3, 8, 10, 0.80); }

#observed-entity,
.vision-glyph {
  font-family: 'Courier New', Courier, 'Liberation Mono', monospace;
  font-size: 18px;
  text-anchor: middle;
  dominant-baseline: central;
  filter: drop-shadow(0 0 6px currentColor);
}

.vision-frame {
  fill: rgba(0, 204, 204, 0.03);
  stroke: rgba(0, 204, 204, 0.35);
  stroke-width: 1;
  stroke-dasharray: 5 5;
}
#perception-label,
.vision-label {
  fill: rgba(255, 255, 255, 0.5);
  text-anchor: middle;
  font-size: 11px;
  letter-spacing: 0.16em;
}

#perception-label,
.vision-label,
#legend-layer text,
#network-layer text { font-family: 'Share Tech Mono', monospace; }

.network-link {
  fill: none;
  stroke: rgba(0, 204, 204, 0.36);
  stroke-width: 1;
}

.server-pulse { fill: none; stroke: #0cc; stroke-width: 1.5; opacity: 0; pointer-events: none; }
.wire-packet { fill: #0cc; filter: drop-shadow(0 0 4px rgba(0, 204, 204, 0.9)); opacity: 0; pointer-events: none; }

.client-node {
  fill: var(--client-color, #0cc);
  font-family: 'Courier New', Courier, 'Liberation Mono', monospace;
  font-size: 14px;
  text-anchor: middle;
  dominant-baseline: central;
}
.client-identity-ring { fill: none; stroke: rgba(255, 255, 255, 0.44); stroke-width: 1; }
.network-client[data-state="lagging"] .client-identity-ring { stroke-dasharray: 2 3; stroke-width: 2; }
.network-client[data-state="stalled"] .client-identity-ring { stroke: #f96; stroke-dasharray: 1 3; stroke-width: 2; }
.network-client[data-state="reconnecting"] .client-identity-ring { stroke: #fc6; stroke-dasharray: 5 3; stroke-width: 2; }
.network-client[data-state="recovered"] .client-identity-ring { stroke: #0ea; stroke-width: 2; }
.network-link[data-state="lagging"],
.network-link[data-state="reconnecting"] { stroke-dasharray: 6 5; }
.network-link[data-state="stalled"] { opacity: 0; }
#morph-frame[data-role="server"] { fill: rgba(0, 204, 204, 0.10); stroke: #0cc; stroke-width: 1.5; stroke-dasharray: none; }
#server-label { fill: rgba(255, 255, 255, 0.82); text-anchor: middle; font-size: 12px; letter-spacing: 0.08em; }

/* Durability state readout — a filled pill + bold label, colour-coded by phase
   so the network-instability handling reads at a glance. */
#recovery-label {
  text-anchor: middle;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  fill: #fff;
}
#recovery-label[data-phase="stalled"]      { fill: #ffb99a; }
#recovery-label[data-phase="reconnecting"] { fill: #ffe0a0; }
#recovery-label[data-phase="recovered"]    { fill: #8ff0d2; }

.state-pill { fill: rgba(0, 0, 0, 0.6); stroke-width: 1.5; }
.state-pill[data-phase="stalled"]      { stroke: #f96; filter: drop-shadow(0 0 7px rgba(255, 153, 102, 0.75)); }
.state-pill[data-phase="reconnecting"] { stroke: #fc6; filter: drop-shadow(0 0 7px rgba(255, 204, 102, 0.75)); }
.state-pill[data-phase="recovered"]    { stroke: #0ea; filter: drop-shadow(0 0 8px rgba(0, 234, 170, 0.8)); }
.state-pill[data-phase="static"]       { stroke: rgba(255, 255, 255, 0.5); }

#reconnect-path {
  fill: none;
  stroke: #fc6;
  stroke-width: 2.5;
  stroke-dasharray: 7 5;
  filter: drop-shadow(0 0 4px rgba(255, 204, 102, 0.6));
  animation: reconnect-dash 0.6s linear infinite;
}
@keyframes reconnect-dash { to { stroke-dashoffset: -12; } }
.resume-token { fill: #fc6; filter: drop-shadow(0 0 6px #fc6); pointer-events: none; }

/* The one connection telling the durability story — brighter, glowing, so the
   eye locks onto it in the ring while its phase changes. */
.network-client[data-protagonist="true"] .client-identity-ring { stroke: rgba(255, 255, 255, 0.7); stroke-width: 1.5; }
.network-client[data-protagonist="true"][data-state="stalled"] .client-node,
.network-client[data-protagonist="true"][data-state="reconnecting"] .client-node,
.network-client[data-protagonist="true"][data-state="recovered"] .client-node {
  filter: drop-shadow(0 0 8px var(--client-color, #0cc));
}
#frame-inset { pointer-events: none; }
.inset-cell { stroke: rgba(0, 204, 204, 0.22); stroke-width: 1; }
.inset-codec { fill: #0cc; font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; }
.inset-label { fill: rgba(255, 255, 255, 0.6); font-size: 11px; letter-spacing: 0.14em; }
.inset-arrow { fill: rgba(0, 204, 204, 0.65); font-size: 10px; letter-spacing: 0.1em; }
.inset-bytes { fill: rgba(0, 204, 204, 0.92); font-size: 13px; letter-spacing: 0.04em; }
.inset-caption { fill: rgba(255, 255, 255, 0.45); font-size: 10px; letter-spacing: 0.08em; }
.inset-codec, .inset-label, .inset-arrow, .inset-bytes, .inset-caption { font-family: 'Share Tech Mono', monospace; }
.grace-label {
  fill: #ffcf99;
  text-anchor: middle;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.14em;
  font-family: 'Share Tech Mono', monospace;
  filter: drop-shadow(0 0 6px rgba(255, 153, 102, 0.85));
  pointer-events: none;
}

#legend-layer text { text-anchor: middle; fill: rgba(255, 255, 255, 0.78); }
#legend-layer .legend-species { font-size: clamp(16px, 2vw, 24px); letter-spacing: 0.16em; }
#legend-layer .legend-catalyst { fill: #ff9f43; }
#legend-layer .legend-membrane { fill: #b47cf0; }
#legend-layer .legend-spore { fill: #3fe0e8; }
#legend-layer .legend-detail { font-size: clamp(9px, 1.05vw, 13px); letter-spacing: 0.06em; }
#legend-cycle { font-size: clamp(10px, 1.2vw, 15px); letter-spacing: 0.08em; }

.inset-glyph {
  font-family: 'Courier New', Courier, 'Liberation Mono', monospace;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.opening-line[data-beat="concurrency"] {
  left: 16vw;
  top: 35%;
  width: min(390px, 34vw);
  color: rgba(50, 230, 160, 0.85);
}

/* Title over the server illustration — labels the disconnect/reconnect demo.
   Amber to match the stall/reconnect pills, so label and animation read as one.
   Position and font-size are set per layout in paralife-opening.js. */
#durability-title {
  fill: #fc6;
  text-anchor: middle;
  letter-spacing: 0.2em;
  font-family: 'Share Tech Mono', monospace;
}

/* -- Row 1: architecture SVG ------------------------------------------- */
.arch-svg { max-width: 380px; padding: 8px 0; }

.arch-label-sm {
  fill: rgba(0, 204, 204, 0.6);
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  text-anchor: middle;
  dominant-baseline: central;
}

.arch-node-vt {
  fill: rgba(190, 140, 255, 0.07);
  stroke: rgba(190, 140, 255, 0.35);
}

.arch-queue { fill: rgba(190, 140, 255, 0.7); }
.arch-dot { fill: #0cc; filter: drop-shadow(0 0 5px #0cc); }

.row-title-hero { align-self: end; }

/* -- Row 2: carrier pinning -------------------------------------------- */
.pin-svg { width: 100%; max-width: 420px; }

.pin-lane-label {
  fill: #0cc;
  font-family: 'Share Tech Mono', monospace;
  font-size: 15px;
}

.pin-rail {
  fill: rgba(0, 204, 204, 0.12);
  stroke: rgba(0, 204, 204, 0.5);
  stroke-width: 1.5;
}
.pin-rail-bad {
  fill: rgba(255, 102, 51, 0.18);
  stroke: rgba(255, 102, 51, 0.7);
}

.pin-rail-label,
.pin-count {
  fill: rgba(255, 255, 255, 0.45);
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  text-anchor: middle;
}
.pin-count { text-anchor: end; }
.pin-count-bad  { fill: #f96; }
.pin-count-good { fill: #0ea; }

.pin-chip rect {
  fill: rgba(190, 140, 255, 0.15);
  stroke: rgba(190, 140, 255, 0.6);
  stroke-width: 1.5;
}
.pin-chip text {
  fill: #fff;
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  text-anchor: middle;
  dominant-baseline: central;
}
.pin-chip-bad rect { fill: rgba(255, 102, 51, 0.35); stroke: #f96; }
.pin-chip-dim { opacity: 0.4; }
.pin-chip-parked { opacity: 0.35; }

.pin-verdict {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
}
.pin-verdict-bad  { fill: rgba(255, 130, 90, 0.9); }
.pin-verdict-good { fill: rgba(0, 234, 170, 0.9); }

/* -- Row 3: backpressure ----------------------------------------------- */
.bp-svg { width: 100%; max-width: 440px; }

.bp-tick {
  fill: rgba(0, 204, 204, 0.1);
  stroke: rgba(0, 204, 204, 0.6);
  stroke-width: 1.5;
}
.bp-client {
  fill: rgba(190, 140, 255, 0.07);
  stroke: rgba(190, 140, 255, 0.35);
  stroke-width: 1.5;
}
.bp-label {
  fill: #fff;
  font-family: 'Share Tech Mono', monospace;
  font-size: 14px;
  text-anchor: middle;
  dominant-baseline: central;
}
.bp-sublabel {
  fill: rgba(0, 204, 204, 0.55);
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  text-anchor: middle;
}
.bp-frame { fill: #0cc; filter: drop-shadow(0 0 4px #0cc); }

.bp-queue-outline { stroke: rgba(0, 204, 204, 0.5); stroke-width: 1.5; }
.bp-queue-fill { fill: #f96; }

.bp-badge { fill: rgba(0, 0, 0, 0.4); stroke-width: 1.5; }
.bp-badge-active  { stroke: #0ea; }
.bp-badge-stalled { stroke: #f96; }
.bp-badge-expired { stroke: rgba(255, 255, 255, 0.3); }
.bp-badge-text {
  fill: #fff;
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  text-anchor: middle;
  dominant-baseline: central;
}

.bp-grid rect { stroke: rgba(255, 255, 255, 0.2); }
.bp-grid path { stroke: rgba(255, 255, 255, 0.08); }
.bp-entity { fill: #0ea; filter: drop-shadow(0 0 6px #0ea); }
.bp-ring {
  stroke: #fc6;
  stroke-width: 2;
  stroke-dasharray: 151;
  stroke-dashoffset: 0;
  transform: rotate(-90deg);
  transform-origin: 50px 50px;
}
.bp-grace {
  fill: #fc6;
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  text-anchor: middle;
}
.bp-token { fill: #fc6; filter: drop-shadow(0 0 6px #fc6); }

@media (max-width: 800px) {
  .opening-line::before { background: rgba(3, 8, 10, 0.84); }
  #network-surface { fill: rgba(3, 8, 10, 0.68); }
  #inset-surface { fill: rgba(3, 8, 10, 0.86); }

  .opening-line[data-beat="world"] {
    left: 4vw;
    right: 4vw;
    top: 38%;
    font-size: clamp(20px, 6vw, 30px);
  }

  .opening-line[data-beat="perception"],
  .opening-line[data-beat="emergence"] {
    width: 84vw;
    font-size: clamp(18px, 5vw, 24px);
  }

  .opening-line[data-beat="concurrency"] {
    left: 7vw;
    right: 7vw;
    top: 18%;
    width: auto;
    text-align: center;
    font-size: clamp(19px, 5.4vw, 26px);
  }
}

@media (max-width: 600px) {
  .opening-line[data-beat="perception"],
  .opening-line[data-beat="emergence"] {
    top: 15%;
    bottom: auto;
    width: 84vw;
    transform: translateX(-50%);
  }

  .opening-line[data-beat="perception"] {
    transform: translate(-50%, 0);
  }

  .opening-line[data-beat="concurrency"] {
    top: 15%;
  }

  #durability-title {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .opening-line,
  #opening-visuals * {
    transition: opacity 120ms linear;
    animation: none !important;
  }
}
