/* ============================================================================
 * LOWK // PERSONAL UNIVERSE — Avant-Garde Editorial & AAA Menu Design System
 * Inspired by Metaphor: ReFantazio's tactile brushwork, asymmetrical planes,
 * classical-meets-futuristic typography, and kinetic choreography.
 * ============================================================================ */

:root {
  --bg: #0e0b0a;
  --panel: #171210;
  --paper: #f4ede1;
  --ink: #f7f2ea;
  --muted: #c5b8a8;
  --accent: #ff4d2a;
  --accent-ink: #0e0b0a;
  --accent2: #f2a93b;
  --border: rgba(244, 237, 225, 0.22);
  --chapter-skew: -7deg;

  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-display: 'Syne', system-ui, sans-serif;
  --font-cond: 'Barlow Condensed', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);

  --ease-snap: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-slash: cubic-bezier(0.77, 0, 0.175, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-mono);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
  transition: background-color 480ms var(--ease-snap);
}

body {
  position: relative;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent2);
  outline-offset: 3px;
}

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 9999;
  padding: 10px 16px;
  background: var(--paper);
  color: #0b0a0c;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
}
.skip-link:focus {
  top: calc(14px + var(--safe-top));
}

/* ============================================================================
 * LAYER 0: WebGL Shader, Tactile Paper Grain & Architectural Frame
 * ============================================================================ */

.bg-shader {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  display: block;
}

.paper-grain {
  position: fixed;
  inset: -40%;
  z-index: 1;
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23g)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

.editorial-frame {
  position: fixed;
  inset: calc(12px + var(--safe-top)) calc(12px + var(--safe-right)) calc(12px + var(--safe-bottom)) calc(12px + var(--safe-left));
  z-index: 2;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.frame-corner {
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--accent2);
  border-style: solid;
  opacity: 0.72;
  transition: border-color 420ms var(--ease-snap);
}
.frame-corner.tl { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.frame-corner.tr { top: -1px; right: -1px; border-width: 2px 2px 0 0; }
.frame-corner.bl { bottom: -1px; left: -1px; border-width: 0 0 2px 2px; }
.frame-corner.br { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }

/* ============================================================================
 * LAYER 1: Colossal Background Ghost Typography
 * ============================================================================ */

.ghost-layer {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.ghost-word {
  font-family: var(--font-cond);
  font-weight: 700;
  font-style: italic;
  font-size: clamp(11rem, 26vw, 29rem);
  line-height: 0.82;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(255, 255, 255, 0.075);
  white-space: nowrap;
  transform: rotate(var(--chapter-skew)) translate3d(0, 0, 0);
  will-change: transform, opacity;
  transition: -webkit-text-stroke-color 450ms ease;
}

/* ============================================================================
 * TOP EDITORIAL HUD
 * ============================================================================ */

.topbar {
  position: fixed;
  top: calc(18px + var(--safe-top));
  left: calc(22px + var(--safe-left));
  right: calc(22px + var(--safe-right));
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}

.topbar > * {
  pointer-events: auto;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark-link {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--paper);
}

.brand-seal {
  flex: none;
  transition: transform 350ms var(--ease-snap);
}
.brand-mark-link:hover .brand-seal {
  transform: rotate(-6deg) scale(1.06);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-text strong {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.22em;
}

.brand-text small {
  margin-top: 3px;
  font-size: 9px;
  letter-spacing: 0.26em;
  color: var(--muted);
}

.hud-sep {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, 0.18);
}

.hud-coord {
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gamepad-pill {
  padding: 5px 10px;
  font-size: 10px;
  letter-spacing: 0.16em;
  background: var(--accent2);
  color: #0d0c0e;
  font-weight: 600;
  transform: skewX(-10deg);
}

.hud-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(12, 11, 14, 0.56);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--paper);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transform: skewX(-10deg);
  transition: background-color 220ms ease, border-color 220ms ease, color 220ms ease, transform 220ms var(--ease-snap);
}

.hud-btn > * {
  transform: skewX(10deg);
}

.hud-btn-short {
  display: none;
}

.hud-btn:hover {
  border-color: var(--paper);
  background: rgba(244, 237, 225, 0.14);
}

.hud-btn[aria-pressed='true'] {
  border-color: var(--accent2);
  background: rgba(231, 184, 90, 0.16);
}

.hud-btn[aria-pressed='true'] .hud-dot {
  background: var(--accent2);
  box-shadow: 0 0 8px var(--accent2);
}

.hud-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.32);
  transition: background-color 220ms ease;
}

