/* =============================================
   Problem Block — taubenloft/problem
   Pixel-perfect from Figma node 1:2579
   ─────────────────────────────────────────────
   Section #6 frame:      1920×1101
   Padding:               96 / 240 / 96 / 240
   Background:            #EAEBE6
   itemSpacing (vertical) 64 (titles → grid)
   ─────────────────────────────────────────────
   Title block: 1440×104, vertical, gap 32
   Eyebrow:     dot 20×20, gap 12, text 13/22
   H2:          36 / 50.4 / 500 / #333A42 (Nunito Sans Medium)
   ─────────────────────────────────────────────
   Grid:        image 976 wide | accordion 464 wide
   Image:       830×600 inside image col
   ============================================= */

.tl-problem {
    background: #eaebe6;
    color: #333a42;
    font-family: 'Nunito Sans', 'Nunito Sans Fallback', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    padding: 96px 24px;                /* full Figma 240 emulated via container max-width centering */
}

.tl-problem__container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 64px;                  /* Figma 2026-05 verified: titles INSTANCE → left FRAME gap = 64 */
}

/* ── Titles block ─────────────────────────────────── */
.tl-problem__titles {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.tl-problem__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    font-size: 16px;              /* Figma: 16 */
    line-height: 21.824px;        /* Figma lineHeightPx */
    font-weight: 500;             /* Figma: Medium */
    letter-spacing: 0;            /* Figma: 0 */
    text-transform: uppercase;
    color: #333a42;
}

.tl-problem__eyebrow-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #333a42;
    flex: 0 0 20px;
}

.tl-problem__heading {
    margin: 0;
    font-family: 'Nunito Sans', 'Nunito Sans Fallback', system-ui, sans-serif;
    font-size: 36px;
    line-height: 50.4px;
    font-weight: 500;
    letter-spacing: 0;
    color: #333a42;
}

/* ── Grid: photo 830 + gap 146 + accordion 464 = 1440 ───
   Photo is fixed 830×600 in Figma (NOT filling the whole 976-col).
   Accordion 464. We use flex with proportional widths so both
   shrink together on narrower viewports.
   Figma "Line 11" — top horizontal divider spans full row width. */
.tl-problem__grid {
    display: flex;
    align-items: flex-start;
    gap: 0;                                       /* Figma 2026-05: photo 720 + description 480 = 1200, no gap */
    border-top: 0.5px solid rgba(51, 58, 66, 0.5); /* Figma stroke #333A42@0.5 weight 0.5 */
    padding-top: 32px;
}

.tl-problem__image {
    flex: 0 0 720px;                /* Figma 2026-05: photo column 720 */
    padding-right: 64px;            /* Figma: photo has paddingRight 64 inside its column */
    padding-top: 64px;              /* Figma 2026-05: photo starts 96px below Line 11 (32 grid pad + 64 inside col) */
    box-sizing: border-box;
    max-width: 60%;                 /* 720/1200 */
}

.tl-problem__image img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 656 / 600;       /* Figma 2026-05: photo inside 720 column minus 64 right padding = 656 wide × 600 tall */
    object-fit: cover;
}
.tl-problem--image-right .tl-problem__image img {
    aspect-ratio: 648 / 600;       /* mirror: photo inside 712 column minus 64 left padding */
}

/* ── Accordion (description_section, 464 wide) ──────
   Figma:
   - VERTICAL divider on LEFT edge of accordion column (height = full)
   - Horizontal divider above first item + between items + below last item
*/
.tl-problem__accordion {
    flex: 0 0 480px;                               /* Figma 2026-05: description column 480 */
    max-width: 480px;
    list-style: none;
    margin: -32px 0 0 0;                           /* pull the vertical rule up to meet the grid's top line
                                                      (grid has padding-top 32 above the accordion) */
    padding: 0;                                    /* no L/R inset so item dividers touch the vertical line;
                                                      no top padding either, so the first item's summary sits
                                                      32px below the top line — same gap as between items */
    box-sizing: border-box;
    border-left: 0.5px solid rgba(51, 58, 66, 0.5);
}

.tl-problem__item {
    margin: 0;
    border-bottom: 0.5px solid rgba(51, 58, 66, 0.5);
}
/* no divider below the last item (list ends flush, per design) */
.tl-problem__item:last-child {
    border-bottom: 0;
}

.tl-problem__details > summary {
    list-style: none;
    cursor: pointer;
}
.tl-problem__details > summary::-webkit-details-marker { display: none; }

