/**
 * L² Lab - Starter Cards CSS
 *
 * Base styling for Starter Think Cards (Phase 1 - NO lens features)
 * Cards use pure exploration before children learn about thinking lenses
 *
 * Usage:
 * <link rel="stylesheet" href="../starter-base.css">
 */

/* ========== LAYOUT VARIABLES ========== */
:root {
    /* Layout */
    --page-padding: clamp(12px, 4vw, 24px);
    --card-padding: clamp(16px, 4vw, 40px);
    --header-v-padding: clamp(10px, 2.5vw, 16px);
    --content-max: 800px;
    --radius: 16px;

    /* Text colors (defaults, override in card) */
    --text: #1F2937;
    --text-light: #4B5563;
    --text-muted: #9CA3AF;
}

/* ========== BASE RESET ========== */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
    max-width: 100vw;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg, #F5F5F4);
    color: var(--text);
    line-height: 1.6;
}

/* ========== HEADER ========== */
.header {
    background: var(--card, white);
    padding: var(--header-v-padding) var(--page-padding);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
}

.header-inner {
    max-width: var(--content-max);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.back-link {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--text-light);
    font-weight: 600;
    font-size: clamp(0.8rem, 2.5vw, 0.9rem);
    padding: 6px 12px;
    background: var(--bg, #F0F9FF);
    border-radius: 20px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.back-link:hover {
    color: var(--category, #0EA5E9);
    background: var(--category-soft, #E0F2FE);
}

.category-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: clamp(0.7rem, 2.2vw, 0.8rem);
    font-weight: 700;
    color: var(--category, #0EA5E9);
    background: var(--category-soft, #E0F2FE);
    padding: 5px 12px;
    border-radius: 16px;
}

/* ========== MAIN CONTENT ========== */
main {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--page-padding) var(--page-padding) 80px;
}

/* ========== THINK CARD ========== */
.think-card {
    background: var(--card, white);
    border-radius: clamp(16px, 3vw, 24px);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

/* Card Header */
.card-header {
    background: linear-gradient(135deg, var(--category-soft, #E0F2FE), var(--category-light, #F0F9FF));
    padding: 32px 24px;
    text-align: center;
    position: relative;
}

.card-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 20px;
    background: var(--card, white);
    border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}

.card-number {
    background: var(--category, #0EA5E9);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 10px;
    display: inline-block;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-visual {
    font-size: clamp(40px, 10vw, 56px);
    margin-bottom: 20px;
    line-height: 1.2;
}

.card-question {
    font-family: 'Baloo 2', 'Nunito', sans-serif;
    font-size: clamp(1.2rem, 4vw, 1.5rem);
    font-weight: 700;
    color: var(--text);
    margin: 0;
    line-height: 1.4;
}

/* Card Body */
.card-body {
    padding: 28px 24px;
}

/* ========== THINKING PROMPT ========== */
.thinking-prompt {
    background: var(--bg-warm, var(--category-light, #F0F9FF));
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    border-left: 4px solid var(--category, #0EA5E9);
}

.prompt-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--category, #0EA5E9);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.thinking-prompt p {
    margin: 0;
    color: var(--text-light);
    line-height: 1.7;
}

/* ========== TEXTAREA ========== */
.thinking-textarea {
    width: 100%;
    min-height: 120px;
    padding: 16px;
    border: 2px solid #E5E7EB;
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 24px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.thinking-textarea:focus {
    outline: none;
    border-color: var(--category, #0EA5E9);
    box-shadow: 0 0 0 3px var(--category-light, rgba(14, 165, 233, 0.1));
}

.thinking-textarea::placeholder {
    color: var(--text-muted);
}

/* ========== HINTS SYSTEM ========== */
.hints-section {
    margin-bottom: 24px;
}

.hints-locked {
    background: #FEF3C7;
    border: 2px dashed #F59E0B;
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    color: #92400E;
    font-weight: 600;
    font-size: 0.9rem;
}

.hints-container {
    display: none;
}

.hints-container.unlocked {
    display: block;
}

.hint-card {
    background: var(--bg, #F5F5F4);
    border-radius: var(--radius);
    margin-bottom: 12px;
    border: 2px solid transparent;
    overflow: hidden;
    transition: border-color 0.2s;
}

.hint-card.revealed {
    border-color: var(--category, #0EA5E9);
    background: var(--category-light, #F0F9FF);
}

.hint-btn {
    width: 100%;
    padding: 14px 18px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    font-family: inherit;
    text-align: left;
    transition: background 0.2s;
}

.hint-btn:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.03);
}

.hint-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.hint-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
    background: var(--category, #0EA5E9);
    flex-shrink: 0;
}

.hint-content {
    display: none;
    padding: 0 18px 16px 58px;
    color: var(--text-light);
    line-height: 1.7;
    font-size: 0.95rem;
    position: relative;
}

.hint-content p {
    margin: 0 0 8px 0;
}

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

.hint-card.revealed .hint-content {
    display: block;
}

/* ========== COMPLETE ANSWER ========== */
.complete-answer {
    background: linear-gradient(135deg, var(--category-soft, #E0F2FE), var(--category-light, #F0F9FF));
    border: 2px solid var(--category, #0EA5E9);
    border-radius: var(--radius);
    margin-top: 16px;
    overflow: hidden;
}

.complete-btn {
    width: 100%;
    padding: 16px 18px;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    color: var(--category-dark, var(--category, #0EA5E9));
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: inherit;
    transition: background 0.2s;
}

.complete-btn:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.03);
}

.complete-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.complete-content {
    display: none;
    padding: 0 18px 20px;
}

.complete-answer.revealed .complete-content {
    display: block;
}

.complete-response {
    background: white;
    border-radius: 12px;
    padding: 20px;
    line-height: 1.8;
    border-left: 4px solid var(--category, #0EA5E9);
    position: relative;
}

.complete-response p {
    margin: 0 0 12px 0;
}

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

.complete-response strong {
    color: var(--text);
}

/* ========== NEXT STEP PROMPT (Starter-specific) ========== */
.next-step-prompt {
    background: linear-gradient(135deg, #ECFDF5, #D1FAE5);
    border: 2px solid #10B981;
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 24px;
    text-align: center;
}

.next-step-prompt p {
    margin: 0;
    color: #065F46;
    font-size: 0.95rem;
    line-height: 1.6;
}

.next-step-prompt a {
    color: #059669;
    font-weight: 700;
    text-decoration: none;
}

.next-step-prompt a:hover {
    text-decoration: underline;
}

/* ========== NAVIGATION SECTION ========== */
.nav-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 2px solid #E5E7EB;
}

.nav-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--bg, #F5F5F4);
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-light);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.nav-link:hover {
    background: var(--category-light, #F0F9FF);
    border-color: var(--category, #0EA5E9);
    color: var(--category, #0EA5E9);
}

.nav-link.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.nav-link-prev {
    margin-right: auto;
}

.nav-link-next {
    margin-left: auto;
}

/* ========== PARENT/TEACHER GUIDANCE ========== */
.adult-guidance {
    margin-top: 32px;
    background: linear-gradient(135deg, #FEF3C7, #FDE68A);
    border: 2px solid #F59E0B;
    border-radius: 16px;
    overflow: hidden;
}

/* Header - always visible */
.adult-guidance .guidance-header {
    padding: 16px 20px 0;
    background: linear-gradient(135deg, #FEF3C7, #FDE68A);
}

.adult-guidance .guidance-label {
    font-weight: 700;
    color: #92400E;
    font-size: 1.05rem;
}

/* Micro-story - always visible */
.adult-guidance .micro-story {
    background: linear-gradient(135deg, #FEF9C3, #FEF3C7);
    border-left: 4px solid #F59E0B;
    padding: 16px;
    margin: 16px 20px;
    border-radius: 0 12px 12px 0;
    position: relative;
}

.adult-guidance .micro-story p {
    margin-bottom: 8px;
    font-size: 0.95rem;
    line-height: 1.8;
    color: #78350F;
}

.adult-guidance .micro-story p:last-child {
    margin-bottom: 0;
}

/* "See more" expandable section */
.adult-guidance .guidance-more {
    margin: 0;
    border: none;
    background: none;
}

.adult-guidance .guidance-more summary {
    padding: 12px 20px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #B45309;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s ease;
}

.adult-guidance .guidance-more summary:hover {
    color: #92400E;
}

.adult-guidance .guidance-more summary::-webkit-details-marker {
    display: none;
}

.adult-guidance .guidance-more[open] summary {
    border-bottom: 1px solid #FCD34D;
    padding-bottom: 12px;
}

/* Expanded content */
.adult-guidance .guidance-content {
    padding: 16px 20px 20px;
    background: #FFFBEB;
}

.adult-guidance .guidance-content p {
    margin-bottom: 12px;
    line-height: 1.7;
    color: #78350F;
}

.adult-guidance .guidance-content ul {
    margin: 8px 0 16px 20px;
    color: #78350F;
}

.adult-guidance .guidance-content li {
    margin-bottom: 6px;
    line-height: 1.6;
}

.adult-guidance .guidance-content em {
    font-style: italic;
    color: #92400E;
}

/* ========== TEXT-TO-SPEECH BUTTON ========== */
.tts-btn {
    background: none;
    border: 2px solid var(--category, #EA580C);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--category, #EA580C);
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 0;
}

.tts-btn:hover {
    background: var(--category-light, #FFF7ED);
    transform: scale(1.1);
}

.tts-btn.playing {
    background: var(--category, #EA580C);
    color: white;
    animation: pulse-tts 1s ease-in-out infinite;
}

.tts-btn:focus {
    outline: 3px solid var(--category, #EA580C);
    outline-offset: 2px;
}

@keyframes pulse-tts {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* TTS in card header - floating top-right */
.card-header .tts-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.card-header .tts-btn:hover {
    background: var(--category-light, #FFF7ED);
}

/* TTS inline with section headers */
.tts-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.tts-inline .tts-btn {
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
}

/* TTS inside hint content - floating top-right */
.hint-content .tts-hint {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
    background: white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* TTS inside complete response - floating top-right */
.complete-response .tts-complete {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    font-size: 0.95rem;
    background: white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* TTS inside micro-story - floating top-right */
.micro-story .tts-story {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
    background: white;
    border-color: #F59E0B;
    color: #F59E0B;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.micro-story .tts-story:hover {
    background: #FEF3C7;
}

/* ========== FOOTER ========== */
footer {
    text-align: center;
    padding: 24px var(--page-padding);
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 600px) {
    .card-header {
        padding: 24px 16px;
    }

    .card-body {
        padding: 20px 16px;
    }

    .thinking-prompt {
        padding: 16px;
    }

    .hint-content {
        padding: 0 16px 14px 50px;
    }

    .nav-links {
        flex-direction: column;
    }

    .nav-link {
        width: 100%;
        justify-content: center;
    }

    .nav-link-prev,
    .nav-link-next {
        margin: 0;
    }

    .next-step-prompt {
        padding: 16px;
    }
}

/* ========== ACCESSIBILITY ========== */
@media (prefers-reduced-motion: reduce) {
    .hint-btn,
    .nav-link,
    .tts-btn {
        transition: none;
    }

    .tts-btn.playing {
        animation: none;
    }
}

.hint-btn:focus,
.complete-btn:focus,
.nav-link:focus {
    outline: 3px solid #3B82F6;
    outline-offset: 2px;
}

/* ========== PRINT STYLES ========== */
@media print {
    .header {
        position: static;
        box-shadow: none;
    }

    .hints-locked,
    .nav-section,
    .next-step-prompt {
        display: none;
    }

    .hints-container {
        display: block !important;
    }

    .hint-content {
        display: block !important;
    }

    .complete-content {
        display: block !important;
    }
}
