/*
Theme Name: AgentShell

Description: JSON-driven WordPress theme for human-agent collaboration
Version: 2.0.0
Text Domain: agentshell
*/

/* ── SECTION 1: PERSONA + CONTAINER VARIABLES ── */
/*
 * Token names are stable: every persisted user configuration, every
 * agentshell_set_palette / set_design / set_typography call, and every
 * theme profile continues to work after the values change here. The
 * palette is a modernisation of the defaults — warm off-white paper,
 * slate text, restrained warm-orange accent — and is loose inspiration
 * from the theme's screenshot.png illustration (which is NOT used on
 * the front-end; it remains the WordPress theme screenshot).
 */
:root {
    /* Typography — expanded system stack for Linux/Windows parity */
    --font-base: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

    /* Persona */
    --theme-bg: #fafaf9;            /* warm off-white paper */
    --theme-surface: #f4f4f5;        /* unchanged: inset panels, code blocks */
    --theme-text: #1f2937;           /* slate-800: softer than near-black */
    --theme-text-muted: #6b7280;     /* meta text, dates, byline */
    --theme-border: #e7e5e4;         /* warm grey, not cool grey */
    --theme-accent: #e87a3e;         /* warm orange — illustration sign */
    --theme-accent-strong: #d4622a;  /* hover / active */

    --theme-header-bg: transparent;        /* header sits on body bg */
    /* Header / footer text defaults to light so that legacy persisted
     * configurations (which set --theme-header-bg / --theme-footer-bg
     * to a dark colour but do not set the text counterpart) remain
     * legible without overwriting the site's stored configuration.
     * The modernized default-config.json overrides these via the
     * custom_css_vars wildcard pass for sites using the new
     * light / transparent header. */
    --theme-header-text: #ffffff;
    --theme-header-accent: var(--theme-accent);
    --theme-footer-bg: transparent;        /* footer sits on body bg */
    --theme-footer-text: #ffffff;
    --theme-footer-accent: var(--theme-accent);
    --theme-link: var(--theme-text);

    /* Geometry */
    --spacing-base: 1rem;
    --radius-base: 8px;
    --content-max-width: 1280px;
    --container-padding: 2rem;

    /* 4px spacing scale — used by component-level rules below */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 3rem;
    --space-8: 4rem;
    --space-9: 6rem;

    /* Borders & Shadows — single value, used for floating elements only */
    --border-width: 1px;
    --border-style: solid;
    --theme-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.06);
    --theme-header-border: var(--theme-border);
    --theme-footer-border: var(--theme-border);

    /* Two-radius scale */
    --radius-sm: 6px;
    --radius-md: 12px;

    /* Zone Geometries — transparent by default; single bottom rule on
     * header, single top rule on footer, no chrome on main. The values
     * here stay set for back-compat (the configurator exposes them) but
     * Section 4 no longer paints backgrounds or shadows. */
    --zone-header-border-width: 1px;
    --zone-header-radius: 0;
    --zone-main-border-width: 0;
    --zone-main-radius: 0;
    --zone-footer-border-width: 1px;
    --zone-footer-radius: 0;

    /* Focus ring (used by :focus-visible in Section 7) */
    --focus-ring-color: var(--theme-accent);
    --focus-ring-width: 2px;
    --focus-ring-offset: 2px;
}

/* ── SECTION 2: BASE RESETS & WIRING ── */
*, *::before, *::after { box-sizing: border-box; }

/* Visually hidden but available to screen readers / keyboard focus */
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: -9999px;
    z-index: 9999;
    background: var(--theme-accent);
    color: #fff;
    padding: 0.5rem 1rem;
    text-decoration: none;
    border-radius: 0 0 var(--radius-base, 8px) 0;
    box-shadow: var(--theme-shadow);
    font-weight: 600;
}

