/* Typography styles for Learning Odyssey */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Andika:wght@400;500;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Crimson+Text:ital,wght@0,400;0,600;0,700;1,400;1,600&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@400;700;900&display=swap');

/* Adventure title effect */
.gradient-title {
    font-family: 'Crimson Text', serif;
    font-weight: 600;
    font-size: 3.5rem;
    color: #0d9488;
    text-shadow: 0 2px 4px rgba(13, 148, 136, 0.3);
    position: relative;
    display: inline-block;
    padding: 0.5rem 1.5rem;
    margin: 0.5rem 0;
    letter-spacing: 0.05em;
}

/* Parchment background behind title */
.gradient-title::before {
    content: '';
    position: absolute;
    top: -0.25rem;
    left: -0.5rem;
    right: -0.5rem;
    bottom: -0.25rem;
    background: transparent;
    border-radius: 8px;
    z-index: -1;
    border: none;
}

/* Remove decorative flourishes */

/* Gradient text effect (without changing font size/weight) */
.gradient-text {
    background: linear-gradient(to right, #0d9488, #14b8a6); /* Deep teal gradient */
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: #374151; /* Fallback color */
}

/* Theme settings */
:root {
    /* Typography */
    --font-primary: 'Andika', system-ui, -apple-system, sans-serif;
    --font-reading: 'Crimson Text', Georgia, serif;
    --font-code: monospace;
    --line-height-content: 1.7;
    --font-size-content: 1.2rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-4xl: 2.25rem;

    /* Colors - Primary Theme */
    --color-primary: #0d9488; /* deep teal */
    --color-primary-light: #14b8a6; /* lighter teal */
    --color-primary-lighter: #2dd4bf; /* even lighter teal */
    --color-primary-dark: #0f766e; /* darker teal */
    
    /* Colors - Text */
    --color-text-primary: #1a1a1a;
    --color-text-dark: #0f172a;
    --color-text-light: #ffffff;
    
    /* Colors - Background */
    --color-bg-primary: #fdfcf7; /* Warm off-white */
    --color-bg-secondary: #f7f5f0; /* Cream */
    --color-bg-container: rgba(253, 252, 247, 0.98);
    --color-bg-card: rgba(253, 252, 247, 0.95);
    --color-bg-card-selected: rgba(253, 252, 247, 0.95);
    --color-bg-carousel-card: rgba(253, 252, 247, 0.95);
    --color-bg-carousel-card-active: rgba(253, 252, 247, 0.98);
    --color-bg-carousel-card-back: rgba(253, 252, 247, 0.98);
    --color-bg-header: rgba(253, 252, 247, 0.9);
    --color-bg-controls: rgba(253, 252, 247, 0.8);
    --color-bg-button: rgba(247, 245, 240, 0.8);
    --color-bg-overlay: rgba(253, 252, 247, 0.95);
    --color-bg-code: rgba(247, 245, 240, 0.8);
    --color-bg-gradient-start: rgba(253, 252, 247, 0.5); /* Light cream */
    --color-bg-gradient-end: rgba(253, 252, 247, 0.9);
    
    /* Paper texture colors */
    --color-paper-base: #fdfcf7;
    --color-paper-shadow: rgba(139, 120, 93, 0.1);
    --color-paper-texture: rgba(139, 120, 93, 0.02);
    
    /* Colors - Accents */
    --color-accent-light: rgba(13, 148, 136, 0.05); /* teal/5 */
    --color-accent-medium: rgba(13, 148, 136, 0.1); /* teal/10 */
    --color-accent-strong: rgba(13, 148, 136, 0.2); /* teal/20 */
    --color-accent-start: rgba(20, 184, 166, 0.9); /* lighter teal/90 */
    --color-accent-end: rgba(45, 212, 191, 0.9); /* even lighter teal/90 */
    
    /* Colors - Gradients */
    --color-primary-gradient: linear-gradient(to bottom, var(--color-primary-light), var(--color-primary));
    --color-primary-dark-gradient: linear-gradient(to bottom, var(--color-primary), var(--color-primary-dark));
    
    /* Colors - States */
    --color-hover: #0f766e; /* darker teal */
    --color-focus: #14b8a6; /* lighter teal */
    --color-disabled: rgba(0, 0, 0, 0.5);
}

/* Global font settings */
body {
    font-family: var(--font-primary);
    background: var(--color-bg-secondary);
    background-image: 
        radial-gradient(circle at 1px 1px, var(--color-paper-texture) 1px, transparent 0);
    background-size: 20px 20px;
}

/* Paper texture overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        linear-gradient(90deg, transparent 79px, var(--color-paper-texture) 80px, var(--color-paper-texture) 81px, transparent 82px),
        linear-gradient(transparent 19px, var(--color-paper-texture) 20px, var(--color-paper-texture) 21px, transparent 22px);
    background-size: 80px 20px;
    pointer-events: none;
    z-index: 0;
    opacity: 0.3;
}

/* Main content typography */
.markdown-content {
    font-family: var(--font-reading);
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: var(--font-size-content);
    line-height: var(--line-height-content);
    letter-spacing: 0.02em;
    font-weight: 400;
    color: var(--color-text-primary);
    text-shadow: 0 0 0.3px rgba(0,0,0,0.1);
}

/* Mobile-optimized story content */
@media (max-width: 768px) {
    .markdown-content {
        padding: 0 8px;
        font-size: calc(var(--font-size-content) * 0.95); /* Slightly smaller for mobile */
    }
    
    /* Add subtle styling to paragraphs for better readability */
    .markdown-content p {
        border-left: 1px solid var(--color-accent-light);
        padding-left: 8px;
        margin-left: 0;
        margin-bottom: 1.2em;
    }
}

/* Heading styles */
h1.text-4xl {
    font-family: var(--font-primary);
    font-size: var(--font-size-4xl);
    letter-spacing: -0.02em;
    font-weight: 700;
    color: var(--color-text-dark);
}

/* Mobile typography adjustments */
@media (max-width: 768px) {
    h1.text-4xl {
        margin-bottom: 1rem;
        font-size: calc(var(--font-size-4xl) * 0.9);
    }
}

/* Form and UI text */
.font-medium {
    font-family: var(--font-primary);
    font-weight: 500;
}

/* Form labels */
label.text-sm {
    font-family: var(--font-primary);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text-dark);
}

