/*
====================================
ADVANCED THEME — Glass, gradients, dynamic content
====================================
*/

:root {
    --theme-bg: #0a0a0f;
    --theme-surface: rgba(255, 255, 255, 0.04);
    --theme-surface-hover: rgba(255, 255, 255, 0.08);
    --theme-border: rgba(255, 255, 255, 0.1);
    --theme-text: #f4f4f5;
    --theme-muted: #a1a1aa;
    --theme-accent: #8b5cf6;
    --theme-accent-2: #06b6d4;
    --theme-youtube: #ff0000;
    --theme-medium: #00ab6c;
    --brand-violet: #667eea;
    --brand-purple: #764ba2;
    --brand-pink: #a855f7;
    --brand-cyan: #06b6d4;
    --theme-gradient: linear-gradient(135deg, var(--brand-violet) 0%, var(--brand-purple) 50%, var(--brand-cyan) 100%);
    --theme-glow: 0 0 40px rgba(139, 92, 246, 0.25);
    --theme-radius: 16px;
    --theme-radius-lg: 24px;
}

/* Unified section headings (light pages) */
.section-heading {
    font-size: clamp(1.75rem, 4vw, 3.75rem);
    font-weight: 500;
    text-align: center;
    background: var(--theme-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-divider {
    height: 2px;
    width: 80%;
    max-width: 600px;
    margin: 1rem auto 2rem;
    background: var(--theme-gradient);
    border-radius: 2px;
    opacity: 0.85;
}

.section-surface {
    background: linear-gradient(180deg, #fafafa 0%, #f4f4f8 100%);
}

body.theme-advanced {
    background: var(--theme-bg);
    color: var(--theme-text);
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(255, 255, 255, 0.04), transparent),
        radial-gradient(ellipse 60% 40% at 100% 0%, rgba(255, 255, 255, 0.03), transparent);
}

body.portfolio-site.theme-advanced {
    background: #09090b;
    background-image: none;
}

/* Page hero banners */
.page-hero {
    position: relative;
    padding: 120px 5% 60px;
    text-align: center;
    overflow: hidden;
}

.page-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--theme-gradient);
    opacity: 0.08;
    pointer-events: none;
}

.page-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border-radius: 999px;
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    font-size: 0.875rem;
    color: var(--theme-muted);
    margin-bottom: 1rem;
}

.page-hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    background: var(--theme-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.page-hero-subtitle {
    font-size: 1.125rem;
    color: var(--theme-muted);
    max-width: 600px;
    margin: 0 auto 2rem;
    line-height: 1.7;
}

/* Glass cards */
.glass-card {
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius);
    backdrop-filter: blur(12px);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-4px);
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: var(--theme-glow);
}

/* Dark content blocks on light homepage */
.content-dark-block {
    background: var(--theme-bg);
    color: var(--theme-text);
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(139, 92, 246, 0.15), transparent),
        radial-gradient(ellipse 60% 40% at 100% 0%, rgba(6, 182, 212, 0.1), transparent);
}

.theme-section {
    padding: 80px 5%;
    position: relative;
}

.theme-section-alt {
    background: rgba(255, 255, 255, 0.02);
}

.section-label {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--theme-accent-2);
    margin-bottom: 0.5rem;
}

.section-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    color: var(--theme-text);
    margin-bottom: 0.5rem;
}

.section-subtitle {
    color: var(--theme-muted);
    max-width: 560px;
    margin-bottom: 2.5rem;
}

/* YouTube video cards */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.video-card {
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius);
    overflow: hidden;
    transition: all 0.3s ease;
}

.video-card:hover {
    border-color: rgba(255, 0, 0, 0.4);
    box-shadow: 0 8px 32px rgba(255, 0, 0, 0.15);
    transform: translateY(-4px);
}

.video-card-featured {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 0;
}

@media (max-width: 768px) {
    .video-card-featured {
        grid-template-columns: 1fr;
    }
}

.video-card-thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #111;
}

.video-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.video-card:hover .video-card-thumb img {
    transform: scale(1.05);
}

.video-card-thumb iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.video-play-btn {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    border: none;
    cursor: pointer;
    transition: background 0.3s ease;
}

.video-play-btn i {
    font-size: 3rem;
    color: white;
    background: var(--theme-youtube);
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 4px;
    box-shadow: 0 4px 20px rgba(255, 0, 0, 0.5);
    transition: transform 0.3s ease;
}

.video-play-btn:hover i {
    transform: scale(1.1);
}

.video-card-body {
    padding: 1.25rem;
}

.video-card-date {
    font-size: 0.75rem;
    color: var(--theme-muted);
}

