/* ── Self-hosted fonts (Inter + JetBrains Mono) ───────────────
   Variable fonts with latin + latin-ext subsets. No CDN. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/Inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/Inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("/static/fonts/JetBrainsMono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("/static/fonts/JetBrainsMono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

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

body {
  background: #000000;
  color: #ededed;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01", "ss03";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ── Canvas ── */
#dot-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* ── Vignette overlay ── */
.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(ellipse 35% 85% at 50% 65%, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.95) 40%, transparent 120%),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.9) 0%, transparent 22%, transparent 45%, rgba(0, 0, 0, 0.8) 100%, rgba(0, 0, 0, 0.75) 100%),
    linear-gradient(to right, rgba(0, 0, 0, 0.6) 0%, transparent 30%, transparent 62%, rgba(0, 0, 0, 0.6) 100%);
}

/* ── Navbar ── */
@keyframes navSlideDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ── Scroll-driven: navbar width con easing suave ──
   Keyframes simulan ease-out: 0%→70% lento, 70%→100% acelera */
@keyframes navbarWidth {
  0% { max-width: 1240px; }
  50% { max-width: 1150px; }
  75% { max-width: 950px; }
  90% { max-width: 780px; }
  100% { max-width: 700px; }
}

/* ── Scroll-driven: navbar glass con easing suave ── */
@keyframes navbarGlassCompact {
  0% {
    border-radius: 20px;
    padding: 14px 24px;
    background: rgba(15, 15, 15, 0.55);
    border-color: rgba(255, 255, 255, 0.07);
  }
  50% {
    border-radius: 20px;
    padding: 14px 24px;
    background: rgba(15, 15, 15, 0.55);
    border-color: rgba(255, 255, 255, 0.07);
  }
  75% {
    border-radius: 9999px;
    padding: 12px 21px;
    background: rgba(15, 15, 15, 0.68);
    border-color: rgba(255, 255, 255, 0.08);
  }
  90% {
    border-radius: 9999px;
    padding: 11px 19px;
    background: rgba(15, 15, 15, 0.76);
    border-color: rgba(255, 255, 255, 0.085);
  }
  100% {
    border-radius: 9999px;
    padding: 10px 18px;
    background: rgba(15, 15, 15, 0.82);
    border-color: rgba(255, 255, 255, 0.09);
  }
}

.navbar {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  width: calc(100vw - 40px);
  max-width: 1240px;
  animation: navSlideDown 0.85s 0.6s ease-out both;
  /* Variable unica para animacion de scroll - 0=expandido, 1=compacto */
  --scroll-progress: 0;
  /* Calculos internos basados en --scroll-progress */
  --p: var(--scroll-progress);
  --navbar-width: calc(1240px - (540px * var(--p)));
  max-width: var(--navbar-width);
}

/* Fallback for non-hero pages (no scroll animation) */
body:not(.has-hero) .navbar {
  max-width: 700px;
  animation: navSlideDown 0.85s 0.6s ease-out both;
}

/* Legacy class - kept for compatibility but now handled by CSS */
.navbar--scrolled {
  max-width: 700px;
}

.navbar-glass {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
  /* Calculos basados en --scroll-progress */
  --p: var(--scroll-progress);
  --radius: calc(20px + (9979px * min(var(--p) * 2, 1)));
  --pad-x: calc(24px - 6px);
  --pad-y: calc(14px - 4px);
  --bg-alpha: calc(0.55 + (0.27 * var(--p)));
  --border-alpha: calc(0.07 + (0.02 * var(--p)));

  padding: var(--pad-y) var(--pad-x);
  background: rgba(15, 15, 15, var(--bg-alpha));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, var(--border-alpha));
  border-radius: var(--radius);
  /* Sin transition para evitar conflictos con scroll */
  transition: none;
  will-change: padding, border-radius;
}

/* Fallback para páginas sin hero */
body:not(.has-hero) .navbar-glass {
  border-radius: 9999px;
  padding: 10px 18px;
  background: rgba(15, 15, 15, 0.82);
  border-color: rgba(255, 255, 255, 0.09);
  animation: none;
}

.navbar--scrolled .navbar-glass {
  border-radius: 9999px;
  padding: 10px 18px;
  background: rgba(15, 15, 15, 0.82);
  border-color: rgba(255, 255, 255, 0.09);
}

/* Flex groups */
.nav-links-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar-logo {
  display: flex;
  align-items: center;
  padding: 0 4px;
  flex-shrink: 0;
}

.nav-link {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  padding: 6px 16px;
  transition: color 0.2s;
}

.nav-link:hover {
  color: #ffffff;
}

.login-btn {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.8);
  padding: 6px 20px;
  margin-left: 16px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: all 0.2s;
}

.login-btn:hover {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.1);
}

/* ── Language toggle (navbar, single button with globe icon) ── */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.8);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.lang-toggle:hover {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.1);
}