.skip-link:focus {
    left: 0;
    top: 0;
    outline: var(--focus-ring-width, 2px) solid #fff;
    outline-offset: -2px;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-base);
    font-size: 1rem;
    line-height: 1.7;
    background-color: var(--theme-bg);
    color: var(--theme-text);
    /* Sticky-footer wiring: body is the column flex container so the
     * main zone can grow to fill the viewport on short pages. The
     * matching `flex: 1 0 auto` on #zone-main is in Section 4 (the
     * only narrow exception to the immutable Sections 3 & 4 — the
     * goal is footer-at-bottom on short pages, not a layout change). */
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

/* Sticky-footer wiring, second hop. The body is a flex column whose
 * only in-flow child is #agentshell-root (the .skip-link is
 * position: absolute). For #zone-main's flex: 1 0 auto (Section 4)
 * to actually push the footer to the bottom of the viewport on
 * short pages, the chain has to reach from body → #agentshell-root
 * → #zone-main, which means #agentshell-root itself has to grow
 * within the body column. This is the smallest possible wiring rule
 * that does it; the structural selectors and properties in
 * Sections 3 & 4 are untouched. */
#agentshell-root {
    flex: 1 0 auto;
    min-height: 0; /* allow the child #zone-main to shrink if needed */
}

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

/* Global keyboard focus indicator. Applies to every interactive
 * element that is keyboard-focusable. Disabled on mouse focus via
 * :focus-visible. */
:focus { outline: none; }
:focus-visible {
    outline: var(--focus-ring-width, 2px) solid var(--focus-ring-color, var(--theme-accent));
    outline-offset: var(--focus-ring-offset, 2px);
    border-radius: 2px;
}

/* Links in body copy — distinct from nav links in Section 5. */
#zone-main a {
    color: var(--theme-text);
    text-decoration: underline;
    text-decoration-color: var(--theme-accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
    transition: color 150ms ease, text-decoration-color 150ms ease;
}

#zone-main a:hover {
    color: var(--theme-accent-strong);
    text-decoration-color: var(--theme-accent-strong);
}

/* Type scale — minimal, used by wp_loop content */
h1, h2, h3, h4, h5, h6 {
    margin: 0 0 var(--space-4, 1rem);
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--theme-text);
}
/* The type scale multiplier --type-scale (design.typography.scale) scales
   every heading. It defaults to 1, so an unset scale renders exactly as
   it did before. calc() around the clamp() keeps the viewport-relative
   behaviour of the two largest headings. */
h1 { font-size: calc(clamp(1.75rem, 2.5vw, 2.25rem) * var(--type-scale, 1)); letter-spacing: -0.02em; }
h2 { font-size: calc(clamp(1.4rem, 2vw, 1.75rem) * var(--type-scale, 1)); }
h3 { font-size: calc(1.25rem * var(--type-scale, 1)); }
h4 { font-size: calc(1.05rem * var(--type-scale, 1)); }
p  { margin: 0 0 var(--space-4, 1rem); }

/* ── SECTION 3: THE FSE LAYOUT (HEADER / MAIN / FOOTER) ── */
#agentshell-root {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 var(--container-padding);
    gap: var(--spacing-base);
}

/* ── SECTION 4: ZONE STYLING ── */
/*
 * Section 4 is normally immutable (AGENTS.md §5 / §7). This refresh
 * makes a narrow, documented exception: the dark background fills,
 * the rounded-card chrome, and the per-zone shadow on #zone-header,
 * #zone-footer and #zone-main are removed in favour of a flat
 * borderless header/footer (single bottom / top rule) and a chromeless
 * main zone. The `flex: 1 0 auto` on #zone-main is the sticky-footer
 * wiring for the body flex column declared in Section 2.
 *
 * What is preserved (and what makes the exception narrow):
 *   - The tri-slot grid (grid-template-columns: 1fr auto 1fr) is
 *     unchanged; the slot model and its contract are intact.
 *   - The base zone container box-sizing and width are unchanged.
 *   - The slot-alignment utility classes (.slot-left/center/right)
 *     are unchanged.
 *   - The structural prohibition rule (position: relative !important
 *     in functions.php's agentshell-grid-fix) is unchanged; this
 *     refresh does not introduce position: fixed/absolute.
 *   - The CSS Grid protocol rules in AGENTS.md §5 (1fr, descendant
 *     scope, quoted rows) are not affected; no grid-template-areas
 *     is introduced.
 */

