/**
 * Learning Story CSS Components
 * Wiederverwendbare CSS-Komponenten für Lern-Story-Elemente auf Visualisierungsseiten
 * Version: 1.0 (Januar 2026)
 */

/* ============================================
   LEARNING INTRO
   Kurzer Intro-Text nach dem Subtitle
   ============================================ */

.learning-intro {
    margin-top: 20px;
    padding: 16px 20px;
    background: var(--paper-warm);
    border-radius: 8px;
    border-left: 4px solid var(--embed);
    font-family: var(--font-serif);
    font-size: 1rem;
    color: var(--text-body);
    line-height: 1.7;
}

.learning-intro p {
    margin: 0;
}

.learning-intro strong {
    color: var(--text-dark);
    font-weight: 600;
}

/* Theme color variants for border */
.learning-intro--tokenization,
.learning-intro--embed {
    border-left-color: var(--embed);
}

.learning-intro--attention {
    border-left-color: var(--attention);
}

.learning-intro--ffn {
    border-left-color: var(--ffn);
}

.learning-intro--norm,
.learning-intro--residual {
    border-left-color: var(--norm);
}

.learning-intro--key {
    border-left-color: var(--key);
}

.learning-intro--query {
    border-left-color: var(--query);
}

.learning-intro--value {
    border-left-color: var(--value);
}

/* ============================================
   EXPANDABLE LEARNING PANEL
   Using native <details> element
   ============================================ */

.learning-panel {
    margin-top: 24px;
    border: 1px solid var(--line-light);
    border-radius: 12px;
    background: white;
    overflow: hidden;
}

/* Summary (toggle button) */
.learning-panel > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 20px;
    background: var(--paper-warm);
    border: none;
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    list-style: none;
    transition: background var(--duration-fast, 150ms) ease;
}

.learning-panel > summary::-webkit-details-marker {
    display: none;
}

.learning-panel > summary::marker {
    display: none;
}

.learning-panel > summary:hover {
    background: #eeeeea;
}

.learning-panel > summary:focus-visible {
    outline: 3px solid var(--attention);
    outline-offset: -3px;
}

.learning-panel__toggle-text {
    display: flex;
    align-items: center;
    gap: 10px;
}

.learning-panel__toggle-icon {
    font-size: 18px;
}

.learning-panel__arrow {
    font-size: 12px;
    transition: transform var(--duration-normal, 250ms) ease;
}

.learning-panel[open] .learning-panel__arrow {
    transform: rotate(180deg);
}

/* Panel Content */
.learning-panel__content {
    padding: 24px;
    border-top: 1px solid var(--line-light);
    animation: learningSlideDown var(--duration-normal, 250ms) ease;
}

@keyframes learningSlideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   LEARNING SECTIONS
   Individual content blocks within the panel
   ============================================ */

.learning-section {
    margin-bottom: 24px;
}

.learning-section:last-child {
    margin-bottom: 0;
}

.learning-section__header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.learning-section__icon {
    font-size: 20px;
    line-height: 1;
}

.learning-section__title {
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dark);
    margin: 0;
}

/* Section type color variants */
.learning-section--objectives .learning-section__title {
    color: var(--value);
}

.learning-section--context .learning-section__title {
    color: var(--query);
}

.learning-section--importance .learning-section__title {
    color: var(--attention);
}

.learning-section--takeaways .learning-section__title {
    color: var(--embed);
}

/* Section content styling */
.learning-section__content {
    font-family: var(--font-serif);
    font-size: 15px;
    color: var(--text-body);
    line-height: 1.7;
}

.learning-section__content p {
    margin: 0 0 12px 0;
}

.learning-section__content p:last-child {
    margin-bottom: 0;
}

/* ============================================
   LEARNING JOURNEY INDICATOR
   Shows position in chapter (Schritt X/8)
   ============================================ */

.learning-journey {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(37, 99, 235, 0.05);
    border-radius: 6px;
    margin-bottom: 12px;
}

.learning-journey__step {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--query);
    padding: 4px 10px;
    background: white;
    border-radius: 12px;
    border: 1px solid var(--query);
    white-space: nowrap;
}

.learning-journey__text {
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--text-secondary);
}

/* ============================================
   LEARNING OBJECTIVES LIST
   Checkmark-prefixed list
   ============================================ */

.learning-objectives-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.learning-objectives-list li {
    position: relative;
    padding-left: 28px;
    margin-bottom: 10px;
    font-family: var(--font-serif);
    font-size: 15px;
    color: var(--text-body);
    line-height: 1.6;
}

.learning-objectives-list li:last-child {
    margin-bottom: 0;
}

.learning-objectives-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    top: 0;
    color: var(--value);
    font-weight: 700;
    font-size: 14px;
}

/* ============================================
   KEY TAKEAWAYS BOX
   Arrow-prefixed list with background
   ============================================ */

.learning-takeaways {
    background: var(--paper-warm);
    border-radius: 8px;
    padding: 16px 20px;
}

.learning-takeaways ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.learning-takeaways li {
    position: relative;
    padding-left: 28px;
    margin-bottom: 10px;
    font-family: var(--font-serif);
    font-size: 15px;
    color: var(--text-body);
    line-height: 1.6;
}

.learning-takeaways li:last-child {
    margin-bottom: 0;
}

.learning-takeaways li::before {
    content: "→";
    position: absolute;
    left: 0;
    top: 0;
    color: var(--embed);
    font-weight: 700;
    font-size: 14px;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .learning-intro {
        padding: 14px 16px;
        font-size: 0.95rem;
        margin-top: 16px;
    }

    .learning-panel {
        margin-top: 20px;
        border-radius: 10px;
    }

    .learning-panel > summary {
        padding: 14px 16px;
        font-size: 13px;
    }

    .learning-panel__content {
        padding: 20px 16px;
    }

    .learning-section {
        margin-bottom: 20px;
    }

    .learning-section__title {
        font-size: 13px;
    }

    .learning-section__content {
        font-size: 14px;
    }

    .learning-objectives-list li,
    .learning-takeaways li {
        font-size: 14px;
        padding-left: 24px;
    }

    .learning-journey {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 12px;
    }

    .learning-journey__step {
        font-size: 11px;
        padding: 3px 8px;
    }

    .learning-journey__text {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .learning-intro {
        padding: 12px 14px;
        font-size: 0.9rem;
        border-left-width: 3px;
    }

    .learning-panel {
        border-radius: 8px;
    }

    .learning-panel > summary {
        padding: 12px 14px;
        font-size: 12px;
    }

    .learning-panel__toggle-text {
        gap: 8px;
    }

    .learning-panel__content {
        padding: 16px 14px;
    }

    .learning-section__header {
        gap: 8px;
    }

    .learning-section__title {
        font-size: 12px;
    }

    .learning-takeaways {
        padding: 12px 14px;
    }
}

/* ============================================
   REDUCED MOTION SUPPORT
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .learning-panel__arrow {
        transition: none;
    }

    .learning-panel__content {
        animation: none;
    }

    .learning-panel > summary {
        transition: none;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .learning-panel {
        border: 1px solid #ccc;
    }

    .learning-panel > summary {
        background: #f5f5f5;
    }

    .learning-panel[open] .learning-panel__content {
        display: block;
    }

    .learning-intro {
        border-left-color: #666;
        background: #f9f9f9;
    }
}
