/* ============================================
   ALEX HERRERO — SPATIAL GLASS DESIGN SYSTEM
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Inter+Tight:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@300;400;500;600&display=swap');

:root {
  /* Ground — cool blue-tinted near-black */
  --bg-0: #050709;
  --bg-1: #0a0e13;
  --bg-2: #11161d;

  /* Glass tints */
  --glass-1: rgba(255, 255, 255, 0.03);
  --glass-2: rgba(255, 255, 255, 0.05);
  --glass-3: rgba(255, 255, 255, 0.08);
  --glass-4: rgba(255, 255, 255, 0.12);
  --glass-stroke: rgba(255, 255, 255, 0.08);
  --glass-stroke-strong: rgba(255, 255, 255, 0.16);

  /* Foreground */
  --fg-0: #f4f6f8;
  --fg-1: #c8cdd4;
  --fg-2: #8a929c;
  --fg-3: #5a626c;
  --fg-4: #3a4048;

  /* Accent — mint green */
  --accent: #00ff9d;
  --accent-soft: rgba(0, 255, 157, 0.14);
  --accent-glow: rgba(0, 255, 157, 0.35);
  --accent-deep: #00b86f;

  /* Secondary glow tints */
  --glow-cyan: rgba(80, 200, 255, 0.25);
  --glow-violet: rgba(160, 120, 255, 0.18);

  /* Type */
  --font-display: 'Inter Tight', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;

  /* Spacing scale */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;
  --s-10: 128px;

  /* Radii */
  --r-1: 6px;
  --r-2: 10px;
  --r-3: 16px;
  --r-4: 22px;
  --r-5: 32px;

  /* Shadows */
  --shadow-glass: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 0 0 1px rgba(255, 255, 255, 0.06), 0 30px 60px -20px rgba(0, 0, 0, 0.6);
  --shadow-deep: 0 40px 80px -30px rgba(0, 0, 0, 0.8);
  --shadow-accent: 0 0 60px var(--accent-glow);
}

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

html {
  background: #050709;
  color-scheme: dark;
}

html, body {
  background-color: var(--bg-0);
  color: var(--fg-0);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  background-color: var(--bg-0);
}

body {
  min-height: 100vh;
  position: relative;
}

/* Ambient background — subtle radial glow + grain
   IMPORTANT: layered ON TOP of a solid dark base so we never expose page background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, var(--glow-violet), transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 80%, var(--glow-cyan), transparent 60%),
    radial-gradient(ellipse 50% 40% at 50% 100%, var(--accent-soft), transparent 70%),
    var(--bg-0);
  pointer-events: none;
  z-index: -2;
  opacity: 1;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.10 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  pointer-events: none;
  z-index: -1;
  opacity: 0.25;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
img, svg { display: block; max-width: 100%; }

/* Selection */
::selection { background: var(--accent); color: var(--bg-0); }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-0); }
::-webkit-scrollbar-thumb { background: var(--glass-3); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--glass-4); }

/* ============================================
   TYPE
   ============================================ */
.t-display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 0.95;
}
.t-mega { font-size: clamp(64px, 10vw, 180px); font-weight: 800; letter-spacing: -0.05em; line-height: 0.88; }
.t-h1 { font-size: clamp(40px, 5.5vw, 84px); }
.t-h2 { font-size: clamp(32px, 4vw, 56px); }
.t-h3 { font-size: clamp(22px, 2.4vw, 32px); letter-spacing: -0.02em; }
.t-h4 { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.t-body-lg { font-size: 19px; line-height: 1.55; color: var(--fg-1); }
.t-body { font-size: 16px; line-height: 1.6; color: var(--fg-1); }
.t-small { font-size: 14px; color: var(--fg-2); }
.t-mono { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--fg-2); }
.t-mono-sm { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-3); }

.t-grad {
  background: linear-gradient(180deg, var(--fg-0) 0%, var(--fg-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.t-accent { color: var(--accent); }

/* ============================================
   GLASS PRIMITIVES
   ============================================ */
.glass {
  background: var(--glass-1);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--glass-stroke);
  border-radius: var(--r-3);
  position: relative;
  overflow: hidden;
}

.glass::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(255,255,255,0.18), rgba(255,255,255,0) 40%, rgba(255,255,255,0) 60%, rgba(255,255,255,0.04));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.glass-strong {
  background: var(--glass-2);
  backdrop-filter: blur(40px) saturate(160%);
  -webkit-backdrop-filter: blur(40px) saturate(160%);
  border: 1px solid var(--glass-stroke);
  border-radius: var(--r-3);
  box-shadow: var(--shadow-glass);
}

/* ============================================
   LAYOUT
   ============================================ */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--s-6);
  position: relative;
  z-index: 2;
}
.container-wide { max-width: 1480px; }
.container-narrow { max-width: 880px; }