.tl-problem__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 32px 24px;           /* Figma 2026-05: clicked title paddingLeft/Right 24 */
    font-size: 20px;              /* Figma: 20 */
    font-weight: 600;             /* Figma SemiBold */
    line-height: 27.28px;         /* Figma lineHeightPx */
    color: #333a42;
    transition: color 0.2s;
}
.tl-problem__summary:hover { color: #4a5159; }

.tl-problem__title { flex: 1; }

/* + / − icon — Figma 2026-05: wrapper 24×24 hit area, visible icon 14×14 (Lucide plus) */
.tl-problem__icon {
    position: relative;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
}
.tl-problem__icon::before,
.tl-problem__icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;                   /* Figma icon visible size */
    height: 1.5px;
    background: #333a42;
    transform: translate(-50%, -50%);
    transition: transform 0.25s ease;
    transform-origin: center;
}
.tl-problem__icon::after {
    transform: translate(-50%, -50%) rotate(90deg);
}
.tl-problem__details[open] .tl-problem__icon::after {
    transform: translate(-50%, -50%) rotate(0deg);
}

.tl-problem__body {
    padding: 0 24px 32px;         /* match summary's 24px left padding so title + body align in one column */
    color: #333a42;               /* Figma: same dark as title */
    font-size: 16px;              /* Figma: 16 */
    line-height: 24px;            /* Figma lineHeightPx */
    font-weight: 400;             /* Figma Regular */
}
.tl-problem__body p { margin: 0 0 12px; }
.tl-problem__body p:last-child { margin-bottom: 0; }

/* Safety defaults */
.tl-problem img { max-width: 100%; }

/* ── Mirror variant: accordion LEFT, image RIGHT ─────
   Figma 2026-05: same 720+480=1200 split, just flipped. No gap. */
.tl-problem--image-right .tl-problem__grid {
    gap: 0;
}
.tl-problem--image-right .tl-problem__image {
    order: 2;
    flex: 0 0 712px;                /* Figma 2026-05 mirror: photo column 712 (8px narrower than problem) */
    max-width: 60%;
    padding-right: 0;
    padding-left: 64px;
}
.tl-problem--image-right .tl-problem__accordion {
    order: 1;
    flex: 0 0 488px;                /* Figma 2026-05 mirror: description column 488 (8px wider than problem) */
    max-width: 488px;
    width: 488px;
    padding: 0;                     /* mirror: no L/R inset so dividers touch the right vertical rule;
                                       no top padding, first item 32px below the top line (margin-top -32 inherited) */
    border-left: 0;
    border-right: 0.5px solid rgba(51, 58, 66, 0.5);
}

/* ── Laptop ≤1440 ─────────────────────────────────── */
@media (max-width: 1440px) {
    .tl-problem__image img { width: 100%; height: auto; aspect-ratio: 656 / 600; }
    .tl-problem__accordion { width: auto; }
}

/* ── Tablet (768-1200) — two Problem sections side-by-side via flex-wrap on <main>.
   Each card stacks: image (top) + accordion (bottom). */
@media (min-width: 768px) and (max-width: 1200px) {
    /* Turn <main> into flex-wrap so problem siblings can share a row */
    main.site {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
    }
    main.site > * {
        flex: 0 0 100%;
        width: 100%;
        max-width: 100%;
    }
    /* Problem sections become 50% each, NO gap (same bg color, fills row edge-to-edge) */
    main.site > .tl-problem {
        flex: 0 0 50% !important;
        width: 50% !important;
        max-width: 50% !important;
        margin: 0 !important;
    }
    .tl-problem {
        padding: 62px 24px 32px !important;     /* +30px top space above eyebrow per user feedback */
        box-sizing: border-box;
    }
    .tl-problem__container {
        gap: 24px;
        max-width: 100%;
    }
    .tl-problem__heading {
        font-size: 22px;
        line-height: 1.25;
        min-height: calc(3 * 22px * 1.25);   /* reserve 3 lines so images in both cards align */
    }
    .tl-problem__titles {
        align-self: stretch;
    }

    /* stack inside each card: image top, accordion below */
    .tl-problem__grid,
    .tl-problem--image-right .tl-problem__grid {
        flex-direction: column !important;
        gap: 20px;
        border-top: 0;
        padding-top: 0;
    }
    .tl-problem__image,
    .tl-problem--image-right .tl-problem__image {
        flex: 1 1 auto !important;
        width: 100%;
        max-width: 100% !important;
        margin: 0;
        padding: 0 !important;
        order: 1;
    }
    /* Force same aspect ratio for both default + mirror so 2-up looks symmetric */
    .tl-problem__image img,
    .tl-problem--image-right .tl-problem__image img {
        width: 100%;
        height: auto;
        aspect-ratio: 656 / 400 !important;
        object-fit: cover;
    }
    .tl-problem__accordion,
    .tl-problem--image-right .tl-problem__accordion {
        flex: 1 1 auto !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin-top: 0;                  /* reset desktop's negative pull (no vertical rule at this breakpoint) */
        border-left: 0 !important;
        border-right: 0 !important;
        border-top: 0.5px solid rgba(51, 58, 66, 0.5);
        order: 2;
    }
    .tl-problem__summary { padding: 18px 12px; font-size: 17px; }
    .tl-problem__body { padding: 0 12px 18px; font-size: 14px; }
}

