/* ── Shared site CSS ──────────────────────────────────────────────────────────
   Lifted out of index.php's inline <style> so every page shares one stylesheet
   instead of each carrying its own copy. The SPA-era rules (.view-card,
   #content-scroller) are still here because the old homepage uses them; they go
   when index.php is rebuilt in the next pass. */

/* ── Static background ────────────────────────────────────────────────────────
   Replaces the animated scene. A fixed <div> rather than
   background-attachment: fixed, which is janky-to-broken on iOS Safari.
   center bottom, because the path, deer and treeline live in the lower third —
   a short wide window must never crop those away. */
#SITE_BG {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: #1da8e8 url('/0_IMGS/TNW_DOTNET_BACKGROUND.png') center bottom / cover no-repeat;
}
@media (max-width: 720px) {
    #SITE_BG { background-image: url('/0_IMGS/TNW_DOTNET_BACKGROUND_M.png'); }
}

:root {
    --glass: rgba(255, 255, 255, 0.75);
    --glass-heavy: rgba(255, 255, 255, 0.92);
    --accent: #1a5c2a;
    --accent-soft: rgba(26, 92, 42, 0.1);
    --text: #2a3a2a;
    --title: #1a4a1a;
}

/* ── Layout ───────────────────────────────────────────────────────────────── */
#app-wrap {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Navigation ───────────────────────────────────────────────────────────── */
#nav-pill {
    margin: 24px auto 0;
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 6px;
    border-radius: 999px;
    display: flex;
    gap: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border: 1px solid rgba(255,255,255,0.4);
    pointer-events: auto;
    z-index: 100;
}

.nav-btn {
    font-family: 'Fredoka One', sans-serif;
    font-size: 15px;
    letter-spacing: 0.02em;
    padding: 10px 24px;
    border-radius: 999px;
    border: none;
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.nav-btn:hover { background: rgba(255,255,255,0.5); }
.nav-btn.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 12px rgba(26,92,42,0.25);
}

#nav-pill .join-btn {
    background: #fff;
    border: 2px solid var(--accent);
    padding: 8px 22px;
}

/* ── Content Container ────────────────────────────────────────────────────── */
#content-scroller {
    flex: 1;
    overflow-y: auto;
    padding: 40px 20px 80px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.1) transparent;
}
#content-scroller::-webkit-scrollbar { width: 6px; }
#content-scroller::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 10px; }

.view-card {
    max-width: 860px;
    margin: 0 auto;
    background: var(--glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 24px;
    padding: 50px 60px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.1);
    border: 1px solid rgba(255,255,255,0.5);
    display: none;
    animation: cardIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.view-card.active { display: block; }

/* ── Typography & Elements ────────────────────────────────────────────────── */
h1 { font-family: 'Fredoka One', sans-serif; font-size: 2.8rem; color: var(--title); margin-bottom: 24px; }
p { font-family: 'Nunito', sans-serif; font-size: 1.1rem; line-height: 1.8; color: var(--text); margin-bottom: 20px; }
hr { border: none; border-top: 2px dashed rgba(26, 92, 42, 0.15); margin: 30px 0; }

/* ── Search & Filter ──────────────────────────────────────────────────────── */
.search-wrap { margin-bottom: 30px; position: sticky; top: -10px; z-index: 10; }
.search-input {
    width: 100%;
    padding: 16px 28px;
    border-radius: 999px;
    border: 2px solid rgba(26,92,42,0.15);
    background: #fff;
    font-family: 'Fredoka One', sans-serif;
    font-size: 1.1rem;
    color: var(--title);
    outline: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}
.search-input:focus { border-color: var(--accent); box-shadow: 0 4px 20px rgba(26,92,42,0.15); }

/* ── Grid/List Styles ─────────────────────────────────────────────────────── */
#ART_GRID {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}
.art-tile {
    aspect-ratio: 1;
    background: #eee;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    transition: transform 0.3s;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}
.art-tile:hover { transform: translateY(-5px) scale(1.02); }
.art-tile img { width: 100%; height: 100%; object-fit: cover; }
.art-label {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 25px 15px 10px;
    background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
    color: #fff; font-family: 'Fredoka One', sans-serif;
    font-size: 0.9rem;
}

.post-card {
    padding: 25px 0;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}
.post-card:last-child { border-bottom: none; }
.post-title { font-family: 'Fredoka One', sans-serif; font-size: 1.6rem; color: var(--title); margin-bottom: 8px; }
.post-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; font-size: 0.9rem; color: #667766; }
.read-link {
    display: inline-block;
    background: var(--accent); color: #fff;
    padding: 10px 24px; border-radius: 999px;
    text-decoration: none; font-family: 'Fredoka One', sans-serif;
    margin-top: 10px; transition: 0.2s;
}
.read-link:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(26,92,42,0.3); }

/* ── Handbook Styles ──────────────────────────────────────────────────────── */
.handbook-nav {
    display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 40px;
    padding-bottom: 20px; border-bottom: 1px solid rgba(0,0,0,0.1);
}
.h-nav-btn {
    padding: 8px 18px; border-radius: 999px; background: rgba(0,0,0,0.05);
    border: none; cursor: pointer; font-family: 'Nunito', sans-serif; font-weight: 800;
    color: var(--accent); transition: 0.2s;
}
.h-nav-btn.active { background: var(--accent); color: #fff; }
.h-section { display: none; animation: fadeIn 0.3s; }
.h-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Mobile Overrides ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    #nav-pill {
        position: fixed;
        bottom: 20px;
        top: auto;
        margin: 0;
        left: 50%;
        transform: translateX(-50%);
        width: calc(100% - 40px);
        max-width: 500px;
        justify-content: space-around;
        padding: 8px;
        border-radius: 30px;
    }
    
    .nav-btn {
        padding: 8px 16px;
        font-size: 14px;
    }
    
    .nav-btn span { display: none; } /* Could use icons later if we add them */
    
    #content-scroller {
        padding: 20px 0 100px; /* Space for bottom nav */
    }
    
    .view-card {
        border-radius: 0;
        padding: 40px 24px;
        border-left: none;
        border-right: none;
        background: rgba(255,255,255,0.85); /* Slightly more opaque for readability on mobile */
    }
    
    h1 { font-size: 2.2rem; }
    
    #ART_GRID {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .handbook-nav {
        justify-content: center;
    }
}

