/* ============================================================
   PROJECTMPR — PARTICLE UNIVERSE
   ============================================================ */
:root {
  --bg: #071026;
  --ink: #e9edf2;
  --dim: #8b94a3;
  --accent: #c8ff4d;
  --line: rgba(233, 237, 242, 0.1);
  --font-display: "Syne", sans-serif;
  --font-body: "Space Grotesk", sans-serif;
  --font-mono: "Space Mono", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.6;
  overflow-x: hidden;
  cursor: none;
}
@media (pointer: coarse) { body { cursor: auto; } }

::selection { background: var(--accent); color: #071026; }

/* ============ BOOT LOADER ============ */
#loader {
  position: fixed; inset: 0; z-index: 200;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.9s cubic-bezier(0.83, 0, 0.17, 1);
}
body.booted #loader { transform: translateY(-101%); }
.loader-inner { width: min(480px, 80vw); }
.loader-mono {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.25em;
  color: var(--dim); margin-bottom: 18px;
}
.loader-mono::after { content: "_"; animation: blink 0.8s steps(1) infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }
.loader-count {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(64px, 14vw, 140px); line-height: 1; color: var(--ink);
}
.loader-count i { font-style: normal; color: var(--accent); font-size: 0.4em; }
.loader-bar { height: 2px; background: var(--line); margin-top: 24px; overflow: hidden; }
.loader-bar span { display: block; height: 100%; width: 0%; background: var(--accent); }

/* ============ CURSOR ============ */
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0; z-index: 300; pointer-events: none;
  border-radius: 50%; transform: translate(-50%, -50%);
}
.cursor-dot { width: 6px; height: 6px; background: var(--accent); }
.cursor-ring {
  width: 36px; height: 36px; border: 1px solid var(--accent);
  opacity: 0.5; transition: width 0.25s, height 0.25s, opacity 0.25s;
}
body.cursor-hot .cursor-ring { width: 64px; height: 64px; opacity: 1; }
body.cursor-down .cursor-ring { width: 22px; height: 22px; }
@media (pointer: coarse) { .cursor-dot, .cursor-ring { display: none; } }

/* ============ UNIVERSE CANVAS + GRAIN ============ */
#universe { position: fixed; inset: 0; z-index: 0; display: block; }
.grain {
  position: fixed; inset: -100px; z-index: 90; pointer-events: none; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.6s steps(4) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 25% { transform: translate(-30px, 40px); }
  50% { transform: translate(40px, -25px); } 75% { transform: translate(-25px, -40px); }
  100% { transform: translate(0, 0); }
}

/* ============ NAV ============ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px clamp(20px, 4vw, 56px);
  background: transparent;
  box-shadow: 0 1px 0 rgba(233, 237, 242, 0);
  transition: background 0.35s ease, box-shadow 0.35s ease, padding 0.35s ease;
}
.nav::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(to bottom, rgba(7, 16, 38, 0.85), transparent);
  pointer-events: none;
  opacity: 1; transition: opacity 0.35s ease;
}
.nav.scrolled {
  background: rgba(7, 16, 38, 0.97);
  box-shadow: 0 1px 0 rgba(233, 237, 242, 0.12);
  padding-top: 12px; padding-bottom: 12px;
}
.nav.scrolled::before { opacity: 0; }
.nav-logo { display: flex; flex-direction: column; text-decoration: none; line-height: 1.1; }
.nav-logo-mark {
  font-family: var(--font-display); font-weight: 800; font-size: 22px;
  letter-spacing: 0.08em; color: var(--ink);
}
.nav-logo-mark::after { content: "•"; color: var(--accent); }
.nav-logo-sub {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.3em; color: var(--dim);
}
.nav-links { display: flex; gap: clamp(16px, 3vw, 40px); }
.nav-links a {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--dim); text-decoration: none;
  transition: color 0.25s;
}
.nav-links a:hover { color: var(--accent); }
.nav-links .nav-contact { color: var(--accent); }
.nav-links .nav-contact::before { content: "⌁ "; }
.nav-links .nav-contact:hover { color: var(--ink); }
.nav-cta {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em;
  color: #071026; background: var(--accent); text-decoration: none;
  padding: 10px 18px; clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  transition: background 0.25s;
}
.nav-cta:hover { background: var(--ink); }
@media (max-width: 720px) { .nav-links { display: none; } }

/* ============ HUD RAILS ============ */
.rail {
  position: fixed; z-index: 95; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 18px;
}
.rail-left { left: clamp(12px, 2vw, 28px); }
.rail-right { right: clamp(12px, 2vw, 28px); align-items: center; gap: 12px; }
.rail-item {
  display: flex; gap: 8px; align-items: baseline; text-decoration: none;
  font-family: var(--font-mono); letter-spacing: 0.15em;
  color: var(--dim); opacity: 0.55; transition: opacity 0.3s, color 0.3s;
}
.rail-item b { font-size: 10px; font-weight: 700; }
.rail-item i {
  font-style: normal; font-size: 9px;
  max-width: 0; overflow: hidden; white-space: nowrap;
  transition: max-width 0.4s ease;
}
.rail-item.active { color: var(--accent); opacity: 1; }
.rail-item.active i, .rail-item:hover i { max-width: 90px; }
.rail-track {
  width: 2px; height: 140px; background: var(--line); position: relative; overflow: hidden;
}
.rail-track span {
  position: absolute; top: 0; left: 0; width: 100%; height: 0%;
  background: var(--accent);
}
.rail-coord {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.2em;
  color: var(--dim); writing-mode: vertical-rl;
}
@media (max-width: 900px) { .rail { display: none; } }

