/* Baseline: small structural rules that theme.json cannot express. */

html {
    scroll-behavior: smooth;
}

body {
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body {
    overflow-x: hidden;
}

/* Wireframe placeholder: apply to any group or image to show a hatched box. */
.is-style-placeholder,
.wf-placeholder {
    background-color: var(--wp--preset--color--gray-010);
    background-image: repeating-linear-gradient(
        135deg,
        transparent 0 10px,
        var(--wp--preset--color--gray-020) 10px 11px
    );
    border: 1px solid var(--wp--preset--color--gray-030);
    border-radius: 4px;
    min-height: 8rem;
}

/* --- Accessibility -------------------------------------------------------- */

/* One focus style everywhere, visible on light and dark backgrounds. */
:focus-visible {
    outline: 2px solid var(--wp--preset--color--gray-090);
    outline-offset: 2px;
    border-radius: 2px;
}
:is(.has-gray-080-background-color, .has-gray-090-background-color, .has-black-background-color) :focus-visible {
    outline-color: var(--wp--preset--color--white);
}

.screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}
.screen-reader-text:focus {
    position: static !important;
    width: auto;
    height: auto;
    margin: 0;
    padding: var(--wp--preset--spacing--8) var(--wp--preset--spacing--16);
    clip: auto;
    clip-path: none;
    white-space: normal;
    background: var(--wp--preset--color--white);
    color: var(--wp--preset--color--gray-090);
    z-index: 100000;
}

/* Respect motion preferences. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
}

/* Minimum target size for inline controls (WCAG 2.5.8). */
.wp-block-navigation-item__content,
.wp-block-button__link {
    min-height: 24px;
    min-width: 24px;
}

/* --- Responsive ------------------------------------------------------------
   Columns already stack on mobile. These rules cover the layouts core keeps rigid:
   fixed grid column counts, fixed flex sizes, and no-wrap flex rows. */

@media (max-width: 1024px) {
    .wp-block-group.is-layout-grid,
    .wp-block-post-template.is-layout-grid {
        grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
    }
}

@media (max-width: 781px) {
    .wp-block-group.is-layout-grid,
    .wp-block-post-template.is-layout-grid {
        grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
    }
    /* A grid with the class baseline-stack-mobile goes to one column (a design that stacks cards on phones). */
    .baseline-stack-mobile.is-layout-grid {
        grid-template-columns: minmax(0, 1fr);
    }
    /* Fixed and fill flex sizes become full width. */
    .is-layout-flex > [class*="wp-container-content-"] {
        flex-basis: 100% !important;
        max-width: 100%;
    }
    /* No-wrap rows wrap, except tiny inline pairs. */
    .is-layout-flex.is-nowrap:not(.baseline-logo):not(.baseline-profile):not(.baseline-tabs__tab):not(.wp-block-buttons) {
        flex-wrap: wrap !important;
    }
    /* Kit fixed heights on hero-like sections relax. */
    .baseline-section[style*="min-height"] {
        min-height: 0 !important;
    }
}

@media (max-width: 600px) {
    /* Headings never overflow the viewport. */
    h1, h2, h3 { overflow-wrap: anywhere; }
    /* Buttons rows stack when they have to. */
    .wp-block-buttons { flex-wrap: wrap; }
    /* Two-up column layouts inside cards go single. */
    .wp-block-columns.is-not-stacked-on-mobile { flex-wrap: wrap !important; }
    .wp-block-columns.is-not-stacked-on-mobile > .wp-block-column { flex-basis: 100% !important; }
    /* Navigation overlay: readable size and spacing. */
    .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container {
        gap: var(--wp--preset--spacing--16);
        font-size: var(--wp--preset--font-size--display-4);
    }
}

/* A page whose content starts with a kit section: the sections carry their own padding and headline. */
.baseline-section-first main.wp-block-group { padding-top: 0 !important; }
.baseline-section-last main.wp-block-group { padding-bottom: 0 !important; }
.baseline-section-first main.wp-block-group > .wp-block-post-content > .baseline-section:first-child { margin-top: 0; }
.baseline-section-last main.wp-block-group > .wp-block-post-content > .baseline-section:last-child { margin-bottom: 0; }
