/* =============================================
   AI Proto Lab — Neon Landing Page
   ============================================= */

:root {
  --bg-deep:    #0a0a1a;
  --bg-card:    #111128;
  --bg-card-border: #1e1e3a;

  --neon-pink:   #ff2d78;
  --neon-cyan:   #00f0ff;
  --neon-purple: #b24dff;
  --neon-gold:   #ffd700;
  --neon-green:  #39ff14;

  --text-primary:   #e8e8f0;
  --text-secondary: #9090b0;
  --text-muted:     #555580;

  --font-main: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;

  --radius: 16px;
  --radius-sm: 10px;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-main);
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ─── File protocol notice (when opening index.html directly from disk) ─── */
.file-protocol-notice {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 1rem 3rem 1rem 1.5rem;
  background: rgba(255, 45, 120, .15);
  border-bottom: 1px solid var(--neon-pink);
  font-size: .9rem;
  color: var(--text-primary);
  line-height: 1.5;
}
.file-protocol-notice[hidden] { display: none; }
.file-protocol-notice p { margin: 0 0 .5rem; }
.file-protocol-notice p:last-of-type { margin-bottom: 0; }
.file-protocol-notice code {
  display: inline-block;
  margin: .35rem 0;
  padding: .35rem .6rem;
  background: rgba(0,0,0,.3);
  border-radius: 6px;
  font-size: .85rem;
  color: var(--neon-cyan);
}
.file-protocol-notice a {
  color: var(--neon-cyan);
  text-decoration: none;
}
.file-protocol-notice a:hover { text-decoration: underline; }
.dismiss-notice {
  position: absolute;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 6px;
  transition: color .2s, background .2s;
}
.dismiss-notice:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,.08);
}

/* ─── Hero — compact so cards peek into view ─── */
.hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 25vh;
  max-height: 30vh;
  text-align: center;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 30% 20%, #ff2d7812 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, #00f0ff0a 0%, transparent 50%),
    var(--bg-deep);
}

.skyline {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  opacity: .55;
  pointer-events: none;
}

.skyline svg {
  display: block;
  width: 100%;
  height: auto;
}

.hero-content {
  position: relative;
  z-index: 2;
  padding: 2rem 2.5rem;
  background: radial-gradient(ellipse 80% 70% at 50% 50%, rgba(10, 10, 26, .75) 0%, rgba(10, 10, 26, .4) 50%, transparent 70%);
  border-radius: 20px;
}

.hero-title {
  font-size: clamp(1.8rem, 5vw, 3.5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.03em;
  margin-bottom: 1rem;
  animation: fadeInDown .8s .15s var(--ease-out) both;
}

.neon {
  display: inline-block;
}

.neon-pink {
  color: var(--neon-pink);
  text-shadow:
    0 0 2px rgba(0, 0, 0, 1),
    0 0 4px rgba(0, 0, 0, .9),
    0 0 7px  var(--neon-pink),
    0 0 20px var(--neon-pink),
    0 0 42px #ff2d7888,
    0 0 80px #ff2d7844;
  animation: flicker 4s ease-in-out infinite alternate;
}

.neon-cyan {
  color: var(--neon-cyan);
  text-shadow:
    0 0 2px rgba(0, 0, 0, 1),
    0 0 4px rgba(0, 0, 0, .9),
    0 0 7px  var(--neon-cyan),
    0 0 20px var(--neon-cyan),
    0 0 42px #00f0ff88,
    0 0 80px #00f0ff44;
  animation: flicker 5s 1s ease-in-out infinite alternate;
}

.neon-purple {
  color: var(--neon-purple);
  text-shadow:
    0 0 2px rgba(0, 0, 0, 1),
    0 0 4px rgba(0, 0, 0, .9),
    0 0 7px  var(--neon-purple),
    0 0 20px var(--neon-purple),
    0 0 42px #b24dff88,
    0 0 80px #b24dff44;
  animation: flicker 6s 2s ease-in-out infinite alternate;
}

@keyframes flicker {
  0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
    opacity: 1;
  }
  20%, 24%, 55% {
    opacity: .85;
  }
}

.hero-subtitle {
  font-size: clamp(.85rem, 1.5vw, 1.05rem);
  color: var(--text-primary);
  max-width: 440px;
  margin: 0 auto;
  animation: fadeInDown .8s .3s var(--ease-out) both;
  text-shadow:
    0 0 2px rgba(0, 0, 0, 1),
    0 1px 4px rgba(0, 0, 0, .8),
    0 2px 8px rgba(0, 0, 0, .5);
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Projects section ─── */
.projects {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.75rem 1.75rem 1.5rem;
  text-align: left;
}

/* Projects como pill (desktop y mobile): etiqueta compacta que encaja con el layout */
.section-heading {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 1.75rem;
  padding: 0.4rem 0.9rem;
  background: rgba(255, 255, 255, .06);
  color: var(--text-secondary);
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
}

/* ─── Landing: Projects | Tools tabs (misma estética que .section-heading; reset de <button> nativo) ─── */
.landing-tabs {
  position: relative;
  z-index: 5;
  margin-bottom: 1.75rem;
}
.landing-tabs-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.landing-tab {
  display: inline-block;
  box-sizing: border-box;
  margin: 0;
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.3;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, .06);
  color: var(--text-secondary);
  cursor: pointer;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  appearance: none;
  -webkit-appearance: none;
  transition: color 0.2s var(--ease-out), border-color 0.2s var(--ease-out), background 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}
