/**
 * Periódico Vanguardia – Hoja de estilos
 * Paleta: azul marino oscuro + celeste, tipografía del sistema, responsive.
 * Cubre: index.htm  y  visor.php
 */

/* ==========================================================
   RESET & BASE
   ========================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont,
                 "Helvetica Neue", Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: #e8ecf1;
    background: linear-gradient(135deg, #0a1628 0%, #1a2a4a 50%, #0f1d35 100%);
    background-attachment: fixed;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color .2s ease, background-color .2s ease,
                transform .3s ease, box-shadow .3s ease;
}

img { max-width: 100%; height: auto; }

/* ==========================================================
   PATRÓN GEOMÉTRICO DE FONDO
   ========================================================== */
.bg-pattern {
    position: fixed; inset: 0;
    opacity: .03; pointer-events: none; z-index: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* ==========================================================
   HERO  (index)
   ========================================================== */
.hero {
    position: relative; z-index: 1;
    padding: 3rem 1.5rem 2.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(100,149,237,.12);
}
.hero-inner { max-width: 820px; margin: 0 auto; }

.hero-badge {
    display: inline-flex; align-items: center; gap: .5rem;
    background: rgba(42,90,138,.25);
    border: 1px solid rgba(100,149,237,.2);
    border-radius: 20px; padding: .4rem 1rem;
    font-size: .8rem; color: #87CEEB;
    margin-bottom: 1.4rem; letter-spacing: .03em;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 700; letter-spacing: -.02em;
    margin: 0 0 .35rem;
    background: linear-gradient(90deg, #e8ecf1 0%, #87CEEB 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: clamp(.95rem, 2vw, 1.15rem);
    color: #87CEEB; margin: 0 0 1.8rem;
    font-weight: 400; letter-spacing: .05em; text-transform: uppercase;
}

.hero-story {
    max-width: 660px; margin: 0 auto 2rem; text-align: left;
    background: rgba(15,30,55,.6);
    border: 1px solid rgba(100,149,237,.1);
    border-radius: 12px; padding: 1.5rem 2rem;
}
.hero-story p {
    font-size: .95rem; color: #a0b4cc;
    line-height: 1.8; margin-bottom: .8rem;
}
.hero-story p:last-child { margin-bottom: 0; }
.hero-story strong { color: #87CEEB; font-weight: 600; }

/* Herramientas (Olivetti + Mimeógrafo) */
.hero-tools {
    display: flex; align-items: center;
    justify-content: center; gap: 1.5rem; flex-wrap: wrap;
}
.tool-item { display: flex; flex-direction: column; align-items: center; gap: .5rem; }
.tool-img {
    width: 120px; height: 120px; object-fit: cover;
    border-radius: 10px;
    border: 2px solid rgba(100,149,237,.2);
    transition: border-color .3s ease, transform .3s ease;
}
.tool-img:hover { border-color: rgba(135,206,235,.5); transform: scale(1.05); }
.tool-label {
    font-size: .75rem; color: #7a9ab8;
    text-transform: uppercase; letter-spacing: .04em;
}
.tool-sep { color: #4a6a8a; }

/* ==========================================================
   SECCIÓN EDICIONES  (index)
   ========================================================== */
.editions {
    position: relative; z-index: 1;
    padding: 2.5rem 1.5rem 3rem;
    max-width: 1100px; margin: 0 auto;
}

.section-title {
    display: flex; align-items: center; justify-content: center;
    gap: .6rem; font-size: 1.3rem; font-weight: 600;
    color: #c8d8ec; margin-bottom: 2rem;
}
.section-title svg { color: #87CEEB; }

/* ==========================================================
   GRID DE TARJETAS
   ========================================================== */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.4rem;
}

/* ==========================================================
   TARJETA DE EDICIÓN
   ========================================================== */
.card {
    background: linear-gradient(145deg, rgba(20,40,70,.8) 0%, rgba(15,30,55,.9) 100%);
    border: 1px solid rgba(100,149,237,.12);
    border-radius: 14px; overflow: hidden;
    transition: border-color .35s ease, transform .35s ease, box-shadow .35s ease;
}
.card:hover {
    border-color: rgba(100,149,237,.4);
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0,0,0,.35);
}

.card-thumb {
    position: relative; overflow: hidden;
    aspect-ratio: 2/3;          /* proporción de la página mimeografiada */
    background: #0d1a2e;
}
.card-thumb img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform .4s ease;
}
.card:hover .card-thumb img { transform: scale(1.05); }

.card-overlay {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(10,22,40,.7);
    opacity: 0; transition: opacity .3s ease;
}
.card:hover .card-overlay { opacity: 1; }
.card-overlay span {
    color: #87CEEB; font-size: .9rem; font-weight: 500;
    padding: .5rem 1.2rem;
    border: 1px solid rgba(135,206,235,.4);
    border-radius: 6px; background: rgba(10,22,40,.5);
}

.card-info {
    display: flex; align-items: center; justify-content: space-between;
    padding: .85rem 1.1rem; gap: .4rem;
}
.card-number { font-size: .95rem; font-weight: 700; color: #e8ecf1; }
.card-pages  { font-size: .72rem; color: #6a8caf; }
.card-date {
    font-size: .78rem; color: #7a9ab8;
    background: rgba(42,90,138,.2);
    padding: .2rem .6rem; border-radius: 12px;
}

/* ==========================================================
   BOTÓN "VOLVER / CERRAR"
   ========================================================== */
.btn-back, .btn-menu {
    display: inline-flex; align-items: center; gap: .5rem;
    background: linear-gradient(135deg, #1e5aa8 0%, #2a7cc7 100%);
    color: #fff; padding: .65rem 1.4rem; border-radius: 8px;
    font-size: .9rem; font-weight: 500;
    box-shadow: 0 4px 15px rgba(42,124,199,.3);
    transition: transform .3s ease, box-shadow .3s ease;
}
.btn-back:hover, .btn-menu:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(42,124,199,.4);
}

/* ==========================================================
   FOOTER  (compartido)
   ========================================================== */
.footer {
    position: relative; z-index: 1;
    border-top: 1px solid rgba(100,149,237,.1);
    padding: 2rem 1.5rem; text-align: center;
    background: rgba(10,22,40,.5);
}
.footer-inner { max-width: 720px; margin: 0 auto; }
.footer-license { margin-top: .8rem; }
.footer-license a {
    font-size: .78rem; color: #4a5a70;
    transition: color .2s ease;
}
.footer-license a:hover { color: #87CEEB; }

/* ==========================================================
   VISOR  (visor.php)
   ========================================================== */
.viewer {
    position: relative; z-index: 1;
    max-width: 920px; margin: 2rem auto; padding: 0 1rem;
}

/* Cabecera del visor */
.viewer-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: .8rem; margin-bottom: 1.4rem;
}
.viewer-title { font-size: 1.3rem; font-weight: 600; color: #c8d8ec; }
.viewer-counter {
    font-size: .85rem; color: #7a9ab8;
    background: rgba(42,90,138,.2);
    padding: .3rem .8rem; border-radius: 12px;
}

/* Zona principal:  [←]  [imagen]  [→] */
.viewer-main {
    display: flex; align-items: center; gap: .8rem;
}

/* Flechas laterales */
.viewer-nav { flex-shrink: 0; }
.viewer-nav a {
    display: flex; align-items: center; justify-content: center;
    width: 48px; height: 130px;
    background: rgba(20,40,70,.8);
    border: 1px solid rgba(100,149,237,.15);
    border-radius: 10px; color: #87CEEB;
    transition: background .3s ease, border-color .3s ease;
}
.viewer-nav a:hover {
    background: rgba(42,90,138,.4);
    border-color: rgba(100,149,237,.4);
}
.viewer-nav svg { width: 26px; height: 26px; }

/* Contenedor de la imagen */
.viewer-image {
    flex: 1; text-align: center;
    background: rgba(15,30,55,.6);
    border: 1px solid rgba(100,149,237,.12);
    border-radius: 14px; padding: 1rem;
    min-height: 420px;
    display: flex; align-items: center; justify-content: center;
    touch-action: pan-y;        /* permite scroll vertical, captura swipe horizontal */
}
.viewer-image img {
    max-width: 100%; max-height: 78vh;
    object-fit: contain; border-radius: 8px;
    user-select: none; -webkit-user-drag: none;
}

/* Dots de página */
.viewer-dots {
    display: flex; justify-content: center; gap: .55rem;
    margin-top: 1.2rem;
}
.viewer-dots a {
    width: 11px; height: 11px; border-radius: 50%;
    background: rgba(100,149,237,.2);
    border: 1px solid rgba(100,149,237,.3);
    transition: background .3s ease, transform .2s ease;
}
.viewer-dots a:hover { background: rgba(100,149,237,.5); transform: scale(1.25); }
.viewer-dots a.active { background: #87CEEB; border-color: #87CEEB; }

/* Navegación entre ediciones */
.edition-nav {
    display: flex; justify-content: center; gap: 1.2rem;
    margin-top: 1.4rem; flex-wrap: wrap;
}
.edition-nav a {
    display: inline-flex; align-items: center; gap: .4rem;
    font-size: .85rem; color: #87CEEB;
    padding: .45rem 1rem; border-radius: 8px;
    border: 1px solid rgba(100,149,237,.2);
    background: rgba(20,40,70,.5);
    transition: background .3s ease, border-color .3s ease;
}
.edition-nav a:hover {
    background: rgba(42,90,138,.35);
    border-color: rgba(100,149,237,.4);
}

/* Volver al índice */
.viewer-footer { margin-top: 1.6rem; text-align: center; }

/* ==========================================================
   RESPONSIVE
   ========================================================== */
@media (max-width: 600px) {
    .viewer-main { flex-direction: column; }
    .viewer-nav {
        width: 100%; display: flex;
        justify-content: center; gap: 1rem;
    }
    .viewer-nav a { width: 90px; height: 44px; }
    .viewer-image { min-height: 300px; }
}

@media (max-width: 480px) {
    .hero { padding: 2rem 1rem 1.5rem; }
    .hero-story { padding: 1.2rem 1.3rem; }
    .hero-tools { gap: 1rem; }
    .tool-img { width: 90px; height: 90px; }
    .grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
}

@media (min-width: 481px) and (max-width: 768px) {
    .grid { grid-template-columns: repeat(2, 1fr); }
}

/* ==========================================================
   ACCESIBILIDAD
   ========================================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
    html { scroll-behavior: auto; }
}

a:focus-visible, button:focus-visible {
    outline: 2px solid #87CEEB;
    outline-offset: 2px;
}