/* Libertaire Sailing — homepage design v1
   Live homepage stylesheet; post pages continue to use css/style.css. */

:root {
    --bg: #f4f0e8;
    --surface: #fffaf2;
    --surface-strong: #ffffff;
    --ink: #17202a;
    --ink-soft: #405061;
    --muted: #6f7a83;
    --line: rgba(27, 42, 56, 0.12);
    --navy: #0e2a3a;
    --navy-2: #12384c;
    --ocean: #126c87;
    --sun: #e9a23b;
    --coral: #e56d5f;
    --green: #4d8b72;
    --shadow: 0 24px 80px rgba(20, 35, 50, 0.14);
    --shadow-soft: 0 10px 34px rgba(20, 35, 50, 0.10);
    --radius: 24px;
    --radius-sm: 14px;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'DM Serif Display', Georgia, serif;
    --max: 1240px;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

/* Focus indicators */
.year-chip:focus-visible,
.tool-btn:focus-visible,
.nav-link:focus-visible,
.story-card:focus-visible,
.pag-btn:focus-visible,
.overlay-close:focus-visible,
.brand-mark:focus-visible {
    outline: 2px solid var(--ocean);
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .loading-spinner { animation: none; border-color: var(--ocean); }
    .story-card:hover, .route-card:hover,
    .feature-story:hover .feature-image img,
    .story-card:hover .story-img img,
    .story-card:hover .story-no-img .no-photo-logo {
        transform: none;
    }
    html { scroll-behavior: auto; }
}

/* Print styles */
@media print {
    .site-nav, .context-rail, .map-overlay, .pagination,
    .year-rail, .view-tools, .route-card-legend { display: none; }
    body {
        background: #fff;
        color: #000;
        font-size: 12pt;
    }
    .hero-v1 { grid-template-columns: 1fr; padding: 20px 0; }
    .page-shell { grid-template-columns: 1fr; }
    .journal-panel { box-shadow: none; border: 1px solid #ccc; }
    .story-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
        grid-template-columns: 200px 1fr;
    }
    .feature-story {
        background: #f5f5f5;
        color: #000;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    a { text-decoration: underline; }
}
body {
    min-height: 100vh;
    overflow-x: hidden;
    font-family: var(--font-body);
    color: var(--ink);
    background:
        radial-gradient(circle at 10% 0%, rgba(233,162,59,.16), transparent 30%),
        radial-gradient(circle at 86% 12%, rgba(18,108,135,.14), transparent 32%),
        linear-gradient(180deg, #fbf6ee 0%, var(--bg) 58%, #efe6d8 100%);
    -webkit-font-smoothing: antialiased;
    line-height: 1.55;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; }

/* Navigation */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 1200;
    padding: 12px 18px;
    background: rgba(244, 240, 232, .78);
    backdrop-filter: blur(22px) saturate(1.25);
    -webkit-backdrop-filter: blur(22px) saturate(1.25);
    border-bottom: 1px solid rgba(20, 35, 50, 0.08);
}
.nav-shell {
    max-width: var(--max);
    margin: 0 auto;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.brand-mark {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--navy);
}
.brand-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
    background: #fffaf2;
    border: 1px solid rgba(14,42,58,.16);
    box-shadow: 0 8px 22px rgba(20,35,50,.14);
}
.brand-icon img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    border-radius: 50%;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px;
    border-radius: 999px;
    background: rgba(255,255,255,.58);
    border: 1px solid rgba(255,255,255,.82);
    box-shadow: 0 10px 30px rgba(20,35,50,.07);
}
.nav-link {
    padding: 9px 14px;
    border-radius: 999px;
    color: var(--ink-soft);
    font-size: .91rem;
    font-weight: 650;
    transition: .18s ease;
}
.nav-link:hover, .nav-link.active {
    background: var(--navy);
    color: #fff8ed;
}
.nav-cta { color: var(--ocean); }

