/* =================================================================
   site.css — frontend público Renault 12 v2
   Paleta y fuentes provienen de variables emitidas por functions.php
   (render_theme_css_vars) — todo configurable desde el admin.
   ================================================================= */

/* ---------- Reset mínimo ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--r12-font-ui, 'Inter', system-ui, sans-serif);
    color: var(--r12-text, #1F1C18);
    background: var(--r12-bg, #F2EEE5);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
blockquote { margin: 0; }

/* Ocultar scrollbar por estética (mantiene función) */
body::-webkit-scrollbar { display: none; }
body { scrollbar-width: none; -ms-overflow-style: none; }

/* ---------- Header ---------- */
.site-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--r12-bg) 92%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid color-mix(in srgb, var(--r12-line) 60%, transparent);
    transform: translateY(0);
    transition: transform .35s ease;
}

.site-header--hidden { transform: translateY(-100%); }

.site-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-logo {
    font-family: var(--r12-font-editorial, Georgia, serif);
    font-size: 1.4rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--r12-text);
}

/* Hamburger */
.menu-toggle {
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
}
.menu-toggle span {
    display: block;
    width: 22px;
    height: 1.5px;
    background: var(--r12-text);
    transition: transform .3s, opacity .3s;
}
.menu-toggle--open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.menu-toggle--open span:nth-child(2) { opacity: 0; }
.menu-toggle--open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ---------- Menú lateral ---------- */
.site-menu {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 100vh;
    z-index: 60;
    background: color-mix(in srgb, var(--r12-bg) 98%, transparent);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .35s ease;
    overflow-y: auto;
}
.site-menu--open { opacity: 1; pointer-events: auto; }

.site-menu-inner {
    max-width: 720px;
    margin: 0 auto;
    padding: 100px 32px 60px;
    font-family: var(--r12-font-editorial, Georgia, serif);
}

.site-menu-title {
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 500;
    letter-spacing: -0.02em;
    margin: 0 0 32px;
    color: var(--r12-text);
}

.site-menu-body {
    font-size: 1.0625rem;
    line-height: 1.7;
    color: var(--r12-text);
}

.site-menu-contact {
    margin-top: 32px;
    font-family: var(--r12-font-ui, system-ui, sans-serif);
    font-size: 0.875rem;
    color: var(--r12-muted);
}
.site-menu-contact a {
    border-bottom: 1px solid var(--r12-line);
    transition: color .2s, border-color .2s;
}
.site-menu-contact a:hover { color: var(--r12-accent); border-color: var(--r12-accent); }

/* ---------- Feed ---------- */
.feed-wrap {
    padding: 100px 24px 80px;
    max-width: 1300px;
    margin: 0 auto;
}

/*
 * Layout: CSS Grid row-major.
 * Como TODOS los items (fichas y curiosidades) tienen aspect-ratio 950/534,
 * cada fila tiene altura uniforme y no necesita masonry. El orden DOM
 * coincide con el orden visual, lo que garantiza que las dos imágenes de
 * una misma fila entren al viewport y se descarguen al mismo tiempo.
 */
.feed-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: start;
}

@media (max-width: 900px) {
    .feed-wrap { padding: 80px 16px 60px; }
    .feed-grid { grid-template-columns: 1fr; gap: 48px; }
}

.feed-item {
    display: block;
}

/* ---------- Tarjeta de imagen ---------- */
.feed-photo a { display: block; }

.feed-image-figure {
    margin: 0;
    padding: 0;
}

.feed-image-frame {
    position: relative;
    overflow: hidden;
    border-radius: 2px;
    background: color-mix(in srgb, var(--r12-line) 50%, var(--r12-bg));
    transition: box-shadow .35s ease, transform .35s cubic-bezier(.2, .8, .2, 1);
    will-change: transform;
}

.feed-image-frame img {
    width: 100%;
    height: auto;
    aspect-ratio: 950 / 534;
    object-fit: cover;
    display: block;
    transition: transform .6s cubic-bezier(.2, .8, .2, 1);
    will-change: transform;
}

/* Hover: zoom suave del img, leve elevación + sombra del frame */
@media (hover: hover) {
    .feed-photo a:hover .feed-image-frame {
        transform: translateY(-2px);
        box-shadow:
            0 22px 48px -12px color-mix(in srgb, var(--r12-text) 35%, transparent),
            0 8px 18px  -6px color-mix(in srgb, var(--r12-text) 22%, transparent);
        cursor: zoom-in;
    }
    .feed-photo a:hover .feed-image-frame img {
        transform: scale(1.04);
    }
}

