/* ==========================================================================
   v8.css. Version 8 on top of site.css: the hero with the digital twin's box,
   the project cards that lead with a picture and a number, the lean project
   view, and the twin's chat. Colors and sizes come from tokens.css.
   Dark only.
   ========================================================================== */

/* -------------------------------- hero -------------------------------- */
.v8-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.hero { padding: 104px 0 72px; }
.hero-shade {
  background:
    radial-gradient(ellipse 62% 70% at 50% 50%,
      color-mix(in srgb, var(--bg) 88%, transparent) 0%,
      color-mix(in srgb, var(--bg) 58%, transparent) 50%,
      transparent 82%),
    linear-gradient(to bottom,
      color-mix(in srgb, var(--bg) 66%, transparent) 0%,
      transparent 18%,
      transparent 76%,
      var(--bg) 100%);
}
.v8-hero .hero-name {
  margin-top: 20px;
  font-size: clamp(1.25rem, 2vw, 1.6rem);
  letter-spacing: -0.01em;
  font-weight: 600;
  color: var(--text);
}
.v8-hero .hero-role {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 400;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--text-2);
}
.v8-hero .role-stack { justify-items: center; }
.hero-headline {
  margin-top: 22px;
  max-width: 17ch;
  font-family: var(--font-display);
  font-size: clamp(2.3rem, 5.6vw, 4.6rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.035em;
  color: var(--text);
  text-wrap: balance;
}
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .hero-headline {
    background: linear-gradient(180deg, #ffffff 0%, #cfe0ff 62%, #8fb4ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
  }
}
.v8-hero .hero-lede { margin-top: 16px; max-width: 52ch; font-size: 1.05rem; }
.v8-hero .hero-actions { justify-content: center; margin-top: 22px; }
.v8-hero .hero-actions .btn { min-height: 44px; }
.v8-hero .hero-stats { margin: 36px auto 0; text-align: left; width: 100%; }

/* ------------------------------ the ask box ------------------------------ */
.tw-hero { width: 100%; max-width: 720px; margin-top: 30px; }
.tw-field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 7px 7px 7px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-3) 86%, transparent);
  box-shadow: 0 0 0 1px rgba(79, 216, 255, 0.08), 0 18px 60px rgba(0, 0, 0, 0.5), 0 0 60px rgba(79, 216, 255, 0.10);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.tw-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 216, 255, 0.22), 0 18px 60px rgba(0, 0, 0, 0.5), 0 0 70px rgba(79, 216, 255, 0.18);
}
.tw-field-orb,
.tw-fab-orb {
  position: relative;
  flex: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, var(--accent) 34%, var(--accent-2) 72%, transparent 74%);
  box-shadow: 0 0 18px rgba(79, 216, 255, 0.7);
  animation: tw-breathe 3.6s var(--ease-in-out) infinite;
}
@keyframes tw-breathe {
  0%, 100% { transform: scale(0.9); box-shadow: 0 0 12px rgba(79, 216, 255, 0.5); }
  50% { transform: scale(1.06); box-shadow: 0 0 24px rgba(143, 125, 255, 0.8); }
}
.tw-input {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1.05rem;
  text-align: left;
}
.tw-input::placeholder { color: var(--text-3); opacity: 1; }
.tw-input:focus { outline: none; }
.tw-send {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 48px; height: 48px;
  border: 0;
  border-radius: 50%;
  background: var(--grad);
  color: var(--text-on-accent);
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease), filter var(--t-fast) var(--ease);
}
.tw-send:hover { transform: scale(1.05); filter: brightness(1.1); }
.tw-send:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.tw-send[disabled] { opacity: 0.5; cursor: default; transform: none; }

.tw-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}
.tw-chip {
  min-height: 36px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel-solid) 80%, transparent);
  color: var(--text-2);
  font: inherit;
  font-size: var(--fs-small);
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.tw-chip:hover { color: var(--text); border-color: var(--line-strong); background: var(--panel-hi); }
.tw-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tw-note {
  margin-top: 12px;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-3);
}

