/* ================================================================
   Libertaire Sailing v1.1 — Complete Design System
   ================================================================ */
/* --- Tokens --- */
:root {
    --bg:        #f6f7f9;
    --bg-raised: #ffffff;
    --bg-card:   #ffffff;
    --bg-hover:  #f0f2f5;

    --ink:       #1a1d21;
    --ink-soft:  #444950;
    --ink-muted: #6b7280;
    --ink-faint: #d1d5db;

    --border:    #e2e5ea;
    --border-subtle: #eceef1;

    --accent:    #1a6fa5;
    --accent-dim:#1a6fa5;

    --radius:    8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.1);

    --font-display: 'DM Serif Display', Georgia, serif;
    --font-body:    'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

    --max-width: 1200px;
}
/* --- Reset --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
/* --- Base --- */
body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
/* ================================================================
   Site Banner (post pages header)
   ================================================================ */
.site-banner {
    background: linear-gradient(170deg, #1c3d4f 0%, #1a3040 60%, #162530 100%);
    border-bottom: 1px solid var(--border-subtle);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.site-banner h1 {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 400;
    letter-spacing: 0.5px;
    margin: 0;
}
.site-banner h1 a {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #f0f4f8;
    text-decoration: none;
}
.site-banner h1 a::before {
    content: '';
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 50%;
    background: #fffaf2 url('../images/logo-libertaire.png?v=20260508logo') center / cover no-repeat;
    border: 1px solid rgba(255,255,255,.35);
    box-shadow: 0 8px 22px rgba(0,0,0,.18);
}
.site-banner h1 a:hover {
    color: #fff;
}
.site-banner .main-nav a {
    color: rgba(240, 244, 248, 0.82);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
.site-banner .main-nav a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    text-decoration: none;
}
@keyframes wave {
    0% { background-position-x: 0; }
    100% { background-position-x: 600px; }
}
.stat-post {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255,255,255,0.08);
    padding: 12px 24px;
    border-radius: var(--radius-lg);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.1);
}
/* ================================================================
   Year Filter
   ================================================================ */
/* ================================================================
   Post Cards (homepage)
   ================================================================ */
/* ================================================================
   Pagination
   ================================================================ */
#sidebar-map {
    height: 200px;
}
/* ================================================================
   Loading & Empty States
   ================================================================ */
@keyframes spin {
    to { transform: rotate(360deg); }
}
#map-overlay-frame {
    flex: 1;
    width: 100%;
    border: none;
}
/* ================================================================
   Post Page (single post view)
   ================================================================ */
.post-page {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 32px 24px;
}
.post-full {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 24px;
}
.post-full .post-header {
    padding: 24px 28px;
    border-bottom: 1px solid var(--border-subtle);
}
.post-full .post-header .date {
    font-size: 0.85rem;
    color: var(--ink-muted);
    font-variant-numeric: tabular-nums;
    margin-right: 12px;
}
.post-full .post-header .category {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
    background: rgba(26, 111, 165, 0.08);
    padding: 2px 8px;
    border-radius: 4px;
}
.post-full .post-header h2 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 400;
    color: var(--ink);
    line-height: 1.3;
    margin-top: 8px;
}
.post-full .post-text {
    padding: 24px 28px;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--ink-soft);
}
.post-full .post-text p {
    margin-bottom: 1em;
}
.post-full .post-text p:last-child {
    margin-bottom: 0;
}
/* ================================================================
   Post Gallery
   ================================================================ */
.post-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    padding: 0 28px 24px;
}
.gallery-item {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    background: var(--bg);
    aspect-ratio: 4 / 3;
}
.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.gallery-item:hover img {
    transform: scale(1.05);
}

/* Captioned post-gallery items (2016 repair): keep old grid, but allow captions below images. */
.gallery-item.has-caption {
    aspect-ratio: auto;
    overflow: visible;
    display: flex;
    flex-direction: column;
    cursor: default;
}
.gallery-item.has-caption img {
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: var(--radius);
    cursor: pointer;
}
.gallery-item.has-caption .image-caption {
    padding: 0 4px 6px;
    color: #666;
    font-size: 0.85rem;
    line-height: 1.35;
    text-align: center;
    font-style: italic;
}