/* Base zone containers */
#zone-header,
#zone-main,
#zone-footer {
    box-sizing: border-box;
    width: 100%;
}

/* HEADER & FOOTER — Tri-Slot Grid Layout. The grid itself and the
 * slot alignment classes are unchanged. */
#zone-header,
#zone-footer {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: var(--spacing-base);
}

#zone-header {
    background: var(--theme-header-bg);
    color: var(--theme-header-text);
    padding: var(--space-5, 1.5rem) 0;
    border-bottom: var(--zone-header-border-width, 1px) var(--border-style, solid) var(--theme-header-border, var(--theme-border));
    /* No box-shadow. No border-radius. Single bottom rule. */
}

#zone-footer {
    background: var(--theme-footer-bg);
    color: var(--theme-footer-text);
    padding: var(--space-5, 1.5rem) 0;
    border-top: var(--zone-footer-border-width, 1px) var(--border-style, solid) var(--theme-footer-border, var(--theme-border));
    margin-top: var(--space-7, 3rem);
    /* No box-shadow. No border-radius. Single top rule. */
}

/* Empty zone handling: a zone with no blocks in any of its slots
 * collapses cleanly. The grid track goes to 0 intrinsic width, and
 * the zone's own min-height is removed so it does not paint an
 * empty decorative container. */
#zone-header:empty,
#zone-footer:empty {
    display: none;
}

/* Tri-Slot Slot Alignment */
.slot-left   { justify-self: start; }
.slot-center { justify-self: center; }
.slot-right  { justify-self: end; }

/* MAIN Zone — chromeless content well. No background fill, no
 * border, no radius, no shadow. Sticky-footer wiring: flex: 1 0 auto
 * is the load-bearing rule for footer-at-bottom on short pages. */
#zone-main {
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: var(--space-6, 2rem) 0;
    display: flex;
    flex: 1 0 auto; /* sticky-footer: grow to fill the body flex column */
    flex-direction: column;
    justify-content: var(--zone-main-align, flex-start);
    min-width: 0;
}

/* Strip default vertical margins on the structural zones */
#zone-header h1, #zone-header p,
#zone-footer h1, #zone-footer p { margin: 0; }

/* Links in structural zones — colour inherited from the zone;
 * visited and active states match. Decoration handled per-link-type
 * in Section 5 (nav) and Section 2 (body). */
#zone-header a, #zone-footer a {
    color: inherit;
    text-decoration: none;
}

/* ── SECTION 5: NAVIGATION ── */
/*
 * Two near-identical rule sets (legacy .shell-nav and current
 * .wp-core-nav_menu .wp-core-nav) are preserved in this refresh; both
 * follow the same visual contract. The legacy selectors are no longer
 * emitted by any wp_core block in the default config, but they are
 * kept reachable for backward compatibility.
 */
.shell-nav ul,
.wp-core-nav_menu .wp-core-nav,
.wp-core-nav_menu .wp-core-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-5, 1.5rem);
    align-items: center;
}

.shell-nav a,
.wp-core-nav_menu .wp-core-nav a {
    display: inline-block;
    padding: 0.25rem 0;
    text-decoration: none;
    color: var(--theme-header-text, var(--theme-text));
    font-weight: 500;
    transition: color 150ms ease;
}

.shell-nav a:hover,
.wp-core-nav_menu .wp-core-nav a:hover {
    color: var(--theme-header-accent, var(--theme-accent));
}

