/* Consolidated Build comments presentation — child-theme owned. */
/* SFFLABS Comments V2 — shared Site Essentials presentation
   Normal posts use the inline shell; Community Builds use the drawer shell. */

:root {
    --comments-bg: #050608;
    --comments-panel: #0e1015;
    --comments-control: #000000;
    --comments-border: rgba(255,255,255,.12);
    --comments-border-subtle: rgba(255,255,255,.07);
    --comments-text: #f4f4f5;
    --comments-muted: #a1a1aa;
    --comments-soft: #71717a;
    --comments-accent: #38bdf8;
    --comments-accent-soft: rgba(56,189,248,.08);
    --comments-radius: 4px;

    /* Shared comments typography scale. */
    --comments-type-meta: 11px;
    --comments-type-ui: 11px;
    --comments-type-body: 13px;
    --comments-type-section: 15px;
}

[data-theme="light"] {
    --comments-bg: #f8fafc;
    --comments-panel: #ffffff;
    --comments-control: #f1f5f9;
    --comments-border: rgba(15,23,42,.18);
    --comments-border-subtle: rgba(15,23,42,.09);
    --comments-text: #0f172a;
    --comments-muted: #475569;
    --comments-soft: #64748b;
    --comments-accent: #0284c7;
    --comments-accent-soft: rgba(2,132,199,.07);
}

/* --------------------------------------------------------------------------
   Shared Build drawer component
   -------------------------------------------------------------------------- */
