/* =========================================
   Daikibo★Uchuu Oficial — Neo‐Retro‐Medieval
   ========================================= */

/* 1. Variables & Fuentes */
:root {
  --bg: #0a0a0a;
  --fg: #e0e0e0;
  --accent: #ff66cc;
  --glitch-r: rgba(255,102,204,0.7);
  --glitch-b: rgba(0,255,255,0.7);
  --border: #444;

  /* Ahora todo en serif para coherencia */
  --font-body: 'Noto Serif JP', serif;
  --font-title: 'Noto Serif JP', serif;

  --spacing: 1rem;
}

/* 2. Reset & Base */
* { margin:0; padding:0; box-sizing:border-box; }
body {
  background-image: var(--bg-image);
  background-size: cover;              /* Que llene la pantalla */
  background-position: center center;  /* Centrado */
  background-repeat: no-repeat;        /* Que no se repita */
  
  color: var(--fg);
  font-family: var(--font-body);
  line-height: 1.5;
  padding: var(--spacing);
  position: relative;
}
a { color: var(--accent); text-decoration:none; }
a:hover { text-decoration: underline; }

html, body {
  height: 100%;
  min-height: 100vh;
}

/* 3. Glitch Keyframes */
@keyframes glitch {
  0%   { text-shadow: 2px 0 var(--glitch-r), -2px 0 var(--glitch-b); }
  20%  { text-shadow:-2px 2px var(--glitch-r), 2px -2px var(--glitch-b); }
  40%  { text-shadow:2px -2px var(--glitch-r), -2px 2px var(--glitch-b); }
  60%  { text-shadow:-2px -2px var(--glitch-r), 2px 2px var(--glitch-b); }
  80%  { text-shadow:2px 2px var(--glitch-r), -2px -2px var(--glitch-b); }
  100% { text-shadow: 2px 0 var(--glitch-r), -2px 0 var(--glitch-b); }
}

/* 4. Header */
.site-header {
  text-align: center;
  margin-bottom: var(--spacing);
}
.site-title {
  font-family: var(--font-title);
  font-size: clamp(2rem, 6vw, 3.5rem);
  color: var(--accent);
  animation: glitch 2s infinite;
  margin-bottom: 0.5rem;
}

/* 5. Navegación */
.site-nav {
  display: flex;
  justify-content: center;
  gap: var(--spacing);
  margin-bottom: var(--spacing);
}
.site-nav a {
  font-size: 0.9rem;
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.site-nav a:hover {
  border-color: var(--accent);
}

/* 6. Contenedor principal */
.window {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--spacing);
}

/* 7. Paneles estilo “ventana antigua” con toque medieval */
.panel {
  background: #111;
  border: 3px double var(--border);
  padding: var(--spacing);
  margin-bottom: var(--spacing);
  box-shadow: inset 0 0 6px rgba(0,0,0,0.8), 0 0 8px rgba(0,0,0,0.7);
  position: relative;
}
.panel-title {
  font-family: var(--font-title);
  font-size: 1.25rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
  text-align: center;
}
.panel-title::before,
.panel-title::after {
  content: "❦";
  margin: 0 0.3rem;
  color: var(--fg);
  font-size: 0.9rem;
}

/* 8. Anuncios */
.announcement {
  border-bottom: 1px dashed var(--border);
  padding: 0.5rem 0;
}
.announcement h3 {
  font-weight: bold;
  margin-bottom: 0.25rem;
}
.announcement time {
  display: block;
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 0.5rem;
}

/* 9. Botones de Plataforma */
.platform-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--spacing);
}
.platform-buttons a {
  padding: 0.5rem 1rem;
  background: #222;
  border: 2px solid var(--accent);
  border-radius: 0.3rem;
  transition: background .2s, color .2s;
}
.platform-buttons a:hover {
  background: var(--accent);
  color: var(--bg);
}

/* 10. Footer */
.site-footer {
  text-align: center;
  margin-top: var(--spacing);
  font-size: 0.8rem;
  color: #777;
}
/* ── Breadcrumb ───────────────────────────────────────── */
.breadcrumb {
  font-size: 0.85rem;
  color: #aaa;
  margin-bottom: 0.5rem;
}
.breadcrumb a {
  color: var(--accent);
}
.breadcrumb span {
  color: var(--fg);
}

/* ── Fecha del post ───────────────────────────────────── */
.post-date {
  display: block;
  font-size: 0.85rem;
  color: #aaa;
  margin-bottom: var(--spacing);
}

/* ── Enlace de vuelta ─────────────────────────────────── */
.back-link {
  display: inline-block;
  margin-top: var(--spacing);
  color: var(--accent);
  text-decoration: none;
  font-weight: bold;
}
.back-link:hover {
  text-decoration: underline;
}

/* ── Opcional: Capítulo inicial elegante ───────────────── */
.post-detail .body p:first-of-type::first-letter {
  font-size: 2rem;
  font-weight: bold;
  color: var(--accent);
  float: left;
  margin: 0 0.5rem 0.2rem 0;
}

