/* ===== Base Reset ===== */
body {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    max-width: 100%;
    overflow-x: hidden;
}

/* ===== Banner / Hero Gradients ===== */
.banner {
    background: linear-gradient(
        135deg,
        rgb(var(--color-primary)) 0%,
        rgb(var(--color-primary-hover)) 50%,
        rgb(var(--color-secondary)) 100%
    );
    position: relative;
}

.banner::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.06'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

.dark .banner {
    background: linear-gradient(
        135deg,
        rgb(var(--color-primary-light)) 0%,
        rgb(var(--color-primary-dark)) 50%,
        rgb(var(--color-primary)) 100%
    );
}

/* ===== Section Backgrounds ===== */
.plan-for-you {
    background: url("./plan-for-you.png");
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

.courses {
    background: url("./courses.png");
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

.course-detail {
    background: url("./course-detail.png");
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

/* ===== Footer ===== */
footer {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
}

/* ===== Modal ===== */
.explanation-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 50;
    animation: modalFadeIn 0.2s ease-out;
}

.dark .explanation-modal {
    background: rgba(0, 0, 0, 0.5);
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-content {
    background: rgb(var(--color-surface));
    color: rgb(var(--color-body));
    padding: 24px;
    border-radius: 20px;
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    width: 50%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideUp 0.3s ease-out;
}

.dark .modal-content {
    background: rgb(var(--color-surface-alt));
    color: rgb(var(--color-body));
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

@media only screen and (max-width: 768px) {
    .modal-content {
        width: 92%;
        padding: 20px;
        border-radius: 16px;
    }
}

.close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: background-color 0.2s ease;
    color: rgb(var(--color-muted));
}

.close-btn:hover {
    background-color: rgb(var(--color-surface-alt));
    color: rgb(var(--color-heading));
}

.dark .close-btn:hover {
    background-color: rgb(var(--color-surface-raised));
}

/* ===== Progress (Quiz/Lesson) ===== */
.progress-container {
    margin: auto;
    max-width: 300px;
    width: 100%;
    height: 8px;
    background-color: rgb(var(--color-surface-alt));
    overflow: hidden;
    border-radius: 9999px;
}

.progress-bar {
    height: 100%;
    width: 50%;
    background-color: rgb(var(--color-primary));
    transition: width 0.5s ease-in-out;
    border-radius: 9999px;
}

/* ===== Radio Inputs ===== */
input[type="radio"]:checked {
    background-image: none !important;
    background-color: rgb(var(--color-primary)) !important;
    outline: none !important;
}

/* ===== Blog / Rich Content ===== */
.blog-content h1 {
    font-size: 2rem;
    line-height: 2.5rem;
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: rgb(var(--color-heading));
}

.blog-content h2 {
    font-size: 1.5rem;
    line-height: 2rem;
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: rgb(var(--color-heading));
}

.blog-content h3 {
    font-size: 1.25rem;
    line-height: 1.75rem;
    font-weight: 600;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
    color: rgb(var(--color-heading));
}

.blog-content p {
    line-height: 1.75;
    margin-bottom: 1rem;
    color: rgb(var(--color-body));
}

.blog-content ul {
    list-style: disc;
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.blog-content ol {
    list-style: decimal;
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.blog-content li {
    margin-bottom: 0.375rem;
    line-height: 1.625;
    color: rgb(var(--color-body));
}

.blog-content a {
    color: rgb(var(--color-primary));
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: opacity 0.2s ease;
}

.blog-content a:hover {
    opacity: 0.8;
}

.blog-content blockquote {
    border-left: 4px solid rgb(var(--color-primary));
    padding-left: 1rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: rgb(var(--color-muted));
}

.blog-content pre {
    background-color: rgb(var(--color-surface-alt));
    border-radius: 12px;
    padding: 1rem 1.25rem;
    overflow-x: auto;
    margin: 1.25rem 0;
    font-size: 0.875rem;
    border: 1px solid rgb(var(--color-border));
}

.blog-content code {
    font-family: 'Fira Code', 'JetBrains Mono', monospace;
    font-size: 0.875em;
}

.blog-content img {
    border-radius: 12px;
    margin: 1.5rem 0;
    max-width: 100%;
    height: auto;
}

/* ===== Active Nav ===== */
.active-nav {
    color: rgb(var(--color-primary)) !important;
    font-weight: 600;
}

/* ===== Swiper Overrides ===== */
.swiper-slide > p {
    min-height: 100px;
}

.swiper-slide {
    height: -webkit-fill-available !important;
}

/* ===== Dynamic Content ===== */
.dynamic-content > ul {
    list-style: disc;
}

/* ===== Course Card Hover Animations ===== */
.course-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.course-card:hover {
    transform: translateY(-6px);
    box-shadow:
        0 20px 40px -12px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(var(--color-primary), 0.1);
}

.dark .course-card:hover {
    box-shadow:
        0 20px 40px -12px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(var(--color-primary), 0.2);
}

.course-card .course-thumbnail {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.course-card:hover .course-thumbnail img {
    transform: scale(1.05);
}

.course-card .course-thumbnail img {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Scrollbar Styling ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgb(var(--color-border));
    border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgb(var(--color-muted));
}

.dark ::-webkit-scrollbar-thumb {
    background: rgb(var(--color-surface-raised));
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: rgb(var(--color-muted));
}

/* ===== Selection Color ===== */
::selection {
    background-color: rgba(var(--color-primary), 0.15);
    color: rgb(var(--color-heading));
}

/* ===== Dynamic Content (CMS / About / Legal pages) ===== */
.dynamic-content h1,
.dynamic-content h2,
.dynamic-content h3,
.dynamic-content h4,
.dynamic-content h5,
.dynamic-content h6 {
    font-family: 'Manrope', system-ui, sans-serif;
    font-weight: 700;
    color: rgb(var(--color-heading));
    margin-top: 1.75em;
    margin-bottom: 0.6em;
    line-height: 1.3;
}

.dynamic-content h1 { font-size: 2rem; }
.dynamic-content h2 { font-size: 1.5rem; }
.dynamic-content h3 { font-size: 1.25rem; }
.dynamic-content h4 { font-size: 1.1rem; }

.dynamic-content p {
    margin-bottom: 1.25em;
    line-height: 1.8;
    color: rgb(var(--color-body));
}

.dynamic-content ul,
.dynamic-content ol {
    padding-left: 1.75rem;
    margin-bottom: 1.25em;
}

.dynamic-content ul { list-style: disc; }
.dynamic-content ol { list-style: decimal; }

.dynamic-content li {
    margin-bottom: 0.5em;
    line-height: 1.7;
    color: rgb(var(--color-body));
}

.dynamic-content strong, .dynamic-content b {
    font-weight: 700;
    color: rgb(var(--color-heading));
}

.dynamic-content a {
    color: rgb(var(--color-primary));
    text-decoration: underline;
    text-underline-offset: 2px;
}

.dynamic-content hr {
    border: none;
    border-top: 1px solid rgb(var(--color-border));
    margin: 2em 0;
}

.dynamic-content blockquote {
    border-left: 4px solid rgb(var(--color-primary));
    padding-left: 1.25rem;
    margin: 1.5em 0;
    font-style: italic;
    color: rgb(var(--color-muted));
}

/* Strip inline font overrides from old CMS content */
.dynamic-content [style*="font-family"],
.dynamic-content [style*="font-size"] {
    font-family: inherit !important;
    font-size: inherit !important;
}

/* ===== Prose (generic rich content) ===== */
.prose h1, .prose h2, .prose h3, .prose h4 {
    font-family: 'Manrope', system-ui, sans-serif;
    font-weight: 700;
    color: rgb(var(--color-heading));
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}
.prose h1 { font-size: 2rem; }
.prose h2 { font-size: 1.5rem; }
.prose h3 { font-size: 1.25rem; }
.prose p { margin-bottom: 1.1em; line-height: 1.8; }
.prose ul { list-style: disc; padding-left: 1.5rem; margin-bottom: 1em; }
.prose ol { list-style: decimal; padding-left: 1.5rem; margin-bottom: 1em; }
.prose li { margin-bottom: 0.4em; line-height: 1.7; }
.prose strong { font-weight: 700; color: rgb(var(--color-heading)); }

/* ===== Responsive Fixes ===== */

/* Prevent horizontal overflow globally */
*, *::before, *::after { box-sizing: border-box; }
img, video, iframe { max-width: 100%; }

/* Mobile: reduce hero text */
@media (max-width: 640px) {
    .page-title { font-size: 1.75rem; }
    .section-title { font-size: 1.5rem; }
    .section { padding-top: 3rem; padding-bottom: 3rem; }
    .section-sm { padding-top: 2rem; padding-bottom: 2rem; }
}

/* Ensure site-container never overflows */
.site-container {
    max-width: 80rem;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 640px) {
    .site-container { padding-left: 1.5rem; padding-right: 1.5rem; }
}

@media (min-width: 1024px) {
    .site-container { padding-left: 2rem; padding-right: 2rem; }
}

/* ===== Dark Mode: Dim decorative graphics ===== */
.dark .banner::after {
    opacity: 0.03;
}

.dark img:not([class*="dark:"]):not([src*="logo"]):not([src*="icon"]):not([src*="avatar"]) {
    filter: brightness(0.8) contrast(1.05);
}

.dark .course-card-img,
.dark [class*="aspect-video"] img,
.dark [class*="aspect-square"] img {
    filter: brightness(0.85);
}

/* ===== Navbar fully opaque on scroll ===== */
nav.sticky {
    background-color: rgba(255, 255, 255, 0.97) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.dark nav.sticky {
    background-color: rgba(17, 24, 39, 0.97) !important;
}