.comments-component {
    color: var(--comments-text);
    font-family: "JetBrains Mono", SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.comments-component .comments-list {
    padding: 6px 16px 2px;
}

.comments-component .comments-thread {
    border-bottom: 1px solid var(--comments-border-subtle);
}

.comments-component .comments-thread:last-child {
    border-bottom: 0;
}

.comments-component .comments-item {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 9px;
    padding: 13px 0;
    min-width: 0;
}

.comments-component .comments-thread-replies {
    margin-left: 28px;
    padding-left: 12px;
    border-left: 1px solid var(--comments-border);
}

/* Actual WordPress depth can continue indefinitely; visual depth intentionally
   stops after the first reply inset so narrow drawers/mobile never collapse. */
.comments-component .comments-thread-replies .comments-item {
    grid-template-columns: 25px minmax(0, 1fr);
    padding: 10px 0;
    border-top: 1px solid var(--comments-border-subtle);
}

.comments-component .comments-thread-replies .comments-item:first-child {
    border-top: 0;
}

.comments-component .comments-avatar {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border: 1px solid var(--comments-border);
    border-radius: 50%;
    background: var(--comments-control);
    color: var(--comments-muted);
    font-size: 11px;
    font-weight: 800;
}

.comments-component .comments-item-reply .comments-avatar {
    width: 25px;
    height: 25px;
    font-size: 11px;
}

.comments-component .comments-item-body {
    min-width: 0;
}

.comments-component .comments-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

.comments-component .comments-meta strong {
    color: var(--comments-text);
    font-size: var(--comments-type-body);
    font-weight: 800;
    overflow-wrap: anywhere;
}

.comments-component .comments-meta time {
    margin-left: auto;
    color: var(--comments-soft);
    font-size: var(--comments-type-meta);
    font-weight: 700;
    text-transform: uppercase;
}

.comments-component .comments-owner {
    padding: 1px 4px;
    border: 1px solid color-mix(in srgb, var(--comments-accent) 38%, transparent);
    border-radius: 3px;
    color: var(--comments-accent);
    font-size: var(--comments-type-meta);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.comments-component .comments-reply-context {
    display: block;
    margin-top: 3px;
    color: var(--comments-soft);
    font-size: var(--comments-type-meta);
    font-weight: 700;
}

.comments-component .comments-text {
    margin-top: 5px;
    color: var(--comments-muted);
    font-size: var(--comments-type-body);
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.comments-component .comments-text p {
    margin: 0 0 .65em;
}

.comments-component .comments-text p:last-child {
    margin-bottom: 0;
}

.comments-component .comments-reply {
    margin-top: 7px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--comments-soft);
    text-transform: uppercase;
    letter-spacing: .06em;
    font-size: var(--comments-type-ui);
    font-weight: 800;
    cursor: pointer;
}

.comments-component .comments-reply:hover,
.comments-component .comments-reply:focus-visible {
    color: var(--comments-accent);
    outline: none;
}

.comments-component .comments-item.is-comment-target {
    position: relative;
}

.comments-component .comments-item.is-comment-target::before {
    content: "";
    position: absolute;
    inset: 3px -7px;
    border: 1px solid color-mix(in srgb, var(--comments-accent) 48%, transparent);
    border-radius: var(--comments-radius);
    background: var(--comments-accent-soft);
    pointer-events: none;
}

.comments-component .comments-empty,
.comments-component .comments-closed,
.comments-component .comments-post-status {
    margin: 16px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: 1px solid var(--comments-border);
    border-radius: var(--comments-radius);
    background: var(--comments-panel);
    color: var(--comments-soft);
    font-size: 11px;
}

.comments-component .comments-post-status {
    border-color: color-mix(in srgb, var(--comments-accent) 36%, transparent);
    background: var(--comments-accent-soft);
    color: var(--comments-muted);
}

.comments-component .comments-empty strong,
.comments-component .comments-closed strong,
.comments-component .comments-post-status strong {
    color: var(--comments-text);
    font-size: 11px;
}

.comments-component .comments-compose {
    padding: 15px 16px 20px;
    border-top: 1px solid var(--comments-border);
    background: color-mix(in srgb, var(--comments-panel) 78%, var(--comments-bg));
}

.comments-component .comment-respond,
.comments-component #respond {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

.comments-component .comments-form-title {
    margin: 0 0 10px;
    color: var(--comments-text);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.comments-component .comments-login {
    margin: 0 0 10px;
    color: var(--comments-soft);
    font-size: var(--comments-type-ui);
}

.comments-component .comments-field {
    margin: 0 0 9px;
}

.comments-component .comments-field label {
    display: block;
    margin-bottom: 5px;
    color: var(--comments-soft);
    font-size: var(--comments-type-ui);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .07em;
}

.comments-component .comments-field input,
.comments-component .comments-field textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--comments-border);
    border-radius: var(--comments-radius);
    outline: none;
    background: var(--comments-control);
    color: var(--comments-text);
    font-size: var(--comments-type-body);
    box-sizing: border-box;
    box-shadow: none;
}

.comments-component .comments-field textarea {
    min-height: 96px;
    resize: vertical;
    line-height: 1.55;
}

.comments-component .comments-field input:focus,
.comments-component .comments-field textarea:focus {
    border-color: var(--comments-accent);
    box-shadow: 0 0 0 1px var(--comments-accent);
}

.comments-component .comments-field small {
    display: block;
    margin-top: 4px;
    color: var(--comments-soft);
    font-size: var(--comments-type-meta);
    line-height: 1.45;
}

.comments-component .comments-cookies {
    margin: 8px 0 12px;
    color: var(--comments-soft);
    font-size: var(--comments-type-meta);
    line-height: 1.45;
}

.comments-component .comments-cookies label {
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.comments-component .comments-cookies input {
    margin: 2px 0 0;
    accent-color: var(--comments-accent);
}

.comments-component .form-submit {
    margin: 0;
}

.comments-component .comments-submit {
    min-height: 34px;
    padding: 0 13px;
    border: 1px solid var(--comments-border);
    border-radius: var(--comments-radius);
    background: var(--comments-control);
    color: var(--comments-text);
    text-transform: uppercase;
    letter-spacing: .055em;
    font-size: var(--comments-type-ui);
    font-weight: 800;
    cursor: pointer;
}

.comments-component .comments-submit:hover,
.comments-component .comments-submit:focus-visible {
    border-color: var(--comments-accent);
    background: var(--comments-accent);
    color: #fff;
    outline: none;
}

.comments-component .comments-reply-state {
    margin-bottom: 10px;
    padding: 7px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid color-mix(in srgb, var(--comments-accent) 38%, transparent);
    border-radius: var(--comments-radius);
    background: var(--comments-accent-soft);
    color: var(--comments-muted);
    font-size: 11px;
}

.comments-component .comments-reply-state button {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--comments-accent);
    font-size: var(--comments-type-ui);
    font-weight: 800;
    text-transform: uppercase;
    cursor: pointer;
}

/* --------------------------------------------------------------------------
   Normal WordPress/X inline comments — same visual language, native markup.
   -------------------------------------------------------------------------- */
.x-comments-area,
#comments {
    margin-top: 28px;
    padding-top: 18px;
    border-top: 1px solid var(--comments-border);
    color: var(--comments-text);
    font-family: "JetBrains Mono", SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.h-comments-title,
#comments > h2,
#comments > h3 {
    margin: 0 0 14px;
    color: var(--comments-text);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.x-comments-list,
.comment-list,
ul.comment-list {
    list-style: none;
    padding: 0;
    margin: 0 0 22px;
}

.x-comments-list article.comment,
.comment-list li.comment > article,
.comment-list li.comment > .comment-body {
    position: relative;
    margin: 0;
    padding: 13px 0;
    border-bottom: 1px solid var(--comments-border-subtle);
    background: transparent;
    box-shadow: none;
}

.x-comment-img,
.comment-author img.avatar {
    width: 30px;
    height: 30px;
    margin-right: 9px;
    border: 1px solid var(--comments-border);
    border-radius: 50%;
}

.x-comment-header,
.comment-meta,
.comment-metadata {
    color: var(--comments-soft);
    font-size: 11px;
}

.x-comment-author,
.comment-author .fn {
    color: var(--comments-text);
    font-size: var(--comments-type-body);
    font-style: normal;
    font-weight: 800;
}

.x-comment-time,
.comment-metadata a {
    color: var(--comments-soft);
    text-decoration: none;
    font-size: var(--comments-type-meta);
}

.x-comment-content,
.comment-list .comment-content {
    color: var(--comments-muted);
    font-size: var(--comments-type-body);
    line-height: 1.6;
}

.x-comment-content p,
.comment-list .comment-content p {
    margin: 0 0 .65em;
}

.comment-edit-link,
.comment-reply-link,
.x-reply a,
.x-comment-edit-link {
    color: var(--comments-soft);
    background: transparent;
    border: 0;
    padding: 0;
    text-transform: uppercase;
    text-decoration: none;
    font-size: var(--comments-type-ui);
    font-weight: 800;
}

.comment-edit-link:hover,
.comment-reply-link:hover,
.x-reply a:hover,
.x-comment-edit-link:hover {
    color: var(--comments-accent);
}

/* One visible reply inset only. Deeper native WP children retain data hierarchy
   without progressively crushing the available content width. */
.x-comments-list .children,
.comment-list .children {
    list-style: none;
    margin: 0 0 0 28px;
    padding: 0 0 0 12px;
    border-left: 1px solid var(--comments-border);
}

.x-comments-list .children .children,
.comment-list .children .children {
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
}

.comment-respond,
#respond {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--comments-border);
    background: transparent;
}

.comment-reply-title,
#reply-title {
    margin: 0 0 10px;
    color: var(--comments-text);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.logged-in-as,
.comment-notes {
    margin: 0 0 10px;
    color: var(--comments-soft);
    font-size: var(--comments-type-ui);
}