/* Hero */
.hero-v1 {
    max-width: var(--max);
    margin: 0 auto;
    padding: 48px 20px 28px;
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 34px;
    align-items: center;
}
.hero-copy { padding: 16px 0 28px; }
.eyebrow, .card-kicker, .feature-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--ocean);
    text-transform: uppercase;
    letter-spacing: .16em;
    font-weight: 800;
    font-size: .76rem;
}
.eyebrow::before {
    content: '';
    width: 30px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
}
.eyebrow.small::before { width: 18px; }
.hero-copy h1 {
    max-width: 780px;
    margin-top: 18px;
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3.5vw, 2.8rem);
    line-height: 1;
    letter-spacing: -.02em;
    font-weight: 400;
    color: var(--navy);
}
.hero-lede {
    max-width: 650px;
    margin: 24px 0 0;
    font-size: clamp(1.05rem, 2vw, 1.24rem);
    color: var(--ink-soft);
}
.hero-actions {
    display: flex;
    gap: 12px;
    margin: 30px 0 28px;
    flex-wrap: wrap;
}
.primary-action, .secondary-action {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 22px;
    border-radius: 999px;
    font-weight: 750;
    cursor: pointer;
    border: 0;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.primary-action {
    background: var(--navy);
    color: #fff7ea;
    box-shadow: 0 16px 42px rgba(14,42,58,.25);
}
.secondary-action {
    background: rgba(255,255,255,.65);
    border: 1px solid rgba(20,35,50,.12);
    color: var(--navy);
}
.primary-action:hover, .secondary-action:hover { transform: translateY(-2px); }
.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(90px, 1fr));
    gap: 10px;
    max-width: 520px;
}
.stat {
    padding: 15px 16px;
    border-radius: 18px;
    background: rgba(255,255,255,.56);
    border: 1px solid rgba(255,255,255,.82);
    box-shadow: 0 10px 30px rgba(20,35,50,.06);
}
.stat strong { display: block; color: var(--navy); font-size: 1.28rem; font-weight: 800; line-height: 1; }
.stat span { display: block; margin-top: 4px; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }

.hero-visual {
    position: relative;
    min-height: 0;
}
.hero-visual::before {
    content: '';
    position: absolute;
    inset: 4% -6% 16% 13%;
    border-radius: 44% 56% 40% 60%;
    background: linear-gradient(135deg, rgba(18,108,135,.20), rgba(233,162,59,.20));
    filter: blur(4px);
    z-index: -1;
}
.route-card {
    position: relative;
    width: 100%;
    padding: 14px;
    border-radius: 28px;
    background: rgba(255,250,242,.88);
    border: 1px solid rgba(255,255,255,.92);
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    transition: transform .2s ease;
}
.route-card:hover { transform: translateY(-3px); }
.route-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 4px 12px;
    color: var(--ink-soft);
    font-size: .86rem;
    font-weight: 750;
}
.route-card-head strong { color: var(--navy); }
.route-map {
    height: 280px;
    border-radius: 22px;
    overflow: hidden;
    background: #dce5e5;
}
.route-card-legend {
    text-align: center;
    padding: 10px 0 4px;
    color: var(--ink-soft);
    font-size: .85rem;
    font-weight: 600;
}