/* ----------------------------- floating button ----------------------------- */
.tw-fab {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 18px 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-3) 92%, transparent);
  box-shadow: var(--shadow), 0 0 40px rgba(79, 216, 255, 0.14);
  color: var(--text);
  font-size: var(--fs-small);
  font-weight: 600;
  text-decoration: none;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--ease), border-color var(--t-fast) var(--ease);
}
.tw-fab.is-on { opacity: 1; transform: none; pointer-events: auto; }
.tw-fab:hover { border-color: var(--accent); }
.tw-fab:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
html.locked .tw-fab { display: none; }

.nav-menu .nav-twin { color: var(--accent); }

/* ------------------------------ project cards ------------------------------ */
.v8-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  background: linear-gradient(180deg, var(--bg-3) 0%, var(--bg-2) 100%);
}
.v8-card:hover,
.v8-card:focus-within {
  background: linear-gradient(180deg, #0f1730 0%, var(--bg-2) 100%);
  border-color: var(--line-strong);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45), 0 0 50px rgba(79, 216, 255, 0.08);
}
.v8-card:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.v8-art {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(ellipse 80% 90% at 90% 0%, rgba(79, 216, 255, 0.16), transparent 62%),
    radial-gradient(ellipse 80% 90% at 0% 100%, rgba(143, 125, 255, 0.16), transparent 62%),
    #060a16;
}
.grid-more .v8-art { aspect-ratio: 16 / 9; }
.v8-art > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.v8-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(6, 10, 22, 0.78) 0%, rgba(6, 10, 22, 0) 30%, rgba(6, 10, 22, 0) 46%, rgba(6, 10, 22, 0.94) 100%);
  pointer-events: none;
}
.v8-kicker {
  position: absolute;
  z-index: 2;
  top: 14px; left: 16px; right: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--text-2);
}
.v8-n { color: var(--accent); }
.v8-num {
  position: absolute;
  z-index: 2;
  left: 16px; right: 16px; bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.v8-num-v {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 3.2vw, 2.9rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: #ffffff;
  text-shadow: 0 0 30px rgba(54, 240, 176, 0.35);
}
.v8-num-v.is-text { font-size: clamp(1.4rem, 2vw, 1.8rem); }
.v8-num-l {
  max-width: 34ch;
  font-size: var(--fs-small);
  line-height: 1.35;
  color: var(--accent-3);
}
.grid-more .v8-num-v { font-size: clamp(1.6rem, 2.2vw, 2rem); }
.grid-more .v8-num-v.is-text { font-size: 1.25rem; }
.grid-more .v8-num-l { font-size: 0.8rem; }

.v8-card .card-body { gap: 10px; padding: 16px 18px 20px; }
.v8-card .card-body .label { color: var(--text-3); }
.v8-card .card-title { font-size: 1.08rem; }
.grid-more .v8-card .card-title { font-size: 0.98rem; }
.v8-line {
  font-size: var(--fs-small);
  line-height: 1.5;
  color: var(--text-2);
}
.v8-tag {
  display: inline-block;
  margin-right: 8px;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  vertical-align: 1px;
  color: var(--text-3);
}

/* ------------------------------ the drawings ------------------------------ */
.cv path, .cv circle, .cv rect { vector-effect: non-scaling-stroke; }
.cv .cv-grid { fill: none; stroke: rgba(128, 168, 255, 0.07); stroke-width: 1; }
.cv .cv-track { fill: none; stroke: rgba(168, 181, 210, 0.38); stroke-width: 1.4; }
.cv .cv-tie { fill: none; stroke: rgba(168, 181, 210, 0.22); stroke-width: 1.2; }
.cv .cv-warn { fill: none; stroke: var(--warn); stroke-width: 1.4; opacity: 0.75; }
.cv .cv-faint { fill: none; stroke: rgba(79, 216, 255, 0.45); stroke-width: 1.2; }
.cv .cv-accent { fill: none; stroke: var(--accent); stroke-width: 2; }
.cv .cv-model { fill: none; stroke: var(--accent-2); stroke-width: 2.4; }
.cv .cv-result { fill: none; stroke: var(--accent-3); stroke-width: 2.6; }
.cv .cv-glow { stroke-width: 9; opacity: 0.18; filter: blur(3px); }
.cv .cv-glow-line { stroke-width: 2.6; filter: drop-shadow(0 0 4px var(--accent-2)); }
.cv .cv-dash { stroke-dasharray: 5 6; }
.cv .cv-link { fill: none; stroke: rgba(128, 168, 255, 0.13); stroke-width: 1; }
.cv .cv-node { fill: #0c1426; stroke: rgba(128, 168, 255, 0.5); stroke-width: 1.2; }
.cv .cv-tick { fill: none; stroke: rgba(255, 180, 84, 0.45); stroke-width: 1; }
.cv .cv-base { fill: none; stroke: rgba(168, 181, 210, 0.35); stroke-width: 1; }
.cv .cv-bar { fill: rgba(79, 216, 255, 0.18); stroke: rgba(79, 216, 255, 0.4); stroke-width: 1; }
.cv .cv-pt { fill: rgba(79, 216, 255, 0.5); }
.cv .cv-box-fill { fill: rgba(79, 216, 255, 0.05); }
.cv .cv-packet { fill: var(--accent); }
.cv .cv-dot-model { fill: var(--accent-2); filter: drop-shadow(0 0 6px var(--accent-2)); }
.cv .cv-dot-result { fill: var(--accent-3); filter: drop-shadow(0 0 6px var(--accent-3)); }
.cv .cv-dot-accent { fill: var(--accent); }
.cv .cv-fill-accent { fill: var(--accent); opacity: 0.8; }
.cv .cv-fill-model { fill: var(--accent-2); opacity: 0.9; }
.cv .cv-fill-result { fill: var(--accent-3); opacity: 0.85; }
.cv .cv-obstacle { fill: rgba(255, 180, 84, 0.16); stroke: rgba(255, 180, 84, 0.55); stroke-width: 1; }
.cv .cv-ring { fill: none; stroke: var(--accent-3); stroke-width: 1.2; opacity: 0.6; }
.cv .cv-wall { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linejoin: round; }
.cv .cv-cell-ok { fill: rgba(54, 240, 176, 0.32); }
.cv .cv-cell-warn { fill: rgba(255, 180, 84, 0.6); }
.cv .cv-cell-bad { fill: rgba(255, 107, 129, 0.7); }

/* Gentle motion, only when the visitor allows it. */
@media (prefers-reduced-motion: no-preference) {
  .cv .cv-flow { stroke-dasharray: 14 10; animation: cv-flow 2.4s linear infinite; }
  .cv .cv-pulse { animation: cv-pulse 2.2s var(--ease-in-out) infinite; transform-box: fill-box; transform-origin: center; }
  .cv .cv-scan { animation: cv-scan 5s var(--ease-in-out) infinite; }
}
@keyframes cv-flow { to { stroke-dashoffset: -48; } }
@keyframes cv-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.35); } }
@keyframes cv-scan { 0% { transform: translateX(-10px); opacity: 0; } 15% { opacity: 0.8; } 85% { opacity: 0.8; } 100% { transform: translateX(410px); opacity: 0; } }