.logged-in-as a {
    color: var(--comments-accent);
    text-decoration: none;
}

.comment-form p,
.comment-form-author,
.comment-form-email,
.comment-form-url,
.comment-form-comment {
    margin: 0 0 9px;
}

.comment-form label {
    display: block;
    margin-bottom: 5px;
    color: var(--comments-soft);
    font-size: var(--comments-type-ui);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .07em;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea,
#commentform input[type="text"],
#commentform input[type="email"],
#commentform input[type="url"],
#commentform textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--comments-border);
    border-radius: var(--comments-radius);
    outline: none;
    background: var(--comments-control);
    color: var(--comments-text);
    font-size: var(--comments-type-body);
    box-sizing: border-box;
    box-shadow: none;
}

.comment-form textarea,
#commentform textarea {
    min-height: 108px;
    resize: vertical;
    line-height: 1.55;
}

.comment-form input:focus,
.comment-form textarea:focus,
#commentform input:focus,
#commentform textarea:focus {
    border-color: var(--comments-accent);
    box-shadow: 0 0 0 1px var(--comments-accent);
}

.comment-form .form-submit {
    margin: 0;
}

.comment-form .form-submit input[type="submit"],
#commentform input[type="submit"] {
    min-height: 34px;
    padding: 0 13px;
    border: 1px solid var(--comments-border);
    border-radius: var(--comments-radius);
    background: var(--comments-control);
    color: var(--comments-text);
    text-transform: uppercase;
    letter-spacing: .055em;
    font-size: var(--comments-type-ui);
    font-weight: 800;
    cursor: pointer;
    box-shadow: none;
    -webkit-appearance: none;
}

.comment-form .form-submit input[type="submit"]:hover,
.comment-form .form-submit input[type="submit"]:focus-visible,
#commentform input[type="submit"]:hover,
#commentform input[type="submit"]:focus-visible {
    border-color: var(--comments-accent);
    background: var(--comments-accent);
    color: #fff;
    outline: none;
}

.comment-form-cookies-consent {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    color: var(--comments-soft);
    font-size: 11px;
}

.comment-form-cookies-consent label {
    margin: 0;
    text-transform: none;
    letter-spacing: 0;
}

.comment-form-cookies-consent input[type="checkbox"] {
    margin-top: 2px;
    accent-color: var(--comments-accent);
}

@media (max-width: 640px) {
    .comments-component .comments-list {
        padding-right: 12px;
        padding-left: 12px;
    }

    .comments-component .comments-thread-replies,
    .x-comments-list .children,
    .comment-list .children {
        margin-left: 18px;
        padding-left: 9px;
    }

    .comments-component .comments-item {
        grid-template-columns: 27px minmax(0,1fr);
        gap: 8px;
    }

    .comments-component .comments-item-reply {
        grid-template-columns: 23px minmax(0,1fr);
    }

    .comments-component .comments-avatar {
        width: 27px;
        height: 27px;
    }

    .comments-component .comments-item-reply .comments-avatar {
        width: 23px;
        height: 23px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .comments-component .comments-item.is-comment-target::before {
        transition: none;
    }
}

/* Hidden status containers must remain absent until Build JS deliberately reveals them. */
.comments-component .comments-post-status[hidden] {
    display: none !important;
}

/* --------------------------------------------------------------------------
   BUILD DRAWER — EVENT-TRIGGERED DOCKED COMPOSER

   The native WordPress form is moved here by single-build.js. The comment list
   remains the only scrolling history surface; the composer is always reachable
   from the fixed bottom rail and opens in-place for either a new comment or reply.
   -------------------------------------------------------------------------- */
.comments-compose-dock {
    flex: 0 0 auto;
    min-width: 0;
    border-top: 1px solid var(--comments-border);
    background: var(--comments-panel);
    box-shadow: 0 -12px 28px rgba(0, 0, 0, .18);
}

.comments-compose-rail {
    padding: 10px 12px;
    background: color-mix(in srgb, var(--comments-panel) 88%, var(--comments-bg));
}

.comments-compose-toggle {
    width: 100%;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--comments-border);
    border-radius: var(--comments-radius);
    background: var(--comments-control);
    color: var(--comments-text);
    font: inherit;
    font-size: var(--comments-type-ui);
    font-weight: 800;
    letter-spacing: .055em;
    text-transform: uppercase;
    cursor: pointer;
}

.comments-compose-toggle:hover,
.comments-compose-toggle:focus-visible,
.comments-compose-toggle.is-open {
    border-color: var(--comments-accent);
    color: var(--comments-accent);
    outline: none;
}

.comments-compose-dock .comments-compose {
    max-height: min(58dvh, 520px);
    overflow-y: auto;
    overscroll-behavior: contain;
    border-top: 1px solid var(--comments-border-subtle);
    scrollbar-gutter: stable;
}

.comments-compose-dock .comments-compose[hidden] {
    display: none !important;
}

@media (max-width: 640px) {
    .comments-compose-dock .comments-compose {
        max-height: 64dvh;
    }

    .comments-compose-rail {
        padding: 9px 10px;
    }
}

/* Community Build — Phase 4.1
   Full-bleed X compatibility shell + Build-specific presentation. */

