/* ============================================
   10 RAZONES - Doble interruptor
   Maestro: activa titulos | Por razon: activa contenido
   ============================================ */

:root {
  --bg: #030306;
  --bg-panel: #0a0a0f;
  --border: rgba(0, 229, 255, 0.15);
  --border-active: rgba(0, 229, 255, 0.5);
  --text: #e8eef2;
  --text-muted: #7a8490;
  --accent: #00e5ff;
  --accent-dim: rgba(0, 229, 255, 0.4);
  --glow: rgba(0, 229, 255, 0.25);
  --font-mono: 'IBM Plex Mono', monospace;
  --font-sans: 'IBM Plex Sans', sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 229, 255, 0.4) var(--bg-panel);
}

/* Scrollbar global (donde aparezca el scroll principal) */
html::-webkit-scrollbar {
  width: 12px;
}
html::-webkit-scrollbar-track {
  background: var(--bg-panel);
}
html::-webkit-scrollbar-thumb {
  background: rgba(0, 229, 255, 0.3);
  border-radius: 6px;
  border: 3px solid var(--bg-panel);
}
html::-webkit-scrollbar-thumb:hover {
  background: var(--accent-dim);
}
html::-webkit-scrollbar-thumb:active {
  background: var(--accent);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: clamp(0.9375rem, 1.8vw, 1.0625rem);
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

/* Fondo tecnologico (canvas) - detras de todo el sitio */
.site-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.site-bg canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Piezas flotantes (caballo/peon) en el fondo */
.site-bg__pieces {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.site-bg__piece {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
}
.site-bg__piece svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* --------------------------------------------
   BOOT - Interruptor maestro (activa titulos)
   -------------------------------------------- */
.boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  transition: opacity 0.7s var(--ease), visibility 0.7s var(--ease);
}

.boot.is-off {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot__bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 40%, rgba(0, 229, 255, 0.04) 0%, transparent 60%);
  pointer-events: none;
}

.boot__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 229, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 229, 255, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse 70% 50% at 50% 50%, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 70% 50% at 50% 50%, black 20%, transparent 70%);
  pointer-events: none;
}

/* Logo portada: enlace a Garri Pacheco */
.boot__logo {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(10, 10, 15, 0.6);
  transition: border-color 0.4s var(--ease), box-shadow 0.4s var(--ease), transform 0.3s var(--ease);
}

.boot__logo:hover {
  border-color: var(--accent-dim);
  box-shadow: 0 0 24px var(--glow), 0 0 48px rgba(0, 229, 255, 0.12);
  transform: scale(1.05);
}

.boot__logo:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}

.boot__logo img {
  display: block;
  width: 56px;
  height: 56px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(0, 229, 255, 0.2));
  transition: filter 0.3s var(--ease);
}

.boot__logo:hover img {
  filter: drop-shadow(0 0 16px var(--glow));
}

@media (min-width: 600px) {
  .boot__logo { top: 2rem; left: 2rem; padding: 0.6rem; }
  .boot__logo img { width: 64px; height: 64px; }
}

.boot__content {
  position: relative;
  text-align: center;
  max-width: 420px;
}