/* ------------------------------ project view ------------------------------ */
.v8-po-head .label { color: var(--accent); }
.v8-po-art {
  position: relative;
  margin-top: clamp(24px, 3vw, 40px);
  aspect-ratio: 21 / 6;
  max-height: 300px;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  background:
    radial-gradient(ellipse 60% 90% at 85% 0%, rgba(79, 216, 255, 0.14), transparent 62%),
    radial-gradient(ellipse 60% 90% at 0% 100%, rgba(143, 125, 255, 0.14), transparent 62%),
    #060a16;
}
.v8-po-art > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.v8-po {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(18px, 2.4vw, 28px);
  margin-top: clamp(24px, 3vw, 40px);
}
.v8-sec {
  min-width: 0;
  padding: clamp(18px, 2vw, 26px);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  background: color-mix(in srgb, var(--panel-solid) 70%, transparent);
}
.v8-sec.is-wide { grid-column: 1 / -1; }
.v8-h {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--text-2);
}
.v8-h-n { color: var(--accent); }
.v8-say {
  font-family: var(--font-display);
  font-size: clamp(1.08rem, 1.5vw, 1.3rem);
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}
.v8-sec .v8-say + * { margin-top: 16px; }
.v8-po-more {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: clamp(24px, 3vw, 36px);
}
.v8-po-more .btn { min-height: 46px; }
.po-story[hidden] { display: none; }