.hud-btn kbd {
  padding: 1px 5px;
  font-size: 9px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: var(--muted);
}

.hud-btn-accent {
  background: var(--paper);
  color: #0d0c0e;
  border-color: var(--paper);
  font-weight: 500;
}
.hud-btn-accent kbd {
  border-color: rgba(13, 12, 14, 0.28);
  color: #0d0c0e;
}
.hud-btn-accent:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.hud-btn-accent:hover kbd {
  color: var(--accent-ink);
  border-color: currentColor;
}

/* ============================================================================
 * MAIN STAGE GRID (Desktop & Landscape Tablet)
 * ============================================================================ */

.universe-stage {
  position: relative;
  z-index: 10;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 44px minmax(250px, 295px) 1fr;
  align-items: center;
  padding: calc(74px + var(--safe-top)) calc(34px + var(--safe-right)) calc(56px + var(--safe-bottom)) calc(22px + var(--safe-left));
  gap: clamp(16px, 2.5vw, 38px);
}

/* Vertical Japanese-editorial Spine */
.vertical-spine {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 10px;
  letter-spacing: 0.26em;
  color: var(--muted);
  height: 70vh;
}

.spine-rule {
  width: 1px;
  flex: 1;
  max-height: 170px;
  background: linear-gradient(to bottom, transparent, var(--accent), transparent);
}

/* ============================================================================
 * ASYMMETRIC KINETIC COMMAND RAIL (Metaphor-Inspired Video Game Main Menu)
 * ============================================================================ */

.command-rail {
  position: relative;
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: calc(100vh - 150px);
}

.rail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 9px;
  letter-spacing: 0.24em;
  color: var(--muted);
}

.rail-list {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rail-item {
  position: relative;
}

.rail-btn {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 10px 12px;
  text-align: left;
  color: rgba(247, 242, 234, 0.72);
  transform: skewX(-11deg) translateX(0);
  transition: transform 280ms var(--ease-snap), color 220ms ease;
  overflow: visible;
}

.rail-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.035);
  border-left: 2px solid rgba(255, 255, 255, 0.14);
  transition: background-color 240ms ease, border-color 240ms ease, transform 300ms var(--ease-snap), clip-path 300ms var(--ease-snap);
  z-index: -1;
}

/* Jagged painterly ink splash behind active item */
.rail-btn::after {
  content: '';
  position: absolute;
  inset: -4px -10px -4px -6px;
  background: var(--accent);
  clip-path: polygon(0% 14%, 96% 0%, 100% 82%, 4% 100%);
  opacity: 0;
  transform: scaleX(0.25) translateX(-16px);
  transform-origin: left center;
  transition: opacity 220ms ease, transform 340ms var(--ease-snap), background-color 300ms ease;
  z-index: -2;
}

.rail-btn > * {
  transform: skewX(11deg);
}

.rail-num {
  font-family: var(--font-cond);
  font-weight: 700;
  font-style: italic;
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
  transition: color 220ms ease, transform 260ms var(--ease-snap);
}

