/* ==============================================
   VIGIA.CSS — Estilos compartidos
   Variables, reset, header, footer, utilidades
   ============================================== */

/* Variables globales */
:root {
    --color-bg:       #f5f5f0;
    --color-surface:  #ffffff;
    --color-text:     #1a1a1a;
    --color-muted:    #767676;
    --color-border:   #e0e0d8;
    --color-accent:   #b5121b;
    --color-link:     #1a1a1a;
    --font-serif:     Georgia, 'Times New Roman', serif;
    --font-sans:      'Helvetica Neue', Arial, sans-serif;
    --max-content:    1200px;
    --max-article:    780px;
    --header-height:  56px;
}

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

html { font-size: 16px; }

body {
    font-family: var(--font-sans);
    background-color: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    line-height: 1.6;
}

a {
    color: var(--color-link);
    text-decoration: none;
}

/* ==============================================
   Cabecera del sitio
   ============================================== */
.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-header__inner {
    max-width: var(--max-content);
    margin: 0 auto;
    padding: 0 1.5rem;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.site-header__logo {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: bold;
    letter-spacing: -0.01em;
    color: var(--color-text);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
}

.site-header__logo a {
    color: inherit;
}

.site-header__back {
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    letter-spacing: 0.03em;
    color: var(--color-muted);
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transition: color 0.15s;
    z-index: 1;
}

.site-header__back:hover { color: var(--color-text); }
.site-header__back svg  { flex-shrink: 0; }

/* Espacio simétrico derecho (invisible) */
.site-header__spacer {
    width: 64px;
}

/* ==============================================
   Footer
   ============================================== */
.site-footer {
    border-top: 1px solid var(--color-border);
    padding: 1.5rem;
    text-align: center;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    color: var(--color-muted);
    margin-top: 3rem;
}

/* ==============================================
   Estado de carga compartido
   ============================================== */
.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 4rem 2rem;
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    color: var(--color-muted);
}

.loading-state__spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-text);
    border-radius: 50%;
    flex-shrink: 0;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ==============================================
   Modal / Lightbox
   ============================================== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.93);
    /* espacio superior para la barra de controles */
    padding: 3.5rem 1.5rem 1.5rem;
}

.modal.is-open {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal__inner {
    max-width: 1100px;
    width: 100%;
}

.modal__img {
    width: 100%;
    height: auto;
    max-height: 82vh;
    object-fit: contain;
    display: block;
}

.modal__caption {
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
    text-align: center;
    margin-top: 0.625rem;
    line-height: 1.4;
}

/* -----------------------------------------------
   Barra de controles del lightbox
----------------------------------------------- */
.modal__toolbar {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 0.125rem;
    padding: 0.5rem 0.625rem;
    z-index: 10;
}

/* Botón icono genérico */
.modal__btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.7);
    border-radius: 3px;
    text-decoration: none;
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
    -webkit-appearance: none;
}

.modal__btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.modal__btn svg { display: block; pointer-events: none; }

/* Botón de cierre: ligeramente más destacado */
.modal__btn--close {
    color: rgba(255, 255, 255, 0.8);
    margin-left: 0.25rem;
}

/* -----------------------------------------------
   Menú de compartir (dropdown)
----------------------------------------------- */
.modal__share-wrap {
    position: relative;
}

.modal__share-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.375rem);
    right: 0;
    background: #ffffff;
    min-width: 172px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 20;
    overflow: hidden;
    /* pequeña flecha indicadora */
    border-top: 2px solid var(--color-accent);
}

.modal__share-menu.is-open { display: block; }

.modal__share-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 1rem;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    color: #1a1a1a;
    text-decoration: none;
    transition: background 0.1s;
    white-space: nowrap;
    border-bottom: 1px solid #f0f0ea;
}

.modal__share-item:last-child { border-bottom: none; }

.modal__share-item:hover {
    background: #f5f5f0;
    color: #1a1a1a;
}

.modal__share-item svg { flex-shrink: 0; }