/* 🌑 Fondo negro con halo tenue y pulso suave */
.glitch-bg {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background-color: #000;
  background-image: 
    radial-gradient(
      circle at center,
      rgba(255,255,255,0.03) 0%,
      transparent 60%
    );
  background-repeat: no-repeat;
  background-attachment: fixed;
  z-index: -3;
  pointer-events: none;

  /* Pulso muy suave para dar vida */
  animation: bgPulse 8s ease-in-out infinite;
}

/* Pulso de brillo */
@keyframes bgPulse {
  0%, 100% {
    filter: brightness(0.92);
  }
  50% {
    filter: brightness(1.05);
  }
}
/* ── 1) Contenedor─────── */
.rose-container {
  position: fixed;
  bottom: 35vh;      /* baja todo el sprite 150px */
  left: 50%;
  transform: translateX(-50%);
  width: 80vw;
  max-width: 700px;
  height: 700px;       /* muestra solo los 300px superiores */
  pointer-events: none;
  z-index: -2;
}
/* ── Sprite glitched sin contenedor ────────────────────────────── */
.rose-sprite {
  position: fixed;
  bottom: 0;
  left: 50%;
  width: 80vw;
  max-width: 700px;

  /* Altura = proporción 2:3 → 1.5 veces el ancho */
  height: calc(80vw * 1.5);

  /* Mueve la rosa mitad de su propia altura hacia abajo */
  transform: translate(-50%, 50%);

  /* Imagen de fondo */
  background: url('/assets/rose.png') center bottom / contain no-repeat;
  pointer-events: none;
  opacity: 0.95;
  z-index: -2;
}

/* ── Pseudo-capas para glitch ───────────────────────────────── */
.rose-sprite::before,
.rose-sprite::after {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: inherit;
  mix-blend-mode: screen;
  opacity: 0.8;
}

/* Mitad superior glitch */
.rose-sprite::before {
  clip-path: inset(0 0 50% 0);
  animation: glitchTop    2s infinite step-start,
             hueShift     3s infinite linear;
}

/* Mitad inferior glitch */
.rose-sprite::after {
  clip-path: inset(50% 0 0 0);
  animation: glitchBottom 1.7s infinite step-start reverse,
             hueShift      4s infinite linear reverse;
}

/* ── Keyframes glitch sprite ──────────────────────────────────── */
@keyframes glitchTop {
  0%   { transform: translate(-2px,-2px) skew(-1deg); }
  20%  { transform: translate(3px,1px)   skew(2deg); }
  40%  { transform: translate(-1px,2px)  skew(-1.5deg); }
  60%  { transform: translate(2px,-3px)  skew(1deg); }
  80%  { transform: translate(-3px,0)    skew(-2deg); }
 100%  { transform: translate(0,0)       skew(0deg); }
}
@keyframes glitchBottom {
  0%   { transform: translate(2px,2px)   skew(1deg); }
 25%   { transform: translate(-3px,-1px) skew(-2deg); }
 50%   { transform: translate(1px,3px)   skew(1.5deg); }
 75%   { transform: translate(-2px,-2px) skew(-1deg); }
100%   { transform: translate(0,0)       skew(0deg); }
}
@keyframes hueShift {
  0%   { filter: hue-rotate(0deg); }
 25%  { filter: hue-rotate(10deg); }
 50%  { filter: hue-rotate(-10deg); }
 75%  { filter: hue-rotate(8deg); }
100%  { filter: hue-rotate(0deg); }
}

/* ============================================================
   Overlay CRT + oscurecimiento total (un solo pseudo-elemento)
   ============================================================ */
html::before {
  content: "";
  position: fixed;
  inset: 0;              /* cubre toda la pantalla, siempre */
  z-index: 9999;
  pointer-events: none;

  /* 1) Capa oscura TOTAL */
  background:
    rgba(0, 0, 0, 0.4),
    /* 2) Ruido denso (tile pequeño) */
    url('/assets/noise.png') repeat,
    /* 3) Scanlines gruesas */
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 3px,
      rgba(0,0,0,0.25) 4px,
      rgba(0,0,0,0.25) 7px
    ),
    /* 4) Viñeta oscura en bordes */
    radial-gradient(circle at center, transparent 60%, rgba(0,0,0,0.8) 100%);
  background-size:
    auto,        /* para rgba layer no aplica */
    30px 30px,   /* ruido denso */
    auto,        /* scanlines según definición */
    cover;       /* viñeta cubre todo */

  mix-blend-mode: overlay;
  opacity: 0.7;

  animation:
    tvStatic 0.1s steps(1) infinite,
    tvFlicker 0.15s infinite;
}

/* Si habías aplicado filtro en body, quítalo: */
/*
body {
  filter: none;
}
*/

/* ── Animaciones ─────────────────────────────────────────────── */
@keyframes tvStatic {
  0%   { background-position: 0 0, 0 0, 0 0, 0 0; }
  25%  { background-position: 0 0, 10px 10px, 0 0, 0 0; }
  50%  { background-position: 0 0, 20px 5px, 0 0, 0 0; }
  75%  { background-position: 0 0, 5px 20px, 0 0, 0 0; }
  100% { background-position: 0 0, 0 0, 0 0, 0 0; }
}

@keyframes tvFlicker {
  0%   { opacity: 0.8; }
  50%  { opacity: 0.5; }
  100% { opacity: 0.7; }
}