.rail-label-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.rail-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rail-sub {
  margin-top: 2px;
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.65;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rail-chevron {
  font-size: 13px;
  opacity: 0;
  transform: skewX(11deg) translateX(-6px);
  transition: opacity 220ms ease, transform 260ms var(--ease-snap);
}

.rail-btn:hover {
  color: var(--paper);
  transform: skewX(-11deg) translateX(8px);
}
.rail-btn:hover::before {
  background: rgba(255, 255, 255, 0.09);
  border-left-color: var(--accent2);
}

.rail-btn[aria-selected='true'] {
  color: var(--accent-ink);
  transform: skewX(-11deg) translateX(18px) scale(1.03);
}
.rail-btn[aria-selected='true']::before {
  opacity: 0;
}
.rail-btn[aria-selected='true']::after {
  opacity: 1;
  transform: scaleX(1) translateX(0);
}
.rail-btn[aria-selected='true'] .rail-num {
  color: var(--accent-ink);
  transform: skewX(11deg) scale(1.18);
}
.rail-btn[aria-selected='true'] .rail-sub {
  opacity: 0.85;
}
.rail-btn[aria-selected='true'] .rail-chevron {
  opacity: 1;
  transform: skewX(11deg) translateX(0);
}

/* ============================================================================
 * LIVING CHAPTER STAGE (Artwork Shard + Kinetic SVG Motif + Typography)
 * ============================================================================ */

.chapter-stage {
  position: relative;
  width: 100%;
  height: min(76vh, 690px);
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  align-items: center;
  perspective: 1200px;
}

/* Camera Parallax Layer holding Artwork + Motif */
.stage-camera {
  position: absolute;
  top: 2%;
  right: 0;
  bottom: 2%;
  width: 66%;
  transform-style: preserve-3d;
  will-change: transform;
  pointer-events: none;
}

.art-ribbon {
  position: absolute;
  inset: -4% -3% -5% -4%;
  z-index: 1;
  transform: rotate(calc(var(--chapter-skew) * 0.55));
  transition: transform 550ms var(--ease-snap);
}
.art-ribbon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.art-frame {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  background: var(--panel);
  clip-path: polygon(8% 2%, 100% 0%, 93% 97%, 0% 100%);
  overflow: hidden;
  box-shadow: 0 36px 80px rgba(0, 0, 0, 0.55);
}

.art-img {
  position: absolute;
  inset: -3%;
  width: 106%;
  height: 106%;
  object-fit: cover;
  object-position: center;
  will-change: transform, clip-path, opacity;
}

.art-back {
  z-index: 1;
}

.art-front {
  z-index: 2;
}

.art-scrim {
  position: absolute;
  inset: 0;
  z-index: 3;
  background:
    linear-gradient(104deg, rgba(10, 9, 12, 0.88) 0%, rgba(10, 9, 12, 0.42) 34%, rgba(10, 9, 12, 0.1) 66%, rgba(10, 9, 12, 0.46) 100%),
    linear-gradient(to top, rgba(10, 9, 12, 0.72) 0%, transparent 40%);
}

.art-slash-flash {
  position: absolute;
  inset: -20%;
  z-index: 4;
  background: linear-gradient(110deg, transparent 42%, var(--paper) 49.5%, var(--accent) 52%, transparent 60%);
  opacity: 0;
  transform: translateX(-110%);
  pointer-events: none;
}

/* Bespoke Animated Kinetic SVG Motif */
.motif-layer {
  position: absolute;
  inset: 4% 2% 4% 16%;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  pointer-events: none;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.55));
}

.motif-svg {
  width: min(100%, 500px);
  height: auto;
  overflow: visible;
}

.m-rot-slow {
  animation: motif-spin 36s linear infinite;
}
.m-rot-med {
  animation: motif-spin 16s linear infinite reverse;
}
.m-pulse {
  animation: motif-pulse 2.6s ease-in-out infinite;
}
.m-float-a {
  animation: motif-float 6s ease-in-out infinite;
}
.m-float-b {
  animation: motif-float 7.4s ease-in-out infinite reverse;
}

@keyframes motif-spin {
  to { transform: rotate(360deg); }
}
@keyframes motif-pulse {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.25); }
}
@keyframes motif-float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-9px); }
}

/* ============================================================================
 * INTERLOCKING EXPERIMENTAL TYPOGRAPHY & EDITORIAL DOSSIER
 * ============================================================================ */

.dossier {
  position: relative;
  z-index: 12;
  grid-column: 1 / 2;
  max-width: 630px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-right: 12px;
}

.dossier-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.kicker {
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent2);
  font-weight: 500;
}

.access-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  background: rgba(12, 11, 14, 0.72);
  color: var(--paper);
  transform: skewX(-10deg);
}
.access-badge[data-type='public'] {
  border-color: rgba(25, 169, 126, 0.55);
  color: #8bf0cc;
}
.access-badge[data-type='auth'] {
  border-color: rgba(231, 184, 90, 0.55);
  color: #f5d28c;
}
.access-badge[data-type='gateway'] {
  border-color: rgba(167, 149, 255, 0.6);
  color: #d4c6ff;
}

