:root {
    --bg-body: #020617;
    --bg-surface: #020617;
    --bg-card: #020617;
    --bg-outline: rgba(15, 23, 42, 0.98);
    --border-subtle: rgba(148, 163, 184, 0.35);

    --accent: #38bdf8;
    --accent-soft: rgba(56, 189, 248, 0.14);
    --accent-strong: #0ea5e9;

    --text-main: #e5e7eb;
    --text-muted: #9ca3af;
    --text-soft: #64748b;

    --pill-quiz-bg: rgba(34, 197, 94, 0.15);
    --pill-quiz: #22c55e;
    --pill-exam-bg: rgba(239, 68, 68, 0.15);
    --pill-exam: #f97373;

    --radius-lg: 1.25rem;
    --radius-pill: 999px;

    --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.85);
}

/* GLOBAL */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, #1d283a 0, transparent 40%),
        radial-gradient(circle at bottom right, #0f172a 0, #020617 50%);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
}

/* LAYOUT HELPERS */

.container {
    width: min(1200px, 100% - 3rem);
    margin-inline: auto;
}

/* HEADER */

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: linear-gradient(90deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.96));
    border-bottom: 1px solid rgba(15, 23, 42, 1);
    backdrop-filter: blur(16px);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-block: 0.9rem;
    gap: 1rem;
}

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

.brand-mark {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 30%, #38bdf8, #0f172a 70%);
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    color: #e0f2fe;
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.6),
                0 12px 25px rgba(8, 47, 73, 0.9);
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.brand-title {
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 0.88rem;
    color: #e5e7eb;
}

.brand-subtitle {
    font-size: 0.78rem;
    color: var(--text-soft);
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
}

.nav-link {
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    color: var(--text-muted);
    border: 1px solid transparent;
    transition: all 0.18s ease-out;
}

.nav-link:hover {
    color: #e5e7eb;
    border-color: rgba(148, 163, 184, 0.4);
    background: rgba(15, 23, 42, 0.8);
}

.nav-link.is-active {
    background: var(--accent-soft);
    color: #e0f2fe;
    border-color: rgba(56, 189, 248, 0.5);
}

/* FOOTER */

.site-footer {
    border-top: 1px solid rgba(15, 23, 42, 1);
    background: radial-gradient(circle at top, #020617 0, #020617 70%);
    padding-block: 1.1rem;
    margin-top: 2rem;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-soft);
}

.footer-links {
    display: flex;
    gap: 0.75rem;
}

.footer-link {
    opacity: 0.8;
}

.footer-link:hover {
    opacity: 1;
}

/* COURSE SHELL */

.course-shell {
    padding-block: 1.5rem 2.5rem;
}

/* HERO */

.course-hero {
    padding-block: 1.5rem 1rem;
}

.course-kicker {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
    margin: 0 0 0.5rem;
}

.course-title {
    font-family: "Playfair Display", system-ui, serif;
    font-size: clamp(2.1rem, 3vw, 2.7rem);
    letter-spacing: 0.02em;
    margin: 0 0 0.5rem;
}

.course-subtitle {
    margin: 0;
    max-width: 48rem;
    font-size: 0.98rem;
    color: var(--text-soft);
}

/* COURSE LAYOUT */

.course-layout {
    margin-top: 1.5rem;
}

.course-layout-inner {
    display: grid;
    grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
    gap: 1.4rem;
    align-items: flex-start;
}

/* OUTLINE PANEL */

.course-outline {
    background: linear-gradient(160deg, var(--bg-outline), #020617);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(31, 41, 55, 0.9);
    position: sticky;
    top: 4.4rem;
    max-height: calc(100vh - 5rem);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.outline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.outline-title {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: #cbd5f5;
    margin: 0;
}

/* Mobile toggle button (hidden on desktop) */
.outline-toggle {
    display: none;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: rgba(15, 23, 42, 0.9);
    color: var(--text-muted);
    font-size: 0.78rem;
}

.outline-toggle-icon {
    font-size: 1rem;
}

/* Outline list */

.outline-list {
    margin-top: 0.8rem;
    padding-right: 0.4rem;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.4) transparent;
}

.outline-list::-webkit-scrollbar {
    width: 6px;
}

.outline-list::-webkit-scrollbar-track {
    background: transparent;
}

.outline-list::-webkit-scrollbar-thumb {
    background-color: rgba(148, 163, 184, 0.4);
    border-radius: 999px;
}

.outline-group {
    border-radius: 0.9rem;
    padding: 0.35rem;
    margin-bottom: 0.3rem;
    transition: background 0.16s ease-out, border-color 0.16s ease-out;
    border: 1px solid transparent;
}

.outline-group--exam {
    margin-top: 0.6rem;
    border-top: 1px dashed rgba(148, 163, 184, 0.5);
    padding-top: 0.6rem;
}

.outline-group:hover {
    border-color: rgba(148, 163, 184, 0.4);
    background: rgba(15, 23, 42, 0.9);
}

.outline-item {
    width: 100%;
    border-radius: 0.8rem;
    border: none;
    padding: 0.55rem 0.7rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    text-align: left;
    background: transparent;
    color: var(--text-main);
    transition: background 0.16s ease-out, transform 0.12s ease-out, box-shadow 0.12s ease-out;
    -webkit-tap-highlight-color: transparent;
}

.outline-item-label {
    font-size: 0.88rem;
    font-weight: 500;
}

.outline-item-meta {
    font-size: 0.72rem;
    color: var(--text-soft);
}

.outline-item.is-active {
    background: radial-gradient(circle at top left, var(--accent-soft), rgba(15, 23, 42, 0.95));
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.6);
    transform: translateY(-0.5px);
}

