/* ================================================================
   Workshop-Manuals.com — Site Stylesheet
   Design: Clean and professional, steel blue accent
   Font:   Inter (loaded via Google Fonts in layout.php)

   Colour palette:
     --blue:        #2563EB  Steel blue — buttons, links, accents
     --navy:        #1E3A5F  Deep navy  — header, nav bar
     --bg:          #F0F4F8  Light blue-grey — page background
     --white:       #FFFFFF  Content area, cards
     --text:        #1E293B  Body text
     --text-muted:  #64748B  Secondary text, captions
     --border:      #CBD5E1  Card borders, dividers
     --hover:       #1D4ED8  Link/button hover

   Structure:
     1.  CSS custom properties (variables)
     2.  Reset and base
     3.  Typography
     4.  Layout — page shell
     5.  Site header
     6.  Sticky navigation bar
     7.  Page layout (two-column)
     8.  Cards — make grid and model grid
     9.  Manual page content
     10. Breadcrumb
     11. Prev/Next navigation
     12. Sidebar
     13. Donation popup
     14. Anchor ad
     15. AdSense placeholders (staging)
     16. Footer
     17. Utility classes
     18. Responsive — mobile overrides
================================================================ */


/* ----------------------------------------------------------------
   1. CSS Custom Properties
---------------------------------------------------------------- */
:root {
    --blue:        #2563EB;
    --navy:        #1E3A5F;
    --bg:          #F0F4F8;
    --white:       #FFFFFF;
    --text:        #1E293B;
    --text-muted:  #64748B;
    --border:      #CBD5E1;
    --hover:       #1D4ED8;

    --radius:      8px;
    --shadow-sm:   0 1px 3px rgba(0,0,0,0.08);
    --shadow-md:   0 4px 12px rgba(0,0,0,0.12);
    --transition:  0.2s ease;

    --max-width:   1200px;
    --sidebar-w:   300px;
    --header-h:    70px;
    --nav-h:       48px;
}


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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
    min-height: 100vh;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

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

a:hover {
    color: var(--hover);
    text-decoration: underline;
}


/* ----------------------------------------------------------------
   3. Typography
---------------------------------------------------------------- */
h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.2; }
h2 { font-size: 1.35rem; font-weight: 600; line-height: 1.3; }
h3 { font-size: 1.1rem;  font-weight: 600; line-height: 1.4; }
h4 { font-size: 1rem;    font-weight: 600; }

p  { margin-bottom: 1rem; }

p:last-child { margin-bottom: 0; }


/* ----------------------------------------------------------------
   4. Layout — Page Shell
---------------------------------------------------------------- */
.page-wrap {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
}


/* ----------------------------------------------------------------
   5. Site Header
---------------------------------------------------------------- */
.site-header {
    background-color: var(--navy);
    color: var(--white);
    height: var(--header-h);
    position: relative;
    z-index: 10;
}

.site-header__inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.site-header__logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--white);
    text-decoration: none;
    flex-shrink: 0;
}

.site-header__logo img {
    width: 40px;
    height: 40px;
    border-radius: 4px;
}

.site-header__site-name {
    font-size: 1.1rem;
    font-weight: 600;
    white-space: nowrap;
}

.site-header__make-logo {
    display: flex;
    align-items: center;
    margin-left: 0.5rem;
    flex-shrink: 0;
}

.site-header__make-logo img {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    background: var(--white);
    padding: 2px;
}

.site-header__title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--white);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* ----------------------------------------------------------------
   6. Sticky Navigation Bar
---------------------------------------------------------------- */
.sticky-nav {
    background-color: var(--navy);
    border-top: 1px solid rgba(255,255,255,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--nav-h);
}

.sticky-nav__inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Navigation buttons */
.nav-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--white);
    text-decoration: none;
    transition: background-color var(--transition);
    cursor: pointer;
    border: none;
    background: none;
    white-space: nowrap;
}

.nav-btn:hover,
.nav-btn:focus-visible {
    background-color: var(--blue);
    color: var(--white);
    text-decoration: none;
}

/* Chapter menu dropdown (manual pages) */
.nav-menu {
    position: relative;
    margin-left: auto; /* Push menu to the right */
}

.nav-menu > summary {
    list-style: none;
}

.nav-menu > summary::-webkit-details-marker {
    display: none;
}

.nav-menu__dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 0.5rem;
    min-width: 260px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 200;
}


/* ----------------------------------------------------------------
   7. Page Layout — Two-Column
---------------------------------------------------------------- */
.page-layout {
    max-width: var(--max-width);
    margin: 1.5rem auto;
    padding: 0 1rem;
    display: grid;
    grid-template-columns: 1fr var(--sidebar-w);
    gap: 1.5rem;
    align-items: start;
}

