/* WikiLearn Studio - Custom Styles */

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* Base Styles */
html {
    scroll-behavior: smooth;
    color-scheme: light dark;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Custom Scrollbar - Only on devices with pointer/hover (not touch) */
@media (hover: hover) and (pointer: fine) {
    ::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }

    ::-webkit-scrollbar-track {
        background: rgba(24, 24, 27, 0.5);
    }

    ::-webkit-scrollbar-thumb {
        background: rgba(63, 63, 70, 0.8);
        border-radius: 4px;
    }

    ::-webkit-scrollbar-thumb:hover {
        background: rgba(82, 82, 91, 0.9);
    }
}

/* Form Styles */
input:focus,
textarea:focus {
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1);
}

input::placeholder,
textarea::placeholder {
    opacity: 0.6;
}

/* Typography */
.font-serif {
    font-feature-settings: "liga" 1, "kern" 1;
}

/* Chapter Transitions */
.chapter-section {
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.chapter-section.opacity-50 {
    pointer-events: none;
}

.chapter-section.opacity-100 {
    pointer-events: auto;
}

/* Prose Styles */
.prose p {
    margin-bottom: 1rem;
    line-height: 1.75;
}

.prose p:last-child {
    margin-bottom: 0;
}

/* Image Loading */
figure img {
    background: linear-gradient(90deg, #27272a 0%, #3f3f46 50%, #27272a 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    min-height: 200px;
}

/* Smaller min-height on mobile */
@media (max-width: 640px) {
    figure img {
        min-height: 120px;
    }
}

figure img[src] {
    background: none;
    animation: none;
    min-height: auto;
}

/* Button Hover Effects */
button:not(:disabled):active {
    transform: scale(0.98);
}



/* Ambient Indicator Pulse */
#ambient-indicator span:first-child {
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

/* Navigation Bar */
#prev-btn:disabled,
#next-btn:disabled {
    cursor: not-allowed;
}

/* Progress Bar Glow */
#progress-bar {
    box-shadow: 0 0 10px rgba(14, 165, 233, 0.3);
}

/* Chapter Number Badge */
.chapter-section>div:first-child>div:first-child {
    transition: all 0.3s ease;
}

.chapter-section.opacity-100>div:first-child>div:first-child {
    background: rgba(14, 165, 233, 0.3);
    border-color: rgba(14, 165, 233, 0.5);
}

