/**
 * Lesson block styles.
 * Bootstrap 4 is loaded site-wide, so layout leans on BS utility/component
 * classes in the markup; this file covers what BS doesn't: the icon square,
 * the chevron, the resource action circle, and the video modal.
 * Colors reuse the theme's brand variables from style.css.
 */

/* Accordion container */
.lesson {
    border: 1px solid var(--sky);
    border-radius: 10px;
    margin-bottom: 1.25rem;
    background: var(--white);
    overflow: hidden;
}

/* Header / summary */
.lesson__header {
    list-style: none;
    cursor: pointer;
    padding: 1.25rem 1.5rem;
    gap: 1rem;
}

.lesson__header::-webkit-details-marker {
    display: none;
}

.lesson__icon {
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
    border-radius: 12px;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--sky);
}

.lesson__icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lesson__heading {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
}

.lesson__subtitle {
    font-size: 0.875rem;
    color: var(--blue);
    line-height: 1.2;
}

.lesson__title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--navy);
    line-height: 1.2;
}

.lesson__chevron {
    flex: 0 0 auto;
    color: var(--navy);
    transition: transform 0.2s ease;
}

.lesson[open] .lesson__chevron {
    transform: rotate(180deg);
}

/* Body */
.lesson__body {
    padding: 0 1.5rem 1.5rem;
}

.lesson__description {
    color: #333;
    margin-bottom: 1.25rem;
}

.lesson__description > :last-child {
    margin-bottom: 0;
}

/* Resource cards */
.lesson__resources {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.lesson-resource {
    width: 100%;
    text-align: left;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--sky);
    border-radius: 10px;
    background: var(--white);
    color: var(--navy);
    text-decoration: none;
    cursor: pointer;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.lesson-resource:hover,
.lesson-resource:focus {
    border-color: var(--blue);
    box-shadow: 0 2px 10px rgba(26, 38, 77, 0.12);
    text-decoration: none;
    color: var(--navy);
}

.lesson-resource__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.lesson-resource__title {
    font-weight: 700;
}

.lesson-resource__label {
    font-size: 0.875rem;
    color: #6c757d;
}

.lesson-resource__action {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--sky);
    color: var(--blue);
    font-size: 1rem;
}

.lesson-resource:hover .lesson-resource__action {
    background: var(--blue);
    color: var(--white);
}

/* Video modal */
.lesson-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: rgba(0, 0, 0, 0.8);
    padding: 1rem;
    align-items: center;
    justify-content: center;
}

.lesson-modal.is-open {
    display: flex;
}

.lesson-modal__dialog {
    position: relative;
    width: 100%;
    max-width: 900px;
}

.lesson-modal__close {
    position: absolute;
    top: -2.5rem;
    right: 0;
    background: none;
    border: 0;
    color: var(--white);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
}

/* 16:9 fallback in case Bootstrap's embed-responsive isn't present */
.lesson-modal__video {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #000;
}

.lesson-modal__video iframe,
.lesson-modal__video .embed-responsive-item {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

body.lesson-modal-open {
    overflow: hidden;
}

/* Small screens */
@media (max-width: 575.98px) {
    .lesson__title {
        font-size: 1.25rem;
    }
    .lesson__header {
        padding: 1rem;
    }
    .lesson__body {
        padding: 0 1rem 1rem;
    }
}