/* Monumental Metaphor-Inspired Mixed Serif + Grotesque Kinetic Display Title */
.display-title {
  margin: 0;
  line-height: 0.86;
  display: flex;
  flex-wrap: nowrap;
  white-space: nowrap;
  align-items: baseline;
  gap: 0;
  text-transform: uppercase;
  position: relative;
  z-index: 14;
  text-shadow: 0 14px 40px rgba(0, 0, 0, 0.62);
}

.title-line {
  display: inline-flex;
  align-items: baseline;
}

.title-serif {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(3rem, 6.2vw, 7rem);
  letter-spacing: -0.025em;
  color: var(--paper);
}

.title-accent {
  position: relative;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: clamp(3.1rem, 6.5vw, 7.4rem);
  letter-spacing: -0.02em;
  color: var(--accent-ink);
  padding: 0 0.14em 0.04em 0.09em;
  margin-left: 0.02em;
  z-index: 1;
}

.title-accent::before {
  content: '';
  position: absolute;
  inset: 0.08em -0.04em 0.04em -0.06em;
  background: var(--accent);
  clip-path: polygon(4% 12%, 100% 0%, 95% 88%, 0% 100%);
  z-index: -1;
  transition: background-color 350ms ease;
}

/* Organic "flawed boldness" per-glyph character spans */
.glyph {
  display: inline-block;
  will-change: transform, opacity;
}
.glyph-tilt-a { transform: rotate(-2.4deg) translateY(-2px); }
.glyph-tilt-b { transform: rotate(1.9deg) translateY(2px); }
.glyph-tilt-c { transform: rotate(-1.2deg); }

.chapter-tagline {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1rem, 1.5vw, 1.32rem);
  line-height: 1.28;
  color: var(--paper);
  max-width: 34ch;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.72);
}

.chapter-desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.65;
  color: var(--muted);
  max-width: 50ch;
  background: rgba(10, 9, 12, 0.56);
  padding: 10px 14px;
  border-left: 2px solid var(--accent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Telemetry Readout Strip */
.chapter-stats {
  margin: 2px 0 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.stat-cell {
  padding: 9px 12px;
  background: rgba(12, 11, 14, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-top: 2px solid var(--accent2);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.stat-cell dt {
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin-bottom: 4px;
}

.stat-cell dd {
  margin: 0;
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: clamp(15px, 1.35vw, 18px);
  line-height: 1.15;
  letter-spacing: 0.03em;
  color: var(--paper);
  font-variant-numeric: tabular-nums;
}

/* Live Banner (e.g., Proceso real-time shift indicator) */
.live-banner {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  align-self: flex-start;
  padding: 5px 12px;
  background: rgba(12, 11, 14, 0.8);
  border: 1px solid var(--accent2);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--paper);
}
.live-banner[hidden] {
  display: none !important;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent2);
  box-shadow: 0 0 10px var(--accent2);
  animation: live-blink 1.8s ease-in-out infinite;
}

@keyframes live-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* Primary & Secondary CTA Row */
.action-row {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.primary-cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px 14px 18px;
  background: var(--paper);
  color: #0c0b0e;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transform: skewX(-11deg);
  overflow: hidden;
  transition: transform 260ms var(--ease-snap), color 220ms ease, box-shadow 260ms ease;
  box-shadow: 6px 6px 0 var(--accent);
}

.primary-cta > * {
  position: relative;
  z-index: 2;
  transform: skewX(11deg);
}

.cta-brush {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: var(--accent);
  transform: translateX(-104%) !important;
  transition: transform 320ms var(--ease-snap);
}

.primary-cta:hover,
.primary-cta:focus-visible {
  color: var(--accent-ink);
  transform: skewX(-11deg) translate(-2px, -2px);
  box-shadow: 9px 9px 0 var(--paper);
}

.primary-cta:hover .cta-brush,
.primary-cta:focus-visible .cta-brush {
  transform: translateX(0) !important;
}

.cta-index {
  font-family: var(--font-cond);
  font-style: italic;
  font-size: 18px;
  padding-right: 10px;
  border-right: 1px solid currentColor;
  opacity: 0.72;
}

.cta-arrow {
  font-size: 16px;
  transition: transform 240ms var(--ease-snap);
}
.primary-cta:hover .cta-arrow {
  transform: skewX(11deg) translate(3px, -3px);
}

.secondary-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sub-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 13px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(12, 11, 14, 0.68);
  color: var(--paper);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transform: skewX(-10deg);
  transition: border-color 200ms ease, background-color 200ms ease, color 200ms ease;
}
.sub-link > span {
  transform: skewX(10deg);
}
.sub-link:hover {
  border-color: var(--accent2);
  background: var(--accent2);
  color: #0b0a0c;
}

/* ============================================================================
 * BOTTOM DESKTOP BAR & CUSTOM RETICLE CURSOR
 * ============================================================================ */

.bottombar {
  position: fixed;
  left: calc(24px + var(--safe-left));
  right: calc(24px + var(--safe-right));
  bottom: calc(18px + var(--safe-bottom));
  z-index: 35;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--muted);
  pointer-events: none;
}