.page-content {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    min-width: 0; /* Prevent overflow */
}

.page-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}


/* ----------------------------------------------------------------
   8. Cards — Make Grid and Model Grid
---------------------------------------------------------------- */
.make-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 1rem;
}

.make-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition), box-shadow var(--transition);
    overflow: hidden;
}

.make-card:hover {
    border-color: var(--blue);
    box-shadow: var(--shadow-md);
}

.make-card__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 0.75rem;
    text-decoration: none;
    color: var(--text);
    gap: 0.6rem;
}

.make-card__link:hover {
    text-decoration: none;
}

.make-card__logo {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.make-card__logo img {
    max-width: 80px;
    max-height: 80px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.make-card__name {
    font-size: 0.8rem;
    font-weight: 500;
    text-align: center;
    color: var(--text);
    line-height: 1.3;
}

/* Model grid (make pages) */
.model-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 1rem;
}

.model-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition), box-shadow var(--transition);
    overflow: hidden;
}

.model-card:hover {
    border-color: var(--blue);
    box-shadow: var(--shadow-md);
}

.model-card__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    text-decoration: none;
    color: var(--text);
    gap: 0.6rem;
}

.model-card__image {
    width: 100%;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.model-card__image img {
    max-height: 130px;
    width: auto;
    object-fit: contain;
}

.model-card__name {
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
}


/* ----------------------------------------------------------------
   9. Manual Page Content
   The manual HTML files are 918px wide with absolutely-positioned
   text. We scale the entire block on mobile using JS transform.
---------------------------------------------------------------- */
.manual-page-wrapper {
    width: 100%;
    overflow: hidden;
}

.manual-page-scaler {
    transform-origin: top left;
    /* JS sets transform: scale() on mobile */
}

/* The manual content div injected from the HTML file */
.man-page-div {
    position: relative;
}

/* All images inside manual content — never overflow */
#content-area img {
    max-width: 100%;
}


/* ----------------------------------------------------------------
   10. Breadcrumb
---------------------------------------------------------------- */
.breadcrumb {
    margin-bottom: 1rem;
}

.breadcrumb__list {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    gap: 0.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.breadcrumb__item + .breadcrumb__item::before {
    content: '/';
    margin-right: 0.25rem;
    color: var(--border);
}

.breadcrumb__item a {
    color: var(--blue);
}

.breadcrumb__item a:hover {
    color: var(--hover);
}


/* ----------------------------------------------------------------
   11. Prev/Next Navigation
---------------------------------------------------------------- */
.prev-next {
    display: flex;
    gap: 0.75rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.prev-next--bottom {
    margin-top: 1.5rem;
}

.prev-btn,
.next-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--blue);
    color: var(--white);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background-color var(--transition);
    line-height: 1.4;
}

.prev-btn:hover,
.next-btn:hover {
    background: var(--hover);
    color: var(--white);
    text-decoration: none;
}

.prev-btn { margin-right: auto; }
.next-btn { margin-left: auto; }


/* ----------------------------------------------------------------
   12. Sidebar
---------------------------------------------------------------- */
.page-sidebar > * {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1rem;
}

.sidebar-search__input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
    margin-bottom: 0.5rem;
}

.sidebar-search__input:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

.sidebar-search__btn {
    width: 100%;
    padding: 0.5rem;
    background: var(--blue);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background-color var(--transition);
}

.sidebar-search__btn:hover {
    background: var(--hover);
}

.sidebar-nav {
    max-height: 500px;
    overflow-y: auto;
}