/* Content layout */
.page-shell {
    max-width: var(--max);
    margin: 0 auto 56px;
    padding: 0 20px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 28px;
    align-items: start;
}
.journal-panel, .rail-card {
    background: rgba(255,250,242,.74);
    border: 1px solid rgba(255,255,255,.86);
    box-shadow: var(--shadow-soft);
}
.journal-panel {
    min-width: 0;
    border-radius: 32px;
    padding: 24px;
}
.section-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 18px;
    margin-bottom: 18px;
}
.section-head h2 {
    font-family: var(--font-display);
    color: var(--navy);
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: .95;
    font-weight: 400;
    letter-spacing: -.04em;
}
.view-tools { display: flex; gap: 8px; }
.tool-btn, .year-chip, .pag-btn {
    border: 1px solid rgba(20,35,50,.12);
    background: rgba(255,255,255,.65);
    color: var(--ink-soft);
    border-radius: 999px;
    font-weight: 750;
    cursor: pointer;
    transition: .16s ease;
}
.tool-btn { padding: 10px 15px; }
.tool-btn.active {
    background: var(--navy);
    color: #fff8ec;
    border-color: var(--navy);
}
.year-rail {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    overflow-x: visible;
    padding: 4px 0 18px;
}
.year-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex: none;
    padding: 9px 13px;
    font-size: .88rem;
}
.year-chip span, .year-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
}
.tool-btn:hover, .year-chip:hover, .pag-btn:hover:not(:disabled) { transform: translateY(-1px); background: #fff; }
.year-chip.active {
    background: var(--navy);
    color: #fff8ec;
    border-color: var(--navy);
}

/* Featured story */
.feature-story {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 290px;
    gap: 20px;
    margin: 4px 0 22px;
    padding: 18px;
    border-radius: 30px;
    background:
        radial-gradient(circle at 0% 0%, rgba(233,162,59,.22), transparent 38%),
        linear-gradient(135deg, var(--navy) 0%, #154860 100%);
    color: #fff7ea;
    box-shadow: 0 24px 70px rgba(14,42,58,.22);
    cursor: pointer;
    overflow: hidden;
}
.feature-copy { padding: 14px; }
.feature-label { color: #f1c16e; margin-bottom: 12px; }
.feature-label::before { content:''; width: 22px; height: 2px; background: currentColor; }
.feature-copy h3 {
    max-width: 650px;
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.6rem);
    line-height: .96;
    letter-spacing: -.045em;
    font-weight: 400;
}
.feature-copy p {
    max-width: 620px;
    margin-top: 14px;
    color: rgba(255,247,234,.78);
    font-size: 1rem;
}
.feature-meta {
    margin-top: 18px;
    font-size: .86rem;
    color: rgba(255,247,234,.72);
    font-weight: 700;
}
.feature-image {
    min-height: 260px;
    border-radius: 24px;
    overflow: hidden;
    background: rgba(255,255,255,.1);
}
.feature-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .55s ease;
}
.feature-story:hover .feature-image img { transform: scale(1.045); }

/* Post grid/cards */
.post-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
}
.story-card {
    min-width: 0;
    display: grid;
    grid-template-columns: 265px minmax(0, 1fr);
    border-radius: 26px;
    overflow: hidden;
    background: var(--surface-strong);
    border: 1px solid rgba(20,35,50,.08);
    box-shadow: 0 1px 0 rgba(255,255,255,.7), 0 14px 40px rgba(20,35,50,.08);
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease;
}
.story-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 48px rgba(20,35,50,.12);
}
.story-img {
    aspect-ratio: 16 / 10.5;
    min-height: 0;
    background: linear-gradient(135deg, #d8e3e5, #efe0c7);
    overflow: hidden;
}
.story-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .5s cubic-bezier(.2,.7,.2,1);
}
.story-card:hover .story-img img { transform: scale(1.045); }
.story-no-img {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background:
        radial-gradient(circle at 50% 43%, rgba(255,255,255,.7) 0 12%, rgba(255,255,255,0) 38%),
        linear-gradient(135deg, rgba(126,161,179,.5), rgba(239,224,199,.92));
    color: rgba(14,42,58,.52);
    font-family: var(--font-display);
    font-size: 1.05rem;
}
.story-no-img::before {
    content: "";
    position: absolute;
    inset: 24px;
    border: 1px solid rgba(255,255,255,.55);
    border-radius: 22px;
    pointer-events: none;
}
.no-photo-badge {
    width: 104px;
    height: 104px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(255,255,255,.48);
    box-shadow: 0 18px 42px rgba(14,42,58,.14), inset 0 0 0 1px rgba(255,255,255,.7);
    z-index: 1;
}
.story-no-img .no-photo-logo {
    width: 74px;
    height: 74px;
    object-fit: contain;
    opacity: .72;
    transition: transform .5s cubic-bezier(.2,.7,.2,1), opacity .5s cubic-bezier(.2,.7,.2,1);
}
.story-card:hover .story-no-img .no-photo-logo {
    transform: scale(1.045) rotate(-2deg);
    opacity: .84;
}
.no-photo-label {
    z-index: 1;
    font-family: var(--font-body);
    font-size: .74rem;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: rgba(14,42,58,.56);
}
.story-body {
    min-width: 0;
    padding: 17px;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-wrap: anywhere;
}
.story-body * { min-width: 0; }
.story-body p, .feature-copy p { overflow-wrap: anywhere; }
.story-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.story-body h3 {
    margin-top: 10px;
    color: var(--navy);
    font-size: 1.15rem;
    line-height: 1.14;
    letter-spacing: -.025em;
}
.story-body p {
    margin-top: 10px;
    color: var(--ink-soft);
    font-size: .94rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.story-foot {
    margin-top: auto;
    padding-top: 16px;
    display: flex;
    justify-content: space-between;
    color: var(--ocean);
    font-size: .84rem;
    font-weight: 800;
}

/* Right rail */
.context-rail {
    position: sticky;
    top: 92px;
    display: grid;
    gap: 16px;
}
.rail-card {
    border-radius: 26px;
    padding: 20px;
}
.rail-card h3 {
    margin-top: 8px;
    color: var(--navy);
    font-family: var(--font-display);
    font-size: 2rem;
    line-height: 1;
    font-weight: 400;
}
.rail-card p { margin-top: 10px; color: var(--ink-soft); }
.muted { color: var(--muted) !important; }
.archive-list { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 14px; }
.archive-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 9px;
    border-radius: 14px;
    color: var(--ink-soft);
    font-weight: 750;
    transition: .15s ease;
}
.archive-list a:hover { background: rgba(255,255,255,.64); color: var(--navy); }
.archive-list span { display: inline-flex; align-items: center; gap: 8px; }
.archive-list i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.archive-list strong { font-size: .82rem; color: var(--muted); }