.boot__title {
  font-family: var(--font-sans);
  font-size: clamp(2.25rem, 8vw, 3.5rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 0.75rem;
}

.boot__sub {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0 0 2.5rem;
}

/* Interruptor maestro */
.boot__switch {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  transition: color 0.3s var(--ease);
  touch-action: manipulation;
}

.boot__switch:hover {
  color: var(--accent);
}

.boot__switch[aria-pressed="true"] {
  color: var(--accent);
}

.boot__switch-track {
  display: flex;
  align-items: center;
  width: 64px;
  height: 32px;
  padding: 4px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: border-color 0.4s var(--ease), box-shadow 0.4s var(--ease);
}

.boot__switch:hover .boot__switch-track {
  border-color: var(--accent-dim);
  box-shadow: 0 0 24px var(--glow);
}

.boot__switch-thumb {
  width: 22px;
  height: 22px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform 0.4s var(--ease), background 0.4s var(--ease), box-shadow 0.4s var(--ease);
}

.boot__switch[aria-pressed="true"] .boot__switch-thumb {
  transform: translateX(32px);
  background: var(--accent);
  box-shadow: 0 0 20px var(--accent), 0 0 40px var(--glow);
}

.boot__switch[aria-pressed="true"] .boot__switch-track {
  border-color: var(--accent);
  box-shadow: 0 0 30px var(--glow);
}

.boot__switch-label {
  letter-spacing: 0.25em;
}

.quest-cta {
  --quest-accent: #6fffd7;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text);
  text-decoration: none;
  border: 1px solid rgba(111, 255, 215, 0.35);
  background:
    linear-gradient(135deg, rgba(111, 255, 215, 0.16), rgba(0, 229, 255, 0.08)),
    rgba(10, 10, 15, 0.68);
  box-shadow: 0 0 0 1px rgba(111, 255, 215, 0.06), 0 18px 40px rgba(0, 0, 0, 0.35);
  transition: transform 0.28s var(--ease), border-color 0.28s var(--ease), box-shadow 0.28s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.quest-cta:hover,
.quest-cta:focus-visible {
  border-color: rgba(111, 255, 215, 0.72);
  box-shadow: 0 0 28px rgba(111, 255, 215, 0.22), 0 22px 46px rgba(0, 0, 0, 0.42);
  transform: translateY(-1px);
  outline: none;
}

.quest-cta__icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 13px;
  color: #03100d;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: linear-gradient(135deg, #69f5be, #00e5ff);
  box-shadow: 0 0 24px rgba(111, 255, 215, 0.28);
}

.quest-cta__copy {
  display: grid;
  gap: 0.08rem;
  min-width: 0;
  text-align: left;
}

.quest-cta__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--quest-accent);
}

.quest-cta__main {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.15;
}

/* --------------------------------------------
   APP - Lista de razones (titulo + switch por razon)
   -------------------------------------------- */
.app {
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: opacity 0.5s var(--ease);
}

.app.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.app-header {
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 1rem 1.5rem;
  min-height: 5.5rem;
  background: rgba(3, 3, 6, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.app-header__inner {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.app-header__tag {
  order: 1;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
}

.app-header__home {
  position: absolute;
  top: 0.75rem;
  left: 1.5rem;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(10, 10, 15, 0.6);
  text-decoration: none;
  transition: border-color 0.4s var(--ease), box-shadow 0.4s var(--ease), transform 0.3s var(--ease);
}

.app-header__home:hover,
.app-header__home:focus-visible {
  border-color: var(--accent-dim);
  box-shadow: 0 0 24px var(--glow), 0 0 48px rgba(0, 229, 255, 0.12);
  transform: scale(1.05);
}

.app-header__home:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}

.app-header__home-logo {
  display: block;
  width: 56px;
  height: 56px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(0, 229, 255, 0.2));
  transition: filter 0.3s var(--ease);
}

.app-header__home:hover .app-header__home-logo {
  filter: drop-shadow(0 0 16px var(--glow));
}

.app-header__quest-link,
.quest-cta--header {
  order: 3;
  flex: 0 1 auto;
  padding: 0.42rem 0.62rem;
  border-radius: 999px;
}

.quest-cta--header .quest-cta__icon {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  font-size: 0.65rem;
}

.quest-cta--header .quest-cta__eyebrow {
  font-size: 0.56rem;
  letter-spacing: 0.14em;
}

.quest-cta--header .quest-cta__main {
  font-size: 0.82rem;
}

/* Interruptor "Volver al inicio" */
.app-header__switch {
  order: 4;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color 0.3s var(--ease);
}

.app-header__switch:hover {
  color: var(--accent);
}

.app-header__switch-track {
  display: flex;
  align-items: center;
  width: 40px;
  height: 22px;
  padding: 3px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.app-header__switch:hover .app-header__switch-track {
  border-color: var(--accent-dim);
}

.app-header__switch-thumb {
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent);
  transition: transform 0.35s var(--ease), background 0.35s var(--ease);
}

.app-header__switch[aria-pressed="false"] .app-header__switch-thumb {
  transform: translateX(0);
  background: var(--text-muted);
  box-shadow: none;
}

.app-header__switch[aria-pressed="true"] .app-header__switch-thumb {
  transform: translateX(18px);
}

.app-header__switch-label {
  letter-spacing: 0.1em;
}

.app-header__hint {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  max-width: 800px;
  margin: 0.85rem auto 0;
  padding: 0 1.5rem;
  text-align: center;
  width: min(100%, 800px);
}

.app-main {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem 2rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 229, 255, 0.4) var(--bg-panel);
}

