@import 'tokens.css';

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

html {
  scroll-behavior: smooth;
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  overflow-x: hidden;
  background-color: transparent; /* Membrana del micelio visible detrás */
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family);
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

h1 {
  font-size: clamp(2rem, 5vw, 4rem);
}

h2 {
  font-size: clamp(1.5rem, 4vw, 3rem);
}

p {
  font-weight: 300;
  color: var(--text-dim);
  margin-bottom: 1.5rem;
  max-width: 65ch;
}

a {
  color: inherit;
  text-decoration: none;
  transition: opacity var(--transition-expo-fast);
}

a:hover, a:focus {
  opacity: 0.8;
}

/* Accessibility: Focus visible */
:focus-visible {
  outline: 2px solid var(--blue-soft);
  outline-offset: 4px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- View Transitions API (native, no JS router needed) --- */
@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.5s;
  animation-timing-function: var(--transition-expo);
}

::view-transition-old(root) {
  animation-name: fade-out-scale;
}

::view-transition-new(root) {
  animation-name: fade-in-scale;
}

@keyframes fade-out-scale {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.98); }
}

@keyframes fade-in-scale {
  from { opacity: 0; transform: scale(1.02); }
  to { opacity: 1; transform: scale(1); }
}

/* Mycelium Membrane — capas de z-index */
#mycelium-membrane {
  view-transition-name: none;
  z-index: 0 !important;  /* Canvas visible sobre el fondo de html */
}

header, main, footer, nav {
  position: relative;
  z-index: 1; /* Contenido siempre encima del canvas */
}