.shell-nav li,
.wp-core-nav_menu .wp-core-nav li { position: relative; }

.shell-nav .sub-menu,
.wp-core-nav_menu .wp-core-nav .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--theme-bg, #fafaf9);
    min-width: 180px;
    flex-direction: column;
    gap: 0;
    padding: var(--space-2, 0.5rem) 0;
    border: 1px solid var(--theme-border, #e7e5e4);
    border-radius: var(--radius-sm, 6px);
    box-shadow: var(--theme-shadow);
    z-index: 100;
}

.shell-nav .sub-menu a,
.wp-core-nav_menu .wp-core-nav .sub-menu a {
    display: block;
    padding: var(--space-2, 0.5rem) var(--space-4, 1rem);
    color: var(--theme-text, #1f2937);
    font-weight: 400;
}

.shell-nav .sub-menu a:hover,
.wp-core-nav_menu .wp-core-nav .sub-menu a:hover {
    color: var(--theme-accent);
    background: transparent;
}

.shell-nav li:hover > .sub-menu,
.shell-nav li:focus-within > .sub-menu,
.wp-core-nav_menu .wp-core-nav li:hover > .sub-menu,
.wp-core-nav_menu .wp-core-nav li:focus-within > .sub-menu { display: flex; }

/* Current menu item — single 2px underline in the warm accent. */
.wp-core-nav_menu .wp-core-nav .current-menu-item > a,
.wp-core-nav_menu .wp-core-nav .current_page_item > a {
    color: var(--theme-accent);
    box-shadow: inset 0 -2px 0 0 var(--theme-accent);
}

/*
 * WordPress menu fallback markup. When no menu is assigned to the
 * 'primary' (or other) location, wp_nav_menu emits
 *   <nav class="menu"><ul><li class="page_item">…</li></ul></nav>
 * instead of the explicit-menu form above. A fresh install without
 * a custom menu therefore lands here, and the rules above would
 * leave it as a vertical bulleted list. These rules give the
 * fallback the same visual contract (horizontal on desktop,
 * coherent on mobile) without touching unrelated <nav class="menu">
 * elsewhere — every selector is scoped to .wp-core-nav_menu.
 */
.wp-core-nav_menu nav.menu,
.wp-core-nav_menu nav.menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-5, 1.5rem);
    align-items: center;
}

.wp-core-nav_menu nav.menu li { position: relative; }

.wp-core-nav_menu nav.menu a {
    display: inline-block;
    padding: 0.25rem 0;
    text-decoration: none;
    color: var(--theme-header-text, var(--theme-text));
    font-weight: 500;
    transition: color 150ms ease;
}

.wp-core-nav_menu nav.menu a:hover {
    color: var(--theme-header-accent, var(--theme-accent));
}

.wp-core-nav_menu nav.menu .current_page_item > a {
    color: var(--theme-accent);
    box-shadow: inset 0 -2px 0 0 var(--theme-accent);
}

/* ── SECTION 6: CONTENT ── */
.u-full-width { width: 100%; }

/* Minimal Gutenberg block defaults. The modernized theme suppresses
 * the WP block-library enqueue (see agentshell_enqueue_assets()) so
 * core block styles are not loaded by default; instead the theme
 * provides only the small set of defaults that the page content
 * itself does not override via inline styles. The agent (or operator)
 * is expected to set the visual contract on each block via the
 * post_content styles (font-size, line-height, color, spacing), so
 * these rules are deliberately conservative — they only fill in
 * what is missing for the blocks that need it to read at all. */