:root {
    --wp-admin-bar-height: 0px;

    /* Accents — adapted to the existing Build palette. */
    --blue: #0083bd;
    --sky: #38bdf8;
    --emerald: #34d399;
    --rose: #fb7185;
    --amber: #fbbf24;
    --purple: #c084fc;

    /* Surfaces. */
    --bg-global: #050507;
    --bg-panel: #0d0e12;
    --bg-control: #000000;
    --bg-card: #121318;
    --bg-soft: #090a0f;
    --bg-drawer: #090a0f;
    --bg-compose: #0b0c11;
    --bg-hover: #101218;

    /* Borders / text. */
    --border-default: rgba(255, 255, 255, 0.10);
    --border: var(--border-default);
    --border-strong-global: rgba(255, 255, 255, 0.16);
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-accent: rgba(56, 189, 248, 0.35);
    --text-dark: #f4f4f5;
    --text-heading: #ffffff;
    --text-muted: #71717a;
    --text-muted-strong: #a1a1aa;
    --text-soft: #8b8b94;
    --text-active: #38bdf8;

    --slider-track: #18181b;
    --shadow: 0 16px 32px rgba(0, 0, 0, 0.85);
    --link-direct: #34d399;
    --link-affiliate: #38bdf8;
    --radius: 4px;
    --radius-sm: 2px;

    /* Derived interaction surfaces. */
    --accent-border: rgba(56, 189, 248, 0.28);
    --accent-border-strong: rgba(56, 189, 248, 0.52);
    --accent-soft: rgba(56, 189, 248, 0.04);
    --overlay: rgba(0, 0, 0, 0.62);
    --drawer-shadow-right: -24px 0 60px rgba(0, 0, 0, 0.58);
    --drawer-shadow-left: 24px 0 60px rgba(0, 0, 0, 0.58);
    --toast-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
}

[data-theme="light"] {
    --blue: #0284c7;
    --sky: #0284c7;
    --emerald: #059669;
    --rose: #e11d48;
    --amber: #d97706;

    --bg-global: #f1f5f9;
    --bg-panel: #ffffff;
    --bg-control: #e2e8f0;
    --bg-card: #ffffff;
    --bg-soft: #f8fafc;
    --bg-drawer: #f1f5f9;
    --bg-compose: #ffffff;
    --bg-hover: #f8fafc;

    --border-default: #cbd5e1;
    --border: var(--border-default);
    --border-strong-global: #94a3b8;
    --border-subtle: #e2e8f0;
    --border-accent: rgba(2, 132, 199, 0.38);
    --text-dark: #0f172a;
    --text-heading: #020617;
    --text-muted: #64748b;
    --text-muted-strong: #475569;
    --text-soft: #64748b;
    --text-active: #0284c7;

    --slider-track: #cbd5e1;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    --link-direct: #059669;
    --link-affiliate: #0284c7;

    --accent-border: rgba(2, 132, 199, 0.28);
    --accent-border-strong: rgba(2, 132, 199, 0.52);
    --accent-soft: rgba(2, 132, 199, 0.06);
    --overlay: rgba(15, 23, 42, 0.35);
    --drawer-shadow-right: -18px 0 42px rgba(15, 23, 42, 0.14);
    --drawer-shadow-left: 18px 0 42px rgba(15, 23, 42, 0.14);
    --toast-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
}

/* X output not used by the dedicated Community Build template. */
.x-breadcrumb-wrap,
.entry-featured {
    display: none !important;
}

/* X can retain its sidebar-active body state even though the custom Build
   template intentionally renders no sidebar. */
body.x-content-sidebar-active {
    padding-right: 0 !important;
}

/* Keep fixed Build UI below the WordPress admin bar while signed in. */
body.admin-bar {
    --wp-admin-bar-height: 32px;
}

@media screen and (max-width: 782px) {
    body.admin-bar {
        --wp-admin-bar-height: 46px;
    }
}

@media screen and (max-width: 600px) {
    body.admin-bar #wpadminbar {
        position: fixed !important;
    }
}

