/*
 * AA Student Theme — Global Styles
 * Enhancements beyond what theme.json can express.
 */

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Focus-visible for accessibility */
*:focus-visible {
    outline: 2px solid var(--wp--preset--color--primary);
    outline-offset: 2px;
}

/* Selection color */
::selection {
    background-color: var(--wp--preset--color--accent);
}

/* Link transitions */
a {
    transition: color 0.2s ease, opacity 0.2s ease;
}

/* Frosted header (applied via template part class) */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    transition: box-shadow 0.3s ease;
}

/*
 * backdrop-filter is on a pseudo-element, not the header itself.
 * Applying backdrop-filter directly to .site-header would make it a
 * containing block for position:fixed descendants — trapping the mobile
 * nav overlay inside the header's bounds instead of the full viewport.
 */
.site-header::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background-color: color-mix(in srgb, var(--wp--preset--color--background) 90%, transparent);
}

.site-header.scrolled {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* Hide empty image placeholders — safety net for unset headshots */
.aa-headshot img[src=""],
.aa-headshot img:not([src]) {
    display: none;
}

/* Placeholder for cards without a featured image */
.aa-card .wp-block-post-featured-image {
    min-height: 180px;
    background-color: var(--wp--preset--color--surface);
    border-radius: 8px 8px 0 0;
}

/* Lock card featured images to landscape ratio.
   Set on the figure so blocks with an explicit aspectRatio attribute
   (e.g. portfolio cards at 16/9) override via inline style. */
.aa-card .wp-block-post-featured-image {
    aspect-ratio: 3 / 2;
    overflow: hidden;
}

.aa-card .wp-block-post-featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Lock single post featured images to landscape ratio */
.single-post-featured-image img,
.wp-block-post-featured-image.is-single img {
    aspect-ratio: 16 / 9;
    object-fit: cover;
    width: 100%;
}

/* Image hover lift for cards */
.aa-card img {
    transition: transform 0.3s ease;
}

.aa-card:hover img {
    transform: scale(1.03);
}

/* Subtle card hover */
.aa-card {
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.aa-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

/* Dark hero gradients — diagonal from primary toward black */
.aa-hero-think-tank,
.aa-hero-magazine {
    background: linear-gradient(
        150deg,
        var(--wp--preset--color--primary) 0%,
        color-mix(in srgb, var(--wp--preset--color--primary) 65%, black) 100%
    );
}

.aa-hero-think-tank {
    min-height: 520px;
    display: flex;
    align-items: center;
}

/* Hero gradient overlay (legacy cover block helper) */
.aa-hero-overlay {
    position: relative;
}

.aa-hero-overlay::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
            rgba(0, 0, 0, 0) 0%,
            rgba(0, 0, 0, 0.45) 100%);
    pointer-events: none;
}

/* Responsive images */
img {
    max-width: 100%;
    height: auto;
}

/* Small JS hook for sticky header shadow */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .aa-card img,
    .aa-card {
        transition: none;
    }
}

/* Mobile nav overlay — center items, larger text, spread vertically */
@media (max-width: 599px) {
    .site-header .wp-block-navigation__responsive-container.is-menu-open
    .wp-block-navigation__responsive-container-content {
        justify-content: center;
        align-items: center;
    }

    .site-header .wp-block-navigation__responsive-container.is-menu-open
    .wp-block-navigation__container {
        align-items: center;
        gap: var(--wp--preset--spacing--60);
    }

    .site-header .wp-block-navigation__responsive-container.is-menu-open
    .wp-block-navigation-item__content {
        font-size: 1.5rem !important;
        letter-spacing: 0.04em;
    }
}

/* Mobile adjustments */
@media (max-width: 640px) {
    /* Reduce hero height on small screens */
    .aa-hero-think-tank {
        min-height: 380px;
    }

    /* Tighter header on phones */
    .site-header {
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
    }

    /* Stack buttons vertically on narrow screens */
    .wp-block-buttons {
        flex-direction: column;
        align-items: flex-start;
    }
}