/* =============================================================
   ARCHIE HEARNS · PORTFOLIO SYSTEM
   Original console-dashboard homage. Deep green, neon-lime UI,
   hex mesh, radar rings, glowing menu bars, translucent panels.
   ============================================================= */

:root {
  --lime:      #b6ff3c;
  --lime-hot:  #e3ff5a;
  --neon:      #55d420;
  --neon-mid:  #2ea814;
  --neon-deep: #0e6a12;
  --neon-dark: #062708;
  --ink:       #030907;
  --ink-mid:   #071510;
  --ink-panel: rgba(8, 22, 12, 0.55);
  --text:      #d3f0c4;
  --text-mid:  #7fb96b;
  --text-dim:  #4d7a44;
  --yellow:    #d8ff5a;
  --danger:    #ffb43a;

  --font-display: "Michroma", "Bank Gothic", "Eurostile", "Orbitron", "Segoe UI", sans-serif;
  --font-body:    "Chakra Petch", "Rajdhani", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono:    "Share Tech Mono", "JetBrains Mono", "Fira Code", "Menlo", monospace;

  --edge:       rgba(182, 255, 60, 0.35);
  --edge-soft:  rgba(85, 212, 32, 0.22);
  --glow:       0 0 12px rgba(182, 255, 60, 0.55), 0 0 32px rgba(85, 212, 32, 0.4);
  --glow-soft:  0 0 8px rgba(85, 212, 32, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  min-height: 100%;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  letter-spacing: 0.02em;
  overflow: hidden;
}

body { min-height: 100dvh; }

button {
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

a { -webkit-tap-highlight-color: transparent; }

/* -------- Layered background -------- */
#stage-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Subtle hex mesh drawn via SVG data URI — the biomechanical grid.
   Masked with a soft radial fade so the edges of the screen aren't busy. */
.hex-mesh {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 1;
  background-image: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 56 64' fill='none' \
stroke='%2355d420' stroke-opacity='0.14' stroke-width='0.6'>\
<path d='M28 0 L56 16 L56 48 L28 64 L0 48 L0 16 Z' />\
<path d='M28 0 L28 64' /><path d='M0 16 L56 48' /><path d='M56 16 L0 48' />\
</svg>");
  background-size: 56px 64px;
  background-repeat: repeat;
  opacity: 0.55;
  mix-blend-mode: screen;
  mask-image: radial-gradient(
    ellipse 90% 90% at 50% 50%,
    rgba(0,0,0,0.95) 20%,
    rgba(0,0,0,0.55) 55%,
    rgba(0,0,0,0) 100%
  );
  -webkit-mask-image: radial-gradient(
    ellipse 90% 90% at 50% 50%,
    rgba(0,0,0,0.95) 20%,
    rgba(0,0,0,0.55) 55%,
    rgba(0,0,0,0) 100%
  );
  animation: hexPulse 8s ease-in-out infinite;
}
@keyframes hexPulse {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 0.7; }
}

.vignette {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 2;
  background: radial-gradient(
    ellipse at center,
    transparent 30%,
    rgba(0,0,0,0.55) 70%,
    rgba(0,0,0,0.95) 100%
  );
}

.scanlines {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 3;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0) 0px,
    rgba(0,0,0,0) 2px,
    rgba(0,0,0,0.16) 3px,
    rgba(0,0,0,0) 4px
  );
  mix-blend-mode: multiply;
  opacity: 0.55;
}

/* Top bar removed — the home takes the full viewport below the hint bar. */
@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.25); opacity: 0.6; }
}

/* -------- Home layout -------- */
.home {
  position: fixed;
  inset: 0 0 40px 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr minmax(360px, 42%);
  gap: 48px;
  padding: 32px 5vw;
  align-items: center;
  transition: opacity 0.6s ease 0.25s;
}
body.view-section .home {
  /* No longer fade the whole home; individual pieces (orb, operator, bars)
     handle their own exit animations so we can see the orb shoot away. */
  pointer-events: none;
  transition-delay: 0s;
}
body.view-section .operator {
  transform: translateX(-32px);
  opacity: 0;
  transition-delay: 0s;
  transition-duration: 0.4s, 0.35s;
}

/* Left column */
.dash-left {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 20px;
  min-height: 0;
  height: 100%;
  padding: 24px 0;
}

.orb-slot {
  position: relative;
  min-height: 260px;
  align-self: stretch;
  transform: translateX(0) scale(1) rotate(0);
  opacity: 1;
  filter: blur(0);
  /* Return transition: decelerating "swing back into place" easing */
  transition:
    transform 0.7s cubic-bezier(0.12, 0.7, 0.28, 1) 0.05s,
    opacity 0.55s ease 0.1s,
    filter 0.5s ease 0.1s;
}

/* Section open — orb shoots off to the left and recedes into distance */
body.view-section .orb-slot {
  transform: translateX(-55vw) scale(0.14) rotate(-9deg);
  opacity: 0;
  filter: blur(6px);
  /* Exit transition: fast acceleration, drives it far off-screen */
  transition:
    transform 0.6s cubic-bezier(0.55, 0.05, 0.9, 0.4),
    opacity 0.5s ease,
    filter 0.5s ease;
}

.operator {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 22px;
  border: 1px solid var(--edge-soft);
  border-radius: 4px;
  transform: translateX(0);
  opacity: 1;
  transition:
    transform 0.5s cubic-bezier(0.15, 0.7, 0.3, 1) 0.1s,
    opacity 0.45s ease 0.1s;
  background: linear-gradient(
    135deg,
    rgba(6, 24, 12, 0.62),
    rgba(6, 24, 12, 0.35)
  );
  box-shadow:
    0 0 24px rgba(85, 212, 32, 0.15),
    inset 0 0 60px rgba(6, 24, 12, 0.4);
  /* corner cuts effect via clip-path */
  clip-path: polygon(
    0 12px, 12px 0,
    calc(100% - 12px) 0, 100% 12px,
    100% calc(100% - 12px), calc(100% - 12px) 100%,
    12px 100%, 0 calc(100% - 12px)
  );
}
.op-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.10em;
  color: #fff;
  text-shadow: 0 0 12px rgba(182, 255, 60, 0.8);
}
.op-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.4em;
  color: var(--text-mid);
  text-transform: uppercase;
}

.sys-info {
  margin: 4px 0 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
}
.sys-line {
  display: grid;
  grid-template-columns: 96px 1fr;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px dashed rgba(85, 212, 32, 0.16);
}
.sys-line dt {
  color: var(--text-mid);
  letter-spacing: 0.28em;
  text-transform: uppercase;
}
.sys-line dd {
  margin: 0;
  color: var(--text);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-mid);
}
.dot-online {
  background: var(--lime);
  box-shadow: 0 0 8px var(--lime), 0 0 14px rgba(182, 255, 60, 0.6);
  animation: pulseDot 2s ease-in-out infinite;
}