.bottom-keys {
  display: flex;
  align-items: center;
  gap: 14px;
}

.bottom-keys kbd {
  display: inline-block;
  padding: 1px 5px;
  margin-right: 4px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: var(--paper);
  font-size: 9px;
}

.bottom-progress {
  height: 2px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.bottom-progress-fill {
  height: 100%;
  width: 12.5%;
  background: var(--accent);
  transition: width 360ms var(--ease-snap), background-color 360ms ease;
}

.bottom-sign {
  display: flex;
  align-items: center;
  gap: 8px;
}

.reticle-dot,
.reticle-ring {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 90;
  pointer-events: none;
  transform: translate(-100px, -100px);
  will-change: transform;
}

.reticle-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent2);
  margin: -2.5px 0 0 -2.5px;
}

.reticle-ring {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(244, 237, 225, 0.45);
  border-radius: 50%;
  margin: -15px 0 0 -15px;
  transition: width 220ms var(--ease-snap), height 220ms var(--ease-snap), margin 220ms var(--ease-snap), border-color 220ms ease;
}

body.cursor-hover .reticle-ring {
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border-color: var(--accent);
}

@media (pointer: coarse) {
  .reticle-dot,
  .reticle-ring {
    display: none !important;
  }
}

/* ============================================================================
 * INTRO SEQUENCE & LAUNCH CURTAIN
 * ============================================================================ */

.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #09080b;
  color: var(--paper);
  overflow: hidden;
}
.intro-overlay[hidden] {
  display: none;
}

.intro-slash-bg {
  position: absolute;
  inset: -20%;
  background: linear-gradient(112deg, transparent 36%, var(--accent) 36.2%, var(--accent) 56%, transparent 56.2%);
  opacity: 0.22;
  transform: translateX(-60%);
}

.intro-content {
  position: relative;
  z-index: 2;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px;
}

.intro-code {
  font-size: 11px;
  letter-spacing: 0.34em;
  color: var(--accent2);
}

.intro-wordmark {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(4.8rem, 15vw, 13rem);
  line-height: 0.85;
  letter-spacing: 0.08em;
  display: flex;
  overflow: hidden;
}

.iw-char {
  display: inline-block;
}

.intro-sub {
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--muted);
}

.intro-skip {
  margin-top: 14px;
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--paper);
  transform: skewX(-10deg);
}
.intro-skip:hover {
  background: var(--paper);
  color: #09080b;
}

