/*
 * Chrome shared by the workshop hub and the lesson viewer: the settings menu
 * behind the gear and the resource links at the bottom of the page. Both pages
 * load this after their own stylesheet, so it only uses tokens they both define.
 */

[hidden] {
    display: none !important;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.settings {
    position: relative;
    flex: 0 0 auto;
}

.settings-toggle {
    display: inline-grid;
    width: 2.5rem;
    height: 2.5rem;
    place-items: center;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 150ms ease, color 150ms ease;
}

.settings-toggle:hover,
.settings-toggle[aria-expanded="true"] {
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
}

.settings-toggle svg,
.theme-option svg {
    width: 1.15rem;
    height: 1.15rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.settings-panel {
    position: absolute;
    z-index: 5;
    top: calc(100% + 0.6rem);
    right: 0;
    display: grid;
    width: min(18rem, calc(100vw - 1.5rem));
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-card);
    animation: settings-panel-in 140ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.settings-panel[hidden] {
    display: none;
}

@keyframes settings-panel-in {
    from {
        opacity: 0;
        transform: translateY(-0.3rem);
    }
}

.settings-row {
    display: grid;
    min-width: 0;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
    border: 0;
}

.settings-label {
    padding: 0;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.3;
}

.settings-select {
    width: 100%;
    min-height: 2.5rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-code);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}

.settings-select:hover {
    border-color: var(--neon-cyan);
}

.theme-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.25rem;
    padding: 0.25rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-code);
}

.theme-option {
    cursor: pointer;
}

.theme-option span {
    display: flex;
    min-height: 2rem;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid transparent;
    border-radius: 5px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.2;
    transition: background-color 150ms ease, color 150ms ease;
}

.theme-option:hover span {
    color: var(--text-primary);
}

.theme-option input:checked + span {
    border-color: var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
}

.theme-option input:focus-visible + span {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.site-footer {
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.86rem;
}

.site-footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.75rem;
}

.site-footer a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: inherit;
    font-weight: 600;
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--neon-cyan);
}

.external-icon {
    width: 0.9em;
    height: 0.9em;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@media (prefers-reduced-motion: reduce) {
    .settings-panel {
        animation: none;
    }
}