.landing-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, .1);
}
.landing-tab:focus-visible {
  outline: 2px solid var(--neon-cyan);
  outline-offset: 3px;
}
.landing-tab.is-active {
  color: var(--text-primary);
  border-color: rgba(0, 240, 255, 0.4);
  box-shadow: 0 0 0 1px rgba(0, 240, 255, 0.15);
  background: rgba(0, 240, 255, 0.07);
}
.landing-tab-panel[hidden] {
  display: none !important;
}

/* ─── Card grid: tarjetas compactas, mismas proporciones ─── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
  align-items: stretch;
}

/* ─── Animated border rotation via @property ─── */
@property --angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

@keyframes borderSpin {
  to { --angle: 360deg; }
}

/* ─── Card: neon glass panel (todas igual tamaño) ─── */
.card {
  --accent: var(--neon-cyan);
  --accent-dim: #00f0ff22;
  position: relative;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: transparent;
  border: none;
  border-radius: 2px;
  padding: 2px;
  cursor: pointer;
  transform-style: preserve-3d;
  perspective: 800px;
  transition: transform .35s var(--ease-out);
  min-height: 0;
}

.card--pink  { --accent: var(--neon-pink);   --accent-dim: #ff2d7822; }
.card--cyan  { --accent: var(--neon-cyan);   --accent-dim: #00f0ff22; }
.card--purple{ --accent: var(--neon-purple); --accent-dim: #b24dff22; }

.card-border {
  position: absolute;
  inset: 0;
  border-radius: 2px;
  background: conic-gradient(
    from var(--angle, 0deg),
    var(--accent),
    transparent 25%,
    transparent 50%,
    var(--accent) 75%,
    transparent 100%
  );
  opacity: 0;
  transition: opacity .4s ease;
  z-index: 0;
  animation: borderSpin 4s linear infinite paused;
}

.card:hover .card-border,
.card:focus-visible .card-border {
  opacity: 1;
  animation-play-state: running;
}

.card-body {
  position: relative;
  z-index: 1;
  background: var(--bg-deep);
  border: 1px solid var(--bg-card-border);
  border-radius: 2px;
  padding: 1.5rem 1.35rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  flex: 1;
  min-height: 160px;
  transition:
    border-color .35s ease,
    box-shadow .35s ease,
    background .35s ease;
}

.card:hover .card-body,
.card:focus-visible .card-body {
  border-color: var(--accent);
  box-shadow:
    0 0 20px var(--accent-dim),
    inset 0 0 40px var(--accent-dim);
  background: #0a0a1aee;
}

.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.card:hover {
  transform: translateY(-4px) rotateX(1deg) rotateY(-1deg);
}

/* Tease: mismo efecto que hover, para animación de “llamada” aleatoria */
.card--tease .card-border {
  opacity: 1;
  animation-play-state: running;
}

.card--tease .card-body {
  border-color: var(--accent);
  box-shadow:
    0 0 20px var(--accent-dim),
    inset 0 0 40px var(--accent-dim);
  background: #0a0a1aee;
}

.card--tease {
  transform: translateY(-4px) rotateX(1deg) rotateY(-1deg);
}

.card--tease .card-title {
  color: var(--accent);
  text-shadow: 0 0 12px var(--accent-dim);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
  transition: color .3s ease, text-shadow .3s ease;
}

.card:hover .card-title {
  color: var(--accent);
  text-shadow: 0 0 12px var(--accent-dim);
}

.card-desc {
  font-size: .82rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* Card rating (option 5: right-aligned; pinned to bottom of card-body so short copy aligns with other cards) */
.card-rating {
  display: block;
  font-size: .75rem;
  color: #666;
  text-align: right;
  margin-top: auto;
  padding-top: 0.35rem;
}
.card-rating:empty {
  display: none;
}

/* Card badge (e.g. "New" on CrossFit Fuel) — option 1: top-right corner */
.card-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  background: var(--neon-pink);
  color: #0a0a1a;
}
.card-badge--corner {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
}

/* Hidden from landing (unpublished projects) */
.card--hidden {
  display: none !important;
}

/* Coming-soon cards: ghost state */
.card--soon {
  cursor: default;
  pointer-events: none;
  opacity: .25;
}

.card--soon .card-body {
  border-style: dashed;
}

.card--soon .card-title {
  color: var(--text-muted);
}

.card--soon .card-desc {
  color: var(--text-muted);
}

/* ─── Reveal on scroll ─── */
.card {
  opacity: 0;
  transform: translateY(30px);
}

.card.is-visible {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity .6s var(--ease-out),
    transform .6s var(--ease-out);
}

.card--soon.is-visible {
  opacity: .25;
}

.card:nth-child(2).is-visible { transition-delay: .1s; }
.card:nth-child(3).is-visible { transition-delay: .2s; }

/* ─── Snake: fullscreen canvas on the page ─── */
.snake-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 500;
  pointer-events: none;
}

/* ─── Snake: solo estas cajas, no las de proyectos ─── */
.snake-hud {
  position: fixed;
  top: 1.2rem;
  right: 1.5rem;
  z-index: 510;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem 1rem;
  background: var(--bg-deep);
  border: 1px solid var(--bg-card-border);
  border-radius: 2px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .35);
  pointer-events: none;
  animation: hudIn .4s var(--ease-out) both;
}

.snake-hud[hidden] { display: none; }

@keyframes hudIn {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.snake-hud-label {
  font-size: 1rem;
  opacity: .9;
}

.snake-hud-score {
  font-size: 1rem;
  font-weight: 700;
  color: var(--neon-cyan);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 8px rgba(0, 240, 255, .4);
}

.snake-revive {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 510;
  padding: .65rem 1.35rem;
  font-family: var(--font-main);
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-deep);
  border: 1px solid var(--bg-card-border);
  border-radius: 2px;
  cursor: pointer;
  min-height: 44px;
  transition: border-color .25s ease, color .25s ease, box-shadow .25s ease, transform .15s ease;
  animation: reviveIn .4s var(--ease-out) both;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .35);
}