/* App Launch Curtain */
.launch-curtain {
  position: fixed;
  inset: 0;
  z-index: 150;
  pointer-events: none;
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.launch-curtain.active {
  pointer-events: auto;
  opacity: 1;
}

.launch-blade {
  position: absolute;
  inset: -20%;
  transform: translateX(-115%) skewX(-14deg);
}

.launch-blade.blade-a {
  background: var(--accent);
}

.launch-blade.blade-b {
  background: #0a090c;
}

.launch-label {
  position: relative;
  z-index: 3;
  text-align: center;
  opacity: 0;
  transform: scale(0.92);
}

.launch-kicker {
  display: block;
  font-size: 10px;
  letter-spacing: 0.32em;
  color: var(--accent2);
  margin-bottom: 10px;
}

.launch-label strong {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(2.8rem, 8vw, 6.4rem);
  letter-spacing: 0.02em;
  color: var(--paper);
}

/* ============================================================================
 * QUICK ACCESS DRAWER (Zero-Animation Instant Navigation)
 * ============================================================================ */

.quick-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(5, 5, 8, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.quick-backdrop[hidden] {
  display: none;
}

.quick-drawer {
  position: fixed;
  top: calc(16px + var(--safe-top));
  right: calc(16px + var(--safe-right));
  bottom: calc(16px + var(--safe-bottom));
  width: min(560px, calc(100vw - 32px));
  z-index: 110;
  background: #100f14;
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  flex-direction: column;
  padding: 22px;
  box-shadow: -24px 0 70px rgba(0, 0, 0, 0.65);
}
.quick-drawer[hidden] {
  display: none;
}

.quick-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.quick-eyebrow {
  display: block;
  font-size: 9px;
  letter-spacing: 0.24em;
  color: var(--accent2);
  margin-bottom: 4px;
}

.quick-head h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 700;
  color: var(--paper);
}

.quick-close {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 24px;
  line-height: 1;
  color: var(--paper);
}
.quick-close:hover {
  background: var(--paper);
  color: #100f14;
}

.quick-grid {
  flex: 1;
  overflow-y: auto;
  padding: 14px 2px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quick-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-left: 3px solid var(--row-accent, var(--accent));
  background: rgba(255, 255, 255, 0.03);
}

.quick-row-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.quick-row-main:hover .quick-row-title {
  color: var(--row-accent, var(--accent));
}

.quick-row-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.quick-row-num {
  font-family: var(--font-cond);
  font-style: italic;
  font-weight: 700;
  font-size: 18px;
  color: var(--row-accent, var(--accent));
}

.quick-row-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--paper);
  transition: color 180ms ease;
}

.quick-row-sub {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.quick-row-tag {
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.quick-row-subs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-left: 28px;
}

.quick-row-subs a {
  padding: 4px 9px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--paper);
}
.quick-row-subs a:hover {
  background: var(--paper);
  color: #100f14;
}

.quick-foot {
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.quick-util-btn {
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--paper);
}
.quick-util-btn:hover {
  border-color: var(--accent2);
  color: var(--accent2);
}

.quick-foot-meta {
  font-size: 10px;
  color: var(--muted);
}
.quick-foot-meta kbd {
  padding: 1px 4px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: var(--paper);
}

/* ============================================================================
 * MOBILE DOCK (Hidden on Desktop, Shown on Portrait iPad & iPhone)
 * ============================================================================ */

.mobile-dock {
  display: none;
}

/* ============================================================================
 * RESPONSIVE: PORTRAIT iPAD & TABLET (<= 1024px)
 * ============================================================================ */

@media (max-width: 1024px) {
  .universe-stage {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
    padding: calc(68px + var(--safe-top)) calc(18px + var(--safe-right)) calc(16px + var(--safe-bottom)) calc(18px + var(--safe-left));
    gap: 12px;
  }

  .vertical-spine,
  .command-rail,
  .bottombar {
    display: none;
  }

  .chapter-stage {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 14px;
    padding-bottom: 4px;
  }

  .stage-camera {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    width: 100%;
    flex: 1 1 auto;
    min-height: 220px;
  }

  .art-frame {
    clip-path: polygon(0% 3%, 100% 0%, 100% 95%, 0% 100%);
  }

  .motif-layer {
    inset: 4%;
    justify-content: center;
  }
  .motif-svg {
    width: min(88%, 390px);
    max-height: 100%;
  }

  .dossier {
    max-width: 100%;
    padding-right: 0;
    margin-top: -54px;
    gap: 10px;
  }

  .display-title {
    line-height: 0.86;
  }

  .title-serif {
    font-size: clamp(2.65rem, 10.2vw, 4.9rem);
  }
  .title-accent {
    font-size: clamp(2.75rem, 10.6vw, 5.1rem);
  }

  .chapter-desc {
    font-size: 12px;
    line-height: 1.55;
    padding: 9px 12px;
  }

  .mobile-dock {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    z-index: 30;
  }

  .mobile-dock-top {
    display: grid;
    grid-template-columns: 38px 1fr 38px;
    align-items: center;
    gap: 8px;
  }

  .dock-step {
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(12, 11, 14, 0.75);
    color: var(--paper);
    font-size: 22px;
    line-height: 1;
    transform: skewX(-10deg);
  }

  .dock-pills {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 4px 2px;
    -webkit-overflow-scrolling: touch;
  }
  .dock-pills::-webkit-scrollbar {
    display: none;
  }

  .dock-pill {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 13px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(12, 11, 14, 0.72);
    color: var(--muted);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transform: skewX(-10deg);
    transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease;
  }
  .dock-pill > span {
    transform: skewX(10deg);
  }
  .dock-pill[aria-selected='true'] {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
  }

  .dock-swipe-hint {
    text-align: center;
    font-size: 9px;
    letter-spacing: 0.2em;
    color: var(--muted);
    opacity: 0.72;
  }
}