.outline-sublist {
    margin-top: 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding-left: 0.25rem;
}

.outline-subitem {
    width: 100%;
    text-align: left;
    border-radius: 999px;
    border: none;
    background: transparent;
    padding: 0.45rem 0.7rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    -webkit-tap-highlight-color: transparent;
}

.outline-subitem:hover {
    background: rgba(15, 23, 42, 0.95);
    color: var(--text-main);
}

.outline-subitem.is-active {
    background: radial-gradient(circle at left, rgba(56, 189, 248, 0.2), rgba(15, 23, 42, 0.95));
    color: #e0f2fe;
}

/* PILL STYLES */

.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.05rem 0.6rem;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 500;
    border: 1px solid transparent;
    white-space: nowrap;
}

.pill--quiz {
    background: var(--pill-quiz-bg);
    color: var(--pill-quiz);
    border-color: rgba(34, 197, 94, 0.45);
}

.pill--exam {
    background: var(--pill-exam-bg);
    color: var(--pill-exam);
    border-color: rgba(239, 68, 68, 0.5);
}

/* CONTENT PANEL */

.course-content {
    background: radial-gradient(circle at top left, rgba(56, 189, 248, 0.13), rgba(15, 23, 42, 0.96));
    border-radius: var(--radius-lg);
    padding: 1px;
    box-shadow: var(--shadow-soft);
}

.course-content-inner {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), #020617);
    border-radius: calc(var(--radius-lg) - 2px);
    padding: 1.15rem 1.25rem 1.3rem;
    min-height: 18rem;
}

.content-panel {
    display: none;
    animation: fadeIn 0.18s ease-out;
}

.content-panel.is-active {
    display: block;
}

.content-panel[data-type="quiz"] {
    border-radius: 1rem;
    border: 1px solid rgba(34, 197, 94, 0.6);
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.25);
}

.content-panel[data-type="exam"] {
    border-radius: 1rem;
    border: 1px solid rgba(239, 68, 68, 0.65);
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.25);
}

/* Content header */

.content-header {
    border-bottom: 1px solid rgba(31, 41, 55, 0.85);
    padding-bottom: 0.7rem;
    margin-bottom: 0.85rem;
}

.content-header--quiz {
    border-color: rgba(34, 197, 94, 0.4);
}

.content-header--exam {
    border-color: rgba(239, 68, 68, 0.4);
}

.content-kicker {
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-strong);
    margin: 0 0 0.35rem;
}

.content-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
}

.content-header h2 {
    font-size: 1.4rem;
    margin: 0;
}

.content-meta {
    margin: 0.25rem 0 0;
    font-size: 0.8rem;
    color: var(--text-soft);
}

/* Content body */

.content-body {
    font-size: 0.94rem;
    color: var(--text-main);
}

.content-body h3 {
    font-size: 1rem;
    margin-top: 0.1rem;
    margin-bottom: 0.45rem;
}

.content-body h4 {
    font-size: 0.92rem;
    margin-top: 0.6rem;
    margin-bottom: 0.2rem;
    color: #c4d0ff;
}

.content-body p {
    margin-top: 0;
    margin-bottom: 0.6rem;
    color: #d1d5db;
}

.content-body ul,
.content-body ol {
    padding-left: 1.1rem;
    margin-top: 0;
    margin-bottom: 0.6rem;
}

.content-body li {
    margin-bottom: 0.25rem;
}

/* Quiz list spacing */

.quiz-list {
    list-style: decimal;
    padding-left: 1.25rem;
}

/* ANIMATIONS */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* RESPONSIVE & “ACCORDION-LIKE” MOBILE BEHAVIOUR */

@media (max-width: 991px) {
    .course-layout-inner {
        grid-template-columns: minmax(0, 1fr);
    }

    .course-outline {
        position: static;
        max-height: none;
    }

    .course-content {
        margin-top: 1rem;
    }
}

/* Mobile specific */
@media (max-width: 767px) {
    .header-inner {
        flex-direction: row;
        align-items: center;
    }

    .main-nav {
        display: none;
    }

    .course-shell {
        padding-block: 1rem 2rem;
    }

    .course-hero {
        padding-block: 1rem 0.8rem;
    }

    .course-title {
        font-size: 1.8rem;
    }

    .course-layout-inner {
        gap: 0.9rem;
    }

    .course-outline {
        padding: 0.85rem 0.8rem;
    }

    .outline-toggle {
        display: inline-flex;
    }

    .outline-list.is-collapsed {
        display: none;
    }

    /* Accordion effect: sublists collapse per group */
    .outline-sublist {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.22s ease-out;
    }

    .outline-group.is-open .outline-sublist {
        max-height: 500px; /* large enough for most content */
    }

    .outline-item {
        padding-block: 0.5rem;
    }

    .outline-subitem {
        padding-block: 0.4rem;
    }

    .course-content-inner {
        padding: 0.95rem 0.9rem 1rem;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .container {
        width: 100%;
        padding-inline: 1rem;
    }

    .course-title {
        font-size: 1.65rem;
    }

    .course-subtitle {
        font-size: 0.9rem;
    }
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    * {
        scroll-behavior: auto !important;
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}
