:root {
  /* Ajusta la altura real del nav si la cambias */
  --nav-h: 64px;
  --sidebar-w: 200px;
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden; /* bloquea scroll en body */
}

body {
  margin: 0;
  font-family: "Syne Mono", monospace;
  color: #111;

  /* Fondo base claro */
  background-color: #fdfdfd;

  /* Textura de ruido en bucle */
  background-image: url('img/goose2.gif');
  background-repeat: repeat;
  background-size: 100%; /* Ajusta el tamaño del tile según lo desees */
}

/* NAV FIJO */
.top-nav {
  height: var(--nav-h, 32px);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  flex-shrink: 0; /* no se achica */
  /* Fondo claro */
  /* Fondo con textura de ruido blanco */
  background-image: url('img/goose2.gif');
  background-repeat: repeat;
  background-size: 100%; /*Ajusta el tamaño del tile según lo desees */
  background-position: center;
}

.top-nav a {
  text-decoration: none;
  color: #2844cf;
}

.top-nav a:active, a:hover {
  filter: blur(0.8px); 
  color: #2844CF;
}

/* FRAME “FIJO” BAJO EL NAV */
.frame {
  flex-grow: 1;
  max-width: 1100px;
  margin: 0 auto 32px auto; /* margen inferior */
  min-height: 300px; /* por ejemplo, para que no colapse al achicar la ventana */
  background: #fff;
  border: 3px solid #000;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* En pantallas grandes: restamos márgenes */
@media (min-width: 1080px) {
  .frame {
    height: calc(100dvh - 100px); /* 32px arriba + 32px abajo */
    max-width: 1100px;
    margin: auto auto 64px auto; /* centrado vertical + horizontal */
  }
}

/* Asegura que los hijos puedan colapsar altura y permitir scroll interno */
.container,
.layout {
  height: 100%;
  min-height: 0; /* CRÍTICO para que el scroll interno funcione */
}

/* LAYOUT en 2 columnas: sidebar + main */
.layout {
  display: grid;
  grid-template-columns: auto 1fr;
}

/* SIDEBAR “FIJO” dentro del frame (no scrollea cuando scrollea el main) */
.sidebar {
  border-right: 1px solid #000;
  padding: 12px;
  overflow: auto;      /* si el contenido del sidebar es muy largo, podrá scrollear de forma independiente */
  width: auto;
}

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

.sidebar li {
  margin: 10px 0;
}

.sidebar a {
  text-decoration: none;
  color: #2844CF;
}

.sidebar a:active {
  font-weight: bold; 
}

/* MAIN con SCROLL INTERNO */
.main {
  /* Color de papel */
  background-color: #fffdf5;

  /* Líneas horizontales tipo hoja */
  background-image: 
    repeating-linear-gradient(
      to bottom,
      rgba(58, 95, 205, 0.2) 0px,   /* azul atenuado */
      rgba(58, 95, 205, 0.2) 2px,
      transparent 2px,
      transparent 24px
    ),
    /* Líneas verticales para cuadrícula ligera */
    repeating-linear-gradient(
      to right,
      #eee 0px,
      #eee 1px,
      transparent 1px,
      transparent 24px
    ),
    /* Margen rojo a la izquierda */
    linear-gradient(to right, red 2px, transparent 2px);

  /* Ajustes de tamaño y repetición */
  background-size: auto, 24px 24px, 100% 100%;
  background-repeat: repeat, repeat, no-repeat;
  background-position: 0 0, 0 0, 0 0;

  /* Espaciado interno */
  padding: 20px;

  /* Borde y sombra para efecto hoja */
  border: 1px solid #ccc;
  box-shadow: 2px 2px 8px rgba(0,0,0,0.1);

  /* Scroll */
  overflow-y: auto;   /* scroll vertical */
  overflow-x: visible; /* scroll horizontal de carruseles sigue funcionando */

  /* Flexibility para layout */
  flex: 1 1 auto;
  min-height: 0;

  /* Texto legible */
  color: #000;       /* aseguro que el texto sea negro */
}

.title {
  font-family: 'Nova Cut', cursive;
  font-size: 2rem;
  margin-bottom: 20px;
}

.section { margin-bottom: 40px; }

/* Scroll horizontal de carruseles */
.horizontal-scroll-container {
  display: flex;
  overflow-x: auto;
  gap: 10px;
  padding: 10px 0;
}
.horizontal-scroll-content { flex: 0 0 auto; }

.forced-size {
  width: 200px;
  height: auto;
}

/* Textura CRT con líneas, tilt y parpadeo */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9998;

  /* Líneas horizontales */
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0.12) 0px,
    rgba(0,0,0,0.12) 1px,
    transparent 1px,
    transparent 3px
  );

  transform: skewY(-0.3deg);
  mix-blend-mode: multiply;

  animation: crt-flicker 0.2s infinite;
}

/* Textura CRT con líneas, tilt, parpadeo y ruido estático más agresivo */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;

  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.25) 0px,
    rgba(0, 0, 0, 0.25) 2px,
    transparent 2px,
    transparent 4px
  );

  animation: flicker 0.08s infinite;
}

body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;

  /* Ruido estático más evidente: SVG baseFrequency más alto, mejor visibilidad */
  background-image: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'>\
<filter id='noise'><feTurbulence type='fractalNoise' baseFrequency='0.3' numOctaves='3' stitchTiles='stitch'/></filter>\
<rect width='100%' height='100%' filter='url(%23noise)'/></svg>");
  opacity: 0.89;
  mix-blend-mode: overlay;

  animation: staticNoise 0.15s steps(5) infinite;
}

h1 {
  font-size: 6rem;
  color: #1b1b1b;
  filter: blur(0.5px);
}

h2 {
  color: red;
  font-size: 1rem;
  filter: blur(0.3px);
}

.sticker {
  z-index: 998;
  position: absolute;
  right: 40px;
  top: 0;
  }

.warning {
  background: #2844CF;
  color: white;
  padding: 2px 20px;
  font-size: 0.7rem;
}


@keyframes flicker {
  0% { opacity: 1; }
  25% { opacity: 0.85; }
  50% { opacity: 1; }
  75% { opacity: 0.8; }
  100% { opacity: 1; }
}

@keyframes staticNoise {
  0%   { background-position: 0 0; }
  100% { background-position: 100% 100%; }
}

/* (Opcional) mejora del scroll */
html { scroll-behavior: smooth; }