/* Scrollbar a tono con la pagina (WebKit) */
.app-main::-webkit-scrollbar {
  width: 10px;
}
.app-main::-webkit-scrollbar-track {
  background: var(--bg-panel);
  border-radius: 5px;
  margin: 4px 0;
}
.app-main::-webkit-scrollbar-thumb {
  background: rgba(0, 229, 255, 0.25);
  border-radius: 5px;
  border: 2px solid var(--bg-panel);
}
.app-main::-webkit-scrollbar-thumb:hover {
  background: var(--accent-dim);
}
.app-main::-webkit-scrollbar-thumb:active {
  background: var(--accent);
}

.reason-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.reason {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 1rem;
  overflow: hidden;
  background: rgba(10, 10, 15, 0.5);
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.reason.is-open {
  border-color: rgba(0, 229, 255, 0.3);
  box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.2), 0 0 40px var(--glow);
}

.reason__head {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem 1.25rem 1rem;
  min-height: 3.5rem;
}

.reason__num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--accent);
  flex-shrink: 0;
  padding-top: 0.15rem;
}

.reason__title {
  font-family: var(--font-sans);
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  margin: 0;
  flex: 1;
  letter-spacing: -0.01em;
}

/* Interruptor por razon (contenido) */
.reason__switch {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  margin: -4px -4px -4px 0;
  border-radius: 6px;
  transition: background 0.2s var(--ease);
}

.reason__switch:hover {
  background: rgba(0, 229, 255, 0.08);
}

.reason__switch-track {
  display: flex;
  align-items: center;
  width: 44px;
  height: 24px;
  padding: 3px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.reason__switch:hover .reason__switch-track {
  border-color: var(--accent-dim);
}

.reason__switch-thumb {
  width: 16px;
  height: 16px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform 0.35s var(--ease), background 0.35s var(--ease), box-shadow 0.35s var(--ease);
}

.reason__switch[aria-pressed="true"] .reason__switch-thumb {
  transform: translateX(20px);
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

.reason__switch[aria-pressed="true"] .reason__switch-track {
  border-color: var(--accent);
}

/* Contenido desplegable */
.reason__content {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.5s var(--ease-out), opacity 0.4s var(--ease);
}

.reason__content.is-visible {
  max-height: 1200px;
  opacity: 1;
}

.reason__content p {
  margin: 0;
  padding: 1rem 1.25rem 1.25rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.75;
}

/* Footer - fijo al pie de la vista; la lista crece sin empujarlo */
.app-footer {
  flex-shrink: 0;
  padding: 1.5rem 1.5rem 2rem;
  border-top: 1px solid var(--border);
  background: rgba(3, 3, 6, 0.85);
  backdrop-filter: blur(8px);
}
.app-footer .app-footer__frame {
  max-width: 800px;
  margin: 0 auto;
}

.app-footer__frame {
  text-align: center;
  padding: 2rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(10, 10, 15, 0.6);
}

.app-footer__title {
  font-family: var(--font-sans);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.5rem;
}

.app-footer__text {
  color: var(--text-muted);
  margin: 0 0 1.5rem;
  font-size: 0.9375rem;
}

.app-footer__btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--accent);
  padding: 0.875rem 1.5rem;
  border-radius: 6px;
  text-decoration: none;
  transition: box-shadow 0.3s var(--ease), transform 0.3s var(--ease);
}

