/* ============================================================
   card-situation.css — the situation card (Tjills' own component)
   ============================================================
   A before/after pair on one card: a category row, a problem half and
   a solution half, like an open book. The component "Situationskort"
   (crdsit) uses it. Tjills' own: the framework has no situation card,
   so it lives in its own file and card.css stays the framework's.
   Split out of card.css in the framework round 11-10-2026 (row 25).
   Conventions: _shared/bricks-builder/css-conventions.md

   Contents
     1. The card — surface, spine and fold
     2. Category row, halves and photos
     3. Mood smileys
     4. Stacked below tablet
     5. In a two-column grid — one card per row until there is room

   Last updated: 2026-10-12 (auto-stamped by the pre-commit hook)
   ============================================================ */


/* --- 1. The card — surface, spine and fold ------------------- */

/* Situation variant — before/after pair: a category header row plus a
   problem half and a solution half on one shared card surface.
   STANDALONE — apply it alone, never with .card. DOM order IS reading
   order (.card-category, .card-problem, .card-solution); the grid does
   the placing, so screen readers get situation → problem → solution
   linearly with no spacer elements. Linkless by design, so it has
   no pointer, no shadow and no hover lift. */
.card--situation {
    /* The card family's surface, which card.css gives .card and
       .card--cover only. */
    position: relative;               /* context for the spine and the smileys */
    background-color: var(--surface-base);
    border-style: solid;
    border-radius: var(--radius-3);
    text-align: left;                 /* stay left even in a centred section */

    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr;     /* 1fr row → equal halves, medias align */
    gap: 0;                           /* rhythm lives inside the halves */
    padding: 0;                       /* halves carry their own padding */

    /* "Open book" look: a FLAT page — the family's shadow is off (the
       card is linkless/static; the fold gradient carries the depth),
       and frame + spine share one tone (grey-250) and one weight. */
    border-width: var(--border-width-base);
    border-color: var(--grey-250);
    box-shadow: none;
    /* isolation lets the fold layer (::after, z-index -1) paint above
       the card's own background but below ALL content — no lift rules. */
    isolation: isolate;
}

/* Full-height divider between the halves. A border on .card-solution
   would stop at row 2 — the line must run through the category row
   too, so the wrapper draws it. */
.card--situation::before {
    content: '';
    position: absolute;
    inset-block: 0;
    inset-inline-start: 50%;
    translate: -50% 0;                /* centre the line on the fold */
    inline-size: var(--border-width-base);
    background-color: var(--grey-250);
}

/* The fold: mirrored gradients, darkest at the spine, fading outward —
   the "open book" depth on both pages. Desktop halves are wide, so the
   channel is deeper and narrower than mobile's (grey-100/35% washed out
   to invisible when stretched over ~700 px). */
.card--situation::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to left, var(--grey-200), var(--surface-base) 20%),
        linear-gradient(to right, var(--grey-200), var(--surface-base) 20%);
    background-size: 50% 100%;
    background-position: left, right;
    background-repeat: no-repeat;
    border-radius: var(--radius-3);
    z-index: -1;
}

.card--situation .card-category { grid-area: 1 / 1; }
.card--situation .card-problem  { grid-area: 2 / 1; }
/* Row 2 only — row 1's right cell stays empty, so both halves' heading
   rows start on the same grid line. */
.card--situation .card-solution { grid-area: 2 / 2; }

/* --- 2. Category row, halves and photos --------------------- */

/* Category row: icon + label. The heading inside drops to medium
   weight — it's a wayfinding label, not a ranked title. */
.card-category {
    display: flex;
    /* Explicit: Bricks core makes every .brxe-block a flex COLUMN, so the
       row must be declared, not assumed. Centred variant = swap to
       `justify-content: center` here (tuning knob). */
    flex-direction: row;
    align-items: center;
    gap: var(--space-2xs);
    /* Extra room on the right: the problem smiley sits there (see
       .card-mood below), so a long label wraps instead of hitting it. */
    padding: var(--space-m) calc(var(--space-m) + var(--icon-xl) + var(--space-xs)) var(--space-s) var(--space-m);
}
.card-category :where(h2, h3, h4) {
    margin: 0;
    font-size: var(--title-3);
    font-weight: 500;
}
.card-category > :is(svg, img, i) {
    inline-size: var(--icon-xl);
    block-size: var(--icon-xl);
    flex: 0 0 auto;
    /* The icon files use currentColor — the decorative accent paints them
       red (red-300 in dark mode). Was --text-accent, which the framework
       removed in the round 11-10-2026. */
    color: var(--accent-decorative);
}