/* Intro text styles */
#introText p {
    font-family: var(--font-reading);
    font-weight: 500;
}

#introText {
    /* Increase intro block sizes */
    font-size: 1.125rem; /* secondary line */
}
#introText .text-xl {
    font-size: 1.5rem; /* primary line */
}
#introText p:not(.text-xl) {
    font-size: 1.125rem;
}

/* Choice buttons typography - matching streaming text exactly */
#choicesContainer button {
    font-family: var(--font-reading);
    font-size: var(--font-size-content);
    line-height: var(--line-height-content);
    letter-spacing: 0.02em;
    font-weight: 400;
    text-align: left;
    color: var(--color-text-primary);
    text-shadow: 0 0 0.3px rgba(0,0,0,0.1);
}

/* Shared font styling for narrative and choice text */
.narrative-font {
    font-family: var(--font-reading);
    font-size: var(--font-size-content);
    line-height: var(--line-height-content);
    letter-spacing: 0.02em;
    font-weight: 400;
    color: var(--color-text-primary);
    text-shadow: 0 0 0.3px rgba(0,0,0,0.1);
}

/* Style for the return button - preserving center alignment but matching other typography */
#choicesContainer button.text-center {
    text-align: center;
}

/* Selected choice style - preserving white text but matching other typography */
#choicesContainer button.bg-indigo-600 {
    color: white;
}

/* Journey complete stats typography */
#choicesContainer .text-center {
    font-family: var(--font-reading);
    font-size: var(--font-size-content);
    line-height: var(--line-height-content);
    font-weight: 400;
    text-shadow: 0 0 0.3px rgba(0,0,0,0.1);
}

#choicesContainer h3.text-lg {
    font-size: var(--font-size-lg);
    font-weight: 600;
}

#choicesContainer .text-sm {
    font-size: var(--font-size-sm);
}

/* Progress text */
.text-sm.font-medium {
    font-family: var(--font-primary);
    font-size: var(--font-size-sm);
    font-weight: 500;
}

/* Code block styling */
.markdown-content code {
    font-family: var(--font-code);
    font-size: 0.95em;
    font-weight: normal;
    text-shadow: none;
    background-color: rgba(253, 252, 247, 0.8);
    padding: 0.2em 0.4em;
    border-radius: 3px;
}

.markdown-content pre code {
    display: block;
    padding: 1em;
    overflow-x: auto;
}

/* Drop cap styling */
.drop-cap::first-letter {
    font-family: 'Playfair Display', serif;
    font-size: 4em;
    font-weight: 900;
    line-height: 0.7;
    float: left;
    margin-right: 0.15em;
    margin-top: 0.1em;
    padding: 0.05em 0.1em;
    background: linear-gradient(135deg, #0d9488, #14b8a6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
    z-index: 1;
}

.drop-cap::first-letter::before {
    content: '';
    position: absolute;
    top: -0.1em;
    left: -0.05em;
    right: -0.05em;
    bottom: -0.1em;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(59, 130, 246, 0.1));
    border-radius: 8px;
    z-index: -1;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}

/* Paragraph and text emphasis */
.markdown-content p {
    margin-bottom: 1em;
    white-space: pre-wrap;
}

.markdown-content em {
    font-style: italic;
    color: inherit;
}

.markdown-content strong {
    font-weight: 700;
    color: var(--color-text-dark);
}

/* Selection page typography overrides */
/* Make all text in selection screens use the reading font */
#storyCategoryScreen,
#lessonTopicScreen {
    font-family: var(--font-reading);
}
/* Ensure elements that normally force Andika use Crimson Text here */
#storyCategoryScreen .font-medium,
#lessonTopicScreen .font-medium {
    font-family: var(--font-reading);
}
/* Targeted size increases for selection screens */
#storyCategoryScreen .mb-4.text-sm,
#lessonTopicScreen .mb-4.text-sm {
    font-size: 1rem; /* step indicator line */
}
#storyCategoryScreen .text-xl,
#lessonTopicScreen .text-xl {
    font-size: 1.5rem; /* section headings */
}
#storyCategoryScreen p.text-sm,
#lessonTopicScreen p.text-sm {
    font-size: 1rem; /* helper text */
}
