/* ============================================
   clarvex.mx — Optimización de Windows
   ============================================ */

:root {
  --bg: #0d0e0c;
  --bg-2: #14150f;
  --bg-3: #1a1c14;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.04);
  --fg: #e8eae0;
  --fg-2: #9c9e92;
  --fg-3: #5d5f54;
  --accent: #b8ff3a;
  --accent-dim: #6e9a23;
  --warn: #ff7a3a;
  --grid: rgba(184, 255, 58, 0.06);

  --font-sans: 'Geist', 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'Geist Mono', 'JetBrains Mono', ui-monospace, 'Menlo', monospace;

  --pad: clamp(20px, 4vw, 64px);
}

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

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
  overflow-x: hidden;
  line-height: 1.4;
}

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

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

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

/* ===== Layout helpers ===== */
.container {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding-inline: var(--pad);
}

.grid-bg {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 64px 64px;
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%);
}

.scanline {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 3px,
    rgba(255, 255, 255, 0.012) 3px,
    rgba(255, 255, 255, 0.012) 4px
  );
  mix-blend-mode: overlay;
}

/* ===== NAV ===== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding: 18px var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(13, 14, 12, 0.85), rgba(13, 14, 12, 0));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: -0.01em;
}

.nav-brand img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

.nav-brand .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.nav-links {
  display: flex;
  gap: 4px;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-2);
}

.nav-links a {
  padding: 8px 14px;
  border-radius: 100px;
  transition: color 0.2s;
  position: relative;
}

.nav-cta {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--bg);
  border-radius: 100px;
  font-weight: 500;
  transition: transform 0.2s;
}

.nav-cta:hover {
  transform: translateY(-1px);
}

.nav-scrolled {
  border-bottom: 1px solid var(--line);
}

/* Nav right group */
.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ===== HAMBURGER BUTTON ===== */
.nav-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  gap: 5px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  z-index: 60;
  flex-shrink: 0;
}

.burger-line {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--fg);
  border-radius: 2px;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.25s ease,
              width 0.3s ease;
  transform-origin: center;
}

.nav-burger-open .burger-line:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}
.nav-burger-open .burger-line:nth-child(2) {
  opacity: 0;
  width: 0;
}
.nav-burger-open .burger-line:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

/* ===== MOBILE OVERLAY ===== */
.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 49;
  background: rgba(13, 14, 12, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-overlay-open {
  pointer-events: all;
  opacity: 1;
  transform: translateY(0);
}

.nav-overlay-inner {
  padding: 80px var(--pad) 48px;
  display: flex;
  flex-direction: column;
  gap: 48px;
  height: 100%;
  justify-content: center;
}

.nav-overlay-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-overlay-link {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line-2);
  font-size: clamp(28px, 6vw, 52px);
  font-weight: 500;
  letter-spacing: -0.03em;
  color: var(--fg);
  text-decoration: none;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1),
              color 0.2s ease;
}

.nav-overlay-open .nav-overlay-link {
  opacity: 1;
  transform: translateY(0);
}

.nav-overlay-link:hover {
  color: var(--accent);
}

.nol-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-3);
  letter-spacing: 0.06em;
  min-width: 24px;
}

.nol-label {
  flex: 1;
}

.nol-arrow {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--fg-3);
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.2s, transform 0.2s;
}

.nav-overlay-link:hover .nol-arrow {
  opacity: 1;
  transform: translateX(0);
}

.nav-overlay-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 24px 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.nof-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.nof-item .k {
  color: var(--fg-3);
  letter-spacing: 0.08em;
  font-size: 10px;
}

.nof-item a,
.nof-item span {
  color: var(--fg-2);
}

/* ===== Desktop nav link hover underline ===== */
.nav-link {
  position: relative;
  padding: 8px 14px;
  border-radius: 100px;
  transition: color 0.2s;
}

.nav-link span {
  position: relative;
}

.nav-link span::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.nav-link:hover {
  color: var(--fg);
}

.nav-link:hover span::after {
  width: 100%;
}

@media (max-width: 760px) {
  .nav-links { display: none; }
  .nav-burger { display: flex; }
  .nav-cta { display: none; }
}

/* ===== Section base ===== */
section {
  position: relative;
  z-index: 2;
  padding: clamp(80px, 12vw, 160px) 0;
  border-top: 1px solid var(--line);
}

.section-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--accent);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.section-tag::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--accent);
  display: inline-block;
}

.section-title {
  font-size: clamp(36px, 6vw, 80px);
  line-height: 0.95;
  letter-spacing: -0.04em;
  font-weight: 500;
  margin-bottom: 24px;
  text-wrap: balance;
}

.section-title em {
  font-style: normal;
  color: var(--fg-3);
}

.section-sub {
  font-size: clamp(15px, 1.4vw, 18px);
  color: var(--fg-2);
  max-width: 56ch;
  text-wrap: pretty;
}

/* Mono labels */
.mono-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--fg-3);
  text-transform: uppercase;
}

/* ============================================
   SCROLL REVEAL — micro animations
   ============================================ */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.9s cubic-bezier(0.2, 0.8, 0.2, 1),
              transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: opacity, transform;
}

.reveal.is-in {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.08s; }
.reveal-delay-2 { transition-delay: 0.16s; }
.reveal-delay-3 { transition-delay: 0.24s; }
.reveal-delay-4 { transition-delay: 0.32s; }

/* Section tag — slide-in underline */
.section-tag {
  position: relative;
  overflow: hidden;
}

.section-tag::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  height: 1px;
  width: 0;
  background: var(--accent);
  transition: width 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) 0.3s;
}

.reveal.is-in .section-tag::after {
  width: 60px;
}

/* Service card hover glow */
.service {
  position: relative;
  overflow: hidden;
}

.service::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 50%),
              rgba(184,255,58,0.12), transparent 40%);
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}

.service:hover::after {
  opacity: 1;
}

/* ============================================
   3D ANIMATION SUPPORT
   ============================================ */

/* Perspective contexts — perspective set via GSAP gsap.set() at runtime,
   but transform-style ensures children render in the same 3D space */
.hero-grid,
.about-grid,
.case-list {
  transform-style: preserve-3d;
}

/* Elements that receive GSAP 3D transforms need will-change hint */
.hero h1,
.boot-panel,
.about-card,
.about-text,
.services-grid,
.contact-inner,
.footer-mark,
.ba {
  will-change: transform, opacity;
}

/* Remove will-change after animation completes (handled by GSAP onComplete,
   but this ensures no stale hints on idle elements) */
.gsap-done {
  will-change: auto;
}

/* ============================================
   MAGNETIC BUTTON — prevent layout shift
   ============================================ */
.btn-primary,
.nav-cta,
.form-submit {
  /* transform is used by GSAP magnetic effect; ensure no conflict with
     existing hover translateY */
  position: relative;
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .rig-fan, .rig-key, .rig-pct-fill, .rig-glow, .rig-rgb-strip,
  .rig-gpu-led, .ticker-track, .rig-screen-glare, .nav-brand .dot,
  .hero-meta-dot, .portrait-avatar { animation: none !important; }
}