/* Responsive Adjustments */
@media (max-width: 640px) {
    .chapter-section {
        padding-left: 0;
    }

    .chapter-section .pl-14 {
        padding-left: 0;
    }

    .chapter-section>div:first-child {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
}

/* Loading Overlay - with fallback for older browsers */
#loading-overlay {
    background: rgba(250, 250, 250, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.dark #loading-overlay {
    background: rgba(24, 24, 27, 0.9);
}

/* Header Backdrop - with fallback for older browsers */
header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.dark header {
    background: rgba(24, 24, 27, 0.85);
}

/* Gradient Text (for potential use) */
/* Shared Gradient Text */
.gradient-text {
    background: linear-gradient(to right, #0284c7, #0284c7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dark .gradient-text {
    background: linear-gradient(to right, #38bdf8, #38bdf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Background Orb Effect */
.bg-orb {
    background-color: rgba(14, 165, 233, 0.2);
    border-radius: 9999px;
    filter: blur(64px);
    animation: pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Experience Card Hover */
.experience-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.experience-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* Print Styles - Full Color PDF Guide */
@media print {

    /* Hide non-content elements */
    #ambient-indicator,
    #prev-btn,
    #next-btn,
    #restart-btn,
    #restart-btn-mobile,
    #restart-btn-bottom,
    #toc-toggle,
    #toc-mobile,
    #volume-controls,
    #download-pdf-btn,
    #discussion-form,
    #discussion-response,
    .fixed,
    nav,
    aside,
    footer,
    #site-header,
    #cta-new-experience,
    .branch-btn,
    [id*="toc"] {
        display: none !important;
    }

    /* Reset background to preserve colors */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Page setup */
    @page {
        size: A4;
        margin: 1in;
    }

    /* Body styling */
    body {
        background: white !important;
        color: #1a1a1a !important;
        font-size: 11pt;
        line-height: 1.6;
    }

    /* Main content container */
    .max-w-4xl {
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Experience title */
    header {
        display: block !important;
        page-break-after: avoid;
    }

    h1 {
        font-size: 24pt !important;
        color: #0284c7 !important;
        margin-bottom: 0.5in !important;
        page-break-after: avoid;
    }

    /* Chapter sections */
    .chapter-section {
        opacity: 1 !important;
        page-break-inside: avoid;
        margin-bottom: 0.5in !important;
        padding: 0.25in !important;
        background: #f8fafc !important;
        border-radius: 8px !important;
        border: 1px solid #e2e8f0 !important;
    }

    /* Chapter titles */
    .chapter-section h2,
    .chapter-section h3 {
        color: #0369a1 !important;
        page-break-after: avoid;
    }

    /* Key takeaways box */
    .chapter-section .bg-primary-50,
    .chapter-section [class*="bg-primary"] {
        background: #e0f2fe !important;
        border: 1px solid #0284c7 !important;
        padding: 0.15in !important;
        border-radius: 6px !important;
    }

    /* Images */
    figure {
        page-break-inside: avoid;
        margin: 0.25in 0 !important;
    }

    figure img {
        max-width: 100% !important;
        height: auto !important;
        border-radius: 6px !important;
    }

    /* Text content */
    p,
    li {
        color: #334155 !important;
        orphans: 3;
        widows: 3;
    }

    /* Closing reflection section */
    #scene-closing {
        background: linear-gradient(135deg, #e0f2fe 0%, #f0f9ff 100%) !important;
        border: 2px solid #0284c7 !important;
        padding: 0.3in !important;
    }

    #scene-closing h2 {
        color: #0369a1 !important;
    }

    /* Links - show URL */
    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 9pt;
        color: #64748b;
    }

    a[href^="#"]:after,
    a[href^="javascript"]:after {
        content: "";
    }

    /* Credits section */
    footer.text-center {
        display: block !important;
        border-top: 1px solid #e2e8f0 !important;
        padding-top: 0.25in !important;
        margin-top: 0.5in !important;
    }

    /* Reading time badge - keep visible */
    [class*="reading_time"] {
        display: inline-flex !important;
    }
}

/* ============================================
   Splash Page Styles
   ============================================ */

/* Hero Gradient - Light Mode */
.hero-gradient {
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(14, 165, 233, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 50%, rgba(56, 189, 248, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 20% 80%, rgba(2, 132, 199, 0.08) 0%, transparent 50%),
        linear-gradient(180deg, #f4f4f5 0%, #fafafa 100%);
}

/* Hero Gradient - Dark Mode */
.dark .hero-gradient {
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(14, 165, 233, 0.3) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 50%, rgba(56, 189, 248, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 20% 80%, rgba(2, 132, 199, 0.15) 0%, transparent 50%),
        linear-gradient(180deg, #09090b 0%, #18181b 100%);
}

/* Hero Gradient - Simplified for Mobile Performance */
@media (max-width: 640px) {
    .hero-gradient {
        background: linear-gradient(180deg, #f4f4f5 0%, #fafafa 100%);
    }

    .dark .hero-gradient {
        background: linear-gradient(180deg, #09090b 0%, #18181b 100%);
    }
}

/* Splash Intro Overlay */
.splash-intro {
    background: radial-gradient(ellipse at center, rgba(14, 165, 233, 0.15) 0%, transparent 70%);
}

/* Glow Border Effect */
.glow-border {
    position: relative;
}

.glow-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    padding: 2px;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.5), rgba(56, 189, 248, 0.5), rgba(14, 165, 233, 0.5));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: glow-pulse 4s ease-in-out infinite alternate;
    z-index: -1;
}

@keyframes glow-pulse {
    0% {
        filter: hue-rotate(0deg);
        /* Cyan */
    }

    100% {
        filter: hue-rotate(-45deg);
        /* Emerald Green */
    }
}

/* Glassmorphism */
.glassmorphism {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.dark .glassmorphism {
    background: rgba(39, 39, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Pill Navigation */
.pill-nav {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.pill-nav-item {
    transition: all 0.2s ease;
}

.pill-nav-item:hover {
    background: rgba(255, 255, 255, 0.15);
}

.pill-nav-item.active {
    background: rgba(14, 165, 233, 0.3);
}

/* Feature Card */
.feature-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s ease;
}

.feature-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(14, 165, 233, 0.3);
    transform: translateY(-4px);
}

/* Sound Wave Bar Animation */
@keyframes soundWave {

    0%,
    100% {
        height: 20%;
    }

    50% {
        height: 100%;
    }
}

.sound-bar {
    min-height: 2px;
}

/* Animate bars when audio is playing - DISABLED per user request */
.audio-playing .sound-bar:nth-child(1) {
    /* animation: soundWave 0.8s ease-in-out infinite; */
    animation: none;
}

.audio-playing .sound-bar:nth-child(2) {
    /* animation: soundWave 0.8s ease-in-out infinite; */
    animation: none;
}

.audio-playing .sound-bar:nth-child(3) {
    /* animation: soundWave 0.8s ease-in-out infinite; */
    animation: none;
}

/* Volume Slider Custom Styling */
#volume-slider {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 4px;
    background: linear-gradient(to right, #0ea5e9 0%, #0ea5e9 var(--volume-percent, 10%), #e5e7eb var(--volume-percent, 10%), #e5e7eb 100%);
}

.dark #volume-slider {
    background: linear-gradient(to right, #0ea5e9 0%, #0ea5e9 var(--volume-percent, 10%), #3f3f46 var(--volume-percent, 10%), #3f3f46 100%);
}

#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #0ea5e9;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(14, 165, 233, 0.4);
    transition: transform 0.15s ease;
}

#volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

#volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #0ea5e9;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(14, 165, 233, 0.4);
}

/* Volume Panel Animation */
#volume-slider-panel {
    transform-origin: top right;
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

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

/* TOC Sidebar Overrides */
.toc-link:hover {
    color: #18181b !important;
    background-color: #f4f4f5 !important;
}

.dark .toc-link:hover {
    color: #f4f4f5 !important;
    background-color: #27272a !important;
}

/* ============================================
   Missing Tailwind Utilities (Vertical Toggle)
   These classes are NOT in the compiled tailwind.min.css
   ============================================ */

/* Size utilities for vertical toggle */
.w-7 {
    width: 1.75rem;
}

.h-14 {
    height: 3.5rem;
}

/* Vertical toggle knob translation - dark mode only */
.dark\:translate-y-7:is(.dark *) {
    transform: translateY(1.75rem);
}