/* ============================================================================
 * RESPONSIVE: iPHONE / COMPACT MOBILE (<= 640px)
 * ============================================================================ */

@media (max-width: 640px) {
  .topbar {
    top: calc(12px + var(--safe-top));
    left: calc(14px + var(--safe-left));
    right: calc(14px + var(--safe-right));
  }

  .brand-text small,
  .hud-sep,
  .hud-coord,
  .hud-btn kbd {
    display: none;
  }

  .hud-btn {
    padding: 7px 9px;
    font-size: 9px;
    letter-spacing: 0.1em;
  }

  .hud-btn .hud-btn-label {
    display: none;
  }
  .hud-btn .hud-btn-short {
    display: inline;
  }
  .hud-btn-accent .hud-btn-label {
    display: inline;
  }

  .universe-stage {
    padding: calc(58px + var(--safe-top)) calc(14px + var(--safe-right)) calc(12px + var(--safe-bottom)) calc(14px + var(--safe-left));
    gap: 10px;
  }

  .stage-camera {
    min-height: 210px;
  }

  .dossier {
    margin-top: -42px;
    gap: 8px;
  }

  .kicker {
    font-size: 9px;
    letter-spacing: 0.14em;
  }

  .chapter-tagline {
    font-size: 14px;
    line-height: 1.25;
  }

  .chapter-desc {
    display: none;
  }

  .chapter-stats {
    gap: 6px;
  }

  .stat-cell {
    padding: 7px 8px;
  }
  .stat-cell dt {
    font-size: 8px;
    letter-spacing: 0.12em;
  }
  .stat-cell dd {
    font-size: 15px;
  }

  .action-row {
    margin-top: 2px;
    gap: 8px;
  }

  .primary-cta {
    width: 100%;
    justify-content: space-between;
    padding: 13px 18px;
    font-size: 12px;
    transform: skewX(-6deg);
  }
  .primary-cta > * {
    transform: skewX(6deg);
  }

  .secondary-links {
    width: 100%;
  }
  .sub-link {
    flex: 1 1 auto;
    justify-content: center;
    padding: 7px 10px;
    font-size: 9px;
  }
}

/* ============================================================================
 * REDUCED EFFECTS & ACCESSIBILITY (prefers-reduced-motion / Eco Mode)
 * ============================================================================ */

body.reduced-motion .m-rot-slow,
body.reduced-motion .m-rot-med,
body.reduced-motion .m-pulse,
body.reduced-motion .m-float-a,
body.reduced-motion .m-float-b,
body.reduced-motion .live-dot {
  animation: none !important;
}

body.reduced-motion *,
body.reduced-motion *::before,
body.reduced-motion *::after {
  transition-duration: 0.01ms !important;
}

@media (prefers-reduced-motion: reduce) {
  .m-rot-slow,
  .m-rot-med,
  .m-pulse,
  .m-float-a,
  .m-float-b,
  .live-dot {
    animation: none !important;
  }
}

.noscript-nav {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: #0c0b0e;
  color: #f7f2ea;
  padding: 36px;
  overflow: auto;
}
.noscript-nav ul {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 12px;
}
.noscript-nav a {
  display: block;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.25);
}