/* Compact industrial scrollbars — global by design on the Build template. */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-control); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-sm); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.font-mono {
    font-family: "JetBrains Mono", SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.build-runtime-page,
.build-runtime-page .site,
.build-runtime-page .x-site {
    background: var(--bg-global) !important;
    color: var(--text-dark) !important;
}

.build-runtime {
    /* Local aliases keep component rules compact while the page shares the
       same token language as Database / Workbench. */
    --bg: var(--bg-global);
    --panel: var(--bg-panel);
    --panel-raised: var(--bg-card);
    --panel-soft: var(--bg-soft);
    --border: var(--border-default);
    --border-strong: var(--border-strong-global);
    --text: var(--text-dark);
    --muted: var(--text-muted);
    --muted-strong: var(--text-muted-strong);
    --accent: var(--sky);
    --accent-deep: var(--blue);
    --positive: var(--emerald);
    --warning: var(--amber);
    --danger: var(--rose);

    /* Shared Build typography scale. */
    --type-identifier: 11px;
    --type-ui: 11px;
    --type-body: 13px;
    --type-section: 15px;

    width: 100%;
    min-height: 72vh;
    background: var(--bg);
    color: var(--text);
    font-family: "JetBrains Mono", SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    line-height: 1.5;
}

.build-runtime *,
.build-runtime *::before,
.build-runtime *::after {
    box-sizing: border-box;
}

.build-runtime button {
    color: inherit;
}

.build-header,
.build-nav {
    width: 100%;
    background: color-mix(in srgb, var(--bg-global) 98.5%, transparent);
    border-bottom: 1px solid var(--border);
}

/* Bar 2: Build identity + actions */
.build-header {
    min-height: 76px;
    padding: 11px clamp(16px, 3vw, 44px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.build-identity {
    min-width: 0;
}

.build-eyebrow,
.section-kicker,
.build-meta,
.overview-item > span,
.hardware-label,
.hardware-badge,
.fitment-label,
.fitment-summary span,
.integration-card > span,
.comments-header span {
    text-transform: uppercase;
    letter-spacing: 0.075em;
}

.build-eyebrow {
    display: block;
    margin-bottom: 3px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 800;
}

.build-identity h1 {
    margin: 0;
    color: var(--text-heading);
    font-size: clamp(16px, 2vw, 20px);
    line-height: 1.15;
    font-weight: 800;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}

.build-case-context {
    margin-top: 5px;
    color: var(--text-muted-strong);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: 0.055em;
    text-transform: uppercase;
}

.build-meta {
    margin-top: 5px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 700;
}

.build-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 7px;
}

.build-action {
    min-height: 30px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--border-strong);
    border-radius: 5px;
    background: var(--bg-control);
    color: var(--text) !important;
    text-decoration: none !important;
    text-transform: uppercase;
    letter-spacing: 0.055em;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.build-action span {
    color: var(--accent);
}

.build-action:hover,
.build-action:focus-visible {
    background: var(--accent-deep);
    border-color: var(--accent-deep);
    color: #fff !important;
    outline: none;
}

.build-action:hover span,
.build-action:focus-visible span {
    color: var(--text-heading);
}

.build-action-muted {
    color: var(--text-muted-strong) !important;
}

/* Bar 3: local navigation */
.build-nav {
    min-height: 39px;
    padding: 0 clamp(16px, 3vw, 44px);
    display: flex;
    align-items: stretch;
    gap: 22px;
    overflow-x: auto;
    scrollbar-width: none;
}

.build-nav::-webkit-scrollbar {
    display: none;
}

.build-nav a,
.build-nav button {
    position: relative;
    flex: 0 0 auto;
    min-height: 39px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    color: var(--muted) !important;
    text-decoration: none !important;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}

.build-nav button span {
    margin-left: 3px;
    color: var(--text-muted);
}

.build-nav a:hover,
.build-nav button:hover,
.build-nav a.is-active,
.build-nav button.is-active {
    color: var(--text) !important;
}

.build-nav a.is-active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 1px;
    background: var(--accent);
}

.build-content {
    width: min(1440px, calc(100% - 32px));
    margin: 0 auto;
    padding: 26px 0 54px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.build-section {
    scroll-margin-top: 56px;
}

.section-heading {
    min-height: 36px;
    margin-bottom: 12px;
    padding: 0 2px 9px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--border);
}

.section-heading > div {
    min-width: 0;
}

.section-kicker {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: var(--type-identifier);
    font-weight: 800;
}

.section-heading h2 {
    margin: 0;
    color: var(--text-heading);
    font-size: var(--type-section);
    line-height: 1.2;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.045em;
}

.section-heading > span {
    color: var(--muted);
    font-size: var(--type-identifier);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

/* Photography-first gallery */
.gallery-grid {
    width: 100%;
    height: clamp(390px, 55vw, 650px);
    display: grid;
    gap: 8px;
}

.gallery-item {
    position: relative;
    min-width: 0;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--panel-soft);
    cursor: zoom-in;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform .22s ease, opacity .22s ease;
}

.gallery-item:hover img,
.gallery-item:focus-visible img {
    transform: scale(1.015);
    opacity: .94;
}

.gallery-item:focus-visible {
    outline: 1px solid var(--accent);
    outline-offset: 2px;
}

.gallery-count-1 {
    grid-template-columns: 1fr;
}

.gallery-count-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.gallery-count-3 {
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, .7fr);
    grid-template-rows: repeat(2, 1fr);
}

.gallery-count-3 .gallery-item-1 {
    grid-row: 1 / 3;
}

.gallery-count-4 {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(220px, .55fr);
    grid-template-rows: repeat(2, 1fr);
}

.gallery-count-4 .gallery-item-1,
.gallery-count-4 .gallery-item-2 {
    grid-row: 1 / 3;
}

.gallery-count-5 {
    grid-template-columns: minmax(0, 1.6fr) repeat(2, minmax(220px, .7fr));
    grid-template-rows: repeat(2, 1fr);
}

.gallery-count-5 .gallery-item-1 {
    grid-row: 1 / 3;
}

.gallery-more {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, .58);
    color: var(--text-heading);
    font-size: 20px;
    font-weight: 800;
}

/* Overview strip */
.build-overview {
    display: grid;
    grid-template-columns: repeat(var(--overview-columns, 4), minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--border);
}

.overview-item {
    min-width: 0;
    min-height: 68px;
    padding: 11px 13px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: var(--panel);
}

.overview-item > span {
    color: var(--muted);
    font-size: var(--type-identifier);
    font-weight: 800;
}

.overview-item > strong {
    color: var(--text);
    font-size: 13px;
    line-height: 1.35;
    font-weight: 750;
    overflow-wrap: anywhere;
}

.fitment-status {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
}

.fitment-status::before {
    content: "";
    width: 6px;
    height: 6px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--muted);
}

.fitment-clean_fit::before { background: var(--positive); }
.fitment-fit_with_issue::before { background: var(--warning); }
.fitment-modified_fit::before { background: var(--danger); }

/* Brief page-wide documented evidence, adapted from the Database telemetry block. */
.build-evidence-summary {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.025);
}

.build-evidence-summary[hidden] {
    display: none !important;
}

.build-evidence-summary-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 11px;
    font-weight: 700;
}

.build-evidence-summary-top > span {
    color: var(--muted);
}

