/* ==========================================================================
   GUSEN WORLD — Active Theory-oriented layer
   Realtime stage, custom cursor, HUD, kinetic headings, warp transitions.
   ========================================================================== */

/* World canvases ---------------------------------------------------------- */
.world-canvas {
  position: absolute !important;
  inset: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
  opacity: 0;
  transition: opacity 2.2s var(--ease);
  touch-action: pan-y;
}
.world-ready .world-canvas { opacity: 1; }
.world-fallback { background: radial-gradient(50% 50% at 50% 50%, rgba(185,255,207,.08), transparent 70%); }
.hero-world, .hero__stage .world-canvas { position: absolute; inset: 0; }
.hero-world { z-index: 1; }
.hero__stage { overflow: hidden; cursor: grab; }
.hero__stage.is-dragging { cursor: grabbing; }
.hero__world-hud {
  position: absolute;
  right: var(--gutter);
  bottom: 104px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  color: rgba(255,255,255,.28);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .14em;
  text-transform: uppercase;
  pointer-events: none;
}
.hero__world-hud span:last-child { color: rgba(185,255,207,.55); }
.hero__world-hud { transition: opacity .6s var(--ease), transform .6s var(--ease); }
.hero__world-hud.is-hidden { opacity: 0; transform: translateY(8px); }
@media (max-width: 900px) { .hero__world-hud { display: none; } }

.apple-hero__world {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: auto;
  overflow: hidden;
}
.apple-hero__world .world-canvas { opacity: 0; }
.apple-hero__world.world-ready .world-canvas { opacity: 1; }

.nc-hero__world {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: auto;
}
.nc-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(2,6,10,.86) 0%, rgba(2,6,10,.55) 38%, rgba(2,6,10,.05) 70%, transparent 82%);
}
.nc-hero__inner { position: relative; z-index: 3; }
.sky-hero__world {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: clamp(620px, 78vh, 800px);
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.ai-hero-world {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 420px;
}

/* Fixed grain / optical texture ------------------------------------------- */
#active-grain {
  position: fixed;
  inset: 0;
  z-index: 2000;
  pointer-events: none;
  opacity: .035;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
}

/* Custom cursor ----------------------------------------------------------- */
#active-cursor {
  position: fixed;
  left: 0; top: 0;
  z-index: 9000;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(-100px, -100px, 0);
  transition: opacity .25s ease;
  will-change: transform;
  filter: drop-shadow(0 0 1px rgba(0,0,0,.95)) drop-shadow(0 0 7px rgba(0,0,0,.7));
}
#active-cursor.is-live { opacity: 1; }
#active-cursor .cursor-dot {
  position: absolute;
  width: 6px; height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,.85), 0 0 10px rgba(185,255,207,.75);
  transition: width .3s var(--ease), height .3s var(--ease), margin .3s var(--ease);
}
#active-cursor .cursor-ring {
  position: absolute;
  width: 36px; height: 36px;
  margin: -18px 0 0 -18px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.92);
  box-shadow: 0 0 0 1px rgba(0,0,0,.55), 0 0 18px rgba(0,0,0,.45);
  transition: width .45s var(--ease), height .45s var(--ease), margin .45s var(--ease), border-color .35s ease, background .35s ease;
}
#active-cursor .cursor-label {
  position: absolute;
  left: 40px; top: 40px;
  color: #fff;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .16em;
  text-shadow: 0 0 2px #000, 0 1px 10px rgba(0,0,0,.95);
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity .25s ease, transform .25s ease;
}
#active-cursor.is-hover .cursor-ring { width: 56px; height: 56px; margin: -28px 0 0 -28px; border-color: rgba(255,255,255,1); background: rgba(255,255,255,.04); }
#active-cursor.is-hover .cursor-dot { width: 2px; height: 2px; margin: -1px 0 0 -1px; }
#active-cursor.has-label .cursor-label { opacity: .8; transform: none; }
#active-cursor.is-down .cursor-ring { width: 22px; height: 22px; margin: -11px 0 0 -11px; }
html.has-custom-cursor,
html.has-custom-cursor * { cursor: none !important; }
html.has-custom-cursor input,
html.has-custom-cursor textarea { cursor: text !important; }
/* No coarse-pointer CSS override here. Whether the custom cursor exists is
   decided once in JS; hiding it again via media query was causing hybrid
   laptops to lose both the native and custom cursor. */