/* Specific button icons for mobile (optional but helpful) */
@media (max-width: 480px) {
    .nav-btn { padding: 10px 12px; }
}

/* ── Server-rendered listing pages ───────────────────────────────────────────*/
.page-shell {
    position: relative;
    z-index: 50;
    width: min(980px, calc(100% - 40px));
    margin: 86px auto 0;
    background: rgba(255,255,255,0.82);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    padding: 36px 44px 56px;
    min-height: calc(100vh - 86px);
}
.page-shell h1 {
    font-family: 'Fredoka One', sans-serif;
    font-size: 2.2rem;
    color: #1a4a1a;
    margin-bottom: 6px;
}
.page-lede {
    font-family: 'Nunito', sans-serif;
    color: #4a5a4a;
    margin-bottom: 22px;
}
.result-count { font-size: 0.9rem; color: #667766; margin-bottom: 14px; }
.empty-state  { text-align: center; padding: 48px 0; color: #667766; }

/* Pagination — real links, so they are crawlable and work without JS. */
.pager { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 34px; }
.pager a, .pager span {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    padding: 8px 14px;
    border-radius: 999px;
    text-decoration: none;
    background: rgba(255,255,255,0.75);
    color: #1a5c2a;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.pager .current { background: #1a5c2a; color: #fff; }
.pager .disabled { opacity: 0.4; }

@media (max-width: 720px) {
    .page-shell { width: 100%; margin-top: 70px; border-radius: 14px 14px 0 0; padding: 26px 18px 44px; }
    .page-shell h1 { font-size: 1.7rem; }
}

/* ── Handbook nav ────────────────────────────────────────────────────────────
   Anchors now, not view-switching buttons, so they need the underline removed
   that the old <button> markup never had. */
.handbook-nav a.h-nav-btn { text-decoration: none; display: inline-block; }
.post-title a { color: inherit; text-decoration: none; }
.post-title a:hover { text-decoration: underline; }

/* ── Contact form ────────────────────────────────────────────────────────────
   The inline style="display:none" attributes came out of the markup, so the
   hidden defaults have to live here or the error and success blocks show on
   first paint. */
#ACF_WRAP { display: flex; flex-direction: column; gap: 12px; max-width: 520px; }
#ACF_WRAP textarea.search-input { border-radius: 20px; resize: none; min-height: 130px; }
#ACF_SUBMIT { border: none; cursor: pointer; align-self: flex-start; }
#ACF_ERROR { color: #c22; font-weight: bold; display: none; }
#ACF_SUCCESS { display: none; text-align: center; padding: 40px 0; }
#ACF_SUCCESS h2 { font-family: 'Fredoka One', sans-serif; color: #1a4a1a; margin-bottom: 8px; }

/* ── Artwork lightbox ────────────────────────────────────────────────────────
   Ported up from mobile/index.php, which was the only place it existed. Kept
   [hidden] alongside .open so it stays closed before the script runs. */
#art-lightbox {
    display: none;
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,0.78);
}
#art-lightbox[hidden] { display: none; }

/* Centred panel that scrolls INSIDE itself. The previous rules were ported
   straight from mobile, where the overlay is a full-screen sheet — on desktop
   that produced a scrollbar within a scrollbar, the page still moving behind
   the modal. min-height:0 is required or the flex child refuses to shrink and
   overflow-y never engages. */
#art-lightbox.open {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
}
#art-lightbox-inner {
    background: #fff;
    width: min(900px, 100%);
    max-height: 88vh;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 14px;
    padding: 18px 26px 32px;
    position: relative;
}

/* Freeze the page underneath — otherwise the wheel scrolls the document behind
   the modal once the panel itself reaches its end. */
body.lb-open { overflow: hidden; }