@media (max-width: 820px) {
  .v8-po { grid-template-columns: 1fr; }
  .v8-po-art { aspect-ratio: 16 / 7; }
}

/* ------------------------------- the twin chat ------------------------------- */
.overlay-twin .overlay-scroll { display: flex; flex-direction: column; }
.tw-log {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: clamp(20px, 4vw, 44px) var(--gutter) 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.tw-msg { display: flex; gap: 12px; max-width: 100%; animation: rise var(--t-med) var(--ease) both; }
.tw-user { justify-content: flex-end; }
.tw-user p {
  max-width: 82%;
  padding: 11px 16px;
  border-radius: 18px 18px 4px 18px;
  background: var(--grad-soft);
  border: 1px solid var(--line-strong);
  color: var(--text);
  overflow-wrap: anywhere;
}
.tw-avatar {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: radial-gradient(circle at 50% 40%, #0f1a33, #060a16);
  box-shadow: 0 0 18px rgba(79, 216, 255, 0.18);
}
.twin-orb-svg { width: 26px; height: 26px; }
.twin-orb-svg .o-ring { fill: none; stroke: rgba(79, 216, 255, 0.4); stroke-width: 1.2; }
.twin-orb-svg .o-core { fill: rgba(143, 125, 255, 0.35); }
.twin-orb-svg .o-wave { fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tw-bubble {
  min-width: 0;
  max-width: calc(100% - 46px);
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 4px 18px 18px 18px;
  background: color-mix(in srgb, var(--panel-solid) 85%, transparent);
  color: var(--text);
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.tw-bubble p + p, .tw-bubble p + ul, .tw-bubble ul + p { margin-top: 10px; }
.tw-bubble ul { padding-left: 18px; }
.tw-bubble li + li { margin-top: 4px; }
.tw-bubble a { color: var(--accent); }

/* Pictures inside Kamal's approved answers (twin.js formatAnswer): number cards,
   a simple table that scrolls in its own box, and numbered step boxes. */
.tw-bubble .tw-metrics, .tw-bubble .tw-steps { list-style: none; padding: 0; }
.tw-metrics, .tw-steps, .tw-table-wrap { margin: 12px 0; }
.tw-bubble > :first-child { margin-top: 0; }
.tw-bubble > :last-child { margin-bottom: 0; }
.tw-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tw-bubble .tw-metric { margin: 0; }
.tw-metric {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  background: var(--grad-soft);
}
.tw-metric-v {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--accent-3);
}
.tw-metric-l { font-size: var(--fs-small); line-height: 1.4; color: var(--text-2); }
.tw-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  -webkit-overflow-scrolling: touch;
}
.tw-table-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tw-table { width: 100%; min-width: 420px; border-collapse: collapse; font-size: var(--fs-small); line-height: 1.45; overflow-wrap: normal; }
.tw-table th, .tw-table td { padding: 8px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.tw-table th {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--accent);
  background: var(--panel-hi);
}
.tw-table tbody tr:last-child td { border-bottom: 0; }
.tw-table td:first-child { color: var(--text); font-weight: 600; }
.tw-table td { color: var(--text-2); }
.tw-steps { display: flex; flex-wrap: wrap; gap: 10px; counter-reset: twstep; }
.tw-bubble .tw-step { margin: 0; }
.tw-step {
  counter-increment: twstep;
  position: relative;
  flex: 1 1 150px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  background: color-mix(in srgb, var(--panel-hi) 70%, transparent);
  font-size: var(--fs-small);
  line-height: 1.45;
}
.tw-step::before {
  content: counter(twstep);
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--grad);
  color: var(--text-on-accent);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
}
.tw-chips li[hidden] { display: none; }
.tw-more { color: var(--accent); border-style: dashed; }
.tw-caret {
  display: inline-block;
  width: 7px; height: 1em;
  margin-left: 2px;
  vertical-align: -2px;
  background: var(--accent);
  animation: tw-blink 0.9s steps(2) infinite;
}
@keyframes tw-blink { 50% { opacity: 0; } }
.tw-dots { display: inline-flex; gap: 5px; padding: 6px 0; }
.tw-dots i {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: tw-dot 1.1s var(--ease-in-out) infinite;
}
.tw-dots i:nth-child(3) { animation-delay: 0.15s; }
.tw-dots i:nth-child(4) { animation-delay: 0.3s; }
@keyframes tw-dot { 0%, 100% { opacity: 0.25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

.tw-rels { display: grid; gap: 10px; margin: 14px 0 2px; padding: 0; list-style: none; }
.tw-rel {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 8px;
  padding-right: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  background: var(--bg-2);
  color: var(--text);
  text-decoration: none;
  transition: border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.tw-rel:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.tw-rel:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tw-rel-art {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--r-s);
  background: #060a16;
}
.tw-rel-art > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.tw-rel-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tw-rel-t { font-weight: 600; line-height: 1.3; }
.tw-rel-v { font-family: var(--font-mono); font-size: var(--fs-small); color: var(--accent-3); }
.tw-rel-go { color: var(--accent); }

.tw-dock {
  position: relative;
  z-index: 2;
  flex: none;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-2) 94%, transparent);
  padding: 10px var(--gutter) max(12px, env(safe-area-inset-bottom));
}
.tw-dock-in { max-width: 780px; margin: 0 auto; text-align: center; }
.tw-toggle {
  padding: 4px 8px;
  border: 0;
  background: transparent;
  color: var(--text-3);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}
.tw-toggle:hover { color: var(--text); }
.tw-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.tw-chips-row { margin: 6px 0 10px; }
.tw-chips-row[hidden] { display: none; }
.tw-form .tw-field { min-height: 56px; }
.tw-dock .tw-note { margin-top: 8px; }

/* ------------------------------- small screens ------------------------------- */
@media (max-width: 720px) {
  .hero { padding: 88px 0 56px; }
  .hero-headline { font-size: clamp(2.05rem, 9.4vw, 2.8rem); max-width: 14ch; }
  .tw-hero { margin-top: 24px; }
  .tw-field { min-height: 56px; padding-left: 14px; }
  .tw-input { font-size: 1rem; }
  .tw-send { width: 44px; height: 44px; }
  .tw-chips { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter));
    padding: 0 var(--gutter) 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .tw-chips::-webkit-scrollbar { display: none; }
  /* Opened in the hero, the chips wrap; in the chat they stay one sideways row, so the answers keep the screen. */
  .tw-chips.is-open:not(.tw-chips-row) { flex-wrap: wrap; overflow-x: visible; }
  .tw-metric-v { font-size: 1.35rem; }
  .tw-chips li { flex: none; }
  .tw-chips-row { flex-wrap: nowrap; }
  .v8-hero .hero-stats { text-align: left; }
  .tw-rel { grid-template-columns: 72px minmax(0, 1fr) auto; gap: 10px; }
  .tw-user p { max-width: 90%; }
  .tw-twin .tw-avatar { display: none; }
  .tw-bubble { max-width: 100%; }
  .tw-log { gap: 14px; }
  /* The focus filters scroll sideways instead of filling the first screen. */
  .filters { flex-wrap: nowrap; overflow-x: auto; margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter));
    padding: 0 var(--gutter) 6px; scrollbar-width: none; }
  .filters::-webkit-scrollbar { display: none; }
  .filters .chip { flex: none; }
}