/* ============================================
   BUTTONS / CHIPS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 12px 22px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
  position: relative;
  overflow: hidden;
  transition: transform .35s cubic-bezier(.2,.8,.2,1), background .25s, color .25s, border-color .25s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #00190f;
  border: 1px solid transparent;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-accent); }

.btn-ghost {
  background: var(--glass-2);
  color: var(--fg-0);
  border: 1px solid var(--glass-stroke);
  backdrop-filter: blur(20px);
}
.btn-ghost:hover { background: var(--glass-3); border-color: var(--glass-stroke-strong); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--glass-2);
  border: 1px solid var(--glass-stroke);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-1);
}
.chip-dot::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ============================================
   STATUS PILL — currently open / live indicator
   ============================================ */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 10px;
  background: var(--glass-2);
  border: 1px solid var(--glass-stroke);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-1);
}
.status-pill .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-glow);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 var(--accent-glow); }
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ============================================
   CURSOR particle trail — keeps native cursor visible
   ============================================ */
.cursor-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}

/* ============================================
   NAV
   ============================================ */
.nav {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  background: rgba(8, 12, 16, 0.55);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--glass-stroke);
  border-radius: 999px;
  box-shadow: var(--shadow-glass);
}
.nav-brand {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg-0);
  padding: 8px 14px 8px 16px;
  border-right: 1px solid var(--glass-stroke);
  margin-right: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-brand .pulse {
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 2s infinite;
}
.nav a.nav-link {
  padding: 8px 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-2);
  border-radius: 999px;
  transition: color .2s, background .2s;
  position: relative;
}
.nav a.nav-link:hover { color: var(--fg-0); }
.nav a.nav-link.active { color: var(--bg-0); background: var(--accent); }

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
  padding: var(--s-9) 0 var(--s-7);
  border-top: 1px solid var(--glass-stroke);
  margin-top: var(--s-10);
  position: relative;
  z-index: 2;
}

/* ============================================
   PAGE TRANSITION OVERLAY
   ============================================ */
.page-transition {
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: none;
  background: var(--bg-0);
  transform: translateY(100%);
  transition: transform .6s cubic-bezier(.76,0,.24,1);
}
.page-transition.active { transform: translateY(0); }

/* Page enter animation */
@keyframes page-enter {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
main { animation: page-enter .7s cubic-bezier(.2,.8,.2,1) both; position: relative; z-index: 2; }

/* ============================================
   REVEAL — scroll-driven
   ============================================ */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .9s cubic-bezier(.2,.8,.2,1), transform .9s cubic-bezier(.2,.8,.2,1);
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   PLACEHOLDER IMAGE — striped with mono caption
   ============================================ */
.placeholder {
  position: relative;
  background:
    repeating-linear-gradient(
      135deg,
      rgba(255,255,255,0.025) 0px,
      rgba(255,255,255,0.025) 1px,
      transparent 1px,
      transparent 14px
    ),
    linear-gradient(135deg, rgba(0,255,157,0.04), rgba(80,200,255,0.04));
  border: 1px solid var(--glass-stroke);
  border-radius: var(--r-3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-3);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  overflow: hidden;
}
.placeholder::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.04), transparent 60%);
  pointer-events: none;
}
.placeholder-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 20px;
}
.placeholder-content .pl-icon {
  display: block;
  margin: 0 auto 10px;
  width: 32px; height: 32px;
  border: 1px solid var(--fg-3);
  border-radius: 8px;
  position: relative;
}
.placeholder-content .pl-icon::after {
  content: '';
  position: absolute; inset: 6px;
  border: 1px dashed var(--fg-3);
  border-radius: 4px;
}

/* ============================================
   MAGNETIC + HOVER
   ============================================ */
.magnetic { display: inline-block; will-change: transform; }
.hoverable { transition: transform .35s cubic-bezier(.2,.8,.2,1); }

/* ============================================
   GRID HELPERS
   ============================================ */
