/* ============================================================
   curriculum_how_it_works — Section 2 of the Structured Learning
   landing. Visual reference: Section 2.png.
   Heading + 4 circular step icons connected by arrows, with a
   title and short description under each step.
   Palette + wallpaper accents match the about_instructor /
   curriculum_hero components for visual consistency.
   Light / Dark / wallpaper / RTL aware.
   ============================================================ */

.curriculum-how-section {
    position: relative;
    overflow: hidden;
    padding: 32px 0;
}

/* ============================================================
   Layout — single column by default; side-by-side when BOTH the
   how-it-works steps AND the why panel are present (--split).
   Why column is FIRST in DOM so RTL puts it on the right and LTR
   on the left, matching the design reference (Section 2_1.png).
   ============================================================ */
.curriculum-how-section__layout {
    display: flex;
    flex-direction: column;
    gap: 32px;
    width: 100%;
}
.curriculum-how-section--split .curriculum-how-section__layout {
    flex-direction: row;
    align-items: stretch;
    gap: clamp(20px, 3vw, 48px);
}
.curriculum-how-section__why-col,
.curriculum-how-section__how-col {
    flex: 1 1 0;
    min-width: 0;
}

/* ---- Heading ---- */
.curriculum-how-section__heading {
    margin: 0 0 32px;
    text-align: center;
    font-weight: 800;
    font-size: clamp(1.3rem, 2vw, 1.85rem);
    line-height: 1.25;
    color: var(--dark);
}
body.dark-mode .curriculum-how-section__heading { color: #ffffff; }
body.home-wallpaper-active:not(.dark-mode) .curriculum-how-section__heading {
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(20, 0, 40, 0.35);
}

/* ============================================================
   Steps row — 4 cells split by arrows. Each cell holds the icon
   tile, a title, and a description.
   ============================================================ */
.curriculum-how-section__steps {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: clamp(8px, 1.4vw, 16px);
    flex-wrap: wrap;
    width: 100%;
}

.ch-step {
    flex: 1 1 0;
    min-width: 0;                       /* allow flex to shrink the cell inside a half-width column */
    max-width: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
}

/* ---- Step icon — circular primary tile with white glyph,
       mirroring the visual weight of .ai-card__icon but circular
       (matches the design reference). ---- */
.ch-step__icon {
    width: clamp(56px, 5vw, 80px);
    height: clamp(56px, 5vw, 80px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 10px 28px rgba(62, 0, 95, 0.25);
    flex-shrink: 0;
}
.ch-step__icon img {
    width: 50%;
    height: 50%;
    object-fit: contain;
    filter: brightness(0) invert(1);
}
body.dark-mode .ch-step__icon {
    box-shadow: 0 10px 28px rgba(180, 143, 255, 0.30);
}
body.home-wallpaper-active:not(.dark-mode) .ch-step__icon {
    box-shadow: 0 10px 28px rgba(20, 0, 40, 0.40);
}

/* ---- Step text ---- */
.ch-step__title {
    margin: 8px 0 0;
    font-weight: 700;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    line-height: 1.3;
    color: var(--dark);
}
.ch-step__description {
    margin: 0;
    font-size: clamp(0.78rem, 0.88vw, 0.92rem);
    line-height: 1.55;
    color: var(--gray-500);
}
body.dark-mode .ch-step__title { color: #ffffff; }
body.dark-mode .ch-step__description { color: var(--gray-400); }
body.home-wallpaper-active:not(.dark-mode) .ch-step__title {
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(20, 0, 40, 0.30);
}
body.home-wallpaper-active:not(.dark-mode) .ch-step__description {
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 1px 2px rgba(20, 0, 40, 0.22);
}

/* ============================================================
   Arrow between steps — soft accent color, sized to vertically
   align with the icon center. Auto-flips for RTL.
   ============================================================ */
.ch-step-arrow {
    flex: 0 0 auto;
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    /* The arrow sits at the icon's vertical center, so push it
       down to roughly half the icon height. */
    margin-top: clamp(28px, 3vw, 40px);
    opacity: 0.85;
}
.ch-step-arrow svg {
    display: block;
    width: clamp(22px, 2.2vw, 32px);
    height: clamp(22px, 2.2vw, 32px);
}
/* In RTL the arrow should point right-to-left (page reading
   direction). The flip is applied via the .rtl body class. */
body.rtl .ch-step-arrow { transform: scaleX(-1); }

body.dark-mode .ch-step-arrow { color: var(--accent); }
body.home-wallpaper-active:not(.dark-mode) .ch-step-arrow {
    color: #f1c87a;                  /* gold accent — same wallpaper token
                                        used for separators on the rest of
                                        the curriculum landing */
}

/* ============================================================
   Why-this-system-is-special panel — sub-heading + bullet items
   stacked vertically. Each bullet is a card with a circular check
   on the start side and the reason text on the rest of the row,
   matching the visual style of Section 2_1.png.
   ============================================================ */
.curriculum-how-section__why-heading {
    margin: 0 0 24px;
    text-align: center;
    font-weight: 800;
    font-size: clamp(1.3rem, 2vw, 1.85rem);
    line-height: 1.3;
    color: var(--dark);
}
body.dark-mode .curriculum-how-section__why-heading { color: #ffffff; }
body.home-wallpaper-active:not(.dark-mode) .curriculum-how-section__why-heading {
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(20, 0, 40, 0.30);
}

.curriculum-how-section__why-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ---- Each reason bullet — circular check on the lead side + text ---- */
.ch-reason {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 14px;
    background: #fbdefcf8;
    border: 1.5px solid var(--primary);
    box-shadow: 0 10px 24px rgba(62, 0, 95, 0.08);
    transition: transform .2s ease, box-shadow .2s ease;
}
.ch-reason:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(62, 0, 95, 0.14);
}
body.dark-mode .ch-reason {
    background: rgba(31, 15, 51, 0.55);
    border-color: rgba(180, 143, 255, 0.65);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.ch-reason__check {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: clamp(28px, 2.6vw, 34px);
    height: clamp(28px, 2.6vw, 34px);
    border-radius: 50%;
    background: var(--primary);
    color: var(--primary-btn-color);
    box-shadow: 0 6px 16px rgba(62, 0, 95, 0.20);
}
.ch-reason__check svg {
    display: block;
    width: 60%;
    height: 60%;
}
body.dark-mode .ch-reason__check {
    box-shadow: 0 6px 16px rgba(180, 143, 255, 0.25);
}

.ch-reason__text {
    flex: 1 1 auto;
    font-weight: 600;
    font-size: clamp(0.86rem, 0.95vw, 1rem);
    line-height: 1.5;
    color: var(--dark);
    word-break: break-word;
    overflow-wrap: anywhere;
}
body.dark-mode .ch-reason__text { color: #ffffff; }
body.home-wallpaper-active:not(.dark-mode) .ch-reason__text { color: #6a0d7a; }

/* ============================================================
   Responsive — same four-breakpoint cascade as every other
   landing builder component (1199 / 991 / 767 / 575).
   ============================================================ */
@media (max-width: 1199px) {
    .curriculum-how-section__steps { gap: 10px; }
}

@media (max-width: 991px) {
    /* Collapse the two-column split back to a vertical stack so each
       half (steps row + why list) gets the full container width. */
    .curriculum-how-section--split .curriculum-how-section__layout {
        flex-direction: column;
        gap: 36px;
    }
    .ch-step { min-width: 140px; max-width: 180px; }
    .ch-step__icon { width: clamp(64px, 7vw, 86px); height: clamp(64px, 7vw, 86px); }
    .ch-step-arrow { margin-top: 26px; }
}

@media (max-width: 767px) {
    /* Stack steps into 2 columns. Hide the inline arrows — they
       don't read well at this width because the cells wrap to a
       new line. The flow becomes top-to-bottom which is clear on
       its own. */
    .curriculum-how-section__steps {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 24px 12px;
    }
    .ch-step { max-width: none; }
    .ch-step-arrow { display: none; }
}

@media (max-width: 575px) {
    .curriculum-how-section__steps { grid-template-columns: 1fr; gap: 24px; }
    .curriculum-how-section__heading { font-size: clamp(1.3rem, 5.5vw, 1.7rem); margin-bottom: 28px; }
    .ch-reason { padding: 12px 14px; }
}
