/* ==========================================================
   GLOBAL UTILITIES
========================================================== */

.hidden{
    display:none !important;
}

.center{
    text-align:center;
}

.w-full{
    width:100%;
}

.text-gold{
    color:var(--gold);
}

.text-blueprint{
    color:var(--text-primary);
}

.text-muted{
    color:var(--text-muted);
}

.surface{
    background:var(--surface-2);
}

.surface-card{
    background:var(--surface-3);
}

.border{
    border:1px solid var(--border);
}

.rounded{
    border-radius:var(--radius-lg);
}

.shadow{
    box-shadow:var(--shadow-md);
}

/* ==========================================================
   SPACING UTILITIES
========================================================== */

.mt-1{margin-top:var(--space-1);}
.mt-2{margin-top:var(--space-2);}
.mt-3{margin-top:var(--space-3);}
.mt-4{margin-top:var(--space-4);}
.mt-5{margin-top:var(--space-5);}
.mt-6{margin-top:var(--space-6);}
.mt-8{margin-top:var(--space-8);}

.mb-1{margin-bottom:var(--space-1);}
.mb-2{margin-bottom:var(--space-2);}
.mb-3{margin-bottom:var(--space-3);}
.mb-4{margin-bottom:var(--space-4);}
.mb-5{margin-bottom:var(--space-5);}
.mb-6{margin-bottom:var(--space-6);}
.mb-8{margin-bottom:var(--space-8);}

/* ==========================================================
   FLEX HELPERS
========================================================== */

.flex{
    display:flex;
}

.flex-center{
    display:flex;
    align-items:center;
    justify-content:center;
}

.flex-between{
    display:flex;
    align-items:center;
    justify-content:space-between;
}

.flex-column{
    display:flex;
    flex-direction:column;
}

/* ==========================================================
   GRID HELPERS
========================================================== */

.grid-auto{
    display:grid;
    gap:24px;
    grid-template-columns:repeat(auto-fit,minmax(260px,1fr));
}

/* ==========================================================
   LINKS
========================================================== */

a{
    transition:
        color var(--transition),
        opacity var(--transition);
}

a:hover{
    color:var(--gold-light);
}

/* ==========================================================
   SELECTION
========================================================== */

::selection{
    background:var(--gold);
    color:white;
}

/* ==========================================================
   SCROLLBAR
========================================================== */

::-webkit-scrollbar{
    width:10px;
    height:10px;
}

::-webkit-scrollbar-track{
    background:var(--surface-1);
}

::-webkit-scrollbar-thumb{
    background:var(--border);
    border-radius:999px;
}

::-webkit-scrollbar-thumb:hover{
    background:var(--gold);
}

/* Firefox */
*{
    scrollbar-width:thin;
    scrollbar-color:var(--border) var(--surface-1);
}

/* ==========================================================
   FOCUS
========================================================== */

:focus-visible{
    outline:2px solid var(--gold);
    outline-offset:3px;
}

/* ==========================================================
   SMOOTH ANIMATIONS
========================================================== */

.card,
.btn,
.sidebar-link,
input,
textarea,
select{
    transition:
        background var(--transition),
        border-color var(--transition),
        color var(--transition),
        transform var(--transition-fast),
        box-shadow var(--transition);
}

/* ==========================================================
   FADE-IN ANIMATION
========================================================== */

.fade-in{
    animation:fadeIn .45s ease;
}

@keyframes fadeIn{

    from{
        opacity:0;
        transform:translateY(12px);
    }

    to{
        opacity:1;
        transform:translateY(0);
    }

}

/* ==========================================================
   PAGE WIDTH
========================================================== */

.max-content{
    width:min(100%,var(--content-width));
    margin-inline:auto;
}

/* ==========================================================
   LIGHT SURFACE TEXT FIX
========================================================== */

.light,
.light-surface,
.bg-white,
.card-light {
    color:var(--gray-900);
}

.light h1,
.light h2,
.light h3,
.light h4,
.light h5,
.light h6,
.light-surface h1,
.light-surface h2,
.light-surface h3,
.light-surface h4,
.light-surface h5,
.light-surface h6,
.bg-white h1,
.bg-white h2,
.bg-white h3,
.bg-white h4,
.bg-white h5,
.bg-white h6,
.card-light h1,
.card-light h2,
.card-light h3,
.card-light h4,
.card-light h5,
.card-light h6 {
    color:var(--blueprint);
}

.light p,
.light-surface p,
.bg-white p,
.card-light p {
    color:var(--gray-700);
}

/* ==========================================================
   COURSE CATALOG DARK THEME
========================================================== */

#courseGrid .course-card {
    background: var(--surface-3);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

#courseGrid .course-card:hover {
    border-color: var(--gold-light);
    box-shadow: var(--shadow-md);
}

#courseGrid .course-card h3 {
    color: var(--text-primary);
}

#courseGrid .course-card p,
#courseGrid .course-description,
#courseGrid .course-details p {
    color: var(--text-secondary);
}

#courseGrid .course-card strong {
    color: var(--text-primary);
}

#courseGrid .course-card .badge {
    background: var(--surface-4);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

#courseGrid .course-icon {
    background: var(--surface-4);
    color: var(--text-primary);
}

#courseGrid .view-course-button {
    background: var(--gold);
    color: var(--white);
    border-color: var(--gold);
}

#courseGrid .view-course-button:hover {
    background: var(--gold-light);
    border-color: var(--gold-light);
}

.view-enter{
    animation:studyBuddiesViewEnter .32s
        cubic-bezier(.2,.8,.2,1);
}

.course-card,
.chapter-card,
.lesson-section,
.practice-card,
.chapter-test-card,
.forum-thread-card,
.thread-card{
    animation:studyBuddiesContentEnter .32s
        cubic-bezier(.2,.8,.2,1) both;
}

@keyframes studyBuddiesViewEnter{
    from{
        opacity:0;
        transform:translateY(10px);
    }

    to{
        opacity:1;
        transform:translateY(0);
    }
}

@keyframes studyBuddiesContentEnter{
    from{
        opacity:0;
        transform:translateY(8px) scale(.995);
    }

    to{
        opacity:1;
        transform:translateY(0) scale(1);
    }
}

body,
#sidebar,
.topbar,
.course-card,
.chapter-card,
.lesson-section,
.practice-card,
.chapter-test-card,
.forum-thread-card{
    transition:
        background-color .28s ease,
        border-color .28s ease,
        color .28s ease,
        box-shadow .28s ease;
}

@media (prefers-reduced-motion:reduce){
    .view-enter,
    .course-card,
    .chapter-card,
    .lesson-section,
    .practice-card,
    .chapter-test-card,
    .forum-thread-card,
    .thread-card{
        animation:none;
    }
}
