/* Shared public shell: one source of truth for header/footer alignment and admin hold gesture. */

.navbar > .logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 0 1 auto;
    line-height: 1;
}

.navbar > .logo .codex-logo {
    display: block;
    width: 40px !important;
    height: 40px !important;
    flex: 0 0 40px;
    margin: 0 !important;
    object-fit: contain;
}

.navbar > .logo > span {
    display: block;
    min-width: 0;
    margin: 0;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.navbar > .nav-actions {
    flex-shrink: 0;
}

.codex-client-link{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:40px;padding:8px 12px;border:1px solid #4a4a4e;border-radius:9px;color:#e7e7e8;font-size:11px;font-weight:700;letter-spacing:.04em;white-space:nowrap;transition:border-color .18s,background .18s}
.codex-client-link:hover,.codex-client-link:focus-visible{border-color:#d6be8d;background:#1a1916;color:#fff}
.codex-client-link svg{display:block;width:19px;height:19px;flex:none}
.codex-client-link span{display:none}
.mobile-menu > .codex-client-link span { display: inline; }
.navbar>.nav-actions>.codex-client-link{width:44px;min-height:44px;padding:7px}
.codex-client-link img{display:block;width:28px;height:28px;border-radius:50%;object-fit:cover}
.mobile-menu>.codex-client-link{width:100%;flex-shrink:0;margin-top:10px;min-height:46px}
@media(max-width:1250px){.navbar>.nav-actions>.codex-client-link span:last-child{display:none}.navbar>.nav-actions>.codex-client-link{width:40px;padding:4px}}
@media(max-width:680px){.navbar>.nav-actions>.codex-client-link{display:none}}

[data-codex-shared-footer] .footer-content {
    align-items: start;
}

[data-codex-shared-footer] .footer-brand {
    display: block;
    min-width: 0;
}

[data-codex-shared-footer] .codex-footer-brand-row {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 12px !important;
    min-width: 0;
    margin: 0 0 16px !important;
    line-height: 1;
}

[data-codex-shared-footer] .codex-footer-brand-row > span {
    display: block !important;
    min-width: 0;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.15 !important;
    letter-spacing: 0.16em;
    overflow-wrap: anywhere;
}

[data-codex-shared-footer] .footer-brand > p {
    width: auto;
    margin: 0 0 18px !important;
}

[data-codex-shared-footer] .footer-links a,
[data-codex-shared-footer] .footer-contato a {
    pointer-events: auto !important;
}

/* Link layout must not depend on whitespace between generated anchor tags. */
[data-codex-shared-footer] .footer-links,
[data-codex-shared-footer] .footer-contato {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    min-width: 0;
}
[data-codex-shared-footer] .footer-links > h4,
[data-codex-shared-footer] .footer-contato > h4 {
    margin: 0 0 14px;
    line-height: 1.5;
}
[data-codex-shared-footer] .footer-links > a,
[data-codex-shared-footer] .footer-contato > a {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 40px;
    margin: 0;
    padding: 6px 0;
    line-height: 1.6;
    font-size: 14px;
    overflow-wrap: anywhere;
}
[data-codex-shared-footer] .footer-bottom > :first-child {
    white-space: normal;
    line-height: 1.8;
    min-width: 0;
}
[data-codex-shared-footer] .codex-footer-release {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 16px;
    min-width: 0;
    max-width: 100%;
}
@media (max-width: 620px) {
    [data-codex-shared-footer] .footer-content {
        padding-top: 44px;
        padding-bottom: 36px;
    }
    [data-codex-shared-footer] .footer-bottom.codex-footer-bottom-enhanced {
        display: flex;
        flex-direction: column;
        gap: 18px;
        padding: 24px 78px max(32px, env(safe-area-inset-bottom)) 24px;
    }
    /* Keep shortcuts in a vertical stack at the right edge. */
    body:has([data-codex-shared-footer]) .codex-floating-dock {
        flex-direction: column;
        gap: 8px;
        right: 14px;
        bottom: max(14px, env(safe-area-inset-bottom));
    }
    .mobile-menu {
        top: 72px;
        bottom: 0;
        height: auto;
        padding: 20px 24px 32px;
        justify-content: flex-start;
        gap: 20px;
        background: #080808;
    }
    .mobile-menu nav { width: 100%; flex-shrink: 0; }
    .mobile-menu nav a { font-size: 24px; line-height: 1.35; padding: 10px 0; }
    .mobile-menu > .button, .mobile-menu-footer { flex-shrink: 0; }
    body.menu-open .codex-floating-dock { display: none !important; }
}

/* Children may set visibility themselves; hiding the parent is not sufficient. */
body.menu-open #backToTop,
body.menu-open .back-to-top,
body.menu-open .whatsapp-float,
body.menu-open .codex-social-float,
body:has(.mobile-menu.open) .codex-floating-dock,
body:has(.mobile-menu.open) #backToTop {
    display: none !important;
    pointer-events: none !important;
}
.codex-admin-access {
    appearance: none;
    -webkit-appearance: none;
    display: grid;
    place-items: center;
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    min-width: 46px;
    min-height: 46px;
    padding: 0;
    margin: 0;
    border: 0 !important;
    border-radius: 0;
    outline: 0;
    background: transparent !important;
    box-shadow: none !important;
    color: inherit;
    cursor: pointer;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform 160ms ease, opacity 160ms ease, filter 160ms ease;
}

.codex-admin-access .codex-logo {
    display: block;
    width: 46px !important;
    height: 46px !important;
    max-width: none;
    margin: 0 !important;
    object-fit: contain;
    pointer-events: none;
    transition: inherit;
}

/* Holding feedback stays on the logo only: no square, border or background. */
.codex-admin-access.is-holding {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    transform: scale(1.055);
    opacity: .92;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, .22));
}

