/* User-selectable application theme. Geometry and component ownership stay in their source CSS. */
.app-theme-control {
    display: grid;
    gap: 8px;
    padding: 10px 14px;
    border-block: 1px solid var(--color-border, #e2e8f0);
    background: var(--color-surface, #ffffff);
}

.app-theme-control--auth {
    margin: 0 0 14px;
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 10px;
}

.app-theme-control__label {
    color: var(--color-text, #1e293b);
    font-size: 0.86rem;
    font-weight: 750;
}

.app-theme-control__options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    min-width: 0;
}

.app-theme-control__option {
    min-width: 0;
    min-height: 44px;
    padding: 8px 6px;
    border: 1px solid var(--color-border, #cbd5e1);
    border-radius: 8px;
    background: var(--color-surface, #ffffff);
    color: #173f5b;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}

.app-theme-control__option:hover {
    border-color: color-mix(in srgb, var(--color-primary, #4a90d9) 68%, var(--color-border, #cbd5e1));
    background: color-mix(in srgb, var(--color-primary, #4a90d9) 8%, var(--color-surface, #ffffff));
}

.app-theme-control__option[aria-pressed="true"] {
    border-color: #4a90d9;
    background: #e7f1ff;
    color: #123d6b;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, #4a90d9 26%, transparent);
}

.app-theme-control__status {
    grid-column: 1 / -1;
    color: var(--color-text-secondary, #64748b);
    font-size: 0.7rem;
    line-height: 1.45;
}

.app-theme-control__option:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--color-primary, #4a90d9) 55%, transparent);
    outline-offset: 2px;
}

/* Keep the short theme fade above the page without swallowing input. */
::view-transition {
    pointer-events: none;
}

::view-transition-old(root) {
    animation: app-theme-fade-out 240ms ease-out both;
}

::view-transition-new(root) {
    animation: app-theme-fade-in 240ms ease-out both;
}

@keyframes app-theme-fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes app-theme-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 767px) {
    .app-theme-control__options {
        gap: 5px;
    }
}

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

    html[data-theme] *,
    html[data-theme] *::before,
    html[data-theme] *::after {
        transition-duration: 0.01ms !important;
    }
}
