/* ========================================
   RAINBOWS LESSON PAGE - STYLES
   ======================================== */

/* ========== RESET & BASE ========== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    color: var(--text-body);
    background: var(--page-wash), var(--bg);
    line-height: 1.6;
}

/* ========== TYPOGRAPHY ========== */

h1 {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--text-strong);
    margin-bottom: 0.5rem;
    text-align: center;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-strong);
    margin-bottom: 1.5rem;
    margin-top: 2rem;
    border-left: 5px solid var(--accent);
    padding-left: 1rem;
}

h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-strong);
    margin-bottom: 1rem;
}

h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-strong);
    margin-bottom: 0.75rem;
}

p {
    margin-bottom: 1rem;
    font-size: 1rem;
    line-height: 1.7;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

strong {
    font-weight: 600;
    color: var(--text-strong);
}

/* ========== HERO SECTION ========== */

.hero {
    background: linear-gradient(135deg, #87CEEB 0%, #E0F6FF 100%);
    padding: 4rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-content {
    max-width: 1000px;
    margin: 0 auto;
    position: relative;
    z-index: 10;
}

.hero h1 {
    color: #fff;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.15);
    margin-bottom: 1rem;
    animation: fadeInDown 0.8s ease;
}

.hero-subtitle {
    font-size: 1.4rem;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 300;
    margin-bottom: 1.5rem;
    letter-spacing: 0.5px;
}

.hero-intro {
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.9);
    max-width: 600px;
    margin: 0 auto 2rem;
    line-height: 1.8;
}

.hero-svg {
    max-width: 500px;
    width: 100%;
    height: auto;
    margin-top: 2rem;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== STEP SELECTOR ========== */

.steps-container {
    margin: 2rem 0;
}

.diagram-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.diagram-toolbar-note {
    flex: 1 1 280px;
    margin-bottom: 0;
    font-size: 0.9rem;
    color: #5d6d7e;
}

.steps-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.step-btn {
    padding: 1rem;
    background-color: #f0f0f0;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
    transition: all 0.3s ease;
}

.step-btn:hover {
    background-color: #e8e8e8;
    border-color: #3498db;
    transform: translateY(-2px);
}

.step-btn.active {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border-color: #2980b9;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.step-display {
    background: #f9f9f9;
    padding: 2rem;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.step-explanation {
    animation: fadeIn 0.4s ease;
}

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

.step-explanation h3 {
    color: #2980b9;
    margin-bottom: 1rem;
}

.step-diagram {
    max-width: 300px;
    width: 100%;
    height: auto;
    margin: 1.5rem 0;
    background: #fff;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.interactive-diagram {
    cursor: pointer;
}

.interactive-diagram:hover,
.interactive-diagram.is-active {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(52, 152, 219, 0.18);
}

/* ========== COLOR BARS ========== */

.color-bars {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
    margin: 2rem 0;
}

.color-bar {
    padding: 2rem 1rem;
    border-radius: 6px;
    color: #fff;
    font-weight: 600;
    text-align: center;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
    cursor: default;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.color-bar:hover {
    transform: scale(1.05);
}

.color-bar span {
    font-size: 0.9rem;
}

/* ========== DIAGRAMS ========== */

.diagram-container {
    background: #f9f9f9;
    padding: 2rem;
    border-radius: 8px;
    margin: 2rem 0;
    border: 1px solid #e0e0e0;
}

.diagram-container h4 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 1.5rem;
}

.geometry-svg,
.double-rainbow-svg {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.diagram-action {
    margin: 0 auto 1rem;
    display: block;
    padding: 0.65rem 1rem;
    border: 0;
    border-radius: 999px;
    background: #eef6ff;
    color: #1d5f96;
    font-weight: 700;
    cursor: pointer;
}

.diagram-label {
    font-size: 10px;
    font-weight: 700;
    fill: #1f2d3d;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.interactive-diagram:hover .diagram-label,
.interactive-diagram.is-active .diagram-label,
.interactive-diagram:hover .diagram-overlay-path,
.interactive-diagram.is-active .diagram-overlay-path,
.interactive-diagram:hover .diagram-angle,
.interactive-diagram.is-active .diagram-angle {
    opacity: 1;
}

.diagram-overlay-path,
.diagram-angle {
    opacity: 0;
    transition: opacity 0.25s ease;
}

/* ========== SIMULATION ========== */

.simulation-container {
    display: grid;
    grid-template-columns: minmax(250px, 300px) 1fr;
    gap: 2rem;
    margin: 2rem 0;
    background: #f9f9f9;
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}


.simulation-readouts {
    display: grid;
    gap: 0.75rem;
}

.color-legend h4 {
    display: block;
    margin-bottom: 0.35rem;
}

.color-legend-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
}

.legend-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.65rem;
    border-radius: 999px;
    background: #f7fbff;
    font-size: 0.85rem;
    border: 1px solid #e5eef6;
}

.legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    flex: 0 0 auto;
}

.sim-button {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.3);
}

.sim-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.sim-button:active {
    transform: translateY(0);
}

.sim-button.reset {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    box-shadow: 0 2px 6px rgba(95, 95, 95, 0.3);
}

.sim-button.reset:hover {
    box-shadow: 0 4px 12px rgba(95, 95, 95, 0.4);
}

.simulation-svg {
    width: 100%;
    height: auto;
    min-height: 400px;
    background: linear-gradient(135deg, #E8F4F8 0%, #F5FAFE 100%);
    border-radius: 6px;
    border: 1px solid #d0e8f2;
}

.simulation-svg.is-updating {
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.12);
}

.lesson-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 1.25rem 0 0;
}

.breadcrumb-chip {
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    background: #edf4fa;
    color: #4e6578;
    font-weight: 700;
    font-size: 0.85rem;
}

.breadcrumb-chip.active {
    background: linear-gradient(135deg, #3498db 0%, #5dade2 100%);
    color: #fff;
}

/* ========== VOCABULARY CARDS ========== */

.vocab-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.vocab-card {
    background: #fff;
    border: 2px solid #e0e0e0;
    padding: 1.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.vocab-card:hover {
    border-color: #3498db;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.15);
    transform: translateY(-4px);
}

.vocab-card h4 {
    color: #2980b9;
    margin-bottom: 0.75rem;
    border-bottom: 2px solid #3498db;
    padding-bottom: 0.5rem;
}

.vocab-card p {
    font-size: 0.95rem;
    color: #555;
    margin-bottom: 0;
}

/* ========== QUIZ ========== */

/* ========== SCAVENGER HUNT ========== */

.scavenger-hunt {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.hunt-item {
    background: linear-gradient(135deg, #FFF9E6 0%, #FFFEF0 100%);
    border-left: 5px solid #FF6B6B;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.hunt-item h4 {
    color: #FF6B6B;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.hunt-item p {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.hunt-item .hint {
    color: #666;
    font-style: italic;
    font-size: 0.85rem;
}

.hunt-input {
    width: 100%;
    margin-top: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: 8px;
    border: 1px solid #d5dde5;
    font-size: 0.95rem;
}

.hunt-check-btn {
    margin-top: 0.75rem;
    width: 100%;
}

.hunt-feedback {
    min-height: 2.75rem;
    margin-top: 0.75rem;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.9rem;
    background: rgba(255,255,255,0.72);
}

.hunt-feedback.correct {
    border: 1px solid #b8ebcb;
    color: #1f7a43;
}

.hunt-feedback.incorrect {
    border: 1px solid #f3b0a6;
    color: #b03b2c;
}

/* ========== WONDER CARDS ========== */

.wonder-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.wonder-card {
    background: linear-gradient(135deg, #E8F4F8 0%, #F5FAFE 100%);
    border: 2px solid #3498db;
    padding: 1.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.wonder-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(52, 152, 219, 0.2);
}

.wonder-card h4 {
    color: #2980b9;
    margin-bottom: 0.75rem;
}

.wonder-card p {
    font-size: 0.95rem;
    color: #555;
    margin-bottom: 0;
}

/* ========== FOOTER ========== */

.footer {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    text-align: center;
    padding: 2rem;
    margin-top: 3rem;
}

.footer p {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.footer p:last-child {
    margin-bottom: 0;
    font-size: 0.85rem;
    opacity: 0.8;
}

/* ========== RESPONSIVE DESIGN ========== */

@media (max-width: 1200px) {
    .table-of-contents {
        position: sticky;
        right: auto;
        top: 1rem;
        width: 100%;
        max-height: none;
        margin-bottom: 2rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    h1 {
        font-size: 2.5rem;
    }

    h2 {
        font-size: 1.6rem;
    }

    .hero {
        padding: 2rem 1rem;
    }

    .hero-svg {
        max-width: 100%;
    }

    .simulation-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .simulation-stage {
        order: 1;
    }

    .color-bars {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }

    .color-bar {
        padding: 1.5rem 0.5rem;
    }

    .steps-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .vocab-cards {
        grid-template-columns: 1fr;
    }

    .wonder-cards {
        grid-template-columns: 1fr;
    }

    .scavenger-hunt {
        grid-template-columns: 1fr;
    }
    .diagram-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.4rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

    .hero-intro {
        font-size: 0.95rem;
    }

    .steps-buttons {
        grid-template-columns: 1fr;
    }

    .step-display {
        padding: 1rem;
    }

    .diagram-container {
        padding: 1rem;
    }

    .button-group {
        gap: 0.5rem;
    }

    .sim-button {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
}

/* ========== ACCESSIBILITY ========== */

*:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

button:focus {
    outline: 2px solid #2980b9;
    outline-offset: 2px;
}

input:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* ========== ANIMATIONS & TRANSITIONS ========== */

@keyframes rainbow-shimmer {
    0% {
        opacity: 0.8;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.8;
    }
}

.rainbow-shimmer {
    animation: rainbow-shimmer 2s ease-in-out infinite;
}

@keyframes answerPulse {
    from {
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.08);
    }
    to {
        box-shadow: 0 0 0 8px rgba(52, 152, 219, 0.02);
    }
}

/* Smooth transitions for all interactive elements */
button,
input,
a {
    transition: all 0.3s ease;
}

/* Print styles */
@media print {

    .footer {
        background: white;
        color: #333;
        border-top: 2px solid #ddd;
    }
}