.grid { display: grid; gap: var(--s-5); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-12 { grid-template-columns: repeat(12, 1fr); }

@media (max-width: 880px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .nav { gap: 0; padding: 4px; }
  .nav-brand { display: none; }
  .nav a.nav-link { padding: 8px 10px; font-size: 10px; }
}

/* ============================================
   SECTION
   ============================================ */
section { padding: var(--s-9) 0; position: relative; z-index: 2; }
section.tight { padding: var(--s-7) 0; }

.section-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--s-4);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-2);
}
.section-label::before {
  content: '';
  width: 24px; height: 1px;
  background: var(--accent);
}

/* ============================================
   PROJECT CARD
   ============================================ */
.project-card {
  display: block;
  position: relative;
  border-radius: var(--r-4);
  overflow: hidden;
  background: var(--glass-1);
  border: 1px solid var(--glass-stroke);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: transform .5s cubic-bezier(.2,.8,.2,1), border-color .3s;
  isolation: isolate;
}
.project-card:hover {
  transform: translateY(-4px);
  border-color: var(--glass-stroke-strong);
}
.project-card .card-media {
  aspect-ratio: 16 / 10;
  border-radius: var(--r-3);
  margin: var(--s-3);
}
.project-card .card-body {
  padding: var(--s-2) var(--s-5) var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.project-card .card-meta {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  justify-content: space-between;
}
.project-card .card-arrow {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--glass-2);
  border: 1px solid var(--glass-stroke);
  display: grid;
  place-items: center;
  transition: background .25s, transform .35s cubic-bezier(.2,.8,.2,1);
}
.project-card:hover .card-arrow {
  background: var(--accent);
  color: var(--bg-0);
  transform: rotate(-45deg);
}

/* spotlight on hover */
.project-card .spotlight {
  position: absolute;
  inset: 0;
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 50%), rgba(0,255,157,0.08), transparent 50%);
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
  z-index: 0;
}
.project-card:hover .spotlight { opacity: 1; }

/* ============================================
   STAT
   ============================================ */
.stat {
  padding: var(--s-5);
  background: var(--glass-1);
  border: 1px solid var(--glass-stroke);
  border-radius: var(--r-3);
  backdrop-filter: blur(16px);
}
.stat .num {
  font-family: var(--font-display);
  font-size: clamp(36px, 4vw, 56px);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--fg-0);
  line-height: 1;
  margin-bottom: 6px;
}
.stat .num .unit { color: var(--accent); }
.stat .label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-2);
}

/* ============================================
   CASE-STUDY HERO
   ============================================ */
.case-hero {
  padding-top: 140px;
  padding-bottom: var(--s-9);
}
.case-hero .breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: var(--s-5);
}
.case-hero .breadcrumb a:hover { color: var(--fg-0); }
.case-hero .breadcrumb .sep { color: var(--fg-4); }

.case-hero-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-5);
  margin-top: var(--s-7);
  padding-top: var(--s-5);
  border-top: 1px solid var(--glass-stroke);
}
.case-hero-meta dt {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 6px;
}
.case-hero-meta dd { color: var(--fg-0); font-size: 14px; }

@media (max-width: 880px) {
  .case-hero-meta { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================
   CASE BODY
   ============================================ */
.case-section { padding: var(--s-7) 0; }
.case-section h2 {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.5vw, 44px);
  letter-spacing: -0.025em;
  margin-bottom: var(--s-5);
  font-weight: 600;
}
.case-section p {
  font-size: 18px;
  line-height: 1.7;
  color: var(--fg-1);
  max-width: 70ch;
  margin-bottom: var(--s-4);
}
.case-section p + p { margin-top: 0; }

.numbered-list { counter-reset: ni; }
.numbered-list li {
  counter-increment: ni;
  list-style: none;
  display: flex;
  gap: var(--s-4);
  padding: var(--s-4) 0;
  border-bottom: 1px solid var(--glass-stroke);
}
.numbered-list li::before {
  content: counter(ni, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--accent);
  flex-shrink: 0;
  width: 30px;
  padding-top: 4px;
}
.numbered-list li strong { display: block; color: var(--fg-0); margin-bottom: 4px; font-weight: 600; }
.numbered-list li span { color: var(--fg-1); }

/* ============================================
   NEXT-PROJECT
   ============================================ */
.next-link {
  display: block;
  padding: var(--s-7) var(--s-6);
  border-top: 1px solid var(--glass-stroke);
  border-bottom: 1px solid var(--glass-stroke);
  background: var(--glass-1);
  transition: background .35s;
}
.next-link:hover { background: var(--glass-2); }
.next-link .label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 8px;
}
.next-link .title {
  font-family: var(--font-display);
  font-size: clamp(40px, 6vw, 72px);
  letter-spacing: -0.03em;
  font-weight: 700;
}