/* ------------------------- 2026-10-12 review, round 1 ------------------------- */
/* The hero box holds its place before the scripts run, so the hero does not jump (layout shift 0.51 before). */
html:not(.js) .tw-hero.needs-js { display: block; visibility: hidden; }
/* The floating button is a small round mark at every width; its words stay for screen readers. */
.tw-fab { padding: 0; width: 52px; height: 52px; justify-content: center; }
.tw-fab-orb { width: 24px; height: 24px; }
/* The ask box shows a plain focus ring, like every other control. */
.tw-field:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
/* Tighter rhythm between sections (reviewers: about 300 px of empty space). */
.section { padding: clamp(52px, 7vw, 96px) 0; }
/* The big number on a card sits on a scrim, so the drawing never crosses its words. */
.v8-num {
  left: 10px; right: 10px; bottom: 10px;
  padding: 10px 10px 8px;
  border-radius: 10px;
  background: linear-gradient(0deg, rgba(4, 6, 12, 0.88), rgba(4, 6, 12, 0.62));
}
/* Letters on a certificate without a scan are text, so they meet 4.5 to 1. */
.cert-thumb.is-blank span { color: var(--text-2); }
/* Where he is, next to the status; on a phone, on its own line. */
.status-place { color: var(--text-2); }
.status-place::before { content: "\00b7"; margin: 0 0.6em; }
/* Sections after the first screens skip layout and paint until they come near (mobile blocking time). */
#tour, #how, #experience, #skills, #learning, #notes, #certificates, #education, #beyond, #beliefs, #contact {
  content-visibility: auto;
  contain-intrinsic-size: auto 900px;
}
/* ------------------------- 2026-10-12 review, round 2 ------------------------- */
/* Section numbers come from the page order (main.js), since the sections render in their own containment. */
.sec-idx::before { counter-increment: none; content: attr(data-n); }
/* Hero: the proof right under the claim, in sentence case a reader can scan; the name reads as the label it is. */
.v8-hero .hero-name { font-size: clamp(1.5rem, 2.4vw, 2rem); }
.v8-hero .hero-stats { margin-top: 26px; }
.v8-hero .stat dt { font-family: var(--font-body); font-size: var(--fs-small); letter-spacing: 0; text-transform: none; line-height: 1.45; }
.v8-hero .hero-actions { margin-top: 26px; }
/* Room between the pictures inside a project section. */
.v8-sec > * + * { margin-top: 24px; }
/* "My part" on the project page. */
.v8-part { margin-top: 14px; font-size: var(--fs-body); line-height: 1.55; color: var(--text-2); }
/* A certificate without a scan is a plain text card, not an empty frame of letters. */
.cert-thumb.is-blank { display: none; }
@media (max-width: 640px) {
  /* On a phone the round button covered words; the twin stays in the menu and the hero box. */
  .tw-fab { display: none; }
}