/* The halves: flex columns so the media pins to the bottom and the two
   photos bottom-align when the texts differ in length. */
.card--situation :is(.card-problem, .card-solution) {
    display: flex;
    flex-direction: column;
    gap: var(--space-s);
    padding: 0 var(--space-m) var(--space-m);
}
.card--situation :is(.card-problem, .card-solution) > .card-media {
    margin-block-start: auto;
}

/* Same crop on both photos so the pair reads as one composition. Both
   DOM shapes matched (Bricks usually puts .card-media on the <img>
   itself); :where() keeps specificity at one class. */
.card--situation :where(img.card-media, .card-media img) {
    aspect-ratio: 12 / 7;
    object-fit: cover;
    border-radius: var(--radius-2);
    inline-size: 100%;
    display: block;
}

/* --- 3. Mood smileys ---------------------------------------- */

/* Mood smileys — DESKTOP: top-right corner of each half, level with the
   category row (same size and top offset as the category icon), positioned
   against the CARD (the family base is position: relative) so the headings
   keep their full width. MOBILE (media query below): the halves stack and
   the solution half has no category row, so both smileys move into their
   own heading row instead — in flow, to the right of the heading. */
.card-mood {
    position: absolute;
    inset-block-start: var(--space-m);
    inline-size: var(--icon-xl);
    block-size: var(--icon-xl);
    /* The smiley files use currentColor — same grey as the body text,
       and it flips to white automatically inside dark sections. */
    color: var(--text-base);
}
/* Problem smiley: right edge of the LEFT half's content (the halves are
   two equal columns, so the left column ends at 50%). */
.card--situation .card-problem .card-mood {
    inset-inline-end: calc(50% + var(--space-m));
}
/* Solution smiley: right edge of the RIGHT half's content. */
.card--situation .card-solution .card-mood {
    inset-inline-end: var(--space-m);
}

/* --- 4. Stacked below tablet -------------------------------- */

/* Below tablet the halves stack — the visual order becomes the reading
   order, and the divider flips to a horizontal line carried by the
   solution half. */
@media (width < 48rem) {
    .card--situation {
        grid-template-columns: 1fr;
        grid-template-rows: none;
    }
    .card--situation :is(.card-category, .card-problem, .card-solution) {
        grid-area: auto;
    }
    /* Stacked halves → the spine is HORIZONTAL: kill the vertical
       divider and the desktop fold layer; paint the fold on the halves
       themselves so it follows the real boundary at any content height. */
    .card--situation::before,
    .card--situation::after {
        content: none;
    }
    .card--situation .card-problem {
        background-image: linear-gradient(to top, var(--grey-100), var(--surface-base) 35%);
    }
    .card--situation .card-solution {
        border-block-start: var(--border-width-base) solid var(--grey-250);
        padding-block-start: var(--space-m);
        background-image: linear-gradient(to bottom, var(--grey-100), var(--surface-base) 35%);
        border-radius: 0 0 var(--radius-3) var(--radius-3);
    }
    /* Smileys move into the heading row: a flex row (Bricks' Block default
       is a wrapping column), heading left, smiley right. The smiley is IN
       flow, so the heading wraps before it — no overlap, whatever its length. */
    .card-heading-row {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: flex-start;
        gap: var(--space-xs);
    }
    .card-heading-row > .card-heading {
        flex: 1;                          /* takes all the width the smiley leaves */
    }
    .card-mood {
        position: static;                 /* cancels the desktop absolute placement */
        flex: none;                       /* keeps its size — the heading wraps instead */
        /* One step down the icon scale: lighter next to the smaller mobile
           type, and the heading gets more of the line. Desktop stays icon-xl. */
        inline-size: var(--icon-l);
        block-size: var(--icon-l);
    }
}


/* --- 5. In a two-column grid --------------------------------- */

/* A situation card holds two halves side by side, so it needs a wide
   column: below 38rem the category label runs into the smiley. The
   framework's .grid--2 now shares the 16rem floor of the grid family
   (layout.css §4, 19-09-2026) and would put two situation cards side by
   side at 604 px each. This keeps the floor the old .grid--2 had: two
   cards side by side only when each gets 38rem, otherwise one per row.
   Measured 12-10-2026 on the old front page (four cards) and
   /design-system at 1440, 1100 and 900 px: one per row, no overlap. */
.grid--2:has(> .card--situation),
.grid--2:has(> .display-contents > .card--situation) {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 38rem), 1fr));
}
