:root {
    --ink: #2e2e2e;
    --muted: #6d7075;
    --paper: #ffffff;
    --canvas: #f4f5f5;
    --line: #e4e5e5;
    --brand: #b01e0a;
    --brand-dark: #831509;
    --night: #17191b;
    --success: #28784d;
    --sidebar-width: 330px;
    color-scheme: light;
    font-family: Poppins, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
    margin: 0;
    color: var(--ink);
    background: var(--canvas);
    font-size: 16px;
    line-height: 1.55;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.brand-mark {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.brand-logo {
    display: block;
    width: 192px;
    max-width: 100%;
    height: auto;
}
.brand-mark--dark .brand-logo { filter: brightness(0); }
.app-header__brand .brand-logo { width: 160px; }

.eyebrow {
    display: block;
    margin-bottom: .75rem;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.eyebrow--red { color: var(--brand); }

.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(420px, 1.25fr) minmax(380px, .75fr);
}

.login-brand {
    min-height: 100vh;
    padding: clamp(2rem, 5vw, 5rem);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #fff;
    background:
        linear-gradient(115deg, rgba(25, 26, 26, .87), rgba(79, 27, 18, .45)),
        radial-gradient(circle at 75% 18%, rgba(244, 175, 56, .8), transparent 32%),
        linear-gradient(155deg, #353b3b 10%, #7b2d1e 55%, #151719 100%);
    position: relative;
    overflow: hidden;
}

.login-brand::after {
    content: "";
    position: absolute;
    inset: auto -10% -24% 12%;
    height: 54%;
    opacity: .22;
    transform: perspective(500px) rotateX(55deg) rotateZ(-8deg);
    background-image:
        linear-gradient(rgba(255,255,255,.5) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.5) 1px, transparent 1px);
    background-size: 56px 42px;
}

.login-brand__copy { position: relative; z-index: 1; max-width: 720px; }
.login-brand h1 {
    margin: 0 0 1.5rem;
    font-size: clamp(4rem, 8vw, 8.5rem);
    line-height: .9;
    letter-spacing: -.075em;
    font-weight: 600;
}
.login-brand p { max-width: 540px; font-size: 1.2rem; color: rgba(255,255,255,.82); }

.login-panel {
    padding: 3rem clamp(2rem, 6vw, 6rem);
    display: grid;
    place-items: center;
    background: var(--paper);
}

.login-form { width: 100%; max-width: 420px; }
.login-panel__brand { margin-bottom: clamp(3rem, 9vh, 7rem); }
.login-form h2 { margin: 0; font-size: 2.7rem; line-height: 1.1; letter-spacing: -.055em; }
.login-intro { color: var(--muted); margin: .9rem 0 2rem; }
.login-form label { display: block; margin: 1rem 0 .4rem; font-size: .86rem; font-weight: 650; }
.login-form input {
    width: 100%;
    border: 1px solid #cfd1d2;
    border-radius: 8px;
    padding: .85rem 1rem;
    color: var(--ink);
    background: #fff;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.login-form input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(176,30,10,.12); }

.button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border: 0;
    border-radius: 8px;
    padding: .85rem 1.25rem;
    font-weight: 650;
    text-decoration: none;
    cursor: pointer;
}
.button--primary { margin-top: 1.5rem; color: #fff; background: var(--brand); }
.button--primary:hover { background: var(--brand-dark); }
.login-form .button { width: 100%; }
.login-help { margin: 1rem 0 0; color: var(--muted); text-align: center; font-size: .8rem; }
.validation-summary { color: #981b0b; margin: 1rem 0; }
.validation-summary:empty { display: none; }
.field-error { display: block; margin-top: .25rem; color: #981b0b; font-size: .8rem; }

.app-header {
    height: 70px;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    color: #fff;
    background: var(--night);
    position: sticky;
    top: 0;
    z-index: 20;
}
.app-header__divider { width: 1px; height: 28px; margin: 0 1rem; background: rgba(255,255,255,.22); }
.app-header__title { font-weight: 500; color: rgba(255,255,255,.75); }
.app-header__user { margin-left: auto; display: flex; align-items: center; gap: 1rem; font-size: .84rem; }
.app-header__user form { margin: 0; }
.button-link { border: 0; padding: 0; color: #fff; background: transparent; text-decoration: underline; cursor: pointer; }
.toc-toggle { display: none; margin-right: .7rem; border: 0; background: transparent; color: #fff; font-size: 1.4rem; }

.academy-layout { min-height: calc(100vh - 70px); display: grid; grid-template-columns: var(--sidebar-width) 1fr; }
.toc {
    border-right: 1px solid var(--line);
    padding: 2rem 1.25rem 3rem;
    background: #fff;
    overflow-y: auto;
}
.toc__heading { padding: 0 .65rem 1.5rem; border-bottom: 1px solid var(--line); margin-bottom: .7rem; }
.toc__heading h2 { margin: 0; font-size: 1.35rem; letter-spacing: -.035em; }
.toc__heading p { color: var(--muted); font-size: .84rem; }
.topic { margin: .2rem 0; }
.topic summary {
    list-style: none;
    padding: .72rem .65rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: .86rem;
    font-weight: 650;
    cursor: pointer;
    border-radius: 7px;
}
.topic summary::-webkit-details-marker { display: none; }
.topic summary:hover { background: #f5f5f5; }
.topic__chevron { transition: transform .15s; font-size: 1.2rem; color: var(--muted); }
.topic[open] > summary .topic__chevron { transform: rotate(90deg); }
.topic__children { margin-left: .8rem; padding-left: .65rem; border-left: 1px solid var(--line); }

.video-link {
    width: 100%;
    border: 0;
    border-radius: 7px;
    padding: .62rem .65rem;
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    color: var(--ink);
    background: transparent;
    text-align: left;
    cursor: pointer;
}
.video-link:hover { background: #f5f5f5; }
.video-link.is-active { background: rgba(176,30,10,.08); color: #801609; }
.video-link__copy { min-width: 0; display: flex; flex-direction: column; }
.video-link__copy strong { font-size: .8rem; font-weight: 550; line-height: 1.35; }
.video-link__copy small { margin-top: .15rem; color: var(--muted); font-size: .68rem; }
.progress-dot {
    flex: 0 0 auto;
    width: 11px;
    height: 11px;
    margin-top: .2rem;
    border: 1.5px solid #a8aaac;
    border-radius: 50%;
}
.video-link[data-status="started"] .progress-dot { border-color: var(--brand); background: linear-gradient(90deg, var(--brand) 50%, transparent 50%); }
.video-link[data-status="completed"] .progress-dot { border-color: var(--success); background: var(--success); box-shadow: inset 0 0 0 2px #fff; }

.content { min-width: 0; padding: clamp(2rem, 5vw, 5rem); }
.video-section { width: min(1120px, 100%); margin: 0 auto; }
.video-heading { margin-bottom: 2rem; }
.video-heading h1, .empty-state h1, .simple-page h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 4rem);
    line-height: 1.05;
    letter-spacing: -.055em;
}
.video-heading p { max-width: 760px; margin: 1rem 0 0; color: var(--muted); font-size: 1rem; }
.video-frame { border-radius: 12px; overflow: hidden; background: #090a0b; box-shadow: 0 18px 45px rgba(20,20,20,.18); }
.video-frame video { width: 100%; aspect-ratio: 16/9; display: block; background: #090a0b; }
.video-meta { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem .25rem; color: var(--muted); font-size: .78rem; }
.video-meta__security { text-align: right; }
.empty-state { max-width: 680px; margin: 12vh auto; text-align: center; }
.simple-page { max-width: 680px; margin: 12vh auto; padding: 2rem; }
.simple-page .eyebrow { margin-top: 5rem; }

@media (max-width: 820px) {
    .login-shell { grid-template-columns: 1fr; }
    .login-brand { display: none; }
    .login-panel { min-height: 100vh; }
    .toc-toggle { display: inline-block; }
    .app-header__user > span { display: none; }
    .academy-layout { display: block; }
    .toc {
        position: fixed;
        z-index: 15;
        top: 70px;
        bottom: 0;
        left: 0;
        width: min(88vw, var(--sidebar-width));
        transform: translateX(-105%);
        transition: transform .2s ease;
        box-shadow: 16px 0 40px rgba(0,0,0,.15);
    }
    .toc.is-open { transform: translateX(0); }
    .content { padding: 2rem 1rem 4rem; }
    .video-heading h1 { font-size: 2rem; }
    .video-meta { flex-direction: column; }
    .video-meta__security { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