.app-footer__btn:hover {
  box-shadow: 0 0 30px var(--glow), 0 0 60px rgba(0, 229, 255, 0.15);
  transform: translateY(-1px);
}

/* --------------------------------------------
   Lang switcher ES/EN - sliding pill, tech style
   -------------------------------------------- */
.lang-switcher {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  min-width: 120px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(10, 10, 15, 0.7);
  padding: 3px;
  margin-bottom: 1.25rem;
  box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.06), 0 4px 16px rgba(0, 0, 0, 0.3);
}

.lang-switcher__pill {
  position: absolute;
  left: 3px;
  top: 3px;
  bottom: 3px;
  width: calc(50% - 3px);
  border-radius: 8px;
  background: rgba(0, 229, 255, 0.15);
  box-shadow: 0 0 16px var(--glow), inset 0 0 0 1px rgba(0, 229, 255, 0.2);
  transition: transform 0.35s var(--ease);
  pointer-events: none;
  z-index: 0;
}

.lang-switcher[data-lang="en"] .lang-switcher__pill {
  transform: translateX(100%);
}

.lang-switcher__option {
  flex: 1;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.lang-switcher__option:hover {
  color: var(--text);
}

.lang-switcher__option[aria-pressed="true"] {
  color: var(--accent);
  text-shadow: 0 0 20px rgba(0, 229, 255, 0.4);
}

.lang-switcher__option:focus {
  outline: none;
}

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

/* Switcher in app header: smaller, no bottom margin */
.app-header__inner .lang-switcher {
  order: 5;
  margin-bottom: 0;
  margin-left: auto;
  min-width: 100px;
  height: 36px;
}

.app-header__inner .lang-switcher__option {
  font-size: 0.75rem;
}

/* --------------------------------------------
   Responsive
   -------------------------------------------- */
@media (max-width: 600px) {
  .boot__title { font-size: 1.875rem; }
  .app-header {
    min-height: 0;
    padding: 0.75rem 1rem 1rem;
  }
  .app-header__inner {
    max-width: none;
    margin: 0;
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 0.5rem;
    align-items: center;
    padding-top: 0;
  }
  .app-header__tag {
    grid-column: 2;
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    text-align: right;
  }
  .app-header__inner:has(.lang-switcher) .app-header__tag {
    grid-column: 2;
    min-height: 0;
    justify-content: flex-end;
    text-align: right;
  }
  .app-header__home {
    top: 0.75rem;
    left: 1rem;
    padding: 0.45rem;
  }
  .app-header__home-logo {
    width: 48px;
    height: 48px;
  }
  .app-header__quest-link,
  .quest-cta--header {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: center;
  }
  .app-header__switch {
    grid-column: 1 / -1;
    justify-content: center;
  }
  .app-header__hint {
    margin-top: 0.85rem;
    padding: 0 0.25rem;
    line-height: 1.55;
  }
  .app-header__inner .lang-switcher {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    align-self: center;
    margin-left: 0;
  }
  .reason__head {
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  .reason__title { min-width: 0; }
  .reason__switch { margin-left: auto; }
}

@media (min-width: 600px) {
  .app-header__home {
    top: 0.9rem;
    left: 2rem;
    padding: 0.6rem;
  }
  .app-header__home-logo {
    width: 64px;
    height: 64px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .boot, .reason__content, .reason__switch-thumb {
    transition-duration: 0.01ms !important;
  }
  .reason__content.is-visible { max-height: none; }
}
