/**
 * assets/css/layout.css
 * The structural grid: sticky header, sticky sidebar + main content, footer.
 * Responsive behavior: full sidebar on desktop, a narrower sidebar on tablet,
 * and a hidden sidebar on mobile (replaced by the mobile menu built in Phase 2.3).
 *
 * Depends on tokens from variables.css (loaded first in header.php):
 * --header-height, --sidebar-width, --content-max-width, --color-*, --space-*.
 */

/* ---------------------------------------------------------------------------
   HEADER
--------------------------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: 0 var(--space-6);
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.site-header__brand,
.site-header__actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* ---------------------------------------------------------------------------
   PAGE WRAPPER (sidebar + main content)
--------------------------------------------------------------------------- */
.page-wrapper {
    display: flex;
    align-items: flex-start;
    width: 100%;
}

/* ---------------------------------------------------------------------------
   SIDEBAR (desktop: fixed width, sticky under the header)
--------------------------------------------------------------------------- */
.sidebar {
    flex: 0 0 var(--sidebar-width);
    width: var(--sidebar-width);
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    background-color: var(--color-surface);
    border-right: 1px solid var(--color-border);
    padding: var(--space-6) var(--space-4);
}

.sidebar__nav ul {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.sidebar__nav a {
    display: block;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    font-weight: var(--fw-medium);
    color: var(--color-text-muted);
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.sidebar__nav a:hover {
    background-color: var(--color-primary-light);
    color: var(--color-primary-dark);
}

/* Active section — Phase 2.2 will toggle this class via a scroll listener */
.sidebar__nav a.is-active {
    background-color: var(--color-primary-light);
    color: var(--color-primary-dark);
    font-weight: var(--fw-semibold);
}

/* ---------------------------------------------------------------------------
   MAIN CONTENT
--------------------------------------------------------------------------- */
.main-content {
    flex: 1 1 auto;
    min-width: 0; /* prevents flex overflow with wide content */
    padding: var(--space-8) var(--space-6);
}

.main-content > section {
    max-width: var(--content-max-width);
    margin: 0 auto var(--space-10) auto;
}

/* ---------------------------------------------------------------------------
   FOOTER
--------------------------------------------------------------------------- */
.site-footer {
    background-color: var(--color-surface-alt);
    border-top: 1px solid var(--color-border);
    padding: var(--space-8) var(--space-6);
    color: var(--color-text-muted);
    font-size: var(--fs-sm);
}

/* Step 17.1b — contact info / social links / copyright inside .site-footer */
.site-footer__inner {
    max-width: var(--content-max-width);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
    text-align: center;
}

.site-footer__contact {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
}

.site-footer__email {
    color: var(--color-text-muted);
    text-decoration: none;
}

.site-footer__email:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.site-footer__social {
    display: flex;
    gap: var(--space-3);
}

.site-footer__social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border-strong);
}

.site-footer__social-link:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.site-footer__copyright {
    margin: 0;
    font-size: var(--fs-sm);
}

/* ---------------------------------------------------------------------------
   RESPONSIVE BREAKPOINTS
--------------------------------------------------------------------------- */

/* Tablet: narrower sidebar */
@media (max-width: 1024px) {
    .sidebar {
        flex-basis: 180px;
        width: 180px;
        padding: var(--space-4) var(--space-3);
    }

    .main-content {
        padding: var(--space-6) var(--space-4);
    }
}

/* Mobile: hide the desktop sidebar entirely; Phase 2.3 adds the mobile menu
   (hamburger toggle + floating WhatsApp button) that replaces it. */
@media (max-width: 768px) {
    .page-wrapper {
        flex-direction: column;
    }

    .sidebar {
        display: none;
    }

    .main-content {
        width: 100%;
        padding: var(--space-5) var(--space-4);
    }

    .site-header {
        padding: 0 var(--space-4);
    }
}