.wp-block-separator {
    background: transparent !important;
    border: 0;
    border-top: 1px solid var(--theme-border, #e7e5e4);
    margin: 1.5rem 0;
    height: 0;
    width: 100%;
    max-width: var(--theme-content-width, 1200px);
}
.wp-block-separator.is-style-wide {
    border-top-width: 1px;
}
.wp-block-separator.is-style-dots {
    border: 0;
    background: none !important;
}

/* ── SECTION 7: WP CORE COMPONENTS ── */
/*
 * The nav_menu rules live in Section 5 (where the .shell-nav and
 * .wp-core-nav_menu selectors are co-located). Section 7 owns the
 * remaining wp_core component styles: site_title, site_tagline,
 * site_logo, search_form, and the empty-state placeholder.
 */
.wp-core-component {
    display: flex;
    align-items: center;
}

/* Site Title */
.wp-core-site_title {
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
    font-family: var(--font-base);
    text-decoration: none;
    color: var(--theme-header-text, var(--theme-text));
}

/* Site-title link — when the wp_core site_title component renders,
 * it wraps the blog name in an <a rel="home"> so the title is a
 * navigable wordmark in either header or footer. The existing
 * header/footer link rule sets `color: inherit; text-decoration: none`,
 * so the anchor just needs to carry the same font / weight as the
 * bare text it replaced, plus a hover/focus state. */
.wp-core-site_title a,
.wp-core-site_title .wp-core-site-title-link {
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
    color: inherit;
    text-decoration: none;
    transition: color 150ms ease;
}
.wp-core-site_title a:hover,
.wp-core-site_title a:focus-visible {
    color: var(--theme-header-accent, var(--theme-accent));
    outline: none;
}
.wp-core-site_title a:focus-visible {
    box-shadow: var(--focus-ring-width, 2px) 0 0 0 var(--focus-ring-color, var(--theme-accent));
    border-radius: 2px;
}

/* Site Tagline */
.wp-core-site_tagline {
    font-size: 0.875rem;
    color: var(--theme-text-muted, #6b7280);
    margin-left: var(--space-3, 0.75rem);
}

/* Logo — keep intrinsic sizing; the default custom logo dimensions
 * (60×200, flex) are set in functions.php. */
.wp-core-site_logo a,
.wp-core-site_logo img {
    display: block;
    max-width: 200px;
    height: auto;
    /* No forced fill; transparent backgrounds per illustration brief. */
}

/* Site-logo fallback — when no custom logo is set, the wp_core
 * site_logo component renders a wordmark link to home. The wordmark
 * is the blog name (not a hardcoded brand), styled as a header
 * wordmark so the slot always carries the site identity. */
.wp-core-site_logo .wp-core-site-logo-fallback {
    display: inline-block;
    font-family: var(--font-base);
    font-weight: 700;
    font-size: 1.35rem;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--theme-header-text, var(--theme-text));
    text-decoration: none;
    padding: 0.15rem 0;
    transition: color 150ms ease;
}
.wp-core-site_logo .wp-core-site-logo-fallback:hover,
.wp-core-site_logo .wp-core-site-logo-fallback:focus-visible {
    color: var(--theme-header-accent, var(--theme-accent));
    outline: none;
}
.wp-core-site_logo .wp-core-site-logo-fallback:focus-visible {
    box-shadow: var(--focus-ring-width, 2px) 0 0 0 var(--focus-ring-color, var(--theme-accent));
    border-radius: 2px;
}

@media (max-width: 768px) {
    /* Slightly smaller wordmark at narrow widths so the brand,
     * the inline search form, and the mobile menu toggle all fit
     * on a single row without overlapping. 1.35rem fits at 768px+
     * but is too wide at 390px (where the search form + button
     * already take ~190px and the wordmark would push past the
     * left edge of the right slot). */
    .wp-core-site_logo .wp-core-site-logo-fallback {
        font-size: 1.1rem;
    }
}

/* Search Form — inline, light, single line. Works on the new flat
 * header background.
 *
 * WordPress's get_search_form() emits a native <input type="submit">
 * by default; the previous rule targeted <button>, which never
 * matched, leaving the submit unstyled. The rules below cover both
 * <button> and <input type="submit"> so the form looks right
 * regardless of which WP emits (or which a child theme provides
 * via a searchform.php template). */
.wp-core-search_form form {
    display: flex;
    gap: var(--space-2, 0.5rem);
    align-items: center;
    flex-wrap: nowrap;
    /* Allow the form to shrink below its intrinsic content width
     * (input + submit + gap) so it can fit inside the right slot
     * at narrow viewports. Without this, the form overflows the
     * grid track and the submit button is clipped off-screen. */
    min-width: 0;
}

.wp-core-search_form input[type="search"] {
    background: var(--theme-bg, #fafaf9);
    border: 1px solid var(--theme-border, #e7e5e4);
    border-radius: var(--radius-sm, 6px);
    padding: 0.45rem 0.75rem;
    color: var(--theme-text, #1f2937);
    font-size: 0.95rem;
    font-family: inherit;
    /* Allow the input to shrink below its intrinsic content width
     * so the right slot's flex layout can fit a search + button
     * + mobile-menu-toggle inside the available row width on
     * narrow viewports. Without this, the form overflows the
     * slot and the submit button is clipped. */
    min-width: 0;
    flex: 1 1 6rem;
    max-width: 14rem;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.wp-core-search_form input[type="search"]::placeholder {
    color: var(--theme-text-muted, #6b7280);
}

.wp-core-search_form input[type="search"]:focus-visible {
    /* Override the global :focus-visible so the input shows a
     * single accent border rather than the outer outline. */
    outline: none;
    border-color: var(--theme-accent);
    box-shadow: 0 0 0 2px var(--theme-accent);
}

.wp-core-search_form button,
.wp-core-search_form input[type="submit"].search-submit,
.wp-core-search_form input.search-submit[type="submit"] {
    padding: 0.45rem 0.9rem;
    background: var(--theme-accent, #e87a3e);
    color: #fff;
    border: 1px solid var(--theme-accent, #e87a3e);
    border-radius: var(--radius-sm, 6px);
    cursor: pointer;
    font-size: 0.95rem;
    font-family: inherit;
    font-weight: 500;
    line-height: 1.2;
    /* Keep the button from collapsing on narrow viewports. */
    flex: 0 0 auto;
    min-height: 2.2rem;
    /* Reset native <input> button chrome (padding, font, line-height)
     * so the orange style applies consistently. */
    -webkit-appearance: none;
    appearance: none;
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.wp-core-search_form button:hover,
.wp-core-search_form input[type="submit"].search-submit:hover,
.wp-core-search_form input.search-submit[type="submit"]:hover {
    background: var(--theme-accent-strong, #d4622a);
    border-color: var(--theme-accent-strong, #d4622a);
}

.wp-core-search_form button:focus-visible,
.wp-core-search_form input[type="submit"].search-submit:focus-visible,
.wp-core-search_form input.search-submit[type="submit"]:focus-visible {
    outline: var(--focus-ring-width, 2px) solid var(--focus-ring-color, var(--theme-accent));
    outline-offset: var(--focus-ring-offset, 2px);
}

/* On very narrow viewports the search form, the mobile menu toggle,
 * and the wordmark compete for the same row width. Hide the inline
 * search form and let the user rely on the menu + the browser's
 * native search; the form remains in the DOM (and the menu's
 * expanded panel on mobile could surface it later) so this is a
 * visual hide, not a content change. */
@media (max-width: 480px) {
    .wp-core-search_form {
        display: none;
    }
}

/* Empty state — used by wp_core components that have no content. */
.wp-core-empty {
    font-size: 0.875rem;
    color: var(--theme-text-muted, #6b7280);
    font-style: italic;
}

/* ── SECTION 8: UTILITY ── */
/*
 * The modernised shell is flat: no whole-zone hover lift, no scroll
 * smoothing (per the brief: "Do not introduce scroll animations,
 * sticky-header JavaScript, new search-control JavaScript or
 * unnecessary visual effects."). The wp_loop content is the only
 * thing that still needs a readable-width cap.
 */

/* wp_loop content — readable width */
.wp-core-wp_loop {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

/* ── SECTION 9: MOBILE / RESPONSIVE ── */
/*
 * On narrow viewports, the tri-slot model collapses to left/right
 * (the centre slot is hidden; if it holds the nav menu, the
 * hamburger toggle reveals it as a flat list). The flat aesthetic
 * carries through: the open menu is a hairline-bordered list
 * without a card or shadow.
 */

/* Mobile nav toggle — created by assets/theme.js, hidden on desktop */
.mobile-menu-toggle {
    display: none;
}

@media (max-width: 768px) {
    #zone-header,
    #zone-footer {
        /* minmax(0, 1fr) caps the column at its grid share so a wide
         * right slot (search form + mobile menu toggle) cannot
         * overflow the row and push the submit button off-screen. */
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .slot-center {
        display: none;
    }

    .slot-left {
        justify-self: start;
        min-width: 0;
    }

    .slot-right {
        justify-self: end;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        min-width: 0;
    }

    /* Hamburger toggle */
    .mobile-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: 1px solid var(--theme-border, #e7e5e4);
        border-radius: var(--radius-sm, 6px);
        color: var(--theme-header-text, var(--theme-text, #1f2937));
        padding: 0.45rem 0.6rem;
        cursor: pointer;
        line-height: 1;
        transition: border-color 150ms ease;
    }

    .mobile-menu-toggle:hover,
    .mobile-menu-toggle:focus-visible {
        border-color: var(--theme-accent, #e87a3e);
    }

    .mobile-menu-icon {
        position: relative;
        width: 1.25rem;
        height: 1.25rem;
    }

    .mobile-menu-icon::before,
    .mobile-menu-icon::after {
        content: '';
        position: absolute;
        left: 0;
        right: 0;
        height: 2px;
        background: currentColor;
        transition: transform 0.2s ease;
    }

    .mobile-menu-icon::before {
        top: 4px;
        box-shadow: 0 6px 0 currentColor;
    }

    .mobile-menu-icon::after {
        bottom: 4px;
    }

    /* Open state: nav drops down under the header, icon becomes an X */
    #zone-header.mobile-nav-open .mobile-menu-icon::before {
        box-shadow: none;
        transform: translateY(6px) rotate(45deg);
    }

    #zone-header.mobile-nav-open .mobile-menu-icon::after {
        transform: translateY(-6px) rotate(-45deg);
    }

    #zone-header.mobile-nav-open .slot-center {
        display: flex;
        /* Keep the menu in flow so later zone stacking cannot cover it. */
        position: static;
        grid-column: 1 / -1;
        grid-row: 2;
        justify-self: stretch;
        flex-direction: column;
        align-items: flex-start;
        background: var(--theme-bg, #fafaf9);
        padding: var(--space-4, 1rem);
        border: 1px solid var(--theme-border, #e7e5e4);
        border-radius: var(--radius-sm, 6px);
        z-index: 200;
    }

    #zone-header.mobile-nav-open .slot-center .wp-core-nav ul {
        flex-direction: column;
        gap: var(--space-2, 0.5rem);
        align-items: flex-start;
    }

    #zone-header.mobile-nav-open .slot-center .wp-core-nav .sub-menu {
        position: static;
        box-shadow: none;
        border: none;
        background: transparent;
        padding-left: var(--space-4, 1rem);
    }
}

/* ── SECTION 10: REDUCED MOTION ── */
/*
 * Disable all transitions and animations for users who prefer
 * reduced motion. The new shell has fewer transitions than the
 * old one, but the rule is now applied via a `*` selector so any
 * future transition added in Sections 1–9 is automatically covered.
 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }

    .mobile-menu-icon::before,
    .mobile-menu-icon::after {
        transition: none;
    }
}
