/* Local theme control: original geometric CSS, no SVG, font icon or remote asset. */
.apus-appearance-control[hidden], .site-header .apus-appearance-control[hidden] { display: none; }
.apus-header-tools { display: flex; align-items: center; justify-content: flex-end; flex: 0 0 auto; height: 100%; }
.site-header .apus-appearance-control {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; min-width: 36px; height: 36px; flex: 0 0 36px;
    padding: 0; margin: 0; box-sizing: border-box;
    color: var(--text-primary); background: transparent;
    border: 0; border-radius: var(--action-radius);
    cursor: pointer; touch-action: manipulation;
}
.site-header .apus-appearance-control:hover { color: var(--control-focus); }
.site-header .apus-appearance-control:focus-visible { outline: 2px solid var(--control-focus); outline-offset: 2px; }
.apus-appearance-control :is(.apus-theme-sun, .apus-theme-moon) { position: relative; display: block; width: 22px; height: 22px; pointer-events: none; }
.apus-theme-moon::before { content: ''; position: absolute; inset: 2px; border-radius: 50%; box-shadow: inset 5px -3px 0 0 currentColor; transform: rotate(-10deg); }
.apus-theme-sun::before { content: ''; position: absolute; inset: 6px; border: 1.6px solid currentColor; border-radius: 50%; }
.apus-theme-sun::after { content: ''; position: absolute; top: 10px; left: 10px; width: 2px; height: 2px; border-radius: 50%; box-shadow: 0 -9px currentColor, 0 9px currentColor, 9px 0 currentColor, -9px 0 currentColor, 6.4px 6.4px currentColor, -6.4px 6.4px currentColor, 6.4px -6.4px currentColor, -6.4px -6.4px currentColor; }
.apus-appearance-control .apus-theme-sun, [data-apus-theme="dark"] .apus-appearance-control .apus-theme-moon { display: none; }
[data-apus-theme="dark"] .apus-appearance-control .apus-theme-sun { display: block; }
/* Preserve the original large-screen navigation, including its list-item spacing.
   The theme control follows the last link with the same combined li padding. */
body:not(.hub-body) .apus-header-tools { gap: 6rem; }
.hub-body .apus-header-tools { gap: 2rem; }


@media (min-width: 841px) {

    body:not(.hub-body) .apus-header-tools {
        flex: 1 1 auto;
        min-width: 0;
        margin-left: clamp(1.5rem, 3vw, 3rem);
        justify-content: space-between;
        align-items: center;
        gap: 0.75rem;
    }

    body:not(.hub-body) .site-header .main-nav {
        display: contents;
    }

    body:not(.hub-body) .main-nav > ul {
        display: contents;
    }

    body:not(.hub-body) .main-nav > ul > li {
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
        height: auto;
        padding: 0;
        margin: 0;
        white-space: nowrap;
    }

    body:not(.hub-body) .main-nav > ul > li > a {
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 0;
        padding: 0.75rem 0;
    }

    body:not(.hub-body) .main-nav > ul > li.login-button > a {
        margin: 0;
        padding: 0.5rem 1.5rem;
    }

    body:not(.hub-body) .site-header .apus-appearance-control {
        align-self: center;
    }
}


@media (max-width: 840px) {
    body:not(.hub-body) .apus-header-tools, .hub-body .apus-header-tools { gap: 1.25rem; }
    .site-header .hamburger { position: static; transform: none; margin: 0; width: 44px; height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border: 0; background: transparent; }
    .site-header .hamburger .bar { width: 28px; height: 2px; margin: 0; }
    .site-header .hamburger.active .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .site-header .hamburger.active .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
    .site-header .hamburger:focus-visible { outline: 2px solid var(--control-focus); outline-offset: 2px; }
}
@media (max-width: 400px) {
    .site-header #logo-link { min-width: 0; }
}

