/* App chrome on top of themes.css. Colors come from the active theme's custom properties. */

.theme-neon-horizon,
.theme-circuit-dawn { color-scheme: dark; }

.theme-atomic-pioneer { color-scheme: light; }

.skip-link {
    position: absolute;
    left: 0.75rem;
    top: -3rem;
    z-index: 300;
    padding: 0.4rem 0.7rem;
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
}

.skip-link:focus { top: 0.75rem; }

.site-header {
    flex-wrap: wrap;
    row-gap: 0.75rem;
}

.logo {
    color: var(--text-primary);
    text-decoration: none;
}

.nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.25rem;
}

.nav a { margin-left: 0; }

.logo:hover { color: var(--accent-primary); text-decoration: none; }

.nav a[aria-current="page"] {
    color: var(--accent-primary);
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

.header-tools {
    display: flex;
    align-items: center;
    gap: 1rem;
}

main {
    width: min(860px, calc(100% - 2rem));
    margin: 1.5rem auto 4rem;
}

main h1 {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4vw, 2.75rem);
    line-height: 1.1;
    margin: 0.2rem 0 0.6rem;
}

.lesson h2,
.lesson h3,
main h2 {
    font-family: var(--font-display);
    line-height: 1.2;
}

.kicker,
.meta,
.lede,
.admin { color: var(--text-secondary); }

.admin { font-size: 0.95rem; }

.round { margin-left: 0.6rem; }

.credits { font-variant-numeric: tabular-nums; color: var(--text-secondary); }

.credits.negative { color: #ffb4b4; font-weight: 700; }

.theme-atomic-pioneer .credits.negative { color: #8d1d1d; }

.banner {
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 0.7rem 0.9rem;
    color: var(--text-primary);
}

.banner.error { border-color: var(--accent-secondary); }

.actions { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }

.actions form,
.header-tools form { margin: 0; }

a.btn,
a.btn:hover { text-decoration: none; }

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.theme-neon-horizon .btn-primary { color: #1a0420; }

.theme-neon-horizon .theme-selector button.active,
.theme-neon-horizon .theme-selector button:hover,
.theme-circuit-dawn .theme-selector button.active,
.theme-circuit-dawn .theme-selector button:hover { color: #071018; }

.lesson {
    margin-top: 1.5rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.4rem 1.2rem 1.2rem;
    box-shadow: var(--shadow);
}

.theme-neon-horizon .lesson,
.theme-circuit-dawn .lesson { box-shadow: var(--glow-soft); }

.lesson details {
    margin: 1rem 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.9rem;
    background: var(--bg-secondary);
}

.lesson summary { cursor: pointer; font-weight: 650; }

.lesson details.solution { border-color: var(--border-strong); }

.lesson pre {
    margin: 0.8rem 0;
    padding: 1rem;
    overflow: auto;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.45;
}

.lesson code,
.meta code { font-family: var(--font-mono); font-size: 0.92em; }

.lesson :not(pre) > code {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.05em 0.35em;
}

.lesson a,
.sources a {
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.lesson table,
.table-wrap table { width: 100%; border-collapse: collapse; }

.lesson th,
.lesson td,
.table-wrap th,
.table-wrap td {
    text-align: left;
    padding: 0.55rem 0.4rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.lesson th,
.table-wrap th { color: var(--text-secondary); font-weight: 650; }

.table-wrap { padding: 0.4rem 0.9rem 0.6rem; overflow-x: auto; }

.table-wrap:hover,
.login.card:hover,
.theme-current:hover { transform: none; }

.login {
    max-width: 28rem;
    margin: 8vh auto;
}

.login h1 { margin-top: 0; }

label { display: block; margin: 0.9rem 0; }

input {
    display: block;
    width: 100%;
    margin-top: 0.3rem;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.sources ul { padding-left: 1.2rem; }

form.theme-selector {
    position: static;
    margin: 1rem 0 0.75rem;
    flex-wrap: wrap;
}

.theme-selector button { min-height: 44px; }

.theme-current h2 {
    font-family: var(--font-display);
    margin-top: 0;
}

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

@media (max-width: 768px) {
    .header-tools { width: 100%; justify-content: center; flex-wrap: wrap; }
    main { margin-top: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    *, *::before, *::after {
        transition: none !important;
        animation: none !important;
    }

    .btn:hover,
    .card:hover { transform: none; }
}
