/* ============================================================
   Suththa.org — Header search + mobile drawer
   ============================================================ */

/* Desktop: the drawer & its button stay hidden */
.nav-more-toggle {
    display: none;
}

.nav-drawer,
.nav-drawer-backdrop {
    display: none;
}

/* ---------------- Search area (below the header) ---------------- */
#header-search-slot {
    width: 100%;
    padding: 10px 16px;
    box-sizing: border-box;
}

/* pages that have no search UI (dictionary/notes/bookmarks) */
#header-search-slot:empty {
    display: none;
}

.search-area-inner {
    width: 100%;
    display: flex;
    justify-content: center;
}

#search-box {
    width: min(100%, 900px);
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---------------- Mobile (<= 768px) ---------------- */
@media (max-width: 768px) {

    /* Desktop nav hide */
    .nav-links {
        display: none !important;
    }

    /* Right-align header actions */
    .app-header > .header-actions {
        margin-left: auto;
    }

    /* Drawer button */
    .nav-more-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* ---------------- Right drawer ---------------- */
    .nav-drawer {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(78vw, 320px);
        z-index: 200;
        background: var(--paper-light);
        border-left: 1px solid var(--paper-dark);
        box-shadow: var(--shadow-page);
        padding: calc(var(--header-h) + 0.4rem) 0.8rem 1.2rem;
        box-sizing: border-box;
        overflow-y: auto;
        transform: translateX(105%);
        transition: transform 0.25s ease;
        pointer-events: none;
    }
    .nav-drawer.open {
        transform: translateX(0);
        pointer-events: auto;
    }

    .nav-drawer-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 190;
        background: rgba(40, 28, 10, 0.35);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s ease, visibility 0.2s ease;
    }
    .nav-drawer-backdrop.show {
        opacity: 1;
        visibility: visible;
    }
    [data-theme='dark'] .nav-drawer-backdrop {
        background: rgba(0, 0, 0, 0.55);
    }

    .drawer-title {
        font-family: var(--font-sinhala-heading);
        font-weight: 700;
        color: var(--accent-deep);
        padding: 0 0.4rem 0.6rem;
        border-bottom: 1px solid var(--paper-edge);
        margin-bottom: 0.5rem;
    }

    .drawer-nav {
        display: flex;
        flex-direction: column;
    }
    .drawer-nav a {
        display: block;
        width: 100%;
        box-sizing: border-box;
        padding: 0.8rem;
        margin: 2px 0;
        border-radius: var(--radius);
        color: inherit;
        text-decoration: none;
        font-size: 1rem;
    }
    .drawer-nav a:hover,
    .drawer-nav a.active {
        background: var(--paper-deep);
        color: var(--accent-deep);
    }

    /* Reader actions (injected by app.js on the reader page) */
    .drawer-actions {
        border-top: 1px solid var(--paper-edge);
        margin-top: 0.6rem;
        padding-top: 0.6rem;
    }
    .drawer-actions:empty {
        display: none;
    }
    .drawer-actions .da-label {
        font-size: 0.8rem;
        color: var(--ink-faint);
        padding: 0 0.4rem 0.4rem;
    }
    .drawer-actions .da-row {
        display: flex;
        gap: 0.4rem;
        margin-bottom: 0.4rem;
    }
    .drawer-action {
        flex: 1 1 0;
        min-width: 0;
        border: 1px solid var(--paper-dark);
        background: var(--paper);
        color: var(--ink);
        border-radius: var(--radius);
        padding: 0.7rem 0.4rem;
        font-size: 0.9rem;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .drawer-action.primary {
        background: var(--accent);
        border-color: var(--accent-deep);
        color: var(--paper-light);
    }
    .drawer-action:active { background: var(--paper-deep); }
    .drawer-action.primary:active { background: var(--accent-deep); }

    /* ---------------- Search under the header ---------------- */
    /* not sticky — it scrolls away with the page (mobile preference) */

    /* Hide the search bar while the book-tree sidebar is open so it
       does not cover the top of the tree */
    body.suth-sidebar-open #header-search-slot {
        visibility: hidden;
    }

    /* Search wraps into rows on small screens */
    #search-box {
        flex-wrap: wrap;
    }
    #search-box .search-input-wrap {
        flex: 1 1 100%;
    }
    .search-filters {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}
/* ============================================================
   Suththa.org — Site Footer
   ============================================================ */

.site-footer {
    width: 100%;
    margin-top: 3rem;
    border-top: 1px solid var(--paper-edge);
    background: var(--paper-deep);
    color: var(--ink-soft);
}

.footer-inner {
    max-width: var(--content-max, 1200px);
    margin: 0 auto;
    padding: 1.5rem 1rem 1.2rem;
    text-align: center;
}

.footer-brand {
    margin-bottom: 0.7rem;
}

.footer-title {
    font-family: var(--font-sinhala-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-deep);
}

.footer-subtitle {
    margin-top: 0.2rem;
    font-size: 0.78rem;
}

.footer-sites {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.55rem;
    margin-top: 0.8rem;
    font-size: 0.75rem;
}

.footer-sites a {
    color: var(--accent-deep);
    text-decoration: none;
}

.footer-sites a:hover {
    text-decoration: underline;
}

.footer-sites span {
    color: var(--ink-faint);
}

.footer-copy {
    margin-top: 0.65rem;
    font-size: 0.7rem;
    color: var(--ink-faint);
}

@media (max-width: 768px) {
    .footer-inner {
        padding: 1.2rem 0.8rem 1rem;
    }

    .footer-title {
        font-size: 0.95rem;
    }

    .footer-subtitle {
        font-size: 0.74rem;
    }

    .footer-sites {
        font-size: 0.72rem;
    }
}