.build-evidence-summary-top > strong {
    color: var(--text-heading);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.build-evidence-summary-detail {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.build-evidence-summary-detail a {
    color: var(--accent);
    text-decoration: none;
}

.build-evidence-summary-detail a:hover,
.build-evidence-summary-detail a:focus-visible {
    color: var(--text-heading);
    outline: none;
}

.build-evidence-summary[data-band="EXACT"] .build-evidence-summary-top > strong,
.build-evidence-summary[data-band="STRONG"] .build-evidence-summary-top > strong { color: var(--emerald); }
.build-evidence-summary[data-band="MODERATE"] .build-evidence-summary-top > strong { color: var(--sky); }
.build-evidence-summary[data-band="RELATED"] .build-evidence-summary-top > strong { color: var(--amber); }
.build-evidence-summary[data-band="CASE_ONLY"] .build-evidence-summary-top > strong { color: var(--text-muted-strong); }

/* Hardware */
.hardware-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.hardware-card {
    min-width: 0;
    min-height: 104px;
    padding: 13px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--panel);
}

.hardware-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.hardware-label {
    color: var(--muted);
    font-size: var(--type-identifier);
    font-weight: 800;
}

.hardware-badge {
    padding: 2px 5px;
    border: 1px solid var(--accent-border);
    border-radius: 3px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 800;
}

.hardware-card > strong {
    color: var(--text);
    font-size: 13px;
    line-height: 1.4;
    font-weight: 750;
    overflow-wrap: anywhere;
}

.hardware-card > small {
    color: var(--muted-strong);
    font-size: var(--type-ui);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .045em;
}

/* Fitment evidence */
.fitment-panel {
    padding: 16px;
    display: grid;
    grid-template-columns: minmax(220px, .75fr) minmax(0, 1.5fr);
    gap: 18px 24px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--panel);
}

.fitment-summary {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fitment-indicator {
    width: 10px;
    height: 10px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--muted);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--text-muted) 8%, transparent);
}

.fitment-panel-clean_fit .fitment-indicator {
    background: var(--positive);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--emerald) 8%, transparent);
}

.fitment-panel-fit_with_issue .fitment-indicator {
    background: var(--warning);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--amber) 8%, transparent);
}

.fitment-panel-modified_fit .fitment-indicator {
    background: var(--danger);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--rose) 8%, transparent);
}

.fitment-summary span,
.fitment-label {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: var(--type-identifier);
    font-weight: 800;
}

.fitment-summary strong {
    color: var(--text-heading);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.fitment-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.fitment-tags span {
    padding: 6px 8px;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    background: var(--bg-control);
    color: var(--muted-strong);
    font-size: var(--type-ui);
    font-weight: 700;
}

.fitment-detail {
    grid-column: 1 / -1;
    padding-top: 13px;
    border-top: 1px solid var(--border);
}

.fitment-detail p,
.fitment-provenance {
    margin: 0;
    color: var(--muted-strong);
    font-size: var(--type-body);
    line-height: 1.6;
}

.fitment-provenance {
    grid-column: 1 / -1;
    padding-top: 11px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: var(--type-ui);
}

/* Notes */
.build-notes {
    padding: clamp(16px, 2.4vw, 26px);
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--panel);
}

.build-notes p {
    margin: 0 0 1em;
    color: var(--text-muted-strong);
    font-size: 13px;
    line-height: 1.75;
}

.build-notes p:last-child {
    margin-bottom: 0;
}

/* Integration */
.integration-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.integration-card {
    min-width: 0;
    min-height: 118px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 5px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--panel);
    color: var(--text) !important;
    text-align: left;
    text-decoration: none !important;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}

.integration-card:hover,
.integration-card:focus-visible {
    border-color: var(--accent-border-strong);
    background: var(--bg-hover);
    outline: none;
}

.integration-card > span {
    color: var(--accent);
    font-size: var(--type-identifier);
    font-weight: 800;
}

.integration-card > strong {
    color: var(--text-heading);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.integration-card > small {
    color: var(--muted);
    font-size: var(--type-ui);
    line-height: 1.45;
}

/* Shared dual-side drawer shell. Only one drawer can be open at a time.
   Comment internals/forms remain owned by /assets/comments/comments.css. */
.drawer-backdrop {
    position: fixed;
    top: var(--wp-admin-bar-height);
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 99990;
    background: var(--overlay);
    opacity: 0;
    transition: opacity .18s ease;
}

.drawer-backdrop.is-open {
    opacity: 1;
}

.build-drawer {
    position: fixed;
    top: var(--wp-admin-bar-height);
    z-index: 99991;
    height: calc(100dvh - var(--wp-admin-bar-height));
    display: flex;
    flex-direction: column;
    background: var(--bg-drawer);
    visibility: hidden;
    transition: transform .2s ease, visibility 0s linear .2s;
}

.build-drawer-right {
    right: 0;
    width: min(440px, 94vw);
    border-left: 1px solid var(--border-strong);
    box-shadow: var(--drawer-shadow-right);
    transform: translateX(102%);
}

.build-drawer-left {
    left: 0;
    width: min(480px, 94vw);
    border-right: 1px solid var(--border-strong);
    box-shadow: var(--drawer-shadow-left);
    transform: translateX(-102%);
}

.build-drawer.is-open {
    transform: translateX(0);
    visibility: visible;
    transition: transform .2s ease;
}

.build-drawer-header {
    min-height: 68px;
    padding: 13px 14px 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-drawer);
}

.build-drawer-header span {
    display: block;
    margin-bottom: 2px;
    color: var(--accent);
    font-size: var(--type-identifier);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .075em;
}

