/* Shared controls for switching between the saved visual styles. */

html {
    --theme-origin-x: 50vw;
    --theme-origin-y: 72px;
}

.hero-layout {
    row-gap: clamp(18px, 3svh, 28px);
}

.topic-scroll {
    overflow-x: hidden;
}

.style-showcase {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    width: 100%;
    min-width: 0;
    padding: 12px 14px;
    border: 1px solid rgba(15, 118, 110, 0.20);
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 14px 38px rgba(20, 29, 38, 0.08);
    backdrop-filter: blur(16px);
    transition:
        color 420ms ease,
        background 420ms ease,
        border-color 420ms ease,
        box-shadow 420ms var(--motion-ease);
}

.style-showcase-copy {
    min-width: 0;
}

.style-showcase-kicker {
    display: block;
    margin-bottom: 2px;
    color: var(--accent);
    font-size: 10px;
    font-weight: 900;
    line-height: 1.2;
    text-transform: uppercase;
}

.style-showcase p {
    margin: 0;
    color: #273137;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
}

.style-switch {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: auto 44px auto;
    align-items: center;
    gap: 9px;
    min-height: 42px;
    padding: 6px 9px;
    border: 1px solid rgba(15, 118, 110, 0.18);
    border-radius: 999px;
    background: rgba(247, 251, 250, 0.96);
    color: var(--muted);
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(20, 29, 38, 0.08);
    transition:
        color 300ms ease,
        background 300ms ease,
        border-color 300ms ease,
        box-shadow 300ms var(--motion-ease),
        transform 240ms var(--motion-ease);
}

.style-switch:hover {
    transform: translateY(-1px);
    border-color: rgba(15, 118, 110, 0.36);
}

.style-switch:focus-visible {
    outline: 3px solid rgba(15, 118, 110, 0.28);
    outline-offset: 3px;
}

.style-switch-label {
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
    transition: color 300ms ease;
}

.style-switch-label-minimal {
    color: var(--accent-dark);
}

.style-switch-track {
    position: relative;
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: #dbe8e5;
    box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.16);
    transition:
        background 360ms ease,
        box-shadow 360ms ease;
}

.style-switch-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 4px 10px rgba(15, 118, 110, 0.24);
    transition:
        transform 480ms var(--motion-ease),
        border-radius 360ms ease,
        background 360ms ease,
        box-shadow 360ms ease;
}

.hero-action {
    display: none;
}

body[data-visual-style="bold"] .style-showcase {
    border-color: rgba(255, 255, 255, 0.20);
    border-left-color: var(--accent);
    border-radius: 4px;
    background: rgba(7, 9, 7, 0.88);
    color: #ffffff;
    box-shadow: 8px 8px 0 rgba(255, 91, 56, 0.94), 0 22px 60px rgba(0, 0, 0, 0.28);
}

body[data-visual-style="bold"] .style-showcase-kicker {
    color: var(--accent);
}

body[data-visual-style="bold"] .style-showcase p {
    color: rgba(255, 255, 255, 0.86);
}

body[data-visual-style="bold"] .style-switch {
    border-color: rgba(255, 255, 255, 0.18);
    border-radius: 4px;
    background: #111411;
    color: rgba(255, 255, 255, 0.62);
    box-shadow: none;
}

body[data-visual-style="bold"] .style-switch:hover {
    border-color: var(--accent);
}

body[data-visual-style="bold"] .style-switch:focus-visible {
    outline-color: var(--accent);
}

body[data-visual-style="bold"] .style-switch-label-minimal {
    color: rgba(255, 255, 255, 0.58);
}

body[data-visual-style="bold"] .style-switch-label-bold {
    color: var(--accent);
}

body[data-visual-style="bold"] .style-switch-track {
    border-radius: 2px;
    background: #292f28;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

body[data-visual-style="bold"] .style-switch-thumb {
    border-radius: 1px;
    background: var(--accent);
    box-shadow: 0 0 0 1px rgba(201, 255, 50, 0.28);
    transform: translateX(20px);
}

body[data-visual-style="bold"] .hero-action {
    display: flex;
}

::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 720ms;
    animation-timing-function: var(--motion-ease);
}

::view-transition-old(root) {
    animation-name: theme-hold;
}

::view-transition-new(root) {
    animation-name: theme-reveal;
}

@keyframes theme-hold {
    from,
    to {
        opacity: 1;
    }
}

@keyframes theme-reveal {
    from {
        clip-path: circle(0 at var(--theme-origin-x) var(--theme-origin-y));
    }
    to {
        clip-path: circle(150vmax at var(--theme-origin-x) var(--theme-origin-y));
    }
}

@media (max-width: 680px) {
    .hero-layout {
        row-gap: 14px;
    }

    .style-showcase {
        display: grid;
        gap: 10px;
        padding: 11px 12px;
    }

    .style-showcase p {
        font-size: 13px;
    }

    .style-switch {
        grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr);
        width: 100%;
        min-height: 40px;
    }

    .style-switch-label:last-child {
        text-align: right;
    }

    body[data-visual-style="bold"] .hero-action {
        display: grid;
        grid-template-columns: 1fr;
    }

    body[data-visual-style="bold"] .hero-action p,
    body[data-visual-style="bold"] .signal-row {
        display: none;
    }

    body[data-visual-style="bold"] .focus-panel {
        gap: 10px;
        padding: 15px;
    }

    body[data-visual-style="bold"] .focus-head strong {
        font-size: 21px;
    }

    body[data-visual-style="bold"] .focus-list li {
        min-height: 44px;
        padding: 7px 0;
    }

    body[data-visual-style="bold"] .focus-list span {
        font-size: 12px;
    }
}

@media (max-width: 360px), (max-height: 620px) {
    .style-showcase {
        gap: 7px;
        padding: 9px 10px;
    }

    .style-showcase-kicker {
        display: none;
    }

    .style-showcase p {
        font-size: 12px;
        line-height: 1.28;
    }

    .style-switch {
        min-height: 38px;
        padding: 5px 8px;
    }

    .style-switch-label {
        font-size: 11px;
    }
}

@media (max-width: 340px), (max-height: 590px) {
    .hero-layout {
        row-gap: 10px;
    }

    .style-showcase {
        gap: 5px;
        padding: 7px 10px;
    }

    .style-switch {
        min-height: 36px;
    }

    body[data-visual-style="minimal"] .topic-hero {
        padding-top: 12px;
    }

    body[data-visual-style="minimal"] .topic-hero .focus-panel {
        padding-block: 10px;
    }

    body[data-visual-style="bold"] .bottom-nav {
        bottom: env(safe-area-inset-bottom);
    }
}

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