/* Image Gallery (legacy class names used in some posts) */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}
.image-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.image-gallery img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
    cursor: pointer;
    margin-bottom: 0.5rem;
}
.image-caption {
    font-size: 0.85rem;
    color: #666;
    text-align: center;
    line-height: 1.4;
    margin-top: 0.25rem;
    font-style: italic;
}

/* ================================================================
   Lightbox
   ================================================================ */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.92);
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}
.lightbox.active {
    display: flex;
    flex-direction: column;
}
.lightbox img {
    max-width: 90vw;
    max-height: 84vh;
    object-fit: contain;
    border-radius: var(--radius);
}
.lightbox-caption {
    max-width: 90vw;
    margin-top: 0.75rem;
    padding: 0 1rem;
    color: rgba(255, 255, 255, 0.92);
    font-size: 1rem;
    line-height: 1.35;
    text-align: center;
    font-style: italic;
}
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 28px;
    z-index: 1002;
    font-size: 2.5rem;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}
.lightbox-close:hover {
    color: #fff;
}
.lightbox-nav {
    position: absolute;
    top: 50%;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 72px;
    transform: translateY(-50%);
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.86);
    font-size: 3rem;
    line-height: 1;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s, color 0.2s, transform 0.2s;
}
.lightbox-prev {
    left: 22px;
}
.lightbox-next {
    right: 22px;
}
.lightbox-nav:hover,
.lightbox-nav:focus-visible {
    background: rgba(255, 255, 255, 0.24);
    color: #fff;
    transform: translateY(-50%) scale(1.04);
}
.lightbox-nav:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.85);
    outline-offset: 4px;
}
/* ================================================================
   Post Navigation
   ================================================================ */
.post-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 0;
}
.post-navigation a {
    color: var(--ink-soft);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-raised);
    transition: all 0.15s;
}
.post-navigation a:hover {
    background: var(--bg-hover);
    color: var(--ink);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.nav-prev::before {
    content: "\2190  ";
}
.nav-next::after {
    content: "  \2192";
}
.nav-home {
    margin: 0 auto;
}
/* ================================================================
   Responsive
   ================================================================ */
@media (max-width: 900px) {
    .main-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    .sidebar {
        order: -1;
    }
    .hero { padding: 56px 20px 48px; }
    .hero-stats { gap: 24px; }
    .featured-banner {
        grid-template-columns: 1fr;
    }
    .featured-banner .featured-img {
        width: 100%;
        height: 160px;
    }
    .post-gallery {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        padding: 0 20px 20px;
    }
    .post-full .post-header,
    .post-full .post-text {
        padding: 20px;
    }
}
@media (max-width: 600px) {
    .post-card {
        grid-template-columns: 1fr;
    }
    .post-card-img {
        width: 100%;
        min-height: 180px;
        max-height: 220px;
    }
    .post-card-body {
        padding: 16px;
    }
    .nav-links { gap: 4px; }
    .nav-link { padding: 6px 10px; font-size: 0.8rem; }
    .hero-title { font-size: 1.15rem; }
    .hero-tagline { font-size: 0.82rem; }
    .hero { padding: 24px 16px 20px; }
    .hero-stats { flex-direction: column; gap: 12px; }
    .stat-post { width: 100%; max-width: 200px; }
    .post-gallery {
        grid-template-columns: 1fr;
        padding: 0 16px 16px;
    }
    .post-full .post-header h2 {
        font-size: 1.4rem;
    }
    .post-navigation {
        flex-direction: column;
        gap: 8px;
    }
    .post-navigation a {
        width: 100%;
        text-align: center;
    }
    .lightbox img {
        max-width: 86vw;
        max-height: 86vh;
    }
    .lightbox-nav {
        width: 42px;
        height: 56px;
        font-size: 2.2rem;
        background: rgba(255, 255, 255, 0.18);
    }
    .lightbox-prev {
        left: 8px;
    }
    .lightbox-next {
        right: 8px;
    }
}
@media (prefers-reduced-motion: reduce) {
    .loading-spinner { animation: none; border-top-color: var(--ink-muted); }
    .post-card:hover { transform: none; }
    .post-card:hover .post-card-img img { transform: none; }
    .hero::before { animation: none; }
    .featured-banner:hover { transform: none; }
}
