/* Mystx.in — Midnight Black (#030407) · Electric Cobalt (#1558C9) · Acid Lime (#D4FF24) */
:root {
  --black: #030407;
  --surface: #080b12;
  --cobalt: #1558C9;
  --cobalt-soft: rgba(21, 88, 201, 0.20);
  --lime: #D4FF24;
  --lime-soft: rgba(212, 255, 36, 0.12);
  --text: #F5F7FA;
  --muted: #8B95A8;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--black);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.58;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(62% 52% at 75% 28%, rgba(21, 88, 201, 0.22), transparent 70%),
    radial-gradient(40% 35% at 14% 85%, rgba(212, 255, 36, 0.05), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.shell { position: relative; z-index: 2; }
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 clamp(20px, 4.5vw, 56px); }

/* Header */
header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(3, 4, 7, 0.80);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.nav-row { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 18px; }
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text); text-decoration: none; font-weight: 800; letter-spacing: -0.03em; font-size: 1.05rem;
}
.logo-mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--lime); color: var(--black);
  display: grid; place-items: center; font-family: var(--mono); font-weight: 800; font-size: 0.85rem;
}
.nav-menu { display: flex; align-items: center; gap: 26px; }
.nav-menu a {
  color: var(--muted); text-decoration: none;
  font-size: 0.74rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  transition: color 0.2s var(--ease);
}
.nav-menu a:hover, .nav-menu a[aria-current="page"] { color: var(--text); }
.nav-menu a[aria-current="page"] { position: relative; }
.nav-menu a[aria-current="page"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -24px; height: 2px; background: var(--lime);
}

.cta-pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 20px; border-radius: 999px;
  background: var(--lime); color: var(--black);
  font-size: 0.76rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  text-decoration: none; border: none; cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.cta-pill:hover { transform: translateY(-1px); box-shadow: 0 10px 30px rgba(212, 255, 36, 0.28); }
.cta-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 22px; border-radius: 999px;
  background: transparent; color: var(--text);
  font-size: 0.84rem; font-weight: 600; text-decoration: none;
  border: 1px solid var(--line-strong); cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.cta-ghost:hover { border-color: var(--text); background: rgba(255,255,255,0.04); }
.cta-lg { height: 48px; padding: 0 26px; font-size: 0.8rem; }
.hamburger {
  display: none; background: transparent; border: 1px solid var(--line-strong);
  color: var(--text); width: 40px; height: 40px; border-radius: 8px; cursor: pointer;
}

/* ==================== 3D SCROLL-DRIVEN HERO (280vh TRACK) ==================== */
.scroll-hero-track {
  position: relative;
  height: 270vh;
}
.scroll-hero-sticky {
  position: sticky;
  top: 68px;
  height: calc(100vh - 68px);
  overflow: hidden;
  display: flex;
  align-items: center;
}
#hero3dCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}
.scroll-chapters {
  position: relative;
  z-index: 3;
  width: 100%;
}
.chapter {
  position: absolute;
  left: 0; right: 0; top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s var(--ease), transform 0.55s var(--ease);
}
.chapter.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) scale(1);
}
.chapter.passed {
  opacity: 0;
  transform: translateY(-64%) scale(0.97);
}
.chapter.upcoming {
  opacity: 0;
  transform: translateY(-36%) scale(0.97);
}

.kicker {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
}
.kicker::before { content: ""; width: 24px; height: 1px; background: var(--lime); }

.hero-title {
  margin: 0 0 20px; font-weight: 700; letter-spacing: -0.035em; line-height: 0.96;
  font-size: clamp(2.6rem, 6.4vw, 5.2rem);
  max-width: 13ch;
}
.italic-lime {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  color: var(--lime); font-size: 1.12em;
}
.cobalt-word { color: #4A8BFF; }
.hero-sub { color: var(--muted); font-size: 1.02rem; max-width: 46ch; margin: 0 0 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }

.scroll-progress-hud {
  position: absolute;
  right: clamp(16px, 4vw, 48px);
  bottom: 28px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.scroll-bar-track {
  width: 96px; height: 2px; background: var(--line-strong); overflow: hidden; border-radius: 2px;
}
.scroll-bar-fill {
  height: 100%; width: 0%; background: var(--lime); transition: width 0.08s linear;
}

/* Sections & Hairline Grids */
.section { padding: clamp(56px, 8vw, 96px) 0; border-top: 1px solid var(--line); }
.page-top { padding: clamp(44px, 6vw, 72px) 0 clamp(48px, 7vw, 84px); }
.sec-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 36px;
}
.sec-title { margin: 0; font-size: clamp(1.85rem, 3.8vw, 2.85rem); letter-spacing: -0.03em; line-height: 1.08; }
.sec-title em { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--lime); }