.snake-revive[hidden] { display: none; }

@keyframes reviveIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.snake-revive:hover {
  color: var(--neon-cyan);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 20px rgba(0, 240, 255, .15), inset 0 0 40px rgba(0, 240, 255, .06);
  transform: translateY(-1px);
}

/* ─── Footer: memorable ending (Peak-End Rule) ─── */
.footer {
  text-align: center;
  padding: 2rem 2rem 3rem;
  background: var(--bg-deep);
}

.footer-headline {
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: .5rem;
}

.footer-line {
  font-size: .92rem;
  color: var(--text-secondary);
  margin-bottom: .4rem;
}

.footer-cta {
  font-size: .85rem;
  font-weight: 500;
  color: var(--neon-pink);
  opacity: .8;
}

/* ─── Reduced motion: respect user preferences (Postel's Law) ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .card { opacity: 1; transform: none; }
  .card--soon { opacity: .25; }
  .card-border { display: none; }
}

/* ─── Responsive ─── */
@media (max-width: 640px) {
  .hero { min-height: 20vh; }
  .hero-title { letter-spacing: -.02em; }
  .hero-subtitle {
    font-size: .95rem;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 1.2rem;
  }
  .projects { padding: 1.75rem 1.25rem 1.25rem; }

  /* Skyline más alta en mobile: edificios alargados hacia abajo; menos hueco hasta la pill */
  .hero .skyline {
    height: 140px;
    opacity: 0.65;
  }
  .hero .skyline svg {
    height: 100%;
    width: 100%;
    object-fit: cover;
    object-position: center bottom;
  }

  /* Projects como pill: ocupa poco espacio, estilo etiqueta */
  .section-heading {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 1.75rem;
    padding: 0.35rem 0.75rem;
    background: rgba(255, 255, 255, .06);
    color: var(--text-secondary);
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-align: center;
  }

  .landing-tab {
    font-size: 0.75rem;
    padding: 0.35rem 0.75rem;
  }

  .card-desc {
    font-size: .9rem;
    line-height: 1.55;
  }

  /* Larger tap feedback on cards, only on small screens */
  .card:active {
    transform: translateY(-4px) rotateX(1deg) rotateY(-1deg);
  }
  .card:active .card-border {
    opacity: 1;
    animation-play-state: running;
  }
  .card:active .card-body {
    border-color: var(--accent);
    box-shadow:
      0 0 20px var(--accent-dim),
      inset 0 0 40px var(--accent-dim);
    background: #0a0a1aee;
  }

  /* File notice breathing room on small widths */
  .file-protocol-notice {
    padding: .75rem 1.25rem;
  }

  /* Snake HUD + revive button respect safe areas on mobile */
  .snake-hud {
    top: calc(1rem + env(safe-area-inset-top));
    right: 1rem;
  }

  /* Opción 2: barra ancha — botón ocupa el ancho con márgenes, no choca con el footer */
  .snake-revive {
    bottom: calc(1rem + env(safe-area-inset-bottom));
    left: 1rem;
    right: 1rem;
    width: auto;
    text-align: center;
    animation: reviveInMobileBar .4s var(--ease-out) both;
  }
  .snake-revive:hover {
    transform: translateY(-1px);
  }
  @keyframes reviveInMobileBar {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* Reservar espacio para el CTA sticky: todo el texto del footer (incl. el rojo) queda visible con margen */
  .footer {
    padding-bottom: calc(5rem + 44px + env(safe-area-inset-bottom));
  }
}