/* Preserve the original brand tokens. These are semantic interface colors. */
:root[data-apus-theme="dark"] {
    color-scheme: dark;
    --surface-page: #101811;
    --surface-card: #19251C;
    --surface-muted: #243328;
    --text-primary: #E6EDE3;
    --text-secondary: #C2D0C0;
    --text-muted: #A8B9A6;
    --border-soft: #354839;
    --border-medium: #49604D;
    --shadow-soft: 0 1px 2px rgb(0 0 0 / 18%);
    --shadow-card: 0 4px 16px rgb(0 0 0 / 24%);
    --shadow-panel: 0 12px 32px rgb(0 0 0 / 35%);
    --focus-ring: 0 0 0 3px rgb(155 214 110 / 35%);
    --appearance-accent: #9BD66E;
    --appearance-link: #8BC8FF;
    --appearance-warning: #FFC17D;
    --appearance-error: #FFB4A8;
    --hub-muted: var(--text-muted);
    --control-bg: var(--surface-page);
    --control-text: var(--text-primary);
    --control-border: #758A76;
    --control-muted: var(--text-muted);
    --control-disabled: var(--surface-muted);
    --control-focus: var(--appearance-accent);
    --control-error: var(--appearance-error);
    --action-primary-bg: var(--apus-blue);
    --action-primary-border: var(--apus-blue);
    --action-primary-hover: #234784;
    --action-primary-hover-border: #234784;
    --action-primary-text: #FFFFFF;
    --action-secondary-bg: var(--surface-muted);
    --action-secondary-text: var(--text-primary);
    --action-secondary-hover: var(--surface-card);
    --action-danger-bg: #963F35;
    --action-danger-border: var(--appearance-error);
    --action-danger-hover-border: var(--appearance-error);
    --action-danger-hover: #80352D;
    --status-success-bg: #21351F;
    --status-info-bg: #182C39;
    --status-warning-bg: #35291D;
    --status-error-bg: #352321;
    --access-ink: var(--text-primary);
    --access-text: var(--text-secondary);
    --access-muted: var(--text-muted);
    --access-border: var(--border-medium);
    --access-surface: var(--surface-muted);
    --access-danger: var(--appearance-error);
    --access-success: var(--appearance-accent);
    --access-shadow: var(--shadow-panel);
}
[data-apus-theme="dark"] body,
[data-apus-theme="dark"] body.hub-body {
    color: var(--text-secondary);
    background-color: var(--surface-page);
}
[data-apus-theme="dark"] .site-header {
    background-color: rgb(16 24 17 / 94%);
    border-bottom: 1px solid var(--border-soft);
}
[data-apus-theme="dark"] #apus-logo-original #letras path {
    fill: var(--text-primary) !important;
}
[data-apus-theme="dark"] #apus-logo-original #texto { fill: var(--text-secondary) !important; }
[data-apus-theme="dark"] .main-nav > ul > li > a,
[data-apus-theme="dark"] .hub-account-toggle,
[data-apus-theme="dark"] .hub-header-user-name,
[data-apus-theme="dark"] .hub-account-indicator { color: var(--text-primary); }
[data-apus-theme="dark"] .hamburger .bar { background-color: var(--text-primary); }
[data-apus-theme="dark"] .hub-account-menu,
[data-apus-theme="dark"] .site-footer,
[data-apus-theme="dark"] .hub-footer {
    background: linear-gradient(135deg, #19251C, #101811);
}
[data-apus-theme="dark"] .hub-footer::before {
    background: linear-gradient(to right, transparent, #49604D, transparent);
}
@media (max-width: 840px) {
    [data-apus-theme="dark"] body:not(.hub-body) .main-nav > ul {
        background: #19251C;
    }
}
/* Hub home: keep illustrations and card layout unchanged. */
[data-apus-theme="dark"] .hub-home .hub-page-header::after { opacity: .45; }
[data-apus-theme="dark"] .hub-home a.hub-section-card--compact::after {
    border-color: var(--appearance-accent);
}
[data-apus-theme="dark"] .hub-home a.hub-section-card--compact:hover,
[data-apus-theme="dark"] .hub-home a.hub-section-card--compact:focus-visible {
    border-color: var(--appearance-accent);
}
[data-apus-theme="dark"] .hub-home a.hub-section-card--compact:focus-visible,
[data-apus-theme="dark"] .hub-account-toggle:focus-visible {
    outline-color: var(--appearance-accent);
}
[data-apus-theme="dark"] .hub-message {
    color: var(--appearance-link); background: var(--status-info-bg); border-color: var(--appearance-link);
}
[data-apus-theme="dark"] .hub-message--success {
    color: var(--appearance-accent); background: var(--status-success-bg); border-color: var(--appearance-accent);
}
[data-apus-theme="dark"] .hub-message--warning {
    color: var(--appearance-warning); background: var(--status-warning-bg); border-color: var(--appearance-warning);
}
[data-apus-theme="dark"] .hub-message--error {
    color: var(--appearance-error); background: var(--status-error-bg); border-color: var(--appearance-error);
}
/* Improve low-contrast decorative illustrations without editing the SVGs. */
[data-apus-theme="dark"] .hub-home img[src$="/content-default.svg"],
[data-apus-theme="dark"] .whose-item-2 .whose-image,
[data-apus-theme="dark"] .whose-item-5 .whose-image { filter: brightness(1.65); }
/* Website home: preserve photographs and brand illustrations. */
[data-apus-theme="dark"] .home-services1-intro p,
[data-apus-theme="dark"] .whoses-home h2,
[data-apus-theme="dark"] .whose-item h4,
[data-apus-theme="dark"] .home-blog > p { color: var(--text-primary); }
[data-apus-theme="dark"] .whoses-home,
[data-apus-theme="dark"] .whose-item,
[data-apus-theme="dark"] .whose-item p { color: var(--text-secondary); }
[data-apus-theme="dark"] .whoses-home { background: var(--surface-page); }
[data-apus-theme="dark"] .home-blog { background: var(--surface-card); }
[data-apus-theme="dark"] .divider-gradient-1 { background: linear-gradient(to right, #354839, #101811); }
[data-apus-theme="dark"] .home .blog-card-content { background: rgb(16 24 17 / 86%); }
[data-apus-theme="dark"] .popup-container { background: #19251C; }
[data-apus-theme="dark"] .popup-container .close-popup,
[data-apus-theme="dark"] .form-group label,
[data-apus-theme="dark"] .phone-number-label { color: var(--text-primary); }
[data-apus-theme="dark"] .form-group :is(input, textarea, select),
[data-apus-theme="dark"] .form-group-phone :is(input, textarea, select),
[data-apus-theme="dark"] #phone-number-id_0 {
    background-color: var(--surface-page);
    color: var(--text-primary);
    border-color: var(--border-medium);
}
[data-apus-theme="dark"] .form-group select,
[data-apus-theme="dark"] .form-group-phone select {
    background-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="10" height="5" viewBox="0 0 10 5"%3E%3Cpath fill="%23E6EDE3" d="M0 0l5 5 5-5z"/%3E%3C/svg%3E');
}
[data-apus-theme="dark"] .form-status.loading { color: var(--appearance-link); }
[data-apus-theme="dark"] .form-status.success { color: var(--appearance-accent); }
[data-apus-theme="dark"] .form-status.error { color: var(--appearance-error); }
[data-apus-theme="dark"] .home a:focus-visible,
[data-apus-theme="dark"] .home button:focus-visible,
[data-apus-theme="dark"] .popup-container :is(input, textarea, select, button):focus-visible,
[data-apus-theme="dark"] .main-nav a:focus-visible { outline: 2px solid var(--appearance-accent); outline-offset: 3px; }

/* Public contact popup: explicit foreground/background pairing, including autofill. */
[data-apus-theme="dark"] body:not(.hub-body) .contact-form :is(input:not([type="hidden"]), select, textarea) { background-color: #101811; color: var(--text-primary); border-color: #758A76; caret-color: var(--text-primary); }
[data-apus-theme="dark"] body:not(.hub-body) .contact-form :is(input, textarea)::placeholder { color: var(--text-muted); opacity: 1; }
[data-apus-theme="dark"] body:not(.hub-body) .contact-form :is(input, select, textarea):is(:autofill, :-webkit-autofill) { box-shadow: 0 0 0 1000px #101811 inset; -webkit-text-fill-color: var(--text-primary); }

/* Shared fallback for authentication/status pages owned by APUS. */
[data-apus-theme="dark"] .loading-screen,
[data-apus-theme="dark"] :is(.access-page, .logout-page) { background: var(--surface-page); }
[data-apus-theme="dark"] .logout-panel { background: var(--surface-card); border-color: var(--border-medium); box-shadow: var(--shadow-panel); }
[data-apus-theme="dark"] :is(.logout-panel__title, .logout-panel__lead) { color: var(--text-primary); }
[data-apus-theme="dark"] :is(.logout-panel__description, .logout-panel__note) { color: var(--text-secondary); }
[data-apus-theme="dark"] :is(.logout-panel__eyebrow, .access-panel .access-eyebrow) { color: var(--appearance-link); }
[data-apus-theme="dark"] .logout-panel__symbol { background: var(--status-success-bg); color: var(--appearance-accent); }
[data-apus-theme="dark"] .access-panel .access-status { background: var(--status-error-bg); border-color: var(--appearance-error); }
[data-apus-theme="dark"] .access-panel .access-status--success { background: var(--status-success-bg); border-color: var(--appearance-accent); }
[data-apus-theme="dark"] :is(.logout-panel__button--secondary, .access-actions .access-button--secondary) { background: var(--action-secondary-bg); color: var(--action-secondary-text); }
[data-apus-theme="dark"] :is(.logout-panel__button--secondary, .access-actions .access-button--secondary):hover { background: var(--action-secondary-hover); color: var(--appearance-accent); }
[data-apus-theme="dark"] :is(.contact-form-dropdown, .popup-container) { background: var(--surface-card); }
/* A shared dropdown/control palette, including actual autofill states. */
[data-apus-theme="dark"] body:not(.hub-body) :is(.contact-form, .contact-form-dropdown, .popup-container) :is(input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]), select, textarea) { background-color: var(--control-bg); color: var(--control-text); border-color: var(--control-border); caret-color: var(--control-text); }
[data-apus-theme="dark"] body:not(.hub-body) :is(.contact-form, .contact-form-dropdown, .popup-container) :is(input, textarea, select):autofill { box-shadow: 0 0 0 1000px var(--control-bg) inset !important; -webkit-text-fill-color: var(--control-text) !important; }
[data-apus-theme="dark"] body:not(.hub-body) :is(.contact-form, .contact-form-dropdown, .popup-container) :is(input, textarea, select):-webkit-autofill { box-shadow: 0 0 0 1000px var(--control-bg) inset !important; -webkit-text-fill-color: var(--control-text) !important; }

/* Ordinary APUS action buttons share one scale; links and icon tools do not. */
@media (max-width: 700px) { :root { --action-height: 2.375rem; } }
.home :is(.button1, .button2, .button3),
.home .home-about .button3,
.site-footer .footer-contact-button,
#contact-form-popup .contact-form button[type="submit"] {
    display: inline-flex; align-items: center; justify-content: center;
    box-sizing: border-box; min-height: var(--action-height);
    padding: var(--action-padding); border: 0;
    border-radius: var(--action-radius); font-family: 'Roboto', sans-serif;
    font-size: var(--action-font); font-weight: 500; line-height: 1.25;
    letter-spacing: 0; text-align: center; white-space: normal;
    color: var(--action-primary-text); background: var(--action-primary-bg);
    box-shadow: none;
}
.home :is(.button1, .button2, .button3):hover,
#contact-form-popup .contact-form button[type="submit"]:hover {
    background: var(--action-primary-hover);
    color: var(--action-primary-text); box-shadow: none;
}
.site-footer .footer-contact-button { border-radius: var(--radius-panel); }
#contact-form-popup .contact-form button[type="submit"] { align-self: center; }

/* Brand accents: restrained, non-semantic details; never replace status colors. */
:root {
    --brand-detail: var(--apus-orange);
}
:root[data-apus-theme="dark"] {
    --brand-detail: var(--apus-light-orange);
}

/* Keep the home palette selected after Lot 11.5.21. */
[data-apus-theme="dark"] .home :is(.button1, .button2, .button3) {
    --action-primary-bg: var(--apus-green);
    --action-primary-hover: var(--apus-light-green);
}

/* Footer contact: same action height, no decorative hover; keep keyboard focus. */
[data-apus-theme="dark"] .site-footer .footer-contact-button {
    --action-primary-bg: var(--apus-green);
}
.site-footer .footer-contact-button,
.site-footer .footer-contact-button:is(:hover, :focus-visible, :active) {
    background: var(--action-primary-bg);
    color: var(--action-primary-text);
    text-decoration: none;
    box-shadow: none;
    flex-shrink: 0;
}

/* Editorial links: retain existing text and focus colors, accent the underline only. */
.blog-post-content a:is(:hover, :focus-visible) {
    text-decoration-color: var(--brand-detail);
}

/* Public website content alignment */

body:not(.hub-body) :is(
    .hero-container,
    .home-services1-container,
    .home-about-container,
    .whoses-grid,
    .apus-triade,
    .apus-team__inner,
    .services-details-container,
    .blog-grid,
    .footer-container
) {
    width: var(--layout-max-width);
    max-width: var(--layout-width);
    margin-inline: auto;
    box-sizing: border-box;
}

body:not(.hub-body) :is(
    .hero-container,
    .home-services1,
    .whoses-home,
    .apus-team,
    .apus-triade-section,
    .apus-triade,
    .services-details,
    .blog-content
) {
    padding-inline: 0;
}

body:not(.hub-body) .home-about-content {
    padding-inline: 0;
    box-sizing: border-box;
}