/* SYSTEM LOG panel removed from operator readout. */

/* -------- Menu bars (right) — sci-fi HUD channels -------- */
.menu-bars {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-self: stretch;
  justify-self: end;
  width: 100%;
  padding: 24px 0;
  /* small right padding so the bars have room to slide right on hover */
  padding-right: 8px;
}

/* Main menu bars — inherit the CV-tile aesthetic (diagonal-cut corners
   at top-right + bottom-left) but coloured in the green channel. */
.menu-bar {
  --stagger-in: 0s;
  --stagger-out: 0s;
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 14px 22px;
  border: 1px solid var(--edge-soft);
  background: linear-gradient(
    90deg,
    rgba(14, 106, 18, 0.28) 0%,
    rgba(14, 106, 18, 0.06) 100%
  );
  color: var(--text);
  text-align: left;
  font-family: var(--font-display);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  outline: none;
  cursor: pointer;
  transform: translateX(0);
  opacity: 1;
  transition:
    transform 0.5s cubic-bezier(0.5, 0, 0.4, 1) var(--stagger-in),
    opacity 0.4s ease var(--stagger-in),
    border-color 0.25s ease,
    background 0.3s ease,
    box-shadow 0.3s ease,
    color 0.25s ease;
  clip-path: polygon(
    0 0, calc(100% - 14px) 0, 100% 14px,
    100% 100%, 14px 100%, 0 calc(100% - 14px)
  );
}

.menu-bar:hover,
.menu-bar:focus-visible,
.menu-bar.hover,
.menu-bar.touch-armed {
  transform: translateX(10px);
  border-color: var(--edge);
  color: #fff;
  background: linear-gradient(
    90deg,
    rgba(85, 212, 32, 0.4) 0%,
    rgba(14, 106, 18, 0.15) 100%
  );
  box-shadow: 0 0 24px rgba(182, 255, 60, 0.45);
}

.menu-bar.selected {
  transform: translateX(18px);
  border-color: rgba(216, 255, 90, 0.6);
  color: #fff;
  background: linear-gradient(
    90deg,
    rgba(216, 255, 90, 0.35) 0%,
    rgba(85, 212, 32, 0.18) 60%,
    rgba(14, 106, 18, 0.1) 100%
  );
  box-shadow: 0 0 28px rgba(216, 255, 90, 0.6);
}

/* Signal ticks not needed with the CV-style layout — hide them. */
.menu-bar .mb-signal { display: none; }

/* Chip: [ // 01 ] */
.mb-chip {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px 4px 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.28em;
  color: var(--lime);
  background: rgba(6, 24, 12, 0.6);
  border: 1px solid rgba(85, 212, 32, 0.35);
  text-shadow: 0 0 6px rgba(182, 255, 60, 0.6);
  transition: color 0.25s ease, border-color 0.25s ease, background 0.25s ease;
  clip-path: polygon(
    0 0, 100% 0,
    100% calc(100% - 4px), calc(100% - 4px) 100%,
    0 100%
  );
}
.mb-chip .mb-tag { color: var(--text-mid); }
.mb-chip .mb-num { color: var(--lime); font-weight: 700; }
.menu-bar:hover .mb-chip,
.menu-bar.hover .mb-chip,
.menu-bar.touch-armed .mb-chip {
  color: #fff;
  border-color: var(--lime);
  background: rgba(85, 212, 32, 0.28);
}
.menu-bar.selected .mb-chip {
  border-color: var(--yellow);
  background: rgba(216, 255, 90, 0.24);
}
.menu-bar.selected .mb-chip .mb-num { color: var(--yellow); }

/* Label */
.mb-label {
  position: relative;
  z-index: 1;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-shadow: 0 0 12px rgba(182, 255, 60, 0.55);
}
.menu-bar.selected .mb-label {
  text-shadow: 0 0 14px rgba(216, 255, 90, 0.9), 0 0 30px rgba(216, 255, 90, 0.35);
}

/* Signal ticks — three tiny bars that pulse in sequence */
.mb-signal {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 14px;
}
.mb-signal i {
  display: block;
  width: 3px;
  background: rgba(85, 212, 32, 0.4);
  border-radius: 1px;
}
.mb-signal i:nth-child(1) { height: 40%; animation: sigPulse 1.8s ease-in-out infinite; }
.mb-signal i:nth-child(2) { height: 70%; animation: sigPulse 1.8s ease-in-out 0.2s infinite; }
.mb-signal i:nth-child(3) { height: 100%; animation: sigPulse 1.8s ease-in-out 0.4s infinite; }
@keyframes sigPulse {
  0%, 100% { background: rgba(85, 212, 32, 0.4); box-shadow: none; }
  50%      { background: var(--lime); box-shadow: 0 0 6px var(--lime); }
}
.menu-bar.selected .mb-signal i:nth-child(1),
.menu-bar.selected .mb-signal i:nth-child(2),
.menu-bar.selected .mb-signal i:nth-child(3) {
  background: var(--yellow);
  box-shadow: 0 0 8px var(--yellow);
}

/* Call-to-action chevron */
.mb-cta {
  position: relative;
  z-index: 1;
  font-size: 22px;
  color: var(--lime);
  text-shadow: 0 0 10px rgba(182, 255, 60, 0.8);
  transition: transform 0.25s ease, color 0.25s ease;
}
.menu-bar:hover .mb-cta,
.menu-bar.hover .mb-cta,
.menu-bar.touch-armed .mb-cta { transform: translateX(4px); }
.menu-bar.selected .mb-cta { color: var(--yellow); text-shadow: 0 0 12px rgba(216, 255, 90, 0.9); }

/* -------- Fly-away when a section opens -------- */
/* Staggered forward on exit (top bar flies first, wave downward).
   Staggered reverse on return (bottom bar returns first). */
.menu-bar[data-idx="0"] { --stagger-in: 0.15s; --stagger-out: 0s;     }
.menu-bar[data-idx="1"] { --stagger-in: 0.10s; --stagger-out: 0.05s;  }
.menu-bar[data-idx="2"] { --stagger-in: 0.05s; --stagger-out: 0.10s;  }
.menu-bar[data-idx="3"] { --stagger-in: 0s;    --stagger-out: 0.15s;  }

body.view-section .menu-bar {
  transform: translateX(160vw);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.55s cubic-bezier(0.55, 0, 0.9, 0.4) var(--stagger-out),
    opacity 0.4s ease var(--stagger-out);
}

/* Rotating 3D preview beneath the bars. The layered rings and oval plinth
   echo the original console dashboard's floating object selectors without
   copying any logo or interface artwork. */