/* ============ LAYOUT PRIMITIVES ============ */
main { position: relative; z-index: 10; }
.sec {
  min-height: 100vh; min-height: 100svh; position: relative;
  padding: clamp(90px, 14vh, 160px) clamp(24px, 8vw, 120px);
  display: flex; flex-direction: column; justify-content: center;
}
.mono-tag {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.3em;
  color: var(--dim); text-transform: uppercase;
}
.sec-head { margin-bottom: clamp(36px, 6vh, 72px); }
.sec-head .mono-tag { display: block; margin-bottom: 14px; color: var(--accent); }
.sec-title {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(40px, 7.5vw, 104px); line-height: 0.95;
  letter-spacing: -0.01em; text-transform: uppercase; color: var(--ink);
}
.sec-title em {
  font-style: normal; display: block; color: transparent;
  -webkit-text-stroke: 1px rgba(233, 237, 242, 0.4);
  font-size: 0.55em; letter-spacing: 0.04em;
}
.sec-title.big { font-size: clamp(44px, 8.5vw, 120px); }

/* Reveal animation */
.reveal { opacity: 0; transform: translateY(36px); transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.16, 1, 0.3, 1); }
.reveal.in { opacity: 1; transform: none; }

/* Buttons */
.btn {
  display: inline-block; text-decoration: none; text-align: center;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.2em;
  padding: 16px 30px; border: 1px solid var(--accent); transition: all 0.3s;
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
}
.btn-solid { background: var(--accent); color: #071026; }
.btn-solid:hover { background: transparent; color: var(--accent); }
.btn-ghost { background: transparent; color: var(--ink); border-color: rgba(233, 237, 242, 0.3); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ============ 01 HERO ============ */
.hero { justify-content: center; gap: clamp(24px, 4vh, 48px); }
.hero-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.hero-title {
  font-family: var(--font-display); font-weight: 800; text-transform: uppercase;
  font-size: clamp(40px, 9.5vw, 150px); line-height: 0.92; letter-spacing: -0.015em;
}
.hero-title .line { display: block; overflow: hidden; white-space: nowrap; }
.hero-title .w { display: inline-block; }
.hero-title .ghost {
  color: transparent; -webkit-text-stroke: 1.5px rgba(233, 237, 242, 0.55);
}
.hero-title .accent { color: var(--accent); text-shadow: 0 0 60px rgba(200, 255, 77, 0.35); }
.hero-title .char { display: inline-block; transform: translateY(110%); transition: transform 0.9s cubic-bezier(0.16, 1, 0.3, 1); }
body.booted .hero-title .char { transform: translateY(0); }
.hero-foot {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 32px; flex-wrap: wrap;
}
.hero-sub { max-width: 460px; color: var(--dim); font-size: 15px; }
.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; }
.hero-hint { color: rgba(200, 255, 77, 0.5); }
.scroll-cue {
  position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%);
  width: 1px; height: 56px; background: var(--line); overflow: hidden;
}
.scroll-cue span {
  position: absolute; top: -50%; left: 0; width: 100%; height: 50%;
  background: var(--accent); animation: cue 1.8s ease-in-out infinite;
}
@keyframes cue { to { top: 110%; } }

