/* ==========================================================================
   Tema Y2K "cyber cromado + EVA"
   Se activa con "theme": "y2k" en config.json (añade la clase .theme-y2k al body).
   Cada efecto se puede apagar en "y2k": { "tint", "grid", "scanlines", "sparkles" }.
   ========================================================================== */

body.theme-y2k {
  --y2k-blue: #6ec8ff;
  --y2k-blue-glow: rgba(110, 200, 255, 0.55);
  --y2k-chrome: linear-gradient(180deg,
    #ffffff 0%, #e4ebf2 22%, #a9b6c3 44%, #5d6875 50%, #8996a3 56%, #d7e0e9 78%, #ffffff 100%);
  --y2k-shine: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, 0.95) 50%, transparent 62%);
}

/* Efectos: ocultos fuera del tema */
#fx-tint, #fx-grid, #fx-scanlines, #fx-sparkles { display: none; pointer-events: none; }

/* ---------- Video de fondo: tinte azul eléctrico ---------- */
body.theme-y2k #bg-video { filter: saturate(0.7) contrast(1.1) brightness(0.92); }
body.theme-y2k.fx-tint #fx-tint {
  display: block;
  background:
    radial-gradient(ellipse at 75% 30%, rgba(90, 170, 255, 0.35), transparent 60%),
    linear-gradient(160deg, rgba(30, 80, 255, 0.35), rgba(255, 40, 160, 0.12));
  mix-blend-mode: soft-light;
}

/* ---------- Rejilla 3D en perspectiva ---------- */
body.theme-y2k.fx-grid #fx-grid {
  display: block;
  position: fixed;
  left: -50%;
  right: -50%;
  bottom: 0;
  height: 60vh;
  transform-origin: 50% 100%;
  transform: perspective(100vh) rotateX(55deg); /* suelo que ocupa ~1/4 inferior de la pantalla */
  background-image:
    linear-gradient(var(--y2k-blue-glow) 2px, transparent 2px),
    linear-gradient(90deg, var(--y2k-blue-glow) 2px, transparent 2px);
  background-size: 90px 90px;
  -webkit-mask-image: linear-gradient(to top, #000 0%, rgba(0, 0, 0, 0.5) 45%, transparent 95%);
  mask-image: linear-gradient(to top, #000 0%, rgba(0, 0, 0, 0.5) 45%, transparent 95%);
  filter: drop-shadow(0 0 6px var(--y2k-blue-glow));
  animation: y2k-grid 2.6s linear infinite;
}
@keyframes y2k-grid { to { background-position: 0 90px, 0 90px; } }

/* ---------- Destellos ---------- */
body.theme-y2k.fx-sparkles #fx-sparkles { display: block; }
.sparkle {
  position: absolute;
  color: #fff;
  line-height: 1;
  text-shadow: 0 0 8px #fff, 0 0 18px var(--y2k-blue);
  opacity: 0;
  animation: y2k-twinkle var(--dur, 3.4s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}
@keyframes y2k-twinkle {
  0%, 100% { opacity: 0; transform: scale(0.4) rotate(0deg); }
  30%, 70% { opacity: 1; transform: scale(1) rotate(45deg); }
}

/* ---------- Líneas CRT y grano (por encima del menú y la galería, por debajo del visor) ---------- */
body.theme-y2k.fx-scanlines #fx-scanlines {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 25;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 3px);
  animation: y2k-flicker 6s steps(1) infinite;
}
body.theme-y2k.fx-scanlines #fx-scanlines::after {
  content: "";
  position: absolute;
  inset: -50%;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: y2k-grain 0.6s steps(3) infinite;
}
@keyframes y2k-flicker { 0%, 100% { opacity: 1; } 50% { opacity: 0.85; } 52% { opacity: 1; } }
@keyframes y2k-grain {
  0% { transform: translate(0, 0); }
  33% { transform: translate(-6%, 4%); }
  66% { transform: translate(5%, -7%); }
}

/* ---------- Título: wordmark cromado ---------- */
.chrome-img-wrap { display: block; filter: drop-shadow(0 0 10px var(--y2k-blue-glow)) drop-shadow(0 3px 6px rgba(0, 0, 0, 0.6)); }
.chrome-img {
  display: block;
  background: var(--y2k-shine), var(--y2k-chrome);
  background-size: 300% 100%, 100% 100%;
  background-position: 120% 0, 0 0;
  -webkit-mask: var(--src) center / contain no-repeat;
  mask: var(--src) center / contain no-repeat;
  animation: y2k-sweep 5s ease-in-out infinite;
}
@keyframes y2k-sweep {
  0%, 55% { background-position: 120% 0, 0 0; }
  85%, 100% { background-position: -20% 0, 0 0; }
}
body.theme-y2k #title img { filter: drop-shadow(0 0 10px var(--y2k-blue-glow)) drop-shadow(0 3px 6px rgba(0, 0, 0, 0.6)); }