.menu-preview {
  position: relative;
  width: min(100%, 390px);
  height: clamp(190px, 25vh, 250px);
  margin: 0 auto;
  pointer-events: none;
  transform: translateX(0);
  opacity: 1;
  /* Return: swing back in after the bars have arrived (slight delay). */
  transition:
    transform 0.55s cubic-bezier(0.15, 0.7, 0.3, 1) 0.20s,
    opacity 0.4s ease 0.20s;
}

.mp-stage,
.contact-model-stage {
  position: absolute;
  inset: 0 8% 20px;
  isolation: isolate;
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.mp-stage.is-switching,
.contact-model-stage.is-switching {
  opacity: 0;
  transform: translateY(5px) scale(0.94);
}

.mp-aura {
  position: absolute;
  inset: 3% 7% 4%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 48%, rgba(182, 255, 60, 0.2), transparent 38%),
    radial-gradient(ellipse at 50% 80%, rgba(85, 212, 32, 0.22), transparent 58%);
  filter: blur(10px);
  animation: previewAura 3.2s ease-in-out infinite;
}

.mp-orbit {
  position: absolute;
  left: 50%;
  top: 52%;
  border: 1px solid rgba(182, 255, 60, 0.2);
  border-radius: 50%;
  transform-style: preserve-3d;
  box-shadow: 0 0 14px rgba(85, 212, 32, 0.16);
}

.mp-orbit::before,
.mp-orbit::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  border-top: 2px solid rgba(216, 255, 90, 0.62);
  border-right: 1px solid transparent;
  border-bottom: 1px solid rgba(85, 212, 32, 0.12);
  border-left: 1px solid transparent;
}

.mp-orbit-outer {
  width: 82%;
  aspect-ratio: 1;
  animation: previewOrbitOuter 11s linear infinite;
}

.mp-orbit-inner {
  width: 62%;
  aspect-ratio: 1;
  animation: previewOrbitInner 8s linear infinite reverse;
}

.menu-preview-model,
.contact-preview-model {
  position: absolute;
  inset: -2% 4% 5%;
  width: 92%;
  height: 97%;
  z-index: 3;
  background: transparent;
  --poster-color: transparent;
  --progress-bar-color: transparent;
  --progress-bar-height: 0;
  filter:
    blur(0.65px)
    contrast(1.08)
    saturate(0)
    brightness(0.60)
    sepia(1)
    hue-rotate(48deg)
    saturate(3.6)
    drop-shadow(0 0 8px rgba(155, 255, 46, 0.65));
  mix-blend-mode: screen;
  opacity: 0.96;
}

.mp-scan {
  position: absolute;
  z-index: 4;
  left: 13%;
  right: 13%;
  height: 18%;
  top: 7%;
  border-top: 1px solid rgba(216, 255, 90, 0.72);
  background: radial-gradient(ellipse at 50% 0%, rgba(182, 255, 60, 0.16), transparent 72%);
  filter: drop-shadow(0 0 7px rgba(182, 255, 60, 0.72));
  mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
  animation: previewScan 3s ease-in-out infinite;
}

.mp-plinth {
  position: absolute;
  z-index: 2;
  left: 18%;
  right: 18%;
  bottom: 5%;
  height: 18%;
  border: 1px solid rgba(182, 255, 60, 0.48);
  border-radius: 50%;
  background:
    radial-gradient(ellipse, rgba(182, 255, 60, 0.24), rgba(14, 106, 18, 0.11) 45%, transparent 72%);
  box-shadow:
    0 0 15px rgba(182, 255, 60, 0.34),
    inset 0 0 18px rgba(85, 212, 32, 0.28);
  transform: perspective(320px) rotateX(67deg);
}

.mp-label {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.38em;
  color: var(--text-mid);
  text-indent: 0.38em;
  text-shadow: 0 0 9px rgba(182, 255, 60, 0.6);
  transition: opacity 0.18s ease;
}

.mp-label::before,
.mp-label::after {
  content: "";
  display: inline-block;
  width: 18px;
  height: 1px;
  margin: 0 10px 3px 6px;
  background: linear-gradient(90deg, transparent, var(--neon));
  box-shadow: 0 0 5px rgba(182, 255, 60, 0.55);
}
.mp-label::after {
  margin: 0 6px 3px 10px;
  background: linear-gradient(90deg, var(--neon), transparent);
}

@keyframes previewAura {
  0%, 100% { opacity: 0.62; transform: scale(0.98); }
  50%      { opacity: 1; transform: scale(1.04); }
}
@keyframes previewOrbitOuter {
  from { transform: translate(-50%, -50%) rotateX(68deg) rotateZ(0deg); }
  to   { transform: translate(-50%, -50%) rotateX(68deg) rotateZ(360deg); }
}
@keyframes previewOrbitInner {
  from { transform: translate(-50%, -50%) rotateY(69deg) rotateZ(0deg); }
  to   { transform: translate(-50%, -50%) rotateY(69deg) rotateZ(360deg); }
}
@keyframes previewScan {
  0%, 100% { top: 8%; opacity: 0; }
  12%      { opacity: 0.72; }
  78%      { opacity: 0.32; }
  88%      { top: 77%; opacity: 0; }
}

/* Exit: fly off to the right just after the last menu bar leaves. */
body.view-section .menu-preview {
  transform: translateX(160vw);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.55s cubic-bezier(0.55, 0.05, 0.9, 0.4) 0.20s,
    opacity 0.4s ease 0.20s;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* -------- Section views -------- */
.section {
  position: fixed;
  inset: 0 0 40px 0;
  z-index: 6;
  display: none;
  flex-direction: column;
  padding: 24px 5vw 20px;
  opacity: 0;
  transform: translateX(24px);
  transition: opacity 0.45s ease 0.25s, transform 0.45s ease 0.25s;
  overflow: hidden;
}
.section.active {
  display: flex;
  opacity: 1;
  transform: translateX(0);
}
/* Fast exit when going back (no delay so the section leaves first) */
body.view-home .section {
  transition-delay: 0s;
}

.sec-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--edge-soft);
  margin-bottom: 20px;
}
/* Hologram back button — no border, no fill. Glowing green text with
   a subtle CRT flicker, floating in space. */