/* ── Mobile — Figma node 1:2600 (440×1561) ─────────
   padding:    32 / 16 / 32 / 16
   itemSpacing: 48 (titles → grid)
   titles gap: 32 (within titles block), 24 (between eyebrow and H2)
   Eyebrow dot: 14×14, gap 12
   Eyebrow text: 14/19.1 weight 500
   H2:         24/28.8 weight 500
   Photo:      408×600
*/
@media (max-width: 767px) {
    /* Reset <main> back to block layout for mobile (was flex-wrap at tablet for Problem 2-up) */
    main.site { display: block; }
    main.site > * { flex: initial; width: auto; max-width: none; }

    .tl-problem { padding: 32px 16px; }
    .tl-problem__container { gap: 48px; }
    .tl-problem__titles { gap: 24px; }       /* eyebrow ↔ H2 */
    .tl-problem__eyebrow {
        gap: 12px;
        font-size: 14px;
        line-height: 19.1px;
        font-weight: 500;
        letter-spacing: 0;
    }
    .tl-problem__eyebrow-dot {
        width: 14px;
        height: 14px;
        flex-basis: 14px;
    }
    .tl-problem__heading {
        font-size: 24px;
        line-height: 28.8px;
    }
    /* Mobile: desktop layout is flex (not grid). Need flex-direction: column.
       Mobile dividers per Figma:
         ✗ NO top horizontal divider above row
         ✗ NO vertical left divider on accordion
         ✓ Horizontal dividers between items (border-bottom on each)
         ✓ Top border on accordion (above first item) */
    .tl-problem__grid,
    .tl-problem--image-right .tl-problem__grid {       /* reset desktop mirror's 122px */
        flex-direction: column;
        gap: 24px;                           /* photo ↔ accordion gap on mobile */
        border-top: 0;                       /* no top row divider on mobile */
        padding-top: 0;
    }
    .tl-problem__image,
    .tl-problem--image-right .tl-problem__image {
        flex: 0 1 auto;
        max-width: 500px;
        width: 100%;
        margin-left: auto !important;
        margin-right: auto !important;
        align-self: center;                   /* center on flex column main-cross axis */
        padding-top: 0;
        padding-left: 0;
        padding-right: 0;
    }
    .tl-problem__accordion {
        flex: 1 1 auto;
        max-width: 100%;
        width: 100%;
        padding-left: 0;                     /* no inset on mobile (no vertical line) */
        padding-top: 0;                      /* reset desktop's 32 (no top rule to meet here) */
        margin-top: 0;                       /* reset desktop's negative pull */
        border-left: 0;                      /* no vertical divider */
        border-top: 1px solid rgba(51, 58, 66, 0.2);   /* line above first item */
    }
    /* Mirror variant on mobile: strip right line/padding, reset desktop
       488px/33.9% width clamps that would otherwise beat mobile defaults,
       photo stays first. */
    .tl-problem--image-right .tl-problem__accordion {
        padding-right: 0;
        border-right: 0;
        flex: 1 1 auto;                       /* reset from 0 1 488px */
        width: 100%;                          /* reset from 488px */
        max-width: 100%;                      /* reset from 33.9% */
        order: 2;
    }
    .tl-problem--image-right .tl-problem__image {
        flex: 1 1 auto;
        width: 100%;
        max-width: 100%;
        order: 1;
    }
    /* Figma 2026-05 mobile (node I81:7547;773:2332 / I81:7548;773:2332): photo 408×600 */
    .tl-problem__image img,
    .tl-problem--image-right .tl-problem__image img {
        width: 100%;
        height: auto;
        aspect-ratio: 408 / 600 !important;   /* exact Figma mobile spec */
        object-fit: cover;
        object-position: center;
    }
    .tl-problem--image-right .tl-problem__image img {
        object-position: 70% center;          /* keep mirror crop offset for dovecote scene */
    }
    .tl-problem__summary {
        padding: 32px 0 32px 24px;           /* Figma clicked: itemSpacing 32 + paddingLeft 24 */
        font-size: 20px;                     /* Figma: 20 */
        line-height: 27.28px;
    }
    .tl-problem__body {
        padding: 0 24px 32px;                /* Figma hover_text: padding-x 24, padding-b 32 */
    }
}