.sidebar-donate {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.sidebar-donate a {
    color: var(--blue);
}


/* ----------------------------------------------------------------
   13. Donation Popup
---------------------------------------------------------------- */
.popup {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup[hidden] {
    display: none;
}

.popup__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    cursor: pointer;
}

.popup__box {
    position: relative;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    max-width: 480px;
    width: 90%;
    z-index: 1;
    animation: popup-slide-in 0.3s ease;
}

@keyframes popup-slide-in {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.popup__close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
}

.popup__close:hover { color: var(--text); }

.popup__content h3 {
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.popup__content p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.popup__divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1rem 0;
}

.popup__share-links {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background-color var(--transition), opacity var(--transition);
    margin-bottom: 0.5rem;
}

.btn--primary  { background: var(--blue);    color: var(--white); width: 100%; }
.btn--paypal   { background: #003087;        color: var(--white); width: 100%; }
.btn--kofi     { background: #FF5E5B;        color: var(--white); width: 100%; }

.btn--primary:hover { background: var(--hover); }
.btn--paypal:hover  { background: #002060; }
.btn--kofi:hover    { opacity: 0.9; }


/* ----------------------------------------------------------------
   14. Mobile Anchor Ad
---------------------------------------------------------------- */
.anchor-ad {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-top: 1px solid var(--border);
    z-index: 500;
    padding: 0.25rem;
    text-align: center;
}

.anchor-ad__close {
    position: absolute;
    top: 0.25rem;
    right: 0.5rem;
    background: none;
    border: none;
    font-size: 1rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}


/* ----------------------------------------------------------------
   15. AdSense Placeholders (staging mode only)
---------------------------------------------------------------- */
.ad-placeholder {
    background: #EEF2FF;
    border: 2px dashed var(--blue);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    color: var(--blue);
    font-size: 0.8rem;
    font-weight: 500;
    min-height: 90px;
}

.ad-wrap--leaderboard { min-height: 90px;  margin-bottom: 1rem; }
.ad-wrap--sidebar     { min-height: 250px; }


/* ----------------------------------------------------------------
   16. Footer
---------------------------------------------------------------- */
.site-footer {
    background: var(--navy);
    color: rgba(255,255,255,0.7);
    padding: 1.5rem 1rem;
    margin-top: 2rem;
}

.site-footer__inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
    font-size: 0.875rem;
}

.site-footer a {
    color: rgba(255,255,255,0.8);
}

.site-footer a:hover {
    color: var(--white);
}


/* ----------------------------------------------------------------
   17. Utility Classes
---------------------------------------------------------------- */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

.clearfix::after {
    content: '';
    display: table;
    clear: both;
}


/* ----------------------------------------------------------------
   18. Make Page — Grouped model sections
---------------------------------------------------------------- */
.model-group {
    margin-bottom: 2rem;
}

.model-group__title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--blue);
}

.model-group__title a {
    color: var(--text);
    text-decoration: none;
}

.model-group__title a:hover {
    color: var(--blue);
}

.make-description,
.make-auto-description {
    margin-bottom: 1.5rem;
    color: var(--text-muted);
    line-height: 1.7;
}

.model-card__make {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}


/* ----------------------------------------------------------------
   19. Search Page
---------------------------------------------------------------- */
.search-page-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.search-page-form__input {
    flex: 1;
    font-size: 1rem;
    padding: 0.6rem 0.9rem;
}

.search-no-results {
    color: var(--text-muted);
    margin-top: 1rem;
}

.search-result-count {
    margin-bottom: 1rem;
    color: var(--text-muted);
}


/* ----------------------------------------------------------------
   20. About & Static Pages
---------------------------------------------------------------- */
.about-content h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 1.5rem 0 0.5rem;
}

.about-content ul {
    padding-left: 1.25rem;
    line-height: 1.8;
}

.about-content a {
    color: var(--blue);
}


/* ----------------------------------------------------------------
   21. 404 Not Found
---------------------------------------------------------------- */
.not-found {
    padding: 2rem 0;
    text-align: center;
    color: var(--text-muted);
}

.not-found a {
    color: var(--blue);
}


/* ----------------------------------------------------------------
   22. Responsive — Mobile Overrides
   Breakpoint: 768px
---------------------------------------------------------------- */
@media (max-width: 768px) {

    /* Collapse to single column */
    .page-layout {
        grid-template-columns: 1fr;
        margin: 0.75rem auto;
        padding: 0 0.5rem;
        gap: 0.75rem;
    }

    /* Sidebar moves below main content on mobile */
    .page-sidebar {
        order: 2;
    }

    /* Smaller header on mobile */
    .site-header {
        height: auto;
        padding: 0.6rem 0;
    }

    .site-header__title {
        font-size: 1rem;
    }

    .site-header__site-name {
        display: none; /* Show logo only, save space */
    }

    /* Full-width nav buttons on mobile */
    .sticky-nav__inner {
        gap: 0.15rem;
        padding: 0 0.5rem;
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    .nav-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
        flex-shrink: 0;
    }

    /* Fewer columns on small screens */
    .make-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 0.6rem;
    }

    .model-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    /* Full-width prev/next on mobile */
    .prev-next {
        flex-direction: column;
    }

    .prev-btn,
    .next-btn {
        margin: 0;
        justify-content: center;
    }

    /* Page content less padding on mobile */
    .page-content {
        padding: 1rem;
        border-radius: 0;
    }

    /* Popup full-screen on mobile */
    .popup__box {
        width: 95%;
        padding: 1.25rem;
    }

    /* h1 smaller on mobile */
    h1 { font-size: 1.35rem; }
    h2 { font-size: 1.1rem; }
}