.back {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--lime);
  padding: 4px 10px;
  border-radius: 0;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-shadow:
    0 0 4px rgba(230, 255, 180, 0.95),
    0 0 12px rgba(182, 255, 60, 0.7),
    0 0 30px rgba(85, 212, 32, 0.55),
    0 0 60px rgba(85, 212, 32, 0.25);
  animation: holoFlicker 5.5s ease-in-out infinite;
  transition: color 0.2s ease, text-shadow 0.2s ease, transform 0.2s ease;
}
.back:hover {
  color: #ffffff;
  transform: translateX(-3px);
  text-shadow:
    0 0 6px rgba(255, 255, 255, 1),
    0 0 18px rgba(182, 255, 60, 0.95),
    0 0 40px rgba(85, 212, 32, 0.7);
}
.back:focus-visible {
  outline: 1px dashed rgba(182, 255, 60, 0.55);
  outline-offset: 4px;
}
.back-glyph {
  color: var(--lime);
  font-size: 14px;
  text-shadow:
    0 0 6px rgba(230, 255, 180, 1),
    0 0 16px rgba(182, 255, 60, 0.85);
}
@keyframes holoFlicker {
  0%, 46%, 100% { opacity: 1; }
  47%           { opacity: 0.55; }
  48%           { opacity: 1; }
  70%           { opacity: 1; }
  71%           { opacity: 0.7; }
  72%           { opacity: 1; }
}

.sec-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text);
  text-shadow: 0 0 12px rgba(182, 255, 60, 0.75);
  text-align: center;
}

.sec-code {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--lime);
  padding: 6px 12px;
  border: 1px solid var(--edge);
  border-radius: 3px;
  background: rgba(6, 24, 12, 0.5);
  text-shadow: 0 0 8px rgba(182, 255, 60, 0.6);
}

.sec-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(85,212,32,0.5) transparent;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.sec-body::-webkit-scrollbar { width: 8px; }
.sec-body::-webkit-scrollbar-thumb { background: rgba(85,212,32,0.35); border-radius: 4px; }
.sec-body::-webkit-scrollbar-thumb:hover { background: rgba(182,255,60,0.55); }

/* ---- About section ---- */
.about-body {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 40px;
  align-items: start;
}
.about-portrait { position: relative; }
.portrait-frame {
  position: relative;
  aspect-ratio: 1 / 1.15;
  border: 1px solid var(--edge);
  background: linear-gradient(160deg, rgba(14,106,18,0.18), rgba(6,24,12,0.5));
  overflow: hidden;
  box-shadow: 0 0 24px rgba(85,212,32,0.25), inset 0 0 40px rgba(6,24,12,0.6);
  clip-path: polygon(
    0 20px, 20px 0,
    calc(100% - 20px) 0, 100% 20px,
    100% calc(100% - 20px), calc(100% - 20px) 100%,
    20px 100%, 0 calc(100% - 20px)
  );
}
.portrait-inner {
  position: absolute;
  inset: 12px;
  overflow: hidden;
  background:
    radial-gradient(circle at 40% 32%, rgba(182, 255, 60, 0.35) 0%, transparent 40%),
    radial-gradient(circle at 60% 68%, rgba(85, 212, 32, 0.3) 0%, transparent 50%),
    linear-gradient(180deg, rgba(6, 40, 12, 0.7), rgba(3, 12, 6, 0.95));
  box-shadow: inset 0 0 60px rgba(6, 24, 12, 0.7);
}

/* Hologram GLB portrait inside the profile screen.
   The <model-viewer> shows the model on a transparent canvas; the CSS
   filter chain desaturates the natural textures, tints everything green,
   and adds a soft outer glow so it reads as a holographic projection. */
.portrait-model {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  --poster-color: transparent;
  --progress-bar-color: transparent;
  --progress-bar-height: 0;
  filter:
    blur(2.5px)
    contrast(1.08)
    saturate(0)
    brightness(1.28)
    sepia(1)
    hue-rotate(48deg)
    saturate(3.6)
    drop-shadow(0 0 8px rgba(155, 255, 46, 0.65));
  mix-blend-mode: screen;
  opacity: 0.92;
  z-index: 1;
}

/* Subtle CRT scanlines on top of the model for the classic hologram read */
.portrait-inner::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 30, 10, 0.28) 3px,
    rgba(0, 0, 0, 0) 4px
  );
  mix-blend-mode: multiply;
  opacity: 0.65;
  transition: opacity 0.15s ease;
}

/* Click-triggered glitch. JS toggles .glitching on .portrait-frame briefly.
   The model's animation only touches `transform`, so its base `filter`
   (blur + green tint + glow) stays intact. Colour glitching lives on the
   parent `.portrait-inner`, whose filter stacks on top of the model's. */
.portrait-frame { cursor: pointer; user-select: none; }

.portrait-frame.glitching .portrait-model {
  animation: modelJitter 0.5s steps(1, jump-end) 1;
}
.portrait-frame.glitching .portrait-inner {
  animation: innerColourGlitch 0.5s steps(1, jump-end) 1;
}
.portrait-frame.glitching .portrait-inner::before { opacity: 0.95; }

@keyframes modelJitter {
  0%   { transform: translate(0, 0)      skewX(0); }
  8%   { transform: translate(-6px, 2px) skewX(-3deg); }
  18%  { transform: translate(5px, -2px) skewX(2deg); }
  30%  { transform: translate(-3px, 3px) skewX(-1.5deg); }
  42%  { transform: translate(4px, 0)    skewX(1deg); }
  55%  { transform: translate(-2px, -2px) skewX(0); }
  70%  { transform: translate(3px, 1px)   skewX(-0.5deg); }
  85%  { transform: translate(-1px, -1px) skewX(0.5deg); }
  100% { transform: translate(0, 0)      skewX(0); }
}

@keyframes innerColourGlitch {
  0%, 100% { filter: none; }
  8%       { filter: hue-rotate(30deg)  brightness(1.3) contrast(1.2); }
  18%      { filter: hue-rotate(-20deg) brightness(0.9) contrast(1.3); }
  30%      { filter: hue-rotate(50deg)  contrast(1.4); }
  42%      { filter: hue-rotate(10deg)  brightness(1.15); }
  55%      { filter: hue-rotate(75deg)  brightness(1.25); }
  70%      { filter: hue-rotate(-15deg) brightness(0.95); }
  85%      { filter: hue-rotate(20deg); }
}
.portrait-inner::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(182, 255, 60, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(182, 255, 60, 0.08) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(ellipse at center, rgba(0,0,0,1) 30%, transparent 90%);
  -webkit-mask-image: radial-gradient(ellipse at center, rgba(0,0,0,1) 30%, transparent 90%);
}
.portrait-scan {
  position: absolute;
  left: 0; right: 0;
  height: 32px;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent, rgba(182, 255, 60, 0.35), transparent);
  filter: blur(1px);
  animation: scanY 4s linear infinite;
}
@keyframes scanY {
  from { top: -32px; }
  to   { top: 100%; }
}
.portrait-corners span {
  position: absolute;
  width: 18px; height: 18px;
  border: 1px solid var(--lime);
  box-shadow: 0 0 8px rgba(182, 255, 60, 0.7);
}
.portrait-corners span:nth-child(1) { top: 6px;    left: 6px;    border-right: none; border-bottom: none; }
.portrait-corners span:nth-child(2) { top: 6px;    right: 6px;   border-left: none;  border-bottom: none; }
.portrait-corners span:nth-child(3) { bottom: 6px; left: 6px;    border-right: none; border-top: none; }
.portrait-corners span:nth-child(4) { bottom: 6px; right: 6px;   border-left: none;  border-top: none; }

