/* Immersive digital architecture direction. */
section[id] { scroll-margin-top: var(--header); }

.studio-sequence { background: #010308; }
.studio-sequence::before {
  inset: 0;
  transform: none;
  background: radial-gradient(circle at 50% 50%,rgba(var(--signal-rgb),.08),transparent 22%),radial-gradient(circle at 50% 50%,rgba(var(--violet-rgb),.055),transparent 44%),#010308;
  animation: studio-ambient 2.8s ease both;
}
.studio-sequence::after {
  top: 50%;
  right: auto;
  bottom: auto;
  left: 50%;
  width: min(780px,82vw);
  height: 1px;
  transform: translate(-50%,-50%) scaleX(0);
  background: linear-gradient(90deg,transparent,var(--signal),#fff,var(--violet),transparent);
  box-shadow: 0 0 18px rgba(var(--signal-rgb),.72),0 0 60px rgba(var(--violet-rgb),.34);
  filter: none;
  animation: studio-flash-line 2.4s var(--ease) .12s both;
}
.studio-intro { position: relative; z-index: 3; display: grid; width: min(520px,80vw); aspect-ratio: 1.55; place-items: center; perspective: 900px; }
.studio-streaks { position: absolute; inset: -28% -12%; overflow: hidden; filter: blur(.4px) saturate(1.22); }
.studio-streaks i { --tx: 0px; --rot: 0deg; --delay: 0s; position: absolute; top: 50%; left: 50%; width: 7px; height: 160%; transform: translate(-50%,-50%) scaleY(0) rotate(var(--rot)); transform-origin: center; border-radius: 999px; opacity: 0; background: linear-gradient(180deg,transparent 5%,var(--signal) 32%,#eefcff 50%,var(--violet) 68%,transparent 95%); box-shadow: 0 0 16px rgba(var(--signal-rgb),.42); animation: studio-streak 2.25s cubic-bezier(.16,1,.3,1) var(--delay) both; }
.studio-streaks i:nth-child(1){--tx:-210px;--rot:-8deg;--delay:.03s}.studio-streaks i:nth-child(2){--tx:-155px;--rot:-6deg;--delay:.07s}.studio-streaks i:nth-child(3){--tx:-104px;--rot:-4deg;--delay:.11s}.studio-streaks i:nth-child(4){--tx:-52px;--rot:-2deg;--delay:.15s}.studio-streaks i:nth-child(5){--tx:0px;--rot:0deg;--delay:.18s}.studio-streaks i:nth-child(6){--tx:52px;--rot:2deg;--delay:.15s}.studio-streaks i:nth-child(7){--tx:104px;--rot:4deg;--delay:.11s}.studio-streaks i:nth-child(8){--tx:155px;--rot:6deg;--delay:.07s}.studio-streaks i:nth-child(9){--tx:210px;--rot:8deg;--delay:.03s}
.studio-mark { position: relative; z-index: 4; display: flex; align-items: center; color: #f4fbff; font: 700 clamp(5.5rem,13vw,10rem)/.8 var(--font-display); letter-spacing: -.11em; filter: drop-shadow(0 0 26px rgba(var(--signal-rgb),.3)); }
.studio-mark span { display: block; background: linear-gradient(115deg,#eafcff 6%,var(--signal) 43%,#fff 52%,var(--violet) 88%); background-clip: text; color: transparent; opacity: 0; transform: scaleX(.18) scaleY(1.28); animation: studio-mark-reveal 2.25s cubic-bezier(.16,1,.3,1) .18s both; }
.studio-mark span:last-child { animation-delay: .25s; }
.studio-flare { position: absolute; z-index: 5; top: 50%; left: 50%; width: 12px; aspect-ratio: 1; transform: translate(-50%,-50%) scale(0); border-radius: 50%; background: #fff; box-shadow: 0 0 22px 8px #fff,0 0 90px 34px rgba(var(--signal-rgb),.44),0 0 150px 55px rgba(var(--violet-rgb),.24); animation: studio-flare 2.4s ease .12s both; }
.studio-signature { position: absolute; z-index: 4; top: calc(50% + 122px); left: 50%; margin: 0; transform: translate(-50%,12px); opacity: 0; color: var(--muted); font: 500 .52rem var(--font-mono); letter-spacing: .23em; text-align: center; white-space: nowrap; animation: studio-signature-in .65s ease 1.72s forwards; }
.studio-sequence.is-leaving .studio-intro { animation: studio-intro-out .65s var(--ease) forwards; }
.studio-sequence.is-leaving .studio-signature { animation: studio-signature-out .38s ease forwards; }
@keyframes studio-ambient { 0%{opacity:0} 24%,100%{opacity:1} }
@keyframes studio-flash-line { 0%,12%{transform:translate(-50%,-50%) scaleX(0);opacity:0} 34%{opacity:1} 62%{transform:translate(-50%,-50%) scaleX(1);opacity:.9} 100%{transform:translate(-50%,-50%) scaleX(.05);opacity:0} }
@keyframes studio-streak { 0%,8%{transform:translate(-50%,-50%) scaleY(0) rotate(var(--rot));opacity:0} 28%{opacity:.95} 55%{transform:translate(calc(-50% + var(--tx)),-50%) scaleY(1) rotate(var(--rot));opacity:.72} 100%{transform:translate(calc(-50% + var(--tx)),-50%) scaleY(.12) rotate(var(--rot));opacity:0} }
@keyframes studio-mark-reveal { 0%,16%{opacity:0;transform:scaleX(.12) scaleY(1.35);filter:blur(10px)} 44%{opacity:1;filter:blur(0)} 72%,100%{opacity:1;transform:scaleX(1) scaleY(1);filter:blur(0)} }
@keyframes studio-flare { 0%,26%{transform:translate(-50%,-50%) scale(0);opacity:0} 42%{transform:translate(-50%,-50%) scale(1);opacity:1} 64%,100%{transform:translate(-50%,-50%) scale(.12);opacity:0} }
@keyframes studio-signature-in { to{transform:translate(-50%,0);opacity:1} }
@keyframes studio-intro-out { to{transform:scale(1.3);filter:blur(12px);opacity:0} }
@keyframes studio-signature-out { to{transform:translate(-50%,-8px);opacity:0} }

html[data-webgl="active"] {
  --bg: #050a12;
  --bg-2: #09111d;
  --surface: rgba(10,18,30,.82);
  --surface-2: #0c1624;
  --surface-3: #101d2d;
  --text: #edf5ff;
  --muted: #a8b6c8;
  --dim: #71839a;
  --line: rgba(159,185,215,.16);
  --line-hot: rgba(75,205,220,.44);
}
html[data-webgl="active"] body { background: #03070d; color: var(--text); }
body.webgl-active .webgl-world { opacity: .76; mix-blend-mode: screen; filter: saturate(1.12) contrast(1.04); }
body.webgl-active .hero,
body.webgl-active .profile-section,
body.webgl-active .expertise,
body.webgl-active .experience,
body.webgl-active .cms,
body.webgl-active .process,
body.webgl-active .systems-lab,
body.webgl-active .contact { background-color: rgba(3,8,16,.48); }
body.webgl-active .hero { background: radial-gradient(circle at 74% 35%,rgba(var(--violet-rgb),.13),transparent 26%),radial-gradient(circle at 38% 72%,rgba(var(--signal-rgb),.08),transparent 30%),rgba(3,8,16,.42); }
body.webgl-active .profile-section,
body.webgl-active .expertise,
body.webgl-active .experience,
body.webgl-active .cms,
body.webgl-active .process,
body.webgl-active .systems-lab,
body.webgl-active .contact { background-image: linear-gradient(180deg,rgba(3,8,16,.22),rgba(3,8,16,.5) 52%,rgba(3,8,16,.25)); }
body.webgl-active .site-header.scrolled { background: rgba(4,9,17,.76); box-shadow: 0 12px 42px rgba(0,0,0,.22); }
body.webgl-active .language-switch,
body.webgl-active .signal-toggle,
body.webgl-active .menu-toggle { background: rgba(7,14,24,.72); }
body.webgl-active .logo-stream,
body.webgl-active .site-footer { background: rgba(4,9,17,.78); }
body.webgl-active .logo-set img { filter: invert(1); opacity: .68; }
body.webgl-active .profile-hud { background: linear-gradient(160deg,rgba(var(--signal-rgb),.12),transparent 44%),radial-gradient(circle at 50% 36%,rgba(var(--violet-rgb),.16),transparent 45%),rgba(8,16,27,.82); box-shadow: 0 38px 100px rgba(0,0,0,.36); }
body.webgl-active .profile-data,
body.webgl-active .profile-showcase,
body.webgl-active .profile-manifesto,
body.webgl-active .tech-stack-card,
body.webgl-active .tech-logo,
body.webgl-active .profile-stat,
body.webgl-active .project-feature,
body.webgl-active .tech-matrix,
body.webgl-active .capability,
body.webgl-active .experience-body,
body.webgl-active .cms-card,
body.webgl-active .protocol-list > li > span,
body.webgl-active .lab-card,
body.webgl-active .lab-cta,
body.webgl-active .contact-panel { border-color: var(--line); background: rgba(7,15,26,.72); box-shadow: 0 22px 70px rgba(0,0,0,.2); backdrop-filter: blur(18px); }
body.webgl-active .profile-stat > p { color: var(--muted); }
body.webgl-active .lab-card:hover { background: rgba(11,22,36,.9); box-shadow: 0 28px 70px rgba(0,0,0,.3); }
body.webgl-active .github-action-card { border-color: var(--line); background: rgba(7,15,26,.78); color: var(--text); box-shadow: 0 16px 40px rgba(0,0,0,.2); }
body.webgl-active .portal-stage span,
body.webgl-active .system-navigator a > span,
body.webgl-active .architecture-readout,
body.webgl-active .sound-spectrum,
body.webgl-active .toast { background: rgba(5,12,22,.82); }
body.webgl-active .contact-links img,
body.webgl-active .contact-links svg { filter: invert(1); }
body.webgl-active .mobile-nav { background: rgba(4,9,17,.96); }

.immersive-section > .container { position: relative; z-index: 2; }
.immersive-section::after {
  position: absolute;
  z-index: 0;
  top: clamp(90px, 9vw, 150px);
  right: 4vw;
  color: transparent;
  content: attr(data-system-code);
  font: 500 clamp(8rem, 17vw, 17rem)/.75 var(--font-display);
  letter-spacing: -.1em;
  opacity: .07;
  pointer-events: none;
  -webkit-text-stroke: 1px var(--signal);
}

.system-chapter {
  position: absolute;
  z-index: 7;
  top: 30px;
  left: 50%;
  display: grid;
  width: var(--container);
  grid-template-columns: auto minmax(40px,110px) auto 1fr;
  gap: 13px;
  align-items: center;
  transform: translate(-50%,10px);
  opacity: .58;
  pointer-events: none;
  transition: opacity .7s ease, transform .9s var(--ease);
}

.system-chapter > span,
.system-chapter > strong,
.system-chapter > small { font-family: var(--font-mono); font-weight: 500; letter-spacing: .11em; }
.system-chapter > span { color: var(--signal); font-size: .45rem; }
.system-chapter > i { position: relative; height: 1px; background: linear-gradient(90deg,var(--line-hot),var(--line)); }
.system-chapter > i::before { position: absolute; top: 50%; left: 0; width: 5px; height: 5px; transform: translate(-50%,-50%); border-radius: 50%; background: var(--signal); box-shadow: 0 0 12px rgba(var(--signal-rgb),.55); content: ""; }
.system-chapter > strong { color: var(--text); font-size: .48rem; }
.system-chapter > small { justify-self: end; color: var(--dim); font-size: .43rem; letter-spacing: .07em; text-align: right; }
.immersive-section.is-portal-active .system-chapter { transform: translate(-50%,0); opacity: 1; }

.system-navigator {
  position: fixed;
  z-index: 42;
  top: 50%;
  right: 20px;
  display: grid;
  width: 18px;
  gap: 13px;
  transform: translateY(-50%);
}

.system-navigator::before {
  position: absolute;
  z-index: -1;
  top: 34px;
  bottom: 5px;
  left: 8px;
  width: 1px;
  background: linear-gradient(transparent, var(--line-hot) 12%, var(--line) 88%, transparent);
  content: "";
}

.system-navigator__title {
  position: absolute;
  right: -2px;
  bottom: calc(100% + 18px);
  color: var(--dim);
  font: 500 .42rem var(--font-mono);
  letter-spacing: .13em;
  white-space: nowrap;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.system-navigator a {
  position: relative;
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  color: var(--dim);
  text-decoration: none;
}

.system-navigator a > i {
  display: block;
  width: 5px;
  height: 5px;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: rgba(255,255,255,.94);
  transition: transform .35s var(--ease), background .25s, box-shadow .25s, color .25s;
}

.system-navigator a > span {
  position: absolute;
  top: 50%;
  right: 24px;
  padding: 5px 8px;
  transform: translate(8px,-50%);
  border: 1px solid transparent;
  border-radius: 6px;
  background: rgba(255,255,255,.82);
  box-shadow: 0 8px 22px rgba(24,48,75,.06);
  opacity: 0;
  color: var(--muted);
  font: 500 .45rem var(--font-mono);
  letter-spacing: .1em;
  white-space: nowrap;
  pointer-events: none;
  backdrop-filter: blur(12px);
  transition: opacity .25s, transform .35s var(--ease);
}

.system-navigator a:hover > span,
.system-navigator a:focus-visible > span,
.system-navigator a.active > span { transform: translate(0,-50%); opacity: 1; }
.system-navigator a.active { color: var(--signal); }
.system-navigator a.active > i { transform: scale(1.65); background: var(--signal); box-shadow: 0 0 0 5px rgba(var(--signal-rgb),.1), 0 0 18px rgba(var(--signal-rgb),.36); }
.system-navigator a.active > span { border-color: rgba(var(--signal-rgb),.15); color: var(--signal); }

.architecture-readout {
  position: absolute;
  z-index: 8;
  top: 57%;
  left: -76px;
  display: grid;
  width: 148px;
  gap: 8px;
  padding: 13px 14px;
  transform: translateY(-50%);
  border: 1px solid rgba(var(--signal-rgb),.18);
  border-radius: 10px;
  background: rgba(255,255,255,.78);
  box-shadow: 0 18px 42px rgba(24,48,75,.09);
  backdrop-filter: blur(16px);
}

.architecture-readout > span { margin-bottom: 2px; color: var(--signal); font: 500 .42rem var(--font-mono); letter-spacing: .12em; }
.architecture-readout > div { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.architecture-readout i { position: relative; display: block; height: 2px; overflow: hidden; background: rgba(22,34,53,.08); }
.architecture-readout i::after { position: absolute; inset: 0; transform: translateX(-72%); background: linear-gradient(90deg,transparent,var(--signal),transparent); content: ""; animation: architecture-flow 3.8s ease-in-out infinite; }
.architecture-readout div:nth-child(3) i::after { animation-delay: -.7s; }
.architecture-readout div:nth-child(4) i::after { animation-delay: -1.4s; }
.architecture-readout div:nth-child(5) i::after { animation-delay: -2.1s; }
.architecture-readout b { color: var(--dim); font: 500 .39rem var(--font-mono); letter-spacing: .08em; }

.hero h1 { text-wrap: balance; }
.hero h1 em { text-shadow: 0 0 34px rgba(var(--signal-rgb),.1); }

@keyframes architecture-flow {
  0%, 12% { transform: translateX(-90%); opacity: 0; }
  35%, 68% { opacity: 1; }
  88%, 100% { transform: translateX(90%); opacity: 0; }
}

.github-action-card {
  display: inline-flex;
  min-height: 52px;
  gap: 11px;
  align-items: center;
  padding: 0 17px;
  border: 1px solid rgba(22, 34, 53, .16);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 12px 30px rgba(24, 48, 75, .075);
  font: 600 .62rem var(--font-mono);
  letter-spacing: .065em;
  text-decoration: none;
  text-transform: uppercase;
  transition: .25s var(--ease);
}

.github-action-card svg { width: 16px; flex: 0 0 auto; }
.github-action-card svg:first-child { width: 19px; height: 19px; color: var(--signal); }
.github-action-card svg:last-child { margin-left: 3px; color: var(--dim); }
.github-action-card:hover { transform: translateY(-3px); border-color: var(--signal); color: var(--signal); box-shadow: 0 18px 38px rgba(24, 48, 75, .12); }
.project-detail-link,
.lab-card > .project-detail-link,
.cms-card > .project-detail-link {
  position: relative;
  inset: auto;
  display: inline-flex;
  width: fit-content;
  height: auto;
  min-height: 42px;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin-top: 22px;
  padding: 0 15px;
  border: 1px solid var(--line-hot);
  border-radius: 999px;
  background: rgba(var(--signal-rgb), .055);
  color: var(--signal);
  font: 600 .58rem var(--font-mono);
  letter-spacing: .08em;
  text-decoration: none;
  text-transform: uppercase;
  transition: .25s var(--ease);
}

.lab-card > .project-detail-link { margin-top: 22px; }
.project-detail-link svg { width: 14px; }
.project-detail-link:hover { transform: translateY(-2px); background: var(--signal); color: #fff; }
.experience-body .project-detail-link { margin-top: 4px; }
@media (max-width: 1200px) {
  .system-navigator,
  .architecture-readout { display: none; }
  .mobile-nav { background: rgba(255, 255, 255, .97); }
}

@media (max-width: 860px) {
  .system-chapter { top: 18px; width: calc(100% - 32px); grid-template-columns: auto 45px auto; }
  .system-chapter > small { display: none; }
  .immersive-section::after { top: 105px; right: 18px; font-size: clamp(6rem,30vw,10rem); }
  body.webgl-active .webgl-world { opacity: .42; }
  .profile-stats { gap: 14px; }
  .profile-stat { min-height: 205px; padding-inline: 18px; }
}

@media (max-width: 560px) {
  .studio-intro { width: min(420px,88vw); }
  .studio-mark { font-size: clamp(4.7rem,26vw,7.5rem); }
  .studio-signature {
    top: calc(50% + 92px);
    width: 90vw;
    font-size: .42rem;
    line-height: 1.7;
    white-space: normal;
  }
  .github-action-card { width: 100%; justify-content: center; }
  .profile-manifesto > p {
    margin: 42px auto;
    font-size: 1rem;
    line-height: 1.7;
  }

  .profile-stat { min-height: 170px; }
  .profile-stat > strong { font-size: 4.5rem; }
  .profile-stat > p { font-size: .92rem; }
}

@media (prefers-reduced-motion: reduce) {
  .architecture-readout i::after { animation: none; transform: none; opacity: .55; }
  .system-navigator a > *,
  .architecture-readout { transition: none; }
  .system-chapter { transform: translate(-50%,0); transition: none; }
}