/* YouTube latest video card */
.yt-thumb { position: relative; display: block; margin-top: 12px; border-radius: 14px; overflow: hidden; background: #000; aspect-ratio: 16/9; }
.yt-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s ease; }
.yt-thumb:hover img { transform: scale(1.04); }
.yt-play { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 48px; height: 48px; background: rgba(0,0,0,.72); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 20px; padding-left: 3px; pointer-events: none; transition: background .2s; }
.yt-thumb:hover .yt-play { background: rgba(255,0,0,.88); }
.yt-title { margin-top: 10px; font-size: .88rem; line-height: 1.4; }
.yt-title a { color: var(--ink-soft); text-decoration: none; transition: color .15s; }
.yt-title a:hover { color: var(--ocean); }

/* Pagination / loading */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
}
.pag-btn { padding: 11px 16px; }
.pag-btn:disabled { opacity: .45; cursor: not-allowed; }
.pag-info { color: var(--muted); font-weight: 750; }
.loading-state, .empty-state {
    grid-column: 1 / -1;
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--muted);
    font-weight: 750;
}
.loading-spinner {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 3px solid rgba(18,108,135,.2);
    border-top-color: var(--ocean);
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Map overlay */
.map-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(8, 22, 32, .96);
    display: none;
    flex-direction: column;
}
.map-overlay.active { display: flex; }
.overlay-header {
    min-height: 82px;
    padding: 16px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #fff7ea;
    border-bottom: 1px solid rgba(255,255,255,.12);
}
.overlay-header h2 {
    font-family: var(--font-display);
    font-size: 2rem;
    line-height: 1;
    font-weight: 400;
}
.overlay-close {
    border: 1px solid rgba(255,255,255,.2);
    background: rgba(255,255,255,.08);
    color: #fff7ea;
    padding: 10px 14px;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 750;
}
#map-overlay-frame { flex: 1; width: 100%; border: 0; background: #111; }

.site-footer {
    padding: 26px 20px 42px;
    color: var(--muted);
    font-size: .88rem;
}
.footer-inner {
    max-width: var(--max);
    margin: 0 auto;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    align-items: center;
}
.footer-inner a {
    color: var(--ocean);
    font-weight: 700;
    transition: color .15s ease;
}
.footer-inner a:hover { color: var(--navy); }
.back-to-top {
    cursor: pointer;
    border: 0;
    background: none;
    color: var(--muted);
    font: inherit;
    font-weight: 700;
    transition: color .15s ease;
    padding: 0;
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
}
.back-to-top:hover { color: var(--navy); }

/* Leaflet tweaks inside preview cards */
.leaflet-container { font-family: var(--font-body); }
.leaflet-control-attribution { display: none !important; }

@media (max-width: 1080px) {
    .hero-v1 { grid-template-columns: 1fr; padding-top: 50px; }
    .route-card { width: 100%; }
    .page-shell { grid-template-columns: 1fr; }
    .context-rail { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 920px) {
    .hero-stats { grid-template-columns: repeat(3, 1fr); max-width: 100%; }
}
@media (max-width: 760px) {
    .site-nav { padding: 8px 10px; }
    .nav-shell { height: auto; align-items: flex-start; flex-direction: column; }
    .nav-links { width: 100%; overflow-x: auto; justify-content: flex-start; }
    .hero-v1 { padding: 28px 14px 20px; grid-template-columns: 1fr; }
    .year-chip { flex: 1 1 calc(33.333% - 8px); justify-content: center; }
    .archive-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .hero-copy h1 { font-size: clamp(1.4rem, 7vw, 2rem); }
    .hero-stats { grid-template-columns: 1fr; }
    .route-card { width: 100%; }
    .route-map { height: 220px; }
    .page-shell { padding: 0 12px; }
    .journal-panel { padding: 16px; border-radius: 24px; }
    .section-head { align-items: flex-start; flex-direction: column; }
    .feature-story { grid-template-columns: 1fr; padding: 14px; }
    .feature-image { min-height: 220px; order: -1; }
    .post-grid { grid-template-columns: minmax(0, 1fr); }
    .story-card { grid-template-columns: 1fr; }
    .story-img { aspect-ratio: 16 / 10.5; min-height: 0; }
    .context-rail { grid-template-columns: 1fr; }
}
@media (max-width: 440px) {
    .hero-actions { flex-direction: column; }
    .primary-action, .secondary-action { width: 100%; }
    .hero-visual { min-height: 0; }
    .route-card { width: 100%; }
    .route-map { height: 180px; }
}