.hairline-grid {
  display: grid; grid-template-columns: repeat(5, 1fr);
  border-top: 1px solid var(--line); border-left: 1px solid var(--line);
}
.h-cell {
  padding: 28px 22px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: rgba(8, 11, 18, 0.55); transition: background 0.25s var(--ease);
}
.h-cell:hover { background: rgba(21, 88, 201, 0.14); }
.h-sym { font-family: var(--mono); font-size: 1.5rem; font-weight: 700; color: var(--lime); margin-bottom: 16px; display: block; }
.h-cell h3 { margin: 0 0 8px; font-size: 1rem; font-weight: 700; }
.h-cell p { margin: 0; font-size: 0.86rem; color: var(--muted); }

/* Workbench & Cards */
.workbench {
  display: grid; grid-template-columns: 240px minmax(0, 1fr);
  border: 1px solid var(--line-strong); border-radius: 16px; overflow: hidden;
  background: rgba(8, 11, 18, 0.86); backdrop-filter: blur(18px);
}
.wb-sidebar {
  border-right: 1px solid var(--line); padding: 16px;
  display: flex; flex-direction: column; gap: 4px; background: rgba(3, 4, 7, 0.65);
}
.wb-label { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); padding: 8px 10px 6px; }
.wb-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: var(--muted);
  font-size: 0.86rem; font-weight: 600; text-align: left; cursor: pointer; transition: all 0.16s var(--ease);
}
.wb-item svg { width: 16px; height: 16px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; }
.wb-item:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.wb-item.active { color: var(--lime); background: var(--cobalt-soft); border-color: rgba(21, 88, 201, 0.55); }
.wb-main { padding: clamp(20px, 3vw, 36px); }
.tool-pane { display: none; }
.tool-pane.active { display: block; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.cmd-card {
  padding: 22px; border: 1px solid var(--line); border-radius: 14px;
  background: rgba(8, 11, 18, 0.78); display: flex; flex-direction: column; justify-content: space-between; gap: 14px;
}
.cmd-card:hover { border-color: var(--cobalt); }
.c-tab {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  padding: 6px 12px; border-radius: 8px; font-family: var(--mono); font-size: 0.76rem; font-weight: 600; cursor: pointer;
}
.c-tab.active, .c-tab:hover { border-color: var(--lime); color: var(--lime); background: var(--lime-soft); }

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field label { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--black); color: var(--text);
  font-family: var(--sans); font-size: 0.94rem;
}
.textarea { min-height: 110px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--lime); box-shadow: 0 0 0 3px var(--lime-soft); }
.readout {
  padding: 18px 20px; border-radius: 12px; background: var(--black);
  border: 1px solid var(--line-strong); font-family: var(--mono); font-size: 1.5rem; font-weight: 700; color: var(--lime); word-break: break-word;
}
.qr-card { background: #ffffff; border-radius: 14px; padding: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 250px; }
.font-line { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.font-line:last-child { border-bottom: none; }

.ad-slot {
  margin: 32px 0; padding: 16px; border: 1px dashed var(--line-strong); border-radius: 12px;
  text-align: center; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em; color: var(--muted);
}
.prose { max-width: 74ch; }
.prose p, .prose li { color: var(--muted); font-size: 0.98rem; }
.prose strong { color: var(--text); }
.faq-item { border-bottom: 1px solid var(--line); padding: 16px 0; }
.faq-item summary { cursor: pointer; font-weight: 600; font-size: 1.02rem; }
.faq-item p { margin: 10px 0 0; color: var(--muted); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(16px);
  background: var(--lime); color: var(--black); padding: 10px 20px; border-radius: 999px;
  font-family: var(--mono); font-size: 0.8rem; font-weight: 700; opacity: 0; pointer-events: none; transition: all 0.2s var(--ease); z-index: 90;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

footer { border-top: 1px solid var(--line); padding: 48px 0 36px; background: rgba(3, 4, 7, 0.94); }
.f-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 24px; }
.f-grid h4 { margin: 0 0 12px; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.f-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.f-grid a { color: var(--muted); text-decoration: none; font-size: 0.88rem; }
.f-grid a:hover { color: var(--lime); }

@media (max-width: 980px) {
  .hairline-grid, .workbench, .grid-3, .f-grid { grid-template-columns: 1fr; }
  .wb-sidebar { flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--line); }
  .wb-label { display: none; }
  .wb-item { white-space: nowrap; }
}
@media (max-width: 720px) {
  .grid-2 { grid-template-columns: 1fr; }
  .hamburger { display: grid; place-items: center; }
  .nav-menu {
    display: none; position: absolute; top: 68px; left: 0; right: 0;
    background: var(--black); border-bottom: 1px solid var(--line);
    padding: 18px 24px; flex-direction: column; align-items: flex-start; gap: 16px;
  }
  .nav-menu.open { display: flex; }
  .nav-menu a[aria-current="page"]::after { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