@media (max-width: 720px) {
    /* Back to a full-screen sheet, which is right on a phone. */
    #art-lightbox.open { padding: 0; align-items: stretch; }
    #art-lightbox-inner {
        width: 100%;
        max-height: 100%;
        min-height: 100%;
        border-radius: 0;
        padding: 16px 18px 40px;
    }
}
#art-lightbox-close {
    position: sticky; top: 0;
    display: flex; align-items: center; gap: 6px;
    background: #fff; border: none;
    font-family: 'Fredoka One', sans-serif;
    font-size: 1rem; color: #1a5c2a;
    cursor: pointer; padding: 8px 0 14px; width: 100%;
    -webkit-tap-highlight-color: transparent;
}
#art-lb-title      { font-family: 'Fredoka One', sans-serif; font-size: 1.55rem; color: #1a4a1a; margin-bottom: 10px; line-height: 1.2; }
#art-lb-author-row { font-family: 'Fredoka One', sans-serif; font-size: 1rem; color: #1a4a1a; margin-bottom: 10px; }
#art-lb-desc       { font-family: 'Nunito', sans-serif; font-size: 0.95rem; color: #2a3a2a; line-height: 1.7; margin-bottom: 16px; }
#art-lb-img-wrap   { text-align: center; border-top: 1px solid rgba(0,0,0,0.09); padding-top: 16px; }
#art-lb-img        { max-width: 100%; border-radius: 8px; display: block; margin: 0 auto; box-shadow: 0 4px 16px rgba(0,0,0,0.15); }

/* ── Reset the SPA body ──────────────────────────────────────────────────────
   head.php's inline rule was written for the old app shell: a fixed, centred,
   non-scrolling flex viewport with an animated sky. On real pages that made the
   <nav> and <main> siblings in a flex ROW — nav crushed to a sliver on the left,
   content shoved beside it — and overflow:hidden meant anything past the fold
   was unreachable. This block loads after that one, so it wins.               */
body {
    display: block;
    overflow: visible;
    animation: none;
    align-items: initial;
    justify-content: initial;
}

/* Back into normal flow, sitting above the page card rather than beside it. */
#nav-pill {
    position: relative;
    width: fit-content;
    max-width: calc(100% - 24px);
    margin: 20px auto 0;
    flex-wrap: wrap;
    justify-content: center;
}

/* Nav is in flow now, so the old fixed-header offset would double the gap. */
.page-shell {
    margin-top: 22px;
    min-height: 0;
}

@media (max-width: 720px) {
    .page-shell { margin-top: 16px; }
    #nav-pill   { gap: 4px; padding: 5px; }
}

/* ── Page typography ─────────────────────────────────────────────────────────
   head.php scopes these to #main-content, which the SPA used and .page-shell
   does not — so body copy was falling back to browser defaults. Same values. */
.page-shell p {
    font-family: 'Nunito', sans-serif;
    font-size: 1.05rem;
    color: #2a3a2a;
    line-height: 1.75;
    margin-bottom: 16px;
}
.page-shell h2 {
    font-family: 'Fredoka One', sans-serif;
    color: #1a4a1a;
    font-size: 1.35rem;
    margin: 26px 0 10px;
}
.page-shell h2:first-of-type { margin-top: 14px; }

/* ── Lightbox chrome ─────────────────────────────────────────────────────────
   The nav is dismissed rather than dimmed while the viewer is open — it reads as
   clutter floating over the artwork. visibility, not display, so nothing reflows
   underneath and the pill returns to exactly where it was.                    */
#nav-pill { transition: opacity 0.16s ease; }
body.lb-open #nav-pill { opacity: 0; visibility: hidden; pointer-events: none; }

#art-lb-x {
    position: absolute;
    top: 10px;
    right: 14px;
    z-index: 2;
    background: none;
    border: none;
    font-family: 'Fredoka One', sans-serif;
    font-size: 1.9rem;
    line-height: 1;
    color: #7a8a7a;
    cursor: pointer;
    padding: 2px 6px;
    -webkit-tap-highlight-color: transparent;
}
#art-lb-x:hover { color: #1a4a1a; }

/* Desktop closes with the corner X or a click on the backdrop; the "back" idiom
   belongs to the full-screen sheet, so it only appears on narrow widths. */
#art-lightbox-close { display: none; }
@media (max-width: 720px) {
    #art-lightbox-close { display: flex; }
    #art-lb-x { top: 6px; right: 8px; font-size: 1.7rem; }
}

/* ── Sliding pill strip ──────────────────────────────────────────────────────
   One tidy row that scrolls sideways rather than wrapping to two rows. The
   overflow is on #nav-track, not #nav-pill, so the pill's backdrop-filter is
   never the scrolling element.                                               */
#nav-pill { flex-wrap: nowrap; overflow: hidden; max-width: calc(100% - 20px); }

#nav-track {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;               /* Firefox */
    -ms-overflow-style: none;
}
#nav-track::-webkit-scrollbar { display: none; }
#nav-track > .nav-btn { flex: 0 0 auto; }

@media (prefers-reduced-motion: reduce) {
    #nav-track { scroll-behavior: auto; }
}