.lang-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.lang-toggle .lang-icon {
  width: 16px;
  height: 16px;
  color: inherit;
  flex-shrink: 0;
  opacity: 0.85;
}

.lang-toggle:hover .lang-icon {
  opacity: 1;
}

.lang-toggle .lang-code {
  display: inline-block;
  min-width: 18px;
  text-align: center;
}

/* Neon glow button */
.neon-button {
  background: rgba(255, 255, 255, 0.9);
  color: #000;
  border: none;
  border-radius: 9999px;
  padding: 8px 20px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  position: relative;
  transition: all 0.3s ease;
  box-shadow:
    0 0 10px rgba(255, 255, 255, 0.3),
    0 0 20px rgba(255, 255, 255, 0.15),
    0 0 40px rgba(255, 255, 255, 0.08);
}

.neon-button:hover {
  background: #ffffff;
  box-shadow:
    0 0 15px rgba(255, 255, 255, 0.5),
    0 0 30px rgba(255, 255, 255, 0.3),
    0 0 60px rgba(255, 255, 255, 0.15),
    0 0 90px rgba(255, 255, 255, 0.08);
}

/* ── Sign-in card ── */
.signin-container {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 0 16px;
}

.signin-card {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.signin-title {
  text-align: center;
  margin-bottom: 16px;
}

.signin-title h1 {
  font-size: 48px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
  line-height: 1.1;
  white-space: nowrap;
}

.signin-title p {
  color: rgba(255, 255, 255, 0.4);
  font-size: 18px;
}

/* Google button */
.google-btn {
  background: rgba(30, 30, 30, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  color: white;
  padding: 14px 32px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
}

.google-btn:hover {
  background: rgba(40, 40, 40, 0.9);
  border-color: rgba(255, 255, 255, 0.2);
}

.google-btn .g-icon {
  font-weight: 700;
  color: rgba(255, 255, 255, 0.7);
  font-size: 18px;
  margin-right: 4px;
}

/* Divider */
.divider {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  color: rgba(255, 255, 255, 0.3);
  font-size: 13px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

/* Email input */
.email-input-wrapper {
  position: relative;
  width: 100%;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(20, 20, 20, 0.6);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.email-input-wrapper:focus-within {
  border-color: rgba(255, 255, 255, 0.25);
}

.email-input-wrapper input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: rgba(255, 255, 255, 0.4);
  padding: 14px 56px 14px 32px;
  font-size: 15px;
}

.email-input-wrapper input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.email-submit-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(60, 60, 60, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 18px;
}

.email-submit-btn:hover {
  background: rgba(80, 80, 80, 0.9);
}

/* Legal links */
.legal-links {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  text-align: center;
  line-height: 1.8;
  margin-top: 32px;
}

.legal-links a {
  color: rgba(255, 255, 255, 0.5);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s;
}

.legal-links a:hover {
  color: rgba(255, 255, 255, 0.7);
}

/* ── Mobile hamburger toggle ── */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  padding: 0;
  transition: background 0.2s, border-color 0.2s;
}

.menu-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
}

.menu-toggle-bar {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
  transform-origin: center;
}

.menu-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.menu-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.menu-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ── Mobile slide-down menu ── */
.mobile-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  background: rgba(8, 8, 8, 0.97);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 20px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  /* Hidden by default */
  opacity: 0;
  transform: translateY(-10px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.mobile-nav-link {
  display: block;
  padding: 12px 16px;
  font-size: 16px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  border-radius: 12px;
  transition: color 0.2s, background 0.2s;
}

.mobile-nav-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}

.mobile-menu-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.mobile-menu-footer .neon-button {
  flex: 1;
  text-align: center;
  text-decoration: none;
  display: block;
}

/* ── Responsive: hide desktop nav on mobile, show hamburger ── */
@media (max-width: 767px) {
  .navbar {
    width: calc(100vw - 28px);
    max-width: none;
    transition: none;
  }

  .navbar--scrolled {
    max-width: none;
  }

  .navbar-glass {
    border-radius: 9999px !important;
    padding: 10px 14px !important;
    transition: none !important;
  }

  .nav-links-group {
    display: none;
  }

  .nav-controls .lang-toggle,
  .nav-controls .neon-button {
    display: none;
  }

  .menu-toggle {
    display: flex;
  }
}

/* ── Sign-in / legacy responsive ── */
@media (max-width: 640px) {
  .signin-title h1 {
    font-size: 36px;
    white-space: normal;
  }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .navbar {
    animation: none;
    opacity: 1;
  }

  .navbar,
  .navbar-glass,
  .menu-toggle-bar,
  .mobile-menu {
    transition: none !important;
  }
}

/* ── Back to top button ── */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(15, 15, 15, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  opacity: 0;
  transform: translateY(20px) scale(0.9);
  pointer-events: none;
  transition:
    opacity 0.35s ease,
    transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    background 0.2s ease,
    border-color 0.2s ease;
  z-index: 100;
}

.back-to-top svg {
  width: 20px;
  height: 20px;
}

.back-to-top:hover {
  background: rgba(30, 30, 30, 0.9);
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.back-to-top:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.back-to-top.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

@media (max-width: 640px) {
  .back-to-top {
    bottom: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
  }
}

/* ─────────────────────────────────────────────────────────────────────
   i18n language-switch transition
   ─────────────────────────────────────────────────────────────────────
   Driven by two classes toggled on <html>:
     .i18n-fading-out → everything fades out in 180ms
     .i18n-fading-in  → everything fades in  in 240ms, staggered
                         by --i18n-delay (set once per section on load)

   All work is done by the CSS engine — the JS layer only flips
   classes on <html>, so there's no per-element inline style churn.    */

/* Base: smooth height changes whenever JS locks height */
[data-i18n],
[data-i18n-html] {
  transition: height 360ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* !important on opacity/transform wins over the hero's fadeUp animation
   (animations normally override transitions unless !important is used) */
html.i18n-fading-out [data-i18n],
html.i18n-fading-out [data-i18n-html] {
  transition: opacity 180ms cubic-bezier(0.4, 0, 1, 1),
              transform 180ms cubic-bezier(0.4, 0, 1, 1),
              height 360ms cubic-bezier(0.4, 0, 0.2, 1) !important;
  opacity: 0 !important;
  transform: translateY(-4px) scale(0.98) !important;
}

/* Hero elements need higher specificity due to fadeUp animation */
html.i18n-fading-out .hero [data-i18n],
html.i18n-fading-out .hero [data-i18n-html],
html.i18n-fading-out .hero .hero-headline-line,
html.i18n-fading-out .hero .hero-sub {
  transition: opacity 180ms cubic-bezier(0.4, 0, 1, 1),
              transform 180ms cubic-bezier(0.4, 0, 1, 1),
              height 360ms cubic-bezier(0.4, 0, 0.2, 1) !important;
  opacity: 0 !important;
  transform: translateY(-4px) scale(0.98) !important;
}

html.i18n-fading-out [data-i18n-attr-placeholder]::placeholder {
  opacity: 0;
  transition: opacity 180ms cubic-bezier(0.4, 0, 1, 1);
}

html.i18n-fading-in [data-i18n],
html.i18n-fading-in [data-i18n-html] {
  transition: opacity 240ms cubic-bezier(0, 0, 0.2, 1) var(--i18n-delay, 0ms),
              transform 240ms cubic-bezier(0, 0, 0.2, 1) var(--i18n-delay, 0ms),
              height 360ms cubic-bezier(0.4, 0, 0.2, 1) !important;
  opacity: 1 !important;
  transform: translateY(0) scale(1) !important;
}

/* Hero elements need higher specificity due to fadeUp animation */
html.i18n-fading-in .hero [data-i18n],
html.i18n-fading-in .hero [data-i18n-html],
html.i18n-fading-in .hero .hero-headline-line,
html.i18n-fading-in .hero .hero-sub {
  transition: opacity 240ms cubic-bezier(0, 0, 0.2, 1) var(--i18n-delay, 0ms),
              transform 240ms cubic-bezier(0, 0, 0.2, 1) var(--i18n-delay, 0ms),
              height 360ms cubic-bezier(0.4, 0, 0.2, 1) !important;
  opacity: 1 !important;
  transform: translateY(0) scale(1) !important;
}

/* Elements that should NOT animate height (too unpredictable) */
html.i18n-fading-out [data-i18n].i18n-no-height,
html.i18n-fading-out [data-i18n-html].i18n-no-height,
html.i18n-fading-in [data-i18n].i18n-no-height,
html.i18n-fading-in [data-i18n-html].i18n-no-height {
  transition: opacity 180ms ease !important;
  height: auto !important;
}

/* Permanent state after first animation completes - prevents fadeUp from re-triggering */
.hero .hero-headline-line.i18n-animated,
.hero .hero-sub.i18n-animated {
  animation: none !important;
  opacity: 1 !important;
  transform: none !important;
}

html.i18n-fading-in [data-i18n-attr-placeholder]::placeholder {
  opacity: 1;
  transition: opacity 240ms cubic-bezier(0, 0, 0.2, 1) var(--i18n-delay, 0ms);
}

/* Marker class added by i18n-transition.js — anchors/buttons whose
   text got wrapped into a <span.i18n-wrap>. The anchor itself never
   animates, only the inner span does. Prevents the button chrome
   (background, border, box-shadow) from flickering on re-appear.  */
.i18n-wrap {
  display: inline-block;
  will-change: opacity, transform;
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  html.i18n-fading-out [data-i18n],
  html.i18n-fading-out [data-i18n-html],
  html.i18n-fading-in  [data-i18n],
  html.i18n-fading-in  [data-i18n-html] {
    transition: opacity 120ms linear !important;
    transform: none !important;
  }
}