.portrait-caption {
  margin-top: 10px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.4em;
  color: var(--text-mid);
  text-transform: uppercase;
}

.about-text p {
  margin: 0 0 14px 0;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  max-width: 62ch;
}
.about-text b {
  color: var(--lime);
  font-weight: 600;
  text-shadow: 0 0 8px rgba(182, 255, 60, 0.55);
}
.about-lead { font-size: 17px !important; }

.about-stats {
  list-style: none;
  margin: 24px 0 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  max-width: 62ch;
}
.about-stats li {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 20px;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  border: 1px solid var(--edge-soft);
  border-left: 2px solid var(--neon);
  background: rgba(6, 24, 12, 0.4);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.stat-key { color: var(--text-mid); letter-spacing: 0.28em; }
.stat-val { color: var(--text); }

/* ---- Projects section (memory-unit save-file cards) ---- */
.projects-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
  padding-bottom: 20px;
}
.project-card {
  position: relative;
  padding: 18px 20px 16px;
  border: 1px solid var(--edge-soft);
  background: linear-gradient(160deg, rgba(14,106,18,0.28), rgba(6,24,12,0.55));
  box-shadow: 0 0 20px rgba(85,212,32,0.15), inset 0 0 40px rgba(6,24,12,0.4);
  display: flex;
  flex-direction: column;
  gap: 12px;
  clip-path: polygon(
    0 14px, 14px 0,
    calc(100% - 14px) 0, 100% 14px,
    100% calc(100% - 14px), calc(100% - 14px) 100%,
    14px 100%, 0 calc(100% - 14px)
  );
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.project-card:hover {
  border-color: var(--edge);
  transform: translateY(-3px);
  box-shadow: 0 0 32px rgba(182, 255, 60, 0.35), inset 0 0 40px rgba(6,24,12,0.4);
}
.pc-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}
.pc-slot { color: var(--text-mid); }
.pc-status {
  padding: 3px 10px;
  border-radius: 3px;
  border: 1px solid var(--edge);
  background: rgba(6,24,12,0.7);
  color: var(--lime);
  text-shadow: 0 0 8px rgba(182, 255, 60, 0.55);
}
.status-live      { color: var(--lime); border-color: rgba(182,255,60,0.55); }
.status-dev       { color: var(--yellow); border-color: rgba(216,255,90,0.5); }
.status-research  { color: #7ff0d4; border-color: rgba(127, 240, 212, 0.55); }
.status-proto     { color: var(--text-mid); border-color: rgba(85, 212, 32, 0.28); }
.status-concept   { color: var(--danger); border-color: rgba(255, 180, 58, 0.55); }

.pc-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: 0.06em;
  color: #fff;
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(182, 255, 60, 0.7);
}
.pc-desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  flex: 1;
}
.pc-tags {
  list-style: none;
  margin: 4px 0 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pc-tags li {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  padding: 3px 8px;
  border: 1px solid rgba(85, 212, 32, 0.35);
  color: var(--text-mid);
  background: rgba(6, 24, 12, 0.5);
  text-transform: uppercase;
}
.pc-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.pc-btn {
  padding: 8px 14px;
  border: 1px solid var(--edge);
  background: rgba(85, 212, 32, 0.18);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  text-decoration: none;
  text-shadow: 0 0 8px rgba(182, 255, 60, 0.5);
  transition: background 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}
.pc-btn:hover {
  background: rgba(182, 255, 60, 0.4);
  color: #fff;
  box-shadow: 0 0 20px rgba(182, 255, 60, 0.6);
}
.pc-btn.secondary {
  background: transparent;
  color: var(--text-mid);
  border-color: rgba(85, 212, 32, 0.3);
}
.pc-btn.secondary:hover {
  border-color: var(--edge);
  color: var(--text);
  background: rgba(85, 212, 32, 0.18);
}

/* ---- Experience section: vertical timeline ---- */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 20px 20px;
  position: relative;
  max-width: 820px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: linear-gradient(
    to bottom,
    rgba(182, 255, 60, 0.6),
    rgba(85, 212, 32, 0.2)
  );
  box-shadow: 0 0 8px rgba(182, 255, 60, 0.4);
}
.tl-entry {
  position: relative;
  padding: 8px 0 20px 30px;
}
.tl-node {
  position: absolute;
  left: -6px;
  top: 12px;
  width: 14px;
  height: 14px;
  background: var(--lime);
  border: 2px solid var(--ink);
  border-radius: 50%;
  box-shadow:
    0 0 10px var(--lime),
    0 0 20px rgba(182, 255, 60, 0.6);
  animation: pulseDot 2.4s ease-in-out infinite;
}
.tl-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.tl-date { color: var(--text-mid); }
.tl-tag {
  padding: 2px 8px;
  border: 1px solid rgba(85, 212, 32, 0.35);
  color: var(--lime);
  background: rgba(14, 106, 18, 0.25);
}
.tl-title {
  margin: 4px 0 6px 0;
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.06em;
  color: #fff;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(182, 255, 60, 0.65);
}
.tl-desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  max-width: 68ch;
}