/* ------------------------- 2026-10-12 review, round 3 ------------------------- */
/* The role line and the employer line on cards are facts a recruiter scans for: body type, sentence case. */
.v8-hero .hero-role { font-family: var(--font-body); font-size: 0.95rem; letter-spacing: 0; text-transform: none; }
.v8-card .card-body > .label { font-family: var(--font-body); font-size: 0.8rem; letter-spacing: 0.01em; text-transform: none; color: var(--text-2); }
/* Certificates without a scan sit at the end as short text cards. */
.cert-slot.is-text { align-self: start; }
.cert-slot.is-text .cert { min-height: 0; }
/* The thesis citation, shown as text. */
.pub-cite { margin-top: 14px; font-size: var(--fs-small); line-height: 1.55; color: var(--text-2); }
.pub-cite .label { margin-right: 8px; }

/* ------------------------- 2026-10-12 review, round 4 ------------------------- */
/* Resume one tap away inside a project. */
.overlay-resume { margin-left: auto; min-height: 40px; padding: 0 16px; }
.overlay-contact { min-height: 40px; padding: 0 16px; }
/* When the menu folds, Resume and Contact stay beside the menu button. */
.nav-quick { display: none; }
@media (max-width: 1260px) {
  .nav-quick { display: inline-flex; align-items: center; min-height: 44px; margin-left: auto; padding: 0 10px;
    font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: var(--track-wide); text-transform: uppercase; color: var(--text); }
  .nav-quick-2 { margin-left: 0; }
}
/* A long hero number keeps its size. */
.v8-hero .stat dd { white-space: nowrap; }

