/* Shared palette overrides; project images retain their original colors. */
:root {
    color-scheme: light;
    background-color: #fff;
    --theme-background: #fff;
    --theme-surface: #fbfbfb;
    --theme-text: #333;
    --theme-border: #ddd;
    --theme-accent: #ff594f;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --theme-background: #151515;
    --theme-surface: #1d1d1d;
    --theme-text: #f0eeeb;
    --theme-muted: #bbb8b4;
    --theme-border: #414141;
    --theme-accent: #ff8077;
    background: var(--theme-background);
}

.header__logo {
    min-width: 0;
    margin-right: 8px;
}

.theme-toggle {
    margin-left: auto;
    margin-right: 16px;
    min-height: 44px;
    width: 44px;
    padding: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--theme-text);
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: filter .2s linear, color .65s ease;
}

.theme-toggle__icon {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.theme-toggle__rays {
    opacity: 0;
    transition: opacity .65s ease;
}

[data-theme="dark"] .theme-toggle__rays {
    opacity: 1;
}

/* Match the dimming of the page underneath the fullscreen menu. */
.header__inner:has(.navbar-toggle.open) .theme-toggle {
    filter: brightness(.2);
}

.theme-toggle:hover {
    color: var(--theme-accent);
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--theme-accent);
    outline-offset: 3px;
}

/* Fade the palette together while preserving existing movement interactions. */
:where(html, body, .page-wrap, .bg-gray, .footer, .post,
       h1, h2, h3, h4, h5, h6, a, .page-title__text, .tool-card p,
       .footer__coppy, .footer__built, .contact-box__text, .contact-box__icon,
       .progress__number, .progress__text, .progress__wrap, .page-title__divider,
       .sharebox__module, .customer-swiper .swiper-slide a, hr) {
    transition: background-color .65s ease, color .65s ease, border-color .65s ease;
}

.header.header--fixed {
    transition: background-color .65s ease, color .65s ease,
                top .3s ease, box-shadow .3s ease;
}

.header__logo img {
    transition: filter .65s ease;
}

.contact-box__item {
    transition: background-color .65s ease, color .65s ease,
                transform .3s ease, box-shadow .3s ease;
}

.navbar-icon span,
.navbar-icon span::before,
.navbar-icon span::after {
    transition-property: transform, top, bottom, opacity, background-color;
    transition-duration: .22s, .1s, .1s, .1s, .65s;
}

@media (prefers-reduced-motion: reduce) {
    :where(html, body, .page-wrap, .bg-gray, .footer, .post,
           h1, h2, h3, h4, h5, h6, a, .page-title__text, .tool-card p,
           .footer__coppy, .footer__built, .contact-box__text, .contact-box__icon,
           .progress__number, .progress__text, .progress__wrap, .page-title__divider,
           .sharebox__module, .customer-swiper .swiper-slide a, hr),
    .header.header--fixed, .header__logo img, .contact-box__item,
    .theme-toggle, .theme-toggle__rays,
    .navbar-icon span, .navbar-icon span::before, .navbar-icon span::after {
        transition: none;
    }
}

[data-theme="dark"] body,
[data-theme="dark"] .page-wrap,
[data-theme="dark"] .header.header--fixed,
[data-theme="dark"] .footer {
    background-color: var(--theme-background);
    color: var(--theme-muted);
}

[data-theme="dark"] .bg-gray,
[data-theme="dark"] .contact-box__item,
[data-theme="dark"] .post,
[data-theme="dark"] .form-item input,
[data-theme="dark"] .form-item textarea,
[data-theme="dark"] .form-item select {
    background-color: var(--theme-surface);
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6,
[data-theme="dark"] .tool-card h4,
[data-theme="dark"] .progress__number,
[data-theme="dark"] .progress__text,
[data-theme="dark"] .footer__coppy,
[data-theme="dark"] .footer__built,
[data-theme="dark"] .footer__social a,
[data-theme="dark"] .social-icon,
[data-theme="dark"] .filter li.current a {
    color: var(--theme-text);
}

[data-theme="dark"] .contact-box__text {
    color: var(--theme-muted) !important;
}

[data-theme="dark"] .tool-card p,
[data-theme="dark"] .page-title__text,
[data-theme="dark"] .filter a {
    color: var(--theme-muted);
}

[data-theme="dark"] a,
[data-theme="dark"] a:hover {
    color: var(--theme-accent);
}

[data-theme="dark"] .contact-box__text a,
[data-theme="dark"] .contact-box__icon {
    color: var(--theme-accent) !important;
}

[data-theme="dark"] .footer,
[data-theme="dark"] .social-icon,
[data-theme="dark"] .sharebox__module {
    border-color: var(--theme-border);
}

[data-theme="dark"] hr {
    border-color: var(--theme-border) !important;
}

[data-theme="dark"] .progress__wrap,
[data-theme="dark"] .page-title__divider {
    background-color: var(--theme-border);
}

[data-theme="dark"] .md-btn--outline-primary {
    background-color: transparent;
    border-color: var(--theme-accent);
    color: var(--theme-accent);
}

[data-theme="dark"] .md-btn--outline-primary:hover {
    background-color: var(--theme-accent);
    color: var(--theme-background);
}

[data-theme="dark"] .navbar-icon span,
[data-theme="dark"] .navbar-icon span::before,
[data-theme="dark"] .navbar-icon span::after {
    background-color: var(--theme-text);
}

[data-theme="dark"] .header__logo img {
    filter: invert(1);
}

.customer-swiper .swiper-slide a {
    background-color: transparent;
    padding: 10px;
}

.customer-swiper img {
    mix-blend-mode: normal;
}

[data-theme="dark"] .customer-swiper img {
    /* Keep the original alpha channel while adapting artwork for dark mode. */
    filter: grayscale(1) invert(1);
}

.customer-swiper img[src$="US2.png"] {
    filter: url("../img/collaborator-filters.svg#us-transparent");
}

[data-theme="dark"] .customer-swiper img[src$="US2.png"] {
    filter: url("../img/collaborator-filters.svg#us-transparent") grayscale(1) invert(1);
}

[data-theme="dark"] .hoverbox.light .hb_back {
    background-color: rgba(21, 21, 21, .92);
    color: var(--theme-text);
}

[data-theme="dark"] .hoverbox.light .hb_back h2,
[data-theme="dark"] .hoverbox.light .hb_back h3,
[data-theme="dark"] .hoverbox.light .hb_back h4 {
    color: var(--theme-text);
}

@media (max-width: 380px) {
    .theme-toggle {
        margin-right: 4px;
        padding: 8px;
        font-size: 11px;
    }
}

/* Disable individual fades while a single full-page crossfade is captured. */
html.theme-changing,
html.theme-changing *,
html.theme-changing *::before,
html.theme-changing *::after {
    transition: none !important;
}

::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: .65s;
    animation-timing-function: ease-in-out;
    animation-delay: 0s;
}

/* Keep matching timings in browsers without the View Transition API. */
html.theme-fading,
html.theme-fading *,
html.theme-fading *::before,
html.theme-fading *::after {
    transition-property: background-color, color, border-color, filter, fill, stroke, opacity !important;
    transition-duration: .65s !important;
    transition-timing-function: ease-in-out !important;
    transition-delay: 0s !important;
}

@media (prefers-reduced-motion: reduce) {
    ::view-transition-old(root),
    ::view-transition-new(root) {
        animation: none;
    }
}