/* Fixed world HUD --------------------------------------------------------- */
#world-hud {
  position: fixed;
  left: clamp(14px, 2vw, 30px);
  right: clamp(14px, 2vw, 30px);
  bottom: 12px;
  z-index: 850;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  color: rgba(255,255,255,.45);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .14em;
  text-transform: uppercase;
  pointer-events: none;
  mix-blend-mode: difference;
  opacity: 0;
  transition: opacity .8s ease;
}
#world-hud.is-on { opacity: 1; }
#world-hud .hud-left { display: flex; flex-direction: column; gap: 4px; }
#world-hud .hud-left b { color: rgba(255,255,255,.8); font-weight: 400; }
#world-hud .hud-right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
#world-hud .hud-meter { width: 82px; height: 1px; background: rgba(255,255,255,.22); position: relative; overflow: hidden; }
#world-hud .hud-meter i { display: block; height: 100%; width: 0; background: #fff; transition: width .15s linear; }
#world-hud .hud-chapter { color: rgba(255,255,255,.76); }
@media (max-width: 720px) { #world-hud { display: none; } }

/* A small live status label injected into the nav ------------------------ */
.sound-toggle {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  opacity: .65;
  transition: opacity .3s ease, background .3s ease;
}
.sound-toggle:hover { opacity: 1; background: rgba(255,255,255,.08); }
.site-header.is-light .sound-toggle:hover { background: rgba(0,0,0,.06); }
.sound-toggle svg { width: 16px; height: 16px; }
.sound-toggle .sound-on { display: none; }
.sound-toggle.is-on .sound-on { display: block; }
.sound-toggle.is-on .sound-off { display: none; }
.sound-toggle.is-on { opacity: 1; color: var(--mint); }

/* Kinetic headings: preserved gradients, 3D pointer response -------------- */
[data-kinetic] {
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform .8s var(--ease);
}
[data-kinetic] .k-sheen {
  position: absolute;
  inset: -8% -12%;
  pointer-events: none;
  background: linear-gradient(112deg, transparent 20%, rgba(255,255,255,.12) 42%, transparent 58%);
  mix-blend-mode: screen;
  opacity: 0;
  transform: translateX(-30%);
  transition: opacity .6s ease, transform 1.2s var(--ease);
}
[data-kinetic].is-sheened .k-sheen { opacity: .8; transform: translateX(30%); }

/* Hero / Apple overrides to let the 3D stage breathe ---------------------- */
.hero {
  background: #020407;
}
.hero__stage {
  left: 0; right: 0; top: 0; bottom: 0;
}
.hero__vignette {
  background:
    linear-gradient(90deg, rgba(2, 4, 7, 0.76) 0%, rgba(2, 4, 7, 0.3) 40%, transparent 66%),
    radial-gradient(70% 75% at 50% 46%, transparent 42%, rgba(2, 4, 7, .54) 100%);
}
.hero__grid { opacity: .45; }
.hero__inner::before {
  background:
    linear-gradient(90deg, rgba(2,4,7,.55) 0%, rgba(2,4,7,.22) 40%, transparent 70%),
    linear-gradient(180deg, transparent 24%, transparent 70%, rgba(2,4,7,.62));
}
.apple-hero {
  background: #050606;
  color: #f5f5f7;
  min-height: 960px;
}
.apple-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(5,6,6,.92) 0%, rgba(5,6,6,.68) 32%, rgba(5,6,6,.12) 62%, transparent 80%),
    linear-gradient(180deg, rgba(5,6,6,.2), transparent 32%, rgba(5,6,6,.45));
}
.apple-hero::before {
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  opacity: .7;
}
.apple-hero__inner, .apple-hero__devices { position: relative; z-index: 2; }
.apple-hero .apple-hero__eyebrow { color: rgba(255,255,255,.45); }
.apple-hero .apple-hero__eyebrow i { background: var(--mint); box-shadow: 0 0 0 4px rgba(185,255,207,.08), 0 0 12px rgba(185,255,207,.6); }
.apple-hero h1 { color: #f5f5f7; }
.apple-hero h1 span {
  background: linear-gradient(100deg, #ffffff 0%, #b9ffcf 38%, #8fd8ff 68%, #ffffff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.apple-hero__sub { color: rgba(255,255,255,.52); }
.apple-hero__actions .btn--primary { background: #f5f5f7; color: #050606; }
.apple-hero__actions .btn--ghost { color: #f5f5f7; border-color: rgba(255,255,255,.2); }
.apple-hero__actions .btn--ghost:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.4); }
.apple-hero__note { color: rgba(255,255,255,.28); }
.apple-hero__devices::before { background: radial-gradient(50% 50% at 50% 50%, rgba(185,255,207,.11), transparent 72%); }
.hero-device__label { color: rgba(255,255,255,.35); }
.hero-device__label b { color: rgba(255,255,255,.8); }
.apple-hero .dev-iphone, .apple-hero .dev-ipad, .apple-hero .dev-mac, .apple-hero .dev-vision { filter: drop-shadow(0 25px 50px rgba(0,0,0,.45)); }

/* Nanocore world --------------------------------------------------------- */
.nc-hero__world .world-canvas { opacity: 0; }
.nc-hero__world.world-ready .world-canvas { opacity: 1; }
.nc-hero__station { display: none !important; }
.nc-hero h1 { color: #f5f5f7; }
.nc-hero .nc-hero__inner { pointer-events: none; }
.nc-hero .nc-hero__inner a, .nc-hero .nc-hero__inner .btn { pointer-events: auto; }

/* SkyNet world ----------------------------------------------------------- */
.sky-hero__grid { z-index: 1; }
.sky-hero > .container { position: relative; z-index: 2; }
.sky-hero__head { position: relative; z-index: 3; }
.sky-dash { z-index: 4; }
.sky-hero__world { opacity: .9; }
.sky-status {
  background: rgba(5,6,6,.58) !important;
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

/* AI 3D triad ------------------------------------------------------------ */
.core-triad {
  position: relative;
  height: 500px;
  display: block;
  perspective: none;
}
.core-triad__canvas {
  position: absolute;
  left: -7%;
  right: -7%;
  top: -9%;
  height: 92%;
  z-index: 0;
  -webkit-mask-image: radial-gradient(ellipse at 50% 46%, #000 42%, rgba(0,0,0,.7) 60%, transparent 78%);
  mask-image: radial-gradient(ellipse at 50% 46%, #000 42%, rgba(0,0,0,.7) 60%, transparent 78%);
}
.core-triad__canvas .world-canvas { opacity: 0; }
.core-triad__canvas.world-ready .world-canvas { opacity: 1; }
.core-triad__labels {
  position: absolute;
  left: 0; right: 0; bottom: 86px;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}
.core-triad__labels .core-mini {
  position: relative;
  transform: none !important;
  opacity: .42;
  transition: opacity .35s ease;
  padding: 10px 4px;
  gap: 5px;
}
.core-triad__labels .core-mini.is-active { opacity: 1; }
.core-triad__labels .core-mini:hover { opacity: .85; }
.core-triad__labels .core-mini__orb,
.core-triad__labels .core-mini__glyph { display: none !important; }
.core-triad__labels .core-mini__name { font-size: 17px; }
.core-triad__labels .core-mini em { font-size: 6px; letter-spacing: .08em; }
.core-triad__labels .core-mini b { top: 2px; right: 50%; transform: translateX(50%); color: rgba(255,255,255,.22); }
.core-triad__labels .core-mini::after {
  content: '';
  position: absolute;
  left: 32%; right: 32%;
  bottom: 0;
  height: 1px;
  background: currentColor;
  opacity: 0;
  transition: opacity .3s ease;
}
.core-triad__labels .core-mini.is-active::after { opacity: .7; }
.core-triad__line { display: none; }
.core-triad__caption { bottom: 0; }
@media (max-width: 720px) {
  .core-triad { height: 270px; }
  .core-triad__canvas { top: -2%; height: 78%; }
  .core-triad__labels { bottom: 0; }
  .core-triad__labels .core-mini__name { font-size: 14px; }
  .core-triad__labels .core-mini em { display: none; }
  .core-triad__caption { display: none; }
  .nc-hero__world { opacity: .5; }
  .nc-hero::after { background: linear-gradient(180deg, rgba(2,6,10,.25), rgba(2,6,10,.7) 50%, rgba(2,6,10,.92)); }
  .nc-hero__stats {
    background: rgba(2,6,10,.55);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(185,255,207,.12);
    padding: 14px 16px 12px;
    border-radius: 12px;
  }
  .nc-hero__actions .btn--ghost { background: rgba(2,6,10,.4); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
  .sky-hero__world { opacity: .55; }
  .apple-hero__world { opacity: .78; }
}

/* Intro telemetry -------------------------------------------------------- */
.intro-count {
  position: absolute;
  left: var(--gutter);
  bottom: 122px;
  z-index: 12;
  display: flex;
  align-items: flex-start;
  gap: 4px;
  color: rgba(185,255,207,.8);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .12em;
  pointer-events: none;
}
.intro-count #introPercent {
  font-size: clamp(38px, 5vw, 64px);
  line-height: .8;
  letter-spacing: -.06em;
  color: #f5f5f7;
  font-weight: 300;
}
.intro-count em {
  font-style: normal;
  font-size: 10px;
  color: rgba(185,255,207,.6);
  margin-top: 4px;
}
.intro-count small {
  display: block;
  margin: 12px 0 0 8px;
  font-size: 6px;
  line-height: 1.6;
  color: rgba(255,255,255,.3);
  letter-spacing: .14em;
}
@media (max-width: 720px) {
  .intro-count { bottom: 58px; }
  .intro-count small { display: none; }
}

/* Search becomes part of the dark world, not a white flash. -------------- */
.search-overlay { background: rgba(3,5,6,.93) !important; }
.search-overlay .search-box { position: relative; }
.search-overlay .search-hit:hover { background: rgba(185,255,207,.055); }
.search-overlay .search-hit__title { color: #f5f5f7; }
.search-overlay .search-hit__meta,
.search-overlay .search-box__label,
.search-overlay .search-hint,
.search-overlay .search-close { color: rgba(255,255,255,.42); }
.search-overlay .search-field input { color: #f5f5f7; }

/* Page transition canvas ------------------------------------------------- */
.pt-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
#page-transition .pt-mark,
#page-transition .pt-text { position: relative; z-index: 2; }
#page-transition { background: #020405; }

/* Capability fallbacks --------------------------------------------------- */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass, .twin__panel, .twin__status, .mv-hotspot, .nc2-hero .at-hero__sub { background: rgba(4, 8, 7, .92) !important; }
}
@supports not (height: 100svh) {
  .twin, .at-hero { min-height: 100vh; }
}
@media (max-width: 360px) {
  :root { --gutter: 16px; }
  .at-hero__title { font-size: clamp(32px, 13vw, 46px) !important; }
  .twin__title { font-size: 34px; }
  .twin__panel { left: 12px; right: 12px; bottom: 68px; width: auto; }
  .twin__panel--left { width: auto; }
  .twin__actions .twin__action { padding: 7px 8px; }
  .at-model-layout .mv-host { min-height: 310px; }
}
@media (prefers-contrast: more) {
  .section-label, .at-eyebrow, .twin__metric span, .at-note { color: rgba(255,255,255,.62) !important; }
}

/* Press / reveal --------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  #active-cursor, #active-grain { display: none !important; }
  .world-canvas { transition: none; }
}