/* ---- Contact section ---- */
.contact-body {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  grid-template-areas:
    "status channels"
    "preview channels";
  gap: 14px 32px;
  align-items: start;
  padding-bottom: 20px;
}
.net-panel {
  grid-area: status;
  border: 1px solid var(--edge);
  padding: 18px 20px;
  background: rgba(6, 24, 12, 0.55);
  box-shadow: 0 0 24px rgba(85, 212, 32, 0.2), inset 0 0 40px rgba(6,24,12,0.4);
}
.contact-model-preview {
  grid-area: preview;
  position: relative;
  width: 100%;
  height: 300px;
  overflow: hidden;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 55%, rgba(14, 106, 18, 0.13), transparent 68%);
}
.contact-model-stage {
  inset: 0 1% 24px;
}
.contact-preview-model {
  inset: 0 1% 5%;
  width: 98%;
  height: 95%;
}
.contact-model-label {
  bottom: 42px;
  white-space: nowrap;
}
.contact-model-account,
.contact-model-stat {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: min(94%, 300px);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-mono);
  text-transform: uppercase;
  text-shadow: 0 0 9px rgba(182, 255, 60, 0.55);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.contact-model-account {
  bottom: 21px;
  color: var(--text);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
}
.contact-model-stat {
  bottom: 2px;
  color: var(--lime);
  font-size: 9px;
  letter-spacing: 0.17em;
  text-indent: 0.17em;
}
.np-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--edge-soft);
}
.np-title {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--text);
  text-shadow: 0 0 8px rgba(182, 255, 60, 0.5);
}
.np-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  padding: 3px 9px;
  color: var(--lime);
  border: 1px solid var(--edge);
  background: rgba(14, 106, 18, 0.3);
}
.np-lines { display: grid; gap: 6px; }
.np-line {
  display: grid;
  grid-template-columns: 100px 1fr;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 4px 0;
  border-bottom: 1px dashed rgba(85, 212, 32, 0.16);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.np-key { color: var(--text-mid); letter-spacing: 0.28em; }
.np-val { color: var(--text); display: flex; align-items: center; gap: 8px; }
.np-ok  { color: var(--lime); text-shadow: 0 0 8px rgba(182,255,60,0.45); }

.channels {
  grid-area: channels;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
.channel {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  text-decoration: none;
  border: 1px solid var(--edge-soft);
  background: linear-gradient(90deg, rgba(14,106,18,0.28), rgba(14,106,18,0.06));
  color: var(--text);
  transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
  clip-path: polygon(
    0 0, calc(100% - 12px) 0, 100% 12px,
    100% 100%, 12px 100%, 0 calc(100% - 12px)
  );
}
.channel:hover,
.channel.touch-armed {
  border-color: var(--edge);
  transform: translateX(6px);
  box-shadow: 0 0 24px rgba(182, 255, 60, 0.4);
  background: linear-gradient(90deg, rgba(85,212,32,0.4), rgba(14,106,18,0.15));
}
.ch-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.28em;
  color: var(--lime);
  text-align: center;
  text-shadow: 0 0 8px rgba(182, 255, 60, 0.6);
}
.ch-body { display: flex; flex-direction: column; min-width: 0; }
.ch-name {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--text);
  text-transform: uppercase;
}
.ch-val {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-mid);
  letter-spacing: 0.1em;
  margin-top: 2px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ch-val > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ch-live {
  color: var(--lime);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-shadow: 0 0 7px rgba(182, 255, 60, 0.42);
}
.ch-arrow {
  color: var(--lime);
  font-size: 18px;
  text-shadow: 0 0 8px rgba(182, 255, 60, 0.6);
}
.channel.cv {
  grid-column: 1 / -1;
  border-color: rgba(216, 255, 90, 0.45);
  background: linear-gradient(90deg, rgba(216, 255, 90, 0.22), rgba(14,106,18,0.08));
}
.channel.cv .ch-tag,
.channel.cv .ch-name,
.channel.cv .ch-arrow { color: var(--yellow); }
.channel.cv:hover {
  border-color: var(--yellow);
  box-shadow: 0 0 26px rgba(216, 255, 90, 0.5);
}

/* -------- Hint bar -------- */
.hint-bar {
  position: fixed;
  inset: auto 0 0 0;
  height: 40px;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  background: linear-gradient(to top, rgba(3,9,7,0.9), rgba(3,9,7,0));
  border-top: 1px solid rgba(85, 212, 32, 0.12);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.28em;
  color: var(--text-mid);
  text-transform: uppercase;
}
.hb-item { display: inline-flex; align-items: center; }
.hb-right { margin-left: auto; color: var(--text-dim); }
.hb-mobile { display: none; }
.key {
  display: inline-block;
  min-width: 24px;
  padding: 2px 6px;
  margin-right: 8px;
  border: 1px solid rgba(182, 255, 60, 0.5);
  border-radius: 4px;
  color: var(--text);
  background: rgba(14, 106, 18, 0.35);
  box-shadow: 0 0 8px rgba(85, 212, 32, 0.4);
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.14em;
}