/* ============ MARQUEE ============ */
.marquee {
  position: relative; z-index: 10; overflow: hidden;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 18px 0; background: rgba(7, 16, 38, 0.6);
}
.marquee-track {
  display: flex; white-space: nowrap; width: max-content;
  animation: marquee 28s linear infinite;
  font-family: var(--font-display); font-weight: 700; font-size: clamp(18px, 2.6vw, 30px);
  letter-spacing: 0.12em; color: transparent;
  -webkit-text-stroke: 1px rgba(233, 237, 242, 0.5);
  will-change: transform;
}
@keyframes marquee { to { transform: translateX(-50%); } }

/* ============ 02 ORIGIN ============ */
.origin-grid {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(32px, 6vw, 96px);
  align-items: start;
}
.origin-quote {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(22px, 3vw, 38px); line-height: 1.25; color: var(--ink);
  border-left: 2px solid var(--accent); padding-left: clamp(18px, 2.5vw, 36px);
}
.origin-quote mark { background: none; color: var(--accent); }
.origin-body p { color: var(--dim); margin-bottom: 18px; max-width: 52ch; }
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; margin-top: 26px; }
.chip-row li {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em;
  color: var(--ink); border: 1px solid var(--line); padding: 8px 14px;
  transition: border-color 0.3s, color 0.3s;
}
.chip-row li:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 860px) { .origin-grid { grid-template-columns: 1fr; } }

/* ============ 03 EVIDENCE ============ */
.work-list { list-style: none; counter-reset: work; border-top: 1px solid var(--line); }
.work-row {
  display: grid; grid-template-columns: 70px 1fr auto 40px;
  align-items: baseline; gap: clamp(12px, 3vw, 40px);
  padding: clamp(18px, 2.6vh, 30px) 8px;
  border-bottom: 1px solid var(--line);
  position: relative; transition: padding-left 0.35s ease, background 0.35s;
}
.work-row b { font-family: var(--font-mono); font-size: 11px; color: var(--dim); font-weight: 400; }
.work-row h3 {
  font-family: var(--font-display); font-weight: 700; text-transform: uppercase;
  font-size: clamp(20px, 3.4vw, 42px); line-height: 1; color: var(--ink);
  transition: color 0.3s;
}
.work-row p { font-size: 13px; color: var(--dim); text-align: right; max-width: 320px; }
.work-arrow { color: var(--dim); font-size: 20px; transition: transform 0.35s, color 0.35s; }
.work-row:hover { padding-left: 26px; background: rgba(200, 255, 77, 0.04); }
.work-row:hover h3 { color: var(--accent); }
.work-row:hover .work-arrow { transform: translate(4px, -4px); color: var(--accent); }
@media (max-width: 720px) {
  .work-row { grid-template-columns: 44px 1fr 24px; }
  .work-row p { display: none; }
}

