/* Lesson Layout Styles */
/* Content styles for lesson and topic pages */
/* Layout styles moved to course-template.css to avoid duplication */

/* Lesson Sections Container - Stacked Layout */
.lesson-sections-container {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 60px;
}

.lesson-content-slide {
    width: 100%;
    max-width: 100%;
    padding: 0;
    box-sizing: border-box;
    margin: 0;
    background: transparent;
    border-radius: 0;
    opacity: 1;
    transform: none;
}

/* Lesson Content Grid Styles */
.lesson-content {
    padding: 60px 0;
    width: 100%;
    max-width: 100%;
    overflow: hidden; /* Prevent horizontal overflow */
}

/* Section Number */
.lesson-section-number {
    font-family: SF Pro Display, var(--font-inter, sans-serif);
    font-weight: 400;
    font-size: 28px;
    line-height: 36px;
    letter-spacing: 0px;
    vertical-align: middle;
    color: #6b7280; /* Light gray from styleguide - less visible */
    margin-bottom: 20px;
}

/* Section Title */
.lesson-section-title {
    font-family: SF Pro Display, var(--font-inter, sans-serif);
    font-weight: 500;
    font-size: 42px;
    line-height: 36px;
    letter-spacing: -1.5px;
    vertical-align: middle;
    color: #000000;
    margin: 0 0 30px 0;
}

/* Section Description */
.lesson-section-description {
    font-family: SF Pro Display, var(--font-inter, sans-serif);
    font-weight: 400;
    font-size: 20px;
    line-height: 32px;
    letter-spacing: 0px;
    color: #000000;
    margin: 0 0 60px 0;
    max-width: 800px;
    padding-right: 40px; /* Desktop padding */
}

.lesson-section-description.truncated {
    max-height: 160px; /* Approximately 5 lines at 32px line-height */
    overflow: hidden;
    margin-bottom: 0; /* Remove bottom margin when truncated, button handles spacing */
    position: relative;
}

.lesson-section-description.truncated::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 40px; /* Match padding-right */
    height: 52px; /* ~1.6 lines fade (was 32px / one line) */
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
    pointer-events: none;
}

.lesson-section-description.expanded {
    max-height: none;
    overflow: visible;
    margin-bottom: 60px; /* Restore margin when expanded */
}

/* Read More Button */
.read-more-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    margin-bottom: 60px;
    font-family: SF Pro Display, var(--font-inter, sans-serif);
    font-weight: 600;
    font-size: 16px;
    color: #000000;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
    transition: opacity 0.2s ease;
    max-width: 800px;
    padding-right: 40px;
}

.read-more-toggle:hover {
    opacity: 0.7;
}

.read-more-toggle svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.lesson-section-description.expanded + .read-more-toggle svg {
    transform: rotate(180deg);
}

/* Ensure paragraphs inside description match parent styling exactly */
.lesson-section-description p {
    font-family: inherit;
    font-weight: inherit;
    font-size: inherit;
    line-height: inherit;
    letter-spacing: inherit;
    color: inherit;
    margin: 0 0 1.2em 0;
    max-width: 100%;
    width: 100%;
}

.lesson-section-description p:last-child {
    margin-bottom: 0;
}

/* Lesson Sections */
.lesson-section {
    margin-bottom: 50px;
    width: 100%;
    max-width: 100%;
    overflow: hidden; /* Prevent section overflow */
}