.video-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--theme-text);
    margin: 0.5rem 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-card-desc {
    font-size: 0.875rem;
    color: var(--theme-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.video-card-link {
    font-size: 0.875rem;
    color: var(--theme-youtube);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.video-card-link:hover {
    text-decoration: underline;
}

/* Blog cards */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.5rem;
}

.blog-card {
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius);
    overflow: hidden;
    transition: all 0.3s ease;
}

.blog-card:hover {
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: var(--theme-glow);
    transform: translateY(-4px);
}

.blog-card-image {
    position: relative;
    height: 200px;
    overflow: hidden;
}

.blog-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.blog-card:hover .blog-card-image img {
    transform: scale(1.05);
}

.blog-card-category {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
}

.blog-card-body {
    padding: 1.25rem;
}

.blog-card-meta {
    font-size: 0.75rem;
    color: var(--theme-muted);
    display: flex;
    gap: 6px;
    margin-bottom: 0.5rem;
}

.blog-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--theme-text);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.blog-card-excerpt {
    font-size: 0.875rem;
    color: var(--theme-muted);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.blog-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 1rem;
}

.blog-tag {
    font-size: 0.7rem;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(102, 126, 234, 0.12);
    color: var(--brand-purple);
    border: 1px solid rgba(118, 75, 162, 0.25);
}

.blog-card-link {
    font-size: 0.875rem;
    color: var(--theme-medium);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.blog-card-link:hover {
    color: #1a8917;
}

/* Filter pills */
.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.filter-pill {
    padding: 8px 18px;
    border-radius: 999px;
    border: 1px solid var(--theme-border);
    background: transparent;
    color: var(--theme-muted);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-pill:hover,
.filter-pill.active {
    background: var(--theme-accent);
    border-color: var(--theme-accent);
    color: white;
}

/* CTA buttons */
.btn-theme {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.9375rem;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn-theme-primary {
    background: var(--theme-gradient);
    color: white;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
}

.btn-theme-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(139, 92, 246, 0.5);
}

.btn-theme-outline {
    background: transparent;
    color: var(--theme-text);
    border: 1px solid var(--theme-border);
}

.btn-theme-outline:hover {
    background: var(--theme-surface-hover);
    border-color: var(--theme-accent);
}

.btn-theme-youtube {
    background: var(--theme-youtube);
    color: white;
}

.btn-theme-youtube:hover {
    background: #cc0000;
    transform: translateY(-2px);
}

/* Stats row */
.stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    background: var(--theme-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--theme-muted);
}

.content-empty {
    text-align: center;
    color: var(--theme-muted);
    padding: 3rem;
    grid-column: 1 / -1;
}

.content-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 3rem;
    color: var(--theme-muted);
    grid-column: 1 / -1;
}

.content-loading .spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--theme-border);
    border-top-color: var(--theme-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Scroll progress */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--theme-gradient);
    z-index: 100;
    width: 0%;
    transition: width 0.1s linear;
}

/* Dark theme overrides for existing sections on homepage */
body.theme-advanced .theme-section-light {
    background: #ffffff;
    color: #0a0a0f;
}

body.portfolio-site.theme-advanced .theme-section-light {
    background: #111113;
    color: #f4f4f5;
}

body.theme-advanced .theme-section-light .section-title {
    color: #0a0a0f;
}

body.theme-advanced .theme-section-light .section-subtitle {
    color: #52525b;
}

body.portfolio-site .page-hero-title {
    background: none;
    -webkit-text-fill-color: #ffffff;
    color: #ffffff;
}

body.portfolio-site .page-hero::before {
    opacity: 0.04;
    background: #ffffff;
}

body.portfolio-site .section-heading {
    background: none !important;
    -webkit-text-fill-color: unset !important;
}

/* Footer dark */
.theme-footer {
    background: rgba(0, 0, 0, 0.4);
    border-top: 1px solid var(--theme-border);
    color: var(--theme-muted);
}

.theme-footer a {
    color: var(--theme-text);
}

.theme-footer a:hover {
    color: var(--theme-accent-2);
}

/* Page layout container */
.page-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 5%;
}

/* Header on dark inner pages */
body.inner-page header.scrolled,
body.inner-page header {
    background: rgba(10, 10, 15, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--theme-border);
}

body.inner-page .header-links-hero {
    color: var(--theme-text);
    text-shadow: none;
}

body.inner-page .header-links-hero::after {
    background-color: var(--theme-accent);
}

body.inner-page header > a {
    color: var(--theme-text) !important;
}

body.inner-page #collapse-btn {
    color: var(--theme-text) !important;
}

@media (max-width: 1024px) {
    header .collapsible-header {
        background-color: #0a0a0f !important;
    }
}