.build-drawer-header h2 {
    margin: 0;
    color: var(--text-heading);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.build-drawer-header h2 strong {
    color: var(--muted);
    font-size: 11px;
}

.build-drawer-title-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.build-drawer-count {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.build-drawer-close,
.comments-close,
.gallery-viewer-close {
    width: 32px;
    height: 32px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 1px solid var(--border-strong);
    border-radius: 5px;
    background: var(--bg-control);
    color: var(--muted-strong);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.build-drawer-close:hover,
.build-drawer-close:focus-visible,
.comments-close:hover,
.comments-close:focus-visible,
.gallery-viewer-close:hover,
.gallery-viewer-close:focus-visible {
    border-color: var(--accent);
    color: var(--text-heading);
    outline: none;
}

.build-drawer-scroll,
.comments-scroll {
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.build-panel {
    min-height: 100%;
    padding: 14px;
}

.build-panel[hidden] {
    display: none !important;
}

.build-panel-comments {
    padding: 0;
}

.build-panel-status {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--panel);
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
}

.similar-builds-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.similar-build-card {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 11px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--panel);
}

.similar-build-thumb {
    min-height: 116px;
    background: var(--bg-soft);
}

.similar-build-thumb img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.similar-build-body {
    min-width: 0;
    padding: 10px 10px 10px 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.similar-build-band,
.intelligence-band {
    color: var(--accent);
    font-size: var(--type-identifier);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
}

[data-band="EXACT"].similar-build-band,
[data-band="STRONG"].similar-build-band,
[data-band="EXACT"].intelligence-band,
[data-band="STRONG"].intelligence-band { color: var(--emerald); }
[data-band="MODERATE"].similar-build-band,
[data-band="MODERATE"].intelligence-band { color: var(--sky); }
[data-band="RELATED"].similar-build-band,
[data-band="RELATED"].intelligence-band { color: var(--amber); }
[data-band="CASE_ONLY"].similar-build-band,
[data-band="CASE_ONLY"].intelligence-band { color: var(--text-muted-strong); }

.similar-build-title {
    color: var(--text-heading);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.3;
    text-decoration: none;
}

.similar-build-title:hover,
.similar-build-title:focus-visible {
    color: var(--accent);
    outline: none;
}

.similar-build-meta,
.similar-build-match,
.similar-build-fitment {
    color: var(--muted);
    font-size: var(--type-ui);
    line-height: 1.4;
}

.similar-build-actions {
    margin-top: auto;
    display: flex;
    gap: 6px;
}

.similar-build-actions a,
.similar-build-actions button,
.intelligence-back {
    min-height: 28px;
    padding: 0 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    background: var(--bg-control);
    color: var(--text) !important;
    font-size: var(--type-ui);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .045em;
    text-decoration: none !important;
    cursor: pointer;
}

.similar-build-actions a:hover,
.similar-build-actions button:hover,
.similar-build-actions a:focus-visible,
.similar-build-actions button:focus-visible,
.intelligence-back:hover,
.intelligence-back:focus-visible {
    border-color: var(--accent);
    color: var(--text-heading) !important;
    outline: none;
}

.intelligence-back {
    margin-bottom: 10px;
}

.build-intelligence {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.intelligence-hero {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 12px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--panel);
}

.intelligence-hero img {
    width: 112px;
    height: 94px;
    object-fit: cover;
    border-radius: 4px;
}

.intelligence-hero h3 {
    margin: 2px 0 4px;
    color: var(--text-heading);
    font-size: 12px;
    line-height: 1.3;
}

.intelligence-hero p,
.intelligence-block p {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
}

.intelligence-block {
    padding: 11px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.02);
}

.intelligence-block > span {
    display: block;
    margin-bottom: 6px;
    color: var(--accent);
    font-size: var(--type-identifier);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .055em;
}

.intelligence-facts {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
    list-style: none;
}

.intelligence-facts li {
    color: var(--text-soft);
    font-size: 11px;
    line-height: 1.4;
}

.intelligence-facts strong {
    color: var(--text-heading);
}

/* Full image viewer */
.gallery-viewer {
    position: fixed;
    top: var(--wp-admin-bar-height);
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 99995;
    padding: 54px 70px 34px;
    display: grid;
    place-items: center;
    background: rgba(2, 2, 4, .965);
    opacity: 0;
    visibility: hidden;
    transition: opacity .18s ease, visibility 0s linear .18s;
}

.gallery-viewer.is-open {
    opacity: 1;
    visibility: visible;
    transition: opacity .18s ease;
}

.gallery-viewer figure {
    width: 100%;
    height: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 9px;
}

.gallery-viewer img {
    max-width: 100%;
    max-height: calc(100dvh - var(--wp-admin-bar-height) - 110px);
    object-fit: contain;
    border-radius: 5px;
}

.gallery-viewer figcaption {
    color: var(--muted);
    font-size: var(--type-ui);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.gallery-viewer-close {
    position: absolute;
    top: 14px;
    right: 16px;
}

.gallery-viewer-nav {
    position: absolute;
    top: 50%;
    width: 42px;
    height: 56px;
    padding: 0;
    border: 1px solid var(--border-strong);
    border-radius: 5px;
    background: rgba(0, 0, 0, .82);
    color: var(--text-heading);
    font-size: 28px;
    cursor: pointer;
    transform: translateY(-50%);
}

.gallery-viewer-nav:hover {
    border-color: var(--accent);
}

.gallery-viewer-prev { left: 14px; }
.gallery-viewer-next { right: 14px; }

/* Small feedback toast */
.build-toast {
    position: fixed;
    left: 50%;
    bottom: 22px;
    z-index: 99999;
    padding: 8px 11px;
    border: 1px solid var(--border-strong);
    border-radius: 5px;
    background: var(--bg-control);
    color: var(--text);
    box-shadow: var(--toast-shadow);
    font-size: var(--type-ui);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
    transform: translateX(-50%);
}

.build-empty {
    width: min(960px, calc(100% - 32px));
    margin: 40px auto;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--panel);
    color: var(--muted);
    text-align: center;
}

body.build-overlay-open {
    overflow: hidden;
}

@media (max-width: 1100px) {
    .hardware-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .build-overview {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .gallery-count-4,
    .gallery-count-5 {
        grid-template-columns: 1.35fr 1fr;
        grid-template-rows: repeat(3, 1fr);
    }

    .gallery-count-4 .gallery-item-1,
    .gallery-count-5 .gallery-item-1 {
        grid-row: 1 / 3;
    }

    .gallery-count-4 .gallery-item-2 {
        grid-row: auto;
    }
}

@media (max-width: 860px) {
    .build-header {
        align-items: flex-start;
    }

    .build-actions {
        max-width: 48%;
        justify-content: flex-end;
        flex-wrap: wrap;
    }

    .gallery-grid {
        height: clamp(340px, 66vw, 520px);
    }

    .integration-grid {
        grid-template-columns: 1fr;
    }

    .integration-card {
        min-height: 90px;
    }

    .fitment-panel {
        grid-template-columns: 1fr;
    }

    .fitment-detail,
    .fitment-provenance {
        grid-column: auto;
    }
}

@media (max-width: 640px) {
    .build-header {
        min-height: 0;
        padding: 12px 14px;
        flex-direction: column;
        gap: 10px;
    }

    .build-identity h1 {
        font-size: 16px;
    }

    .build-actions {
        width: 100%;
        max-width: none;
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .build-actions::-webkit-scrollbar {
        display: none;
    }

   .build-action {
        flex: 0 0 auto;
        min-height: 30px;
        padding: 0 10px;
        font-size: var(--type-ui);
    }

    .build-nav {
        padding: 0 14px;
        gap: 18px;
    }

    .build-content {
        width: min(100% - 20px, 1440px);
        padding-top: 18px;
        gap: 23px;
    }

    .section-heading {
        align-items: flex-start;
    }

    .section-heading > span {
        padding-top: 12px;
    }

    .gallery-grid,
    .gallery-count-2,
    .gallery-count-3,
    .gallery-count-4,
    .gallery-count-5 {
        height: auto;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: auto;
        gap: 6px;
    }

    .gallery-item {
        aspect-ratio: 1 / 1;
    }

    .gallery-item-1 {
        grid-column: 1 / -1;
        grid-row: auto !important;
        aspect-ratio: 16 / 10;
    }

    .gallery-count-1 .gallery-item-1 {
        aspect-ratio: 4 / 3;
    }

    .build-overview,
    .hardware-grid {
        grid-template-columns: 1fr;
    }

    .overview-item {
        min-height: 60px;
    }

    .hardware-card {
        min-height: 88px;
    }

    .fitment-panel {
        padding: 14px;
    }

    .build-drawer {
        width: 100vw;
        border-left: 0;
        border-right: 0;
    }

    .drawer-backdrop {
        display: none;
    }

    .gallery-viewer {
        padding: 50px 10px 18px;
    }

    .gallery-viewer-nav {
        top: auto;
        bottom: 14px;
        width: 38px;
        height: 38px;
        transform: none;
    }

    .gallery-viewer-prev { left: calc(50% - 45px); }
    .gallery-viewer-next { right: calc(50% - 45px); }

    .gallery-viewer img {
        max-height: calc(100dvh - var(--wp-admin-bar-height) - 120px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .gallery-item img,
    .build-drawer,
    .drawer-backdrop,
    .gallery-viewer {
        transition: none;
    }
}


/* Child-theme token integration + SVG icon vocabulary. */
/* Native Theme integration for a single Community Build. */
body.sff-site-build {
  --bg-global: var(--labs-bg);
  --bg-panel: var(--labs-surface);
  --bg-control: var(--labs-input-bg);
  --bg-card: var(--labs-surface-raised);
  --bg-soft: var(--labs-surface-muted);
  --bg-drawer: var(--labs-surface);
  --bg-compose: var(--labs-surface);
  --bg-hover: var(--labs-surface-muted);
  --border-default: var(--labs-border);
  --border: var(--labs-border);
  --border-strong-global: var(--labs-border-strong);
  --border-subtle: var(--labs-border);
  --text-dark: var(--labs-text);
  --text-heading: var(--labs-heading);
  --text-muted: var(--labs-muted);
  --text-muted-strong: var(--labs-muted);
  --text-soft: var(--labs-dim);
  --text-active: var(--labs-link);
  --shadow: var(--labs-shadow);
  --comments-bg: var(--labs-bg);
  --comments-panel: var(--labs-surface);
  --comments-control: var(--labs-input-bg);
  --comments-border: var(--labs-border-strong);
  --comments-border-subtle: var(--labs-border);
  --comments-text: var(--labs-heading);
  --comments-muted: var(--labs-muted);
  --comments-soft: var(--labs-dim);
  --comments-accent: var(--labs-link);
}
body.sff-site-build .build-runtime { min-height: calc(100dvh - var(--labs-admin-bar-height) - var(--labs-header-total-height)); }
body.sff-site-build .build-header,
body.sff-site-build .build-nav { background: color-mix(in oklab, var(--labs-paper) 88%, transparent); }
body.sff-site-build .build-section { scroll-margin-top: calc(var(--labs-header-total-height) + 20px); }
body.sff-site-build .drawer-backdrop,
body.sff-site-build .build-drawer,
body.sff-site-build .gallery-viewer { top: calc(var(--labs-admin-bar-height) + var(--labs-header-total-height)); }
body.sff-site-build .build-drawer { height: calc(100dvh - var(--labs-admin-bar-height) - var(--labs-header-total-height)); }
body.sff-site-build .gallery-viewer img { max-height: calc(100dvh - var(--labs-admin-bar-height) - var(--labs-header-total-height) - 110px); }
html[data-theme="light"] body.sff-site-build .intelligence-block { background: color-mix(in srgb, var(--labs-surface-muted) 72%, transparent); }
@media (max-width: 760px) {
  body.sff-site-build .build-header { padding-inline: 14px; }
  body.sff-site-build .build-content { width: min(100% - 20px, 1440px); }
}

body.sff-site-build .build-icon { width:16px; height:16px; display:block; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
body.sff-site-build :where(.build-drawer-close,.comments-close,.gallery-viewer-close) { font-size:0; }