/* -------- Boot overlay + animation -------- */
.boot-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: radial-gradient(ellipse at center, #041508 0%, #000 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
body.booted .boot-overlay {
  opacity: 0;
  visibility: hidden;
}
.boot-inner {
  text-align: center;
  font-family: var(--font-mono);
}
.boot-title {
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 0.22em;
  color: var(--lime);
  text-shadow: 0 0 14px rgba(182, 255, 60, 0.85), 0 0 40px rgba(85, 212, 32, 0.55);
  margin-bottom: 20px;
  opacity: 0;
  animation: bootTitleIn 0.8s ease 0.15s forwards;
}
@keyframes bootTitleIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.boot-lines {
  min-width: 300px;
  text-align: left;
  font-size: 12px;
  color: var(--text-mid);
  letter-spacing: 0.14em;
}
.boot-lines div {
  padding: 3px 0;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.boot-lines div.on {
  opacity: 1;
  transform: translateX(0);
  color: var(--text);
  text-shadow: 0 0 6px rgba(182, 255, 60, 0.4);
}
.boot-lines .ok { color: var(--lime); }

/* Gate the main UI while booting so nothing peeks in before its cue */
body.booting .home,
body.booting .top-bar,
body.booting .hint-bar { opacity: 0; transition: opacity 0.5s ease; }
body:not(.booting) .top-bar { opacity: 1; animation: uiIn 0.6s ease both; }
body:not(.booting) .hint-bar { opacity: 1; animation: uiIn 0.6s ease 0.15s both; }
body:not(.booting) .home { opacity: 1; animation: uiIn 0.6s ease 0.05s both; }
body:not(.booting) .menu-bars .menu-bar {
  /* Fill mode "backwards" so the animation only holds the pre-start state
     during its delay. Once it finishes we revert to normal CSS rules,
     letting the fly-off transform in body.view-section .menu-bar take over. */
  animation: barSlideIn 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
}
body:not(.booting) .menu-bars .menu-bar:nth-child(1) { animation-delay: 0.10s; }
body:not(.booting) .menu-bars .menu-bar:nth-child(2) { animation-delay: 0.20s; }
body:not(.booting) .menu-bars .menu-bar:nth-child(3) { animation-delay: 0.30s; }
body:not(.booting) .menu-bars .menu-bar:nth-child(4) { animation-delay: 0.40s; }
@keyframes uiIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes barSlideIn {
  from { opacity: 0; transform: translateX(60px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* -------- Responsive -------- */
@media (max-width: 900px) {
  .home {
    grid-template-columns: minmax(220px, 0.85fr) minmax(320px, 1.15fr);
    grid-template-rows: 1fr;
    gap: 20px;
    padding: 16px 3vw;
  }
  .dash-left { padding: 8px 0; }
  .orb-slot { min-height: 200px; }
  .menu-bars { padding: 0; }
  .menu-preview { height: min(210px, 25vh); }
  .menu-bar { grid-template-columns: 44px 1fr auto; padding: 14px 18px; }
  .mb-label { font-size: 16px; }
  .about-body { grid-template-columns: 1fr; }
  .about-portrait { max-width: 280px; margin: 0 auto; }
  .contact-body { grid-template-columns: minmax(220px, 280px) 1fr; }
  .contact-model-preview { height: 250px; }
  .sec-title { font-size: 15px; letter-spacing: 0.2em; }
  .hint-bar { gap: 12px; font-size: 9px; letter-spacing: 0.18em; }
  .hb-right { display: none; }
  .status-line .live-text { display: none; }
  .crumbs { display: none; }
}

/* Phone portrait: compact dashboard, safe-area spacing, and thumb-sized UI. */
@media (max-width: 640px) {
  .home {
    inset: 0 0 calc(48px + env(safe-area-inset-bottom)) 0;
    grid-template-columns: 1fr;
    grid-template-rows: 118px minmax(0, 1fr);
    align-items: stretch;
    gap: 8px;
    padding:
      max(10px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      8px
      max(12px, env(safe-area-inset-left));
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
  }
  .home::-webkit-scrollbar { display: none; }

  .dash-left {
    grid-template-columns: 94px minmax(0, 1fr);
    grid-template-rows: 1fr;
    gap: 8px;
    min-height: 0;
    height: 118px;
    padding: 0;
  }
  .orb-slot { min-height: 0; height: 118px; }
  .operator {
    min-width: 0;
    gap: 5px;
    padding: 10px 12px;
    overflow: hidden;
  }
  .op-name {
    font-size: clamp(13px, 4vw, 17px);
    letter-spacing: 0.06em;
    white-space: nowrap;
  }
  .op-sub {
    font-size: 8px;
    letter-spacing: 0.2em;
    white-space: nowrap;
  }
  .sys-info { gap: 2px; margin-top: 1px; font-size: 9px; }
  .sys-line { grid-template-columns: 62px minmax(0, 1fr); padding: 2px 0; }
  .sys-line dt { letter-spacing: 0.14em; }
  .sys-line dd {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: 0.04em;
  }

  .menu-bars {
    align-self: start;
    justify-self: stretch;
    gap: 7px;
    min-height: 0;
    padding: 0 2px;
    touch-action: none;
  }
  .menu-bar {
    min-height: 46px;
    grid-template-columns: 40px 1fr auto;
    gap: 10px;
    padding: 9px 13px;
    clip-path: polygon(
      0 0, calc(100% - 10px) 0, 100% 10px,
      100% 100%, 10px 100%, 0 calc(100% - 10px)
    );
  }
  .menu-bar:hover,
  .menu-bar:focus-visible,
  .menu-bar.hover,
  .menu-bar.touch-armed { transform: translateX(3px); }
  .mb-chip { padding: 3px 6px; font-size: 10px; letter-spacing: 0.2em; }
  .mb-label { font-size: 13px; letter-spacing: 0.07em; }
  .mb-cta { font-size: 19px; }
  .menu-preview {
    width: min(100%, 330px);
    height: clamp(130px, 22dvh, 175px);
    margin-top: -2px;
  }
  .mp-stage { inset: -4% 9% 18px; }
  .mp-label { font-size: 9px; letter-spacing: 0.25em; }
  .mp-label::before,
  .mp-label::after { width: 12px; margin-left: 6px; margin-right: 6px; }

  .section {
    inset: 0 0 calc(48px + env(safe-area-inset-bottom)) 0;
    padding:
      max(10px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      8px
      max(12px, env(safe-area-inset-left));
  }
  .sec-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
    padding-bottom: 9px;
    margin-bottom: 12px;
  }
  .back {
    min-height: 44px;
    padding: 8px 3px;
    gap: 5px;
    font-size: 9px;
    letter-spacing: 0.2em;
  }
  .back-glyph { font-size: 13px; }
  .sec-title {
    min-width: 0;
    font-size: clamp(10px, 3.1vw, 13px);
    letter-spacing: 0.09em;
    line-height: 1.35;
    text-align: left;
  }
  .sec-code { padding: 4px 7px; font-size: 10px; letter-spacing: 0.18em; }
  .sec-body { padding-right: 2px; padding-bottom: 14px; }

  .about-body { gap: 20px; }
  .about-portrait { max-width: 220px; }
  .portrait-inner { inset: 8px; }
  .portrait-caption { font-size: 9px; letter-spacing: 0.26em; }
  .about-text p { font-size: 14px; line-height: 1.6; }
  .about-lead { font-size: 16px !important; }
  .about-stats { margin-top: 18px; }
  .about-stats li {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 10px 12px;
    font-size: 11px;
  }

  .projects-body { grid-template-columns: 1fr; }
  .project-card { padding: 15px 15px 14px; gap: 10px; }
  .pc-head { letter-spacing: 0.2em; }
  .pc-title { font-size: 15px; }
  .pc-desc { font-size: 13px; line-height: 1.55; }
  .pc-actions { display: grid; grid-template-columns: 1fr; }
  .pc-btn { min-height: 44px; display: grid; place-items: center; text-align: center; }

  .timeline { padding-left: 14px; }
  .tl-entry { padding: 6px 0 18px 24px; }
  .tl-node { left: -5px; width: 12px; height: 12px; }
  .tl-head { flex-wrap: wrap; gap: 6px; font-size: 10px; letter-spacing: 0.18em; }
  .tl-title { font-size: 13px; line-height: 1.4; }
  .tl-desc { font-size: 13px; line-height: 1.55; }

  .contact-body {
    grid-template-columns: 1fr;
    grid-template-areas:
      "preview"
      "channels"
      "status";
    gap: 16px;
  }
  .contact-model-preview { max-width: 320px; height: 190px; margin: 0 auto; }
  .contact-model-stage { inset: -5% 5% 22px; }
  .channels { grid-template-columns: 1fr; }
  .channel {
    min-height: 60px;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 12px 14px;
  }
  .channel:hover,
  .channel.touch-armed { transform: translateX(3px); }
  .ch-name { font-size: 11px; }
  .ch-val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .net-panel { padding: 14px; }
  .np-title { font-size: 10px; }
  .np-badge { font-size: 9px; letter-spacing: 0.18em; }
  .np-line { grid-template-columns: 82px minmax(0, 1fr); font-size: 10px; }
  .np-key { letter-spacing: 0.18em; }

  .hint-bar {
    height: calc(48px + env(safe-area-inset-bottom));
    justify-content: center;
    padding:
      0
      max(12px, env(safe-area-inset-right))
      env(safe-area-inset-bottom)
      max(12px, env(safe-area-inset-left));
    font-size: 8px;
    line-height: 1.35;
    letter-spacing: 0.13em;
    text-align: center;
  }
  .hint-bar .hb-item,
  .hint-bar .hb-right { display: none; }
  .hb-mobile { display: inline-flex; align-items: center; justify-content: center; }
  .hb-mobile-section { display: none; }
  body.view-section .hb-mobile-home { display: none; }
  body.view-section .hb-mobile-section { display: inline-flex; }

  .boot-inner { width: min(88vw, 340px); }
  .boot-title { font-size: 12px; line-height: 1.5; letter-spacing: 0.14em; }
  .boot-lines { min-width: 0; width: 100%; font-size: 10px; letter-spacing: 0.08em; }
}

/* Short iPhones and mobile landscape keep the full dashboard without clipping. */
@media (max-width: 640px) and (max-height: 720px) {
  .home { grid-template-rows: 104px minmax(0, 1fr); gap: 6px; }
  .dash-left { height: 104px; grid-template-columns: 82px minmax(0, 1fr); }
  .orb-slot { height: 104px; }
  .operator { padding: 8px 10px; }
  .menu-bar { min-height: 43px; padding-top: 7px; padding-bottom: 7px; }
  .menu-preview { height: clamp(118px, 19dvh, 138px); }
}

@media (max-height: 500px) and (min-width: 641px) and (max-width: 950px) {
  .home {
    bottom: calc(40px + env(safe-area-inset-bottom));
    grid-template-columns: minmax(250px, 0.8fr) minmax(340px, 1.2fr);
    grid-template-rows: 1fr;
    gap: 14px;
    padding:
      max(8px, env(safe-area-inset-top))
      max(18px, env(safe-area-inset-right))
      6px
      max(18px, env(safe-area-inset-left));
  }
  .dash-left {
    grid-template-columns: 120px minmax(0, 1fr);
    grid-template-rows: 1fr;
    gap: 8px;
    padding: 0;
  }
  .orb-slot { min-height: 0; }
  .operator { gap: 5px; padding: 10px 12px; }
  .op-name { font-size: 15px; }
  .op-sub { font-size: 8px; letter-spacing: 0.2em; }
  .sys-info { gap: 2px; font-size: 9px; }
  .sys-line { grid-template-columns: 62px 1fr; padding: 2px 0; }
  .menu-bars { gap: 6px; touch-action: none; }
  .menu-bar { min-height: 39px; padding: 7px 13px; }
  .menu-preview { height: 112px; }
  .section {
    bottom: calc(40px + env(safe-area-inset-bottom));
    padding:
      max(8px, env(safe-area-inset-top))
      max(14px, env(safe-area-inset-right))
      6px
      max(14px, env(safe-area-inset-left));
  }
  .hint-bar {
    height: calc(40px + env(safe-area-inset-bottom));
    justify-content: center;
    padding: 0 max(18px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(18px, env(safe-area-inset-left));
    font-size: 8px;
    letter-spacing: 0.12em;
    text-align: center;
  }
  .hint-bar .hb-item,
  .hint-bar .hb-right { display: none; }
  .hb-mobile { display: inline-flex; }
  .hb-mobile-section { display: none; }
  body.view-section .hb-mobile-home { display: none; }
  body.view-section .hb-mobile-section { display: inline-flex; }
}

@media (hover: none) and (pointer: coarse) {
  .menu-bar,
  .channel,
  .pc-btn,
  .back { touch-action: manipulation; }
  .menu-bar:active,
  .channel:active,
  .pc-btn:active,
  .back:active { transform: scale(0.985); }
  .project-card:hover { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 150ms !important;
  }
  .scan, .portrait-scan { animation: none; }
  .mp-aura, .mp-orbit, .mp-scan { animation: none; }
}

/* -------- Particle orb (3D rotating swarm) --------
   A 0-sized container rotates continuously in 3D. Each particle inside is
   given random --rz and --ry angles via inline style, then a single shared
   keyframe translates it out along that vector, holds it on the sphere,
   and drifts it outward before looping. */

.orb-slot {
  position: relative;
  overflow: visible;
}

.orb-halo {
  position: absolute;
  inset: -20%;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(
    circle at center,
    rgba(182, 255, 60, 0.35) 0%,
    rgba(85, 212, 32, 0.18) 22%,
    rgba(14, 106, 18, 0.08) 45%,
    rgba(0, 0, 0, 0) 70%
  );
  filter: blur(4px);
  animation: orbHaloPulse 4.2s ease-in-out infinite;
  opacity: 0;
}
body:not(.booting) .orb-halo { opacity: 1; transition: opacity 0.8s ease 0.3s; }
@keyframes orbHaloPulse {
  0%, 100% { transform: scale(1);    filter: blur(4px); }
  50%      { transform: scale(1.05); filter: blur(6px); }
}

.orb-3d {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  perspective: 900px;
  pointer-events: none;
}

.orb-wrap {
  position: relative;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  animation: orbSpin 16s linear infinite;
  opacity: 0;
}
body:not(.booting) .orb-wrap { opacity: 1; transition: opacity 0.6s ease 0.2s; }

@keyframes orbSpin {
  from { transform: rotateY(0deg)   rotateX(0deg); }
  to   { transform: rotateY(360deg) rotateX(360deg); }
}

.orb-particle {
  --rz: 0deg;
  --ry: 0deg;
  --hue: 100;
  --orbR: 130px;
  --outR: 380px;
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: hsl(var(--hue) 100% 62%);
  box-shadow: 0 0 6px hsl(var(--hue) 100% 62% / 0.9);
  opacity: 0;
  animation: orbParticle 16s linear infinite;
}

@keyframes orbParticle {
  0%   {
    opacity: 0;
    transform: rotateZ(calc(0deg - var(--rz))) rotateY(var(--ry))
               translateX(0) rotateZ(var(--rz));
  }
  18%  { opacity: 1; }
  30%  {
    transform: rotateZ(calc(0deg - var(--rz))) rotateY(var(--ry))
               translateX(var(--orbR)) rotateZ(var(--rz));
  }
  80%  {
    opacity: 1;
    transform: rotateZ(calc(0deg - var(--rz))) rotateY(var(--ry))
               translateX(var(--orbR)) rotateZ(var(--rz));
  }
  100% {
    opacity: 0;
    transform: rotateZ(calc(0deg - var(--rz))) rotateY(var(--ry))
               translateX(var(--outR)) rotateZ(var(--rz));
  }
}

/* Smaller orb on mobile */
@media (max-width: 900px) {
  .orb-particle { --orbR: 100px; --outR: 300px; }
}
@media (max-width: 560px) {
  .orb-particle { --orbR: 80px;  --outR: 240px; }
}