@media (prefers-reduced-motion: reduce) {
    .feed-image-frame,
    .feed-image-frame img { transition: none; }
    .feed-photo a:hover .feed-image-frame { transform: none; }
    .feed-photo a:hover .feed-image-frame img { transform: none; }
}

.feed-image-caption {
    font-family: var(--r12-font-ui, system-ui, sans-serif);
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    color: var(--r12-muted);
    margin: 10px 2px 0;
    text-transform: lowercase;
}

/* ---------- Tarjeta de curiosidad ---------- */
.feed-curiosity {
    background: color-mix(in srgb, var(--r12-text) 4%, var(--r12-bg));
    border: 1px solid color-mix(in srgb, var(--r12-line) 70%, transparent);
    border-radius: 4px;
    padding: clamp(28px, 5vw, 48px);
    aspect-ratio: 950 / 534;        /* mismo footprint que una imagen */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.feed-curiosity-text {
    font-family: var(--r12-font-editorial, Georgia, serif);
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    line-height: 1.45;
    letter-spacing: -0.005em;
    color: var(--r12-text);
    font-style: italic;
    max-width: 32em;
    quotes: '“' '”' '‘' '’';
}
.feed-curiosity-text::before { content: open-quote; opacity: 0.6; margin-right: .05em; }
.feed-curiosity-text::after  { content: close-quote; opacity: 0.6; margin-left: .05em; }

.feed-curiosity-source {
    display: block;
    margin-top: 16px;
    font-family: var(--r12-font-ui, system-ui, sans-serif);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--r12-muted);
}

/* ---------- Sentinel + loader ---------- */
.feed-sentinel {
    height: 1px;
    width: 100%;
}

.feed-loader {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 40px 0 60px;
}
.feed-loader[hidden] { display: none; }
.feed-loader span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--r12-muted);
    animation: r12-pulse 1.2s infinite ease-in-out;
}
.feed-loader span:nth-child(2) { animation-delay: .15s; }
.feed-loader span:nth-child(3) { animation-delay: .3s; }

@keyframes r12-pulse {
    0%, 80%, 100% { opacity: .25; transform: scale(.8); }
    40%           { opacity: 1;   transform: scale(1); }
}

.feed-empty {
    column-span: all;
    text-align: center;
    color: var(--r12-muted);
    padding: 80px 20px;
    font-family: var(--r12-font-editorial, Georgia, serif);
    font-style: italic;
    font-size: 1.1rem;
}

/* ---------- Lightbox ---------- */
.r12-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(15, 13, 11, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
}

.r12-lightbox--open {
    opacity: 1;
    pointer-events: auto;
}

.r12-lightbox-content {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    max-width: 100%;
    max-height: 100%;
    transform: scale(0.96);
    transition: transform .35s cubic-bezier(.2, .8, .2, 1);
}

.r12-lightbox--open .r12-lightbox-content {
    transform: scale(1);
}

.r12-lightbox-img {
    display: block;
    max-width: min(98vw, 1600px);
    max-height: calc(100vh - 140px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 2px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
    background: rgba(255, 255, 255, 0.04);
}

.r12-lightbox-caption {
    color: rgba(255, 255, 255, 0.78);
    font-family: var(--r12-font-ui, system-ui, sans-serif);
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    text-transform: lowercase;
    text-align: center;
    max-width: min(95vw, 1400px);
}

.r12-lightbox-caption:empty { display: none; }

.r12-lightbox-close {
    position: absolute;
    top: 20px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .2s ease, transform .2s ease;
}

.r12-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: rotate(90deg);
}
.r12-lightbox-close:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 3px;
}

@media (max-width: 600px) {
    .r12-lightbox { padding: 20px; }
    .r12-lightbox-img { max-height: calc(100vh - 120px); }
    .r12-lightbox-close { top: 12px; right: 12px; width: 40px; height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
    .r12-lightbox,
    .r12-lightbox-content,
    .r12-lightbox-close { transition: none; }
    .r12-lightbox-content { transform: none; }
    .r12-lightbox--open .r12-lightbox-content { transform: none; }
}

/* ---------- Fallbacks para color-mix() en navegadores viejos ---------- */
@supports not (color: color-mix(in srgb, red, blue)) {
    .site-header     { background: var(--r12-bg); }
    .site-menu       { background: var(--r12-bg); }
    .feed-curiosity  { background: var(--r12-bg); }
}