.codex-admin-access:active,
.codex-admin-access:hover {
    background: transparent !important;
    box-shadow: none !important;
}

.codex-admin-access:focus-visible {
    outline: 1px solid rgba(255, 255, 255, .75);
    outline-offset: 5px;
    border-radius: 50%;
}

#codexHoldProgress {
    position: fixed;
    left: 50%;
    bottom: max(18px, env(safe-area-inset-bottom));
    width: min(240px, calc(100vw - 40px));
    height: 3px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: rgba(255, 255, 255, .14);
    z-index: 2147483000;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 140ms ease, visibility 140ms ease;
}

#codexHoldProgress.active {
    opacity: 1;
    visibility: visible;
}

#codexHoldProgressBar {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: #fff;
    transform-origin: left center;
    will-change: width;
}

@media (max-width: 1200px) {
    .navbar > nav {
        display: none !important;
    }

    .navbar .menu-toggle {
        display: flex !important;
    }

    .navbar > .logo {
        max-width: 62%;
    }
}

@media (max-width: 600px) {
    .navbar > .logo {
        gap: 9px;
        max-width: calc(100% - 62px);
    }

    .navbar > .logo .codex-logo {
        width: 36px !important;
        height: 36px !important;
        flex-basis: 36px;
    }

    [data-codex-shared-footer] .codex-footer-brand-row {
        gap: 10px !important;
    }

    .codex-admin-access,
    .codex-admin-access .codex-logo {
        width: 42px !important;
        height: 42px !important;
        min-width: 42px;
        min-height: 42px;
        flex-basis: 42px;
    }

    [data-codex-shared-footer] .codex-footer-brand-row > span {
        font-size: 13px;
        letter-spacing: .13em;
    }

    .codex-custom-page .resource-hero h1 {
        font-size: clamp(36px, 10vw, 60px);
        overflow-wrap: anywhere;
    }
}

@media (max-width: 380px) {
    [data-codex-shared-footer] .codex-footer-brand-row > span,
    .navbar > .logo > span {
        letter-spacing: .1em;
    }
}

@media (prefers-reduced-motion: reduce) {
    .codex-admin-access,
    #codexHoldProgress {
        transition: none;
    }
}

/* =========================================================
   FINAL PUBLIC LAYOUT SAFETY NET
   Shared geometry applied after page-specific styles.
========================================================= */
html { max-width: 100%; overflow-x: hidden; }
body { width: 100%; min-width: 0; max-width: 100%; overflow-x: clip; }
main, main > section, .section, .page-header, .hero, .cta,
.resource-hero, .resource-section, .resource-cta,
.services-grid, .features-grid, .portfolio-grid, .processo-grid,
.sobre-grid, .footer-content, .footer-brand, .footer-links, .footer-contato {
    min-width: 0;
}
img, video, canvas { max-width: 100%; }
img, video { height: auto; }
iframe { max-width: 100%; }
button, input, select, textarea { max-width: 100%; }
input, select, textarea { min-width: 0; }
h1, h2, h3, h4, p, li, a, span { text-wrap: pretty; }

.navbar {
    gap: clamp(12px, 2vw, 28px);
    padding-inline: clamp(18px, 6vw, 96px);
}
.navbar > nav {
    min-width: 0;
    align-items: center;
    justify-content: center;
    gap: clamp(14px, 2.2vw, 35px);
}
.navbar > nav a { white-space: nowrap; }
.navbar > .nav-actions { display: flex; align-items: center; gap: 10px; }
.menu-toggle { flex: 0 0 auto; }
.mobile-menu { max-width: 100vw; overflow-x: hidden; }
.mobile-menu nav { min-width: 0; }
.mobile-menu a { overflow-wrap: anywhere; }