/* ---------- Botón seleccionado: barra cromada con reflejo ---------- */
body.theme-y2k .menu-btn::before {
  background: var(--y2k-shine), var(--y2k-chrome);
  background-size: 260% 100%, 100% 100%;
  background-position: 130% 0, 0 0;
  opacity: 0.88;
  border-top: 1px solid rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(40, 50, 60, 0.8);
  box-shadow: 0 0 18px var(--y2k-blue-glow);
  -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 72%, transparent 100%);
  mask-image: linear-gradient(90deg, #000 0%, #000 72%, transparent 100%);
}
body.theme-y2k .menu-btn.selected::before { animation: y2k-bar-sweep 2.8s ease-in-out infinite; }
@keyframes y2k-bar-sweep {
  0%, 40% { background-position: 130% 0, 0 0; }
  80%, 100% { background-position: -30% 0, 0 0; }
}
body.theme-y2k .menu-btn::after { box-shadow: 0 0 10px var(--accent); }
/* Letras EVA sobre el cromo: sombra más marcada para que se separen del metal */
body.theme-y2k .glyph-btn.selected .glyph img { filter: drop-shadow(0 0.05em 0.05em rgba(0, 0, 0, 0.7)); }
body.theme-y2k .glyph-btn .glyph-word { filter: brightness(0.7) saturate(0.6) drop-shadow(0 0 6px rgba(110, 200, 255, 0.25)); }
body.theme-y2k .glyph-btn.selected .glyph-word { filter: none; }

/* ---------- Textos cromados ---------- */
body.theme-y2k #gallery-title,
body.theme-y2k #showcase-title,
body.theme-y2k .panel h2,
body.theme-y2k #title .title-text {
  background: var(--y2k-chrome);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 0.06em;
  filter: drop-shadow(0 0 8px var(--y2k-blue-glow));
}
body.theme-y2k .panel h2::after { background: linear-gradient(90deg, var(--y2k-blue), var(--accent)); }
body.theme-y2k #breadcrumb,
body.theme-y2k #gallery-crumbs { color: var(--y2k-blue); text-shadow: 0 0 8px var(--y2k-blue-glow); }

/* ---------- Pie con atajos: estilo pantalla LCD ---------- */
body.theme-y2k #hints { font-family: Menlo, Monaco, monospace; color: var(--y2k-blue); opacity: 0.75; text-shadow: 0 0 6px var(--y2k-blue-glow); }
body.theme-y2k kbd { border-color: var(--y2k-blue); background: rgba(110, 200, 255, 0.08); }

/* ---------- Ventanas: galería, colección, paneles ---------- */
body.theme-y2k #gallery,
body.theme-y2k #showcase { background: linear-gradient(180deg, rgba(8, 14, 30, 0.86), rgba(4, 6, 12, 0.9)); }
body.theme-y2k #gallery-header,
body.theme-y2k #showcase-header { border-bottom: 1px solid transparent; border-image: linear-gradient(90deg, transparent, var(--y2k-blue), #fff, var(--y2k-blue), transparent) 1; }
body.theme-y2k .icon-btn { border-color: var(--y2k-blue); box-shadow: 0 0 10px var(--y2k-blue-glow); }
body.theme-y2k .tile.selected { outline-color: var(--y2k-blue); box-shadow: 0 0 24px var(--y2k-blue-glow); }
body.theme-y2k .panel { border-left: 2px solid transparent; border-image: linear-gradient(180deg, transparent, var(--y2k-blue), #fff, var(--y2k-blue), transparent) 1; }

/* ---------- Carpetas: icono translúcido y brillante (estilo Aqua) ---------- */
body.theme-y2k .tile.folder { background: linear-gradient(160deg, rgba(110, 200, 255, 0.10), rgba(255, 255, 255, 0.02)); }
body.theme-y2k .tile.folder .folder-icon { inset: 0 0 30px 0; }
body.theme-y2k .tile.folder .folder-icon::before {
  width: 48%;
  height: 72%;
  border: 0;
  border-radius: 0;
  clip-path: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 52'%3E%3Cdefs%3E%3ClinearGradient id='b' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23cdeeff'/%3E%3Cstop offset='1' stop-color='%233a92e6'/%3E%3C/linearGradient%3E%3ClinearGradient id='f' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23eef9ff' stop-opacity='.95'/%3E%3Cstop offset='.5' stop-color='%2386caff' stop-opacity='.9'/%3E%3Cstop offset='1' stop-color='%231d6ad0' stop-opacity='.95'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M4 9q0-4 4-4h15l5 5h28q4 0 4 4v32H4z' fill='url%28%23b%29' stroke='%232a6fc0' stroke-width='1'/%3E%3Crect x='2' y='16' width='60' height='34' rx='5' fill='url%28%23f%29' stroke='%230f4f9e' stroke-width='1.2'/%3E%3Crect x='5' y='18' width='54' height='13' rx='5' fill='%23fff' opacity='.55'/%3E%3Cellipse cx='32' cy='46' rx='22' ry='2' fill='%23fff' opacity='.35'/%3E%3C/svg%3E") center / contain no-repeat;
  filter: drop-shadow(0 6px 12px rgba(30, 110, 220, 0.45));
}
body.theme-y2k .tile.folder .label {
  text-align: center;
  background: var(--y2k-chrome);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 0.08em;
}
body.theme-y2k .tile.folder.selected .folder-icon::before { filter: drop-shadow(0 0 16px var(--y2k-blue)) brightness(1.15); }