/* ============ WORK PREVIEW — full-screen particle reveal ============ */
.work-preview {
  position: fixed; inset: 0; z-index: 110;
  pointer-events: none; opacity: 0; visibility: hidden;
  display: flex; align-items: center; justify-content: center;
}
.work-preview canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: none; pointer-events: none;
}
.work-preview img,
.work-preview video {
  position: relative; z-index: 2;
  max-width: min(82vw, 980px); max-height: 82vh;
  object-fit: contain;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.9);
  display: none; opacity: 0;
}
.work-preview-close {
  position: absolute; top: 20px; right: 20px; z-index: 10;
  background: rgba(7, 16, 38, 0.7);
  border: 1px solid rgba(203, 255, 0, 0.35); color: #CBFF00;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em;
  padding: 9px 18px; cursor: pointer;
  pointer-events: auto; opacity: 0; visibility: hidden;
  transition: opacity 0.25s, background 0.2s;
}
.work-preview-close:hover { background: rgba(203, 255, 0, 0.12); }
.work-preview-tag {
  position: absolute; bottom: 20px; left: 24px; z-index: 10;
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.3em;
  color: var(--accent); pointer-events: none;
}
.work-preview.on  { visibility: visible; opacity: 1; }
.work-preview.on .work-preview-close { opacity: 1; visibility: visible; }
.work-preview.off { visibility: hidden;  opacity: 0; }
/* Touch: overlay captures all taps so underlying content isn't accidentally triggered */
@media (pointer: coarse) {
  .work-preview.on { pointer-events: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .work-preview.on  { opacity: 1; }
  .work-preview.off { opacity: 0; }
}

/* ============ 04 ARSENAL ============ */
.service-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.service-card {
  background: rgba(7, 16, 38, 0.75);
  padding: clamp(28px, 4vw, 48px); position: relative; overflow: hidden;
  transition: background 0.4s;
}
.service-card::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
.service-card:hover::after { transform: scaleX(1); }
.service-card:hover { background: rgba(200, 255, 77, 0.05); }
.service-num {
  font-family: var(--font-mono); font-size: 11px; color: var(--accent); letter-spacing: 0.3em;
}
.service-card h3 {
  font-family: var(--font-display); font-weight: 800; font-size: clamp(17px, 1.7vw, 24px);
  margin: 16px 0 14px; letter-spacing: 0.01em;
}
.service-card p { color: var(--dim); font-size: 14px; }
@media (max-width: 860px) { .service-grid { grid-template-columns: 1fr; } }

.stat-band {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px;
  margin-top: clamp(40px, 7vh, 80px); padding-top: 36px; border-top: 1px solid var(--line);
}
.stat b {
  display: block; font-family: var(--font-display); font-weight: 800;
  font-size: clamp(36px, 5vw, 64px); color: var(--accent); line-height: 1;
}
.stat span { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.25em; color: var(--dim); }
@media (max-width: 720px) { .stat-band { grid-template-columns: repeat(2, 1fr); } }

/* ============ 05 METHOD ============ */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(16px, 2vw, 28px); }
.step {
  border: 1px solid var(--line); padding: clamp(22px, 3vw, 36px);
  background: rgba(7, 16, 38, 0.7);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.4s;
}
.step:hover { transform: translateY(-8px); border-color: var(--accent); }
.step i {
  font-style: normal; font-family: var(--font-display); font-weight: 800;
  font-size: clamp(40px, 5vw, 72px); line-height: 1; color: transparent;
  -webkit-text-stroke: 1px rgba(200, 255, 77, 0.6); display: block; margin-bottom: 18px;
}
.step h3 { font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: 0.06em; margin-bottom: 10px; }
.step p { color: var(--dim); font-size: 13px; }
@media (max-width: 980px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .steps { grid-template-columns: 1fr; } }

/* ============ 06 TRANSMIT ============ */
.transmit-sub { color: var(--dim); max-width: 520px; margin-top: 20px; }
.transmit-form { max-width: 860px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(16px, 3vw, 32px); margin-bottom: clamp(16px, 3vh, 28px); }
.field { display: flex; flex-direction: column; gap: 8px; }
.field span { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.3em; color: var(--accent); }
.field input, .field select {
  background: transparent; border: none; border-bottom: 1px solid rgba(233, 237, 242, 0.25);
  color: var(--ink); font-family: var(--font-body); font-size: 16px; padding: 10px 2px;
  outline: none; border-radius: 0; transition: border-color 0.3s;
}
.field select {
  cursor: none;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23c8ff4d' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 6px center;
  padding-right: 26px;
}
.field select option { background: #0d1834; color: var(--ink); }
.field input:focus, .field select:focus { border-bottom-color: var(--accent); }
.field input::placeholder { color: rgba(139, 148, 163, 0.45); }
.btn-send { width: 100%; margin-top: 12px; font-size: 13px; cursor: none; }
.btn-send[disabled] { opacity: 0.45; pointer-events: none; }
.form-note { text-align: center; margin-top: 18px; color: var(--dim); }
.form-note.sent { color: var(--accent); }
@media (max-width: 640px) { .field-row { grid-template-columns: 1fr; } }

/* ============ FOOTER ============ */
.footer {
  position: relative; z-index: 10;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  padding: 28px clamp(24px, 8vw, 120px);
  border-top: 1px solid var(--line);
}

/* ============ SMALL PHONES ============ */
@media (max-width: 480px) {
  .hero-actions { width: 100%; flex-direction: column; }
  .hero-actions .btn { width: 100%; }
  .nav-cta { font-size: 10px; padding: 8px 12px; }
}

/* ============ NO-JS / FAILED-BOOT FALLBACK ============ */
.no-mpr-js .reveal { opacity: 1 !important; transform: none !important; }
.no-mpr-js body { cursor: auto; }
.no-mpr-js .cursor-dot, .no-mpr-js .cursor-ring { display: none; }
.no-mpr-js .hero-title .char { transform: none !important; }
.no-mpr-js .btn-send, .no-mpr-js .field select { cursor: pointer; }

/* ============ REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { transition: none; opacity: 1; transform: none; }
  .marquee-track { animation: none; }
  .grain { animation: none; }
  .hero-title .char { transition: none; transform: none; }
}