[data-codex-shared-footer] .footer-content {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1.15fr);
    gap: clamp(32px, 5vw, 72px);
    padding-inline: clamp(20px, 6vw, 96px);
}
[data-codex-shared-footer] .footer-content.codex-footer-enhanced { grid-template-columns: minmax(0,1.35fr) minmax(0,.85fr) minmax(0,.8fr) minmax(0,1.2fr); }
[data-codex-shared-footer] .codex-footer-resources { order: 2; }
[data-codex-shared-footer] .footer-contato { order: 3; }
[data-codex-shared-footer] .footer-links a,
[data-codex-shared-footer] .footer-contato a { overflow-wrap: anywhere; }
[data-codex-shared-footer] .footer-bottom {
    gap: 14px;
    padding-inline: clamp(20px, 6vw, 96px);
    overflow-wrap: anywhere;
}

.page-header, .hero, .section, .cta,
.resource-hero, .resource-section, .resource-cta {
    padding-left: clamp(20px, 8vw, 150px);
    padding-right: clamp(20px, 8vw, 150px);
}
.page-header h1, .hero h1, .section-heading h2, .cta h2, .resource-hero h1 {
    max-width: 100%;
    overflow-wrap: break-word;
}
.services-grid, .features-grid, .portfolio-grid, .processo-grid, .sobre-grid,
.resource-grid { grid-auto-columns: minmax(0, 1fr); }

/* Forms must remain usable when editable labels become longer. */
form, fieldset, .form-grid, .budget-grid, .contact-grid { min-width: 0; }
label { overflow-wrap: anywhere; }
input, select, textarea { width: 100%; }
button, .button { min-width: 0; }

@media (max-width: 992px) {
    [data-codex-shared-footer] .footer-content {
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    }
    [data-codex-shared-footer] .footer-contato { grid-column: 1 / -1; }
    [data-codex-shared-footer] .footer-content.codex-footer-enhanced { grid-template-columns: minmax(0,1.2fr) minmax(0,1fr); }
    [data-codex-shared-footer] .codex-footer-enhanced .footer-contato { grid-column: auto; }
}

@media (max-width: 620px) {
    .navbar { min-height: 72px; padding-inline: 18px; }
    .navbar > .logo { max-width: calc(100% - 58px); }
    .navbar > .nav-actions > .button { display: none !important; }
    .navbar > .logo > span {
        max-width: min(52vw, 230px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .mobile-menu { max-height: calc(100dvh - 70px); overflow-y: auto; overscroll-behavior: contain; }
    [data-codex-shared-footer] .footer-content { grid-template-columns: minmax(0, 1fr); gap: 34px; }
    [data-codex-shared-footer] .footer-content.codex-footer-enhanced { grid-template-columns: minmax(0,1fr); }
    [data-codex-shared-footer] .footer-contato { grid-column: auto; }
    [data-codex-shared-footer] .footer-bottom { align-items: center; text-align: center; }
    .page-header, .hero, .section, .cta,
    .resource-hero, .resource-section, .resource-cta { padding-left: 20px; padding-right: 20px; }
    .page-header h1, .hero h1, .cta h2, .resource-hero h1 { letter-spacing: -0.04em; }
    .button { max-width: 100%; white-space: normal; text-align: center; }
}

@media (max-width: 380px) {
    .navbar { padding-inline: 14px; }
    .navbar > .logo > span { max-width: 48vw; font-size: 10px; }
    .page-header, .hero, .section, .cta,
    .resource-hero, .resource-section, .resource-cta { padding-left: 16px; padding-right: 16px; }
}
.codex-skip-link{position:fixed;left:16px;top:12px;z-index:100000;transform:translateY(-160%);padding:11px 15px;border-radius:9px;background:#fff;color:#050505;font-weight:800;text-decoration:none;box-shadow:0 8px 30px #0008;transition:transform .18s ease}.codex-skip-link:focus{transform:translateY(0)}

/* Reserve space for every header control, including the theme button. */
.navbar > .logo { flex: 1 1 auto; }
.navbar > nav { flex: 0 1 auto; }
.navbar > .nav-actions { flex: 0 0 auto; }
.navbar .codex-theme-toggle, .navbar .menu-toggle { min-width: 44px; min-height: 44px; }
.navbar .menu-toggle { border-radius: 9px; }
.navbar > .logo > span { letter-spacing: clamp(.12em,.25vw,.3em); }
@media (max-width: 1280px) {
    .navbar > nav { display: none !important; }
    .navbar .menu-toggle { display: flex !important; }
}
@media (max-width: 620px) {
    .navbar { gap: 12px; }
    .navbar > .logo { max-width: calc(100% - 112px); }
    .navbar > .logo > span { max-width: 100%; font-size: 11px; letter-spacing: .13em; }
    .navbar > .nav-actions { gap: 8px; }
    .mobile-menu { top: 72px; max-height: calc(100dvh - 72px); padding-bottom: max(28px,env(safe-area-inset-bottom)); }
    .mobile-menu > .codex-theme-toggle { align-self: flex-start; margin: 0; }
    .mobile-menu > .codex-client-link { gap: 10px; margin-top: 0; }
}