.lesson-section:last-child {
    margin-bottom: 0;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.section-heading {
    font-family: SF Pro Display, var(--font-inter, sans-serif);
    font-weight: 600;
    font-size: 24px;
    color: #1f2937;
    margin: 0;
}

/* Lesson Cards Grid */
.lesson-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.lesson-cards-grid .lesson-card {
    background: none;
    border-radius: 0;
    overflow: visible;
    box-shadow: none;
    transition: none;
    border: none;
    padding: 0;
    margin: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.lesson-card-thumbnail-link {
    display: block;
    text-decoration: none;
    color: inherit;
    width: 100%;
}

.lesson-card-thumbnail-link:focus {
    outline: none;
}

.lesson-card-thumbnail-link:focus-visible .lesson-card-image-wrapper {
    outline: 2px solid var(--color-link-hover, #6B5344);
    outline-offset: 3px;
}

/* Remove border-radius from document card parent */
.document-card,
.document-card.lesson-card {
    border-radius: 0;
}

.lesson-card:hover {
    box-shadow: none;
    transform: none;
}

.lesson-cards-grid .lesson-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 12px;
    display: block;
    max-width: 100%;
}

.lesson-cards-grid .lesson-card-image-wrapper {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
    border-radius: 12px;
}

.lesson-card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: filter 0.3s ease;
}

.lesson-card-content {
    padding: 12px 0 0 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    overflow: hidden;
}

/* Fix overflow for document cards to prevent button cutoff */
.document-card .lesson-card-content {
    overflow: visible; /* Allow button to display fully */
}

.lesson-card-content h3 {
    font-family: SF Pro Display, var(--font-inter, sans-serif);
    font-weight: 500;
    font-size: 14px;
    margin: 10px 0 8px 0;
    color: #282828;
    letter-spacing: 0.3px;
    vertical-align: middle;
    padding-top: 0;
    max-height: 50px;
    overflow: hidden;
    display: flex;
}

.lesson-card-content h3 a,
.lesson-card-content h3 .lesson-card-topic-title-link {
    color: #000000;
    text-decoration: none;
}

.lesson-card-content h3 a:hover,
.lesson-card-content h3 .lesson-card-topic-title-link:hover {
    color: var(--color-link-hover, #6B5344);
    text-decoration: underline;
}

/* Topic title: plain "1. Title…" text in the link (no inner flex — that stacked the number) */
.lesson-card-content h3 .lesson-card-topic-title-link {
    font-weight: inherit;
    font-size: inherit;
    min-width: 0; /* flex child beside checkmark: title can wrap */
}

/* Completed topic: checkmark as list marker */
.lesson-card-content h3.topic-title-completed {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lesson-card-content .topic-completed-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    background-color: var(--color-topic-completed, #A7925B);
    color: white;
    border-radius: 50%;
    font-size: 11px;
    font-weight: bold;
    line-height: 1;
}

.lesson-card-content p {
    font-family: SF Pro Display, var(--font-inter, sans-serif);
    font-weight: 500;
    font-size: 12px;
    line-height: 15px;
    color: #808080;
    margin: 0;
    letter-spacing: -0.1px;
    vertical-align: middle;
    min-height: 60px; /* Fixed height for descriptions */
    max-height: 60px; /* Prevent growing larger */
    overflow: hidden; /* Hide overflow text */
    display: flex;
    align-items: flex-start; /* Align text to top */
}

/* Call Cards Grid - same styling as lesson cards */
.call-cards-slider {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.call-card {
    background: none;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: none;
    transition: none;
    border: none;
    padding: 0;
    margin: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    cursor: pointer;
}

.call-card:hover {
    box-shadow: none;
    transform: none;
}

.call-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 12px;
    display: block;
    max-width: 100%;
}

.call-card-image-wrapper {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
}

.call-card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.call-card-content {
    padding: 12px 0 0 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    overflow: hidden;
}

.call-card-content h3 {
    font-family: SF Pro Display, var(--font-inter, sans-serif);
    font-weight: 500;
    font-size: 14px;
    color: #282828;
    margin: 10px 0 8px 0;
    letter-spacing: 0.3px;
    vertical-align: middle;
    padding-top: 0px;
    max-height: 50px; /* Prevent title from growing */
    overflow: hidden;
    display: flex;
}

.call-card-content p {
    font-family: SF Pro Display, var(--font-inter, sans-serif);
    font-weight: 500;
    font-size: 12px;
    line-height: 15px;
    color: #808080;
    margin: 0;
    letter-spacing: -0.1px;
    vertical-align: middle;
    min-height: 60px; /* Fixed height for descriptions */
    max-height: 60px; /* Prevent growing larger */
    overflow: hidden; /* Hide overflow text */
    display: flex;
    align-items: flex-start; /* Align text to top */
}

/* Slide wrapper styling */
.slide-wrapper {
    background-color: #FFFFFF;
    border-radius: 16px; /* Rounded corners */
    padding: 40px; /* 40px on all sides for desktop */
    margin: 16px 0 20px 0; /* 24px top, 20px bottom for desktop */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); /* Subtle shadow for depth */
    transition: all 0.3s ease; /* Smooth transitions */
}

.slide-wrapper:nth-child(2) {
    background-color: #F9F2E8;
}

/* Next Lesson Card Styles */
.next-lesson-card {
    cursor: default;
    background-color: transparent;
}

.next-lesson-card:hover {
    transform: none;
    box-shadow: none;
}

.next-lesson-image-wrapper {
    background-color: var(--color-accent, #E1DAC8);
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.next-lesson-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    text-align: center;
    padding: 0 20px;
}

.next-lesson-heading {
    font-family: SF Pro Display, var(--font-inter, sans-serif);
    font-weight: 500;
    font-size: 14px;
    color: #282828;
    margin: 0;
    letter-spacing: 0.3px;
}

.next-lesson-btn {
    font-family: SF Pro Display, var(--font-inter, sans-serif);
    font-size: 12px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 40px;
    text-decoration: none;
    display: inline-block;
    background: transparent;
}

/* Responsive Design */
@media (max-width: 989.98px) {
    /* Layout overrides moved to course-template.css */
    
    .lesson-content-slide {
        padding: 0; /* Wrapper handles padding */

    }
    
    .lesson-section-title {
        font-size: 36px;
        line-height: 32px;
    }
    
    .lesson-section-number {
        font-size: 40px;
    }
    
    .lesson-section {
        margin-bottom: 60px;
    }
    
    .lesson-section-description {
        font-size: 18px;
        line-height: 25px;
        margin-bottom: 35px;
    }
    
    .slide-wrapper {
        padding: 32px; /* Reduced padding for tablet */
        margin: 16px 0;
        border-radius: 14px;
    }
}

@media (max-width: 768px) {
    .lesson-cards-grid,
    .call-cards-slider {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .lesson-content-slide {
        padding: 0; /* Wrapper handles padding */
    }
    
    .section-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        margin-bottom: 10px;
    }
    
    .lesson-section-title {
        font-size: 28px;
        line-height: 26px;
        margin-bottom: 15px;
    }
    
    .lesson-section-number {
        font-weight: 500;
        font-style: medium;
        font-size: 14px;
        line-height: 36px;
        letter-spacing: 0px;
        margin-bottom: 0px;
    }
    
    .lesson-section-description {
        font-size: 16px;
        line-height: 22px;
        margin-bottom: 40px;
        padding-right: 10px; /* Mobile padding */
    }
    
    .lesson-section {
        margin-bottom: 25px;
    }
    
    .lesson-section:after {
        content: "";
        display: block;
        width: calc(100%);
        height: 1px;
        background-color: #E6E6E6;
    }
    
    .lesson-section.resources {
        padding-right: 20px; 
    }
    
    .lesson-section.resources:after {
        content: none;
    }
    
    .lesson-section.contact-section:after {
        content: none;
    }
    
    .lesson-section + .lesson-section {
        margin-bottom: 25px;
        padding-bottom: 10px; /* Mobile padding */
    }
    
    .slide-wrapper {
        padding: 20px 0 40px 20px; /* Mobile padding */
        margin: 12px 0;
        border-radius: 12px;
    }
}

@media (max-width: 480px) {
    .lesson-content-slide {
        padding: 0; /* Wrapper handles padding */
    }
    
    .lesson-section-title {
        font-size: 22px;
        line-height: 22px;
    }
    
    .section-heading {
        font-size: 20px;
    }
    
    .section-header {
        gap: 15px;
    }
    
    .lesson-section-description {
        font-size: 14px;
        line-height: 20px;
        margin-bottom: 30px;
    }
    
    .slide-wrapper {
        padding: 20px; /* Minimal padding for small screens */
        margin: 10px 0;
        border-radius: 10px;
    }
}

/* Documents section - 6 per row, equal height, portrait orientation */
.lesson-section.documents-section .lesson-cards-grid {
    grid-template-columns: repeat(6, 1fr);
    column-gap: 20px;
    row-gap: 32px;
}

.lesson-section.documents-section .document-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.lesson-section.documents-section .document-card .document-thumbnail {
    position: relative;
    background: #f1f1ec;
    aspect-ratio: 3/4;
    height: auto;
    min-height: 0;
    flex-shrink: 0;
    text-decoration: none;
    cursor: pointer;
    display: block;
}

.lesson-section.documents-section .document-card .document-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.2s ease;
}

.lesson-section.documents-section .document-card .document-thumbnail:hover img {
    opacity: 0.9;
}

.lesson-section.documents-section .document-card .lesson-card-content {
    padding: 10px 0 0 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.lesson-section.documents-section .document-card .lesson-card-content h3 {
    font-size: 13px;
    margin: 0 0 8px 0;
    max-height: 40px;
    overflow: hidden;
}

/* Ghost download button */
.lesson-section.documents-section .document-card .lesson-card-content .btn,
.lesson-section.documents-section .document-card .lesson-card-content .btn-secondary {
    padding: 8px 14px;
    font-size: 12px;
    background: transparent;
    border: 1px solid #999;
    color: #333;
}

.lesson-section.documents-section .document-card .lesson-card-content .btn:hover,
.lesson-section.documents-section .document-card .lesson-card-content .btn-secondary:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: #333;
    color: #000;
}

@media (max-width: 1200px) {
    .lesson-section.documents-section .lesson-cards-grid {
        grid-template-columns: repeat(4, 1fr);
        row-gap: 28px;
    }
}

@media (max-width: 768px) {
    .lesson-section.documents-section .lesson-cards-grid {
        grid-template-columns: repeat(2, 1fr);
        row-gap: 24px;
    }
}

.lesson-section.documents-section .document-card .document-thumbnail img[src*="placeholder"],
.lesson-section.documents-section .document-card .document-thumbnail img:not([src]) {
    object-fit: contain;
    padding: 24px;
}

/* Desktop - divider only before Documents section */
@media (min-width: 769px) {
    .lesson-section.documents-section:before {
        content: "";
        display: block;
        width: 100%;
        height: 1px;
        background-color: #E6E6E6;
        margin: 0 auto 20px auto;
    }
}