/* The "More work" fold. */
.more-wrap { display: flex; justify-content: center; margin: 28px 0 0; }
.more-wrap[hidden], #moreToggle[hidden] { display: none; }
@media (max-width: 640px) {
  /* The tour's stop title keeps the page gutter on a phone. */
  .km-tour__head { padding-inline: 16px; }
  .v8-hero .status { flex-wrap: wrap; justify-content: center; row-gap: 2px; }
  .status-place { flex-basis: 100%; text-align: center; }
  .status-place::before { content: none; }
  /* A long stop title or a wide frame never pushes the tour past the screen edge. */
  .km-tour, .km-tour > *, .km-tour__meta, .km-story, .km-stage__view { min-width: 0; max-width: 100%; }
  .km-tour__title { overflow-wrap: anywhere; }
  .km-stage__controls { flex-wrap: wrap; justify-content: center; row-gap: 8px; }
  .km-dots { flex-wrap: wrap; justify-content: center; max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .tw-field-orb, .tw-fab-orb, .tw-caret, .tw-dots i { animation: none; }
  .tw-msg { animation: none; }
  .tw-fab { transition: none; }
}

@media print {
  .tw-hero, .tw-fab, .overlay-twin { display: none !important; }
}

/* Review round 9: the team credit said once under the hero numbers; the phone overlay label fits. */
.v8-hero .hero-stats-note { margin: 12px 0 0; font-size: var(--fs-small); line-height: 1.5; color: var(--text-2); text-align: left; }
@media (max-width: 560px) { .crumb-word { display: none; } }

/* Review round 12: one primary hero action, readable small labels, chip rows that show they scroll or wrap. */
.v8-hero .hero-actions { align-items: center; }
.hero-tour { color: var(--text-2); font-size: var(--fs-small); text-decoration: underline; text-underline-offset: 3px; padding: 10px 4px; }
.hero-tour:hover, .hero-tour:focus-visible { color: var(--accent); }
.label { font-size: 0.78rem; letter-spacing: 0.1em; }
.v8-tag { font-size: 0.72rem; letter-spacing: 0.08em; }
@media (max-width: 720px) {
  /* One sideways row that shows it scrolls: the edge fades. */
  .filters { -webkit-mask-image: linear-gradient(to right, #000 85%, transparent); mask-image: linear-gradient(to right, #000 85%, transparent); }
  .tw-chips-row { -webkit-mask-image: linear-gradient(to right, #000 82%, transparent); mask-image: linear-gradient(to right, #000 82%, transparent); }
}

/* Review round 13: the role reads at a glance under the name. */
.v8-hero .hero-role { font-size: 1.15rem; color: var(--text); }
/* The twin input shows the same 2px focus outline as every other control. */
.tw-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Review round 15: one focus ring on the twin field; focused items clear the sticky header; the twin panel links to how it works. */
.tw-input:focus-visible { outline: none; }
.tw-field:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
html { scroll-padding-top: 88px; }
.overlay-how { margin-left: auto; margin-right: 12px; color: var(--text-2); font-size: var(--fs-small); text-decoration: underline; text-underline-offset: 3px; padding: 10px 4px; }
.overlay-how:hover, .overlay-how:focus-visible { color: var(--accent); }
@media (max-width: 560px) { .overlay-how { display: none; } }
/* Review round 33: on phones the numbers come first; the header keeps Resume and Contact in view as the next step. */
@media (max-width: 560px) { .v8-hero > .hero-stats { order: 1; margin-top: 24px; } .v8-hero > .hero-actions { order: 2; } .v8-hero > .tw-hero { order: 3; } }
/* Review round 18: the tour stage leaves room for its controls; the twin input carries its own rounded focus outline. */
.km-story--stage .km-frame__art .km-dg { max-height: min(50vh, 560px); }
.tw-field:focus-within { outline: none; }
.tw-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 999px; }
/* Review round 19: where the code lives; skills read as links; hero numbers stack on narrow phones. */
.po-code { margin: 10px 0 0; font-size: var(--fs-small); color: var(--text-2); }
button.skill .skill-face::after { content: " \2192"; color: var(--accent); }
@media (max-width: 360px) { .stat { flex-direction: column-reverse; align-items: flex-start; gap: 4px; } }

/* r22: Contact in the twin overlay bar; on phones the "how" link hides, so Contact takes the right edge */
.overlay-twin .overlay-contact { margin-right: 8px; }
@media (max-width: 560px) { .overlay-twin .overlay-contact { margin-left: auto; } }

/* r22: filters, skill chips and the footer links read in sentence-case body text, not tracked mono caps */
.chip, button.skill .skill-face, .footer-links a {
  font-family: var(--font-body); text-transform: none; letter-spacing: 0; font-size: 0.92rem;
}

/* r23: form fields get a border at 3:1 or more against the panel (WCAG 1.4.11) */
.field input, .field textarea { border-color: #4a7396; }
.field input:hover, .field textarea:hover { border-color: #78d0ff; }

/* r23: public credential IDs under a certificate */
.cert-cred { display: block; margin-top: 4px; color: var(--text-2); font-size: 0.78rem; overflow-wrap: anywhere; }
.cert-slot { display: flex; flex-direction: column; }
.cert-slot > .cert { flex: 1 1 auto; }
.cert-verify { align-self: flex-start; margin: 6px 0 0 12px; padding: 6px 2px; font-size: 0.82rem; white-space: nowrap; }

/* r27: the header is solid from the top, so nav labels never print over the hero headline at a partial scroll */
.site-header {
  background: var(--panel-solid);
  background: color-mix(in srgb, var(--bg-2) 82%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
  border-bottom-color: var(--line);
}
/* Review round 35/36: a 5-6 step chain sits in one row of equal-width steps, so a wrapped row never starts with a
   stray arrow; 7+ steps stack as a column, as on phones. Short chains and small chip chains keep their natural widths. */
@media (min-width: 601px) {
  .vk-chain:not(.is-small):has(> .vk-step:nth-child(5)) { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); column-gap: 34px; row-gap: 0; }
  .vk-chain:not(.is-small):has(> .vk-step:nth-child(5)) .vk-step { max-width: none; }
  .vk-chain:not(.is-small):has(> .vk-step:nth-child(5)) .vk-step + .vk-step { margin-left: 0; }
  .vk-chain:not(.is-small):has(> .vk-step:nth-child(7)) { grid-auto-flow: row; grid-auto-columns: auto; row-gap: 30px; max-width: 40rem; }
  .vk-chain:not(.is-small):has(> .vk-step:nth-child(7)) .vk-step + .vk-step::before { top: -27px; left: 50%; margin: 0 0 0 -12px; transform: rotate(90deg); }
}

/* Round 52: certificates as compact rows; the scan opens on click. */
.certs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 820px) { .certs { grid-template-columns: 1fr; } }
.cert-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; min-width: 0; }
.cert-row .cert-body { padding: 0; gap: 2px; min-width: 0; }
.cert-actions { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: flex-end; flex: 0 0 auto; }
.cert-row .cert-verify { margin: 0; align-self: auto; }
.cert-scan { min-height: 44px; padding: 6px 2px; border: 0; background: none; color: var(--accent); font: inherit; font-size: 0.82rem; cursor: pointer; white-space: nowrap; }
.cert-scan { text-decoration: underline; text-underline-offset: 2px; }
.cert-scan:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 480px) { .cert-row { flex-direction: column; align-items: flex-start; } .cert-actions { justify-content: flex-start; } }

/* Round 58: on phones the focus filters wrap instead of scrolling out of view. */
@media (max-width: 720px) {
  .filters { flex-wrap: wrap; overflow-x: visible; margin-left: 0; margin-right: 0; padding: 0 0 6px; -webkit-mask-image: none; mask-image: none; }
}
