/* Example Section - TCG Card */

/* Why Section */
.why-section {
    background-color: var(--surface);
    padding: clamp(1.5rem, 5vw, 3rem) clamp(1rem, 4vw, 2rem);
    border-top: 1px solid var(--border);
}

.why-header {
    border-bottom: 2px solid var(--accent);
    padding-bottom: clamp(0.5rem, 1vw, 1rem);
    margin-bottom: clamp(1rem, 3vw, 1.5rem);
}

.why-title {
    font-size: clamp(1.5rem, 4.20vw, 2.25rem);
    color: var(--accent-text);
    text-align: center;
    margin-bottom: clamp(1rem, 3vw, 1.5rem);
    font-weight: 700;
}

.why-summary-intro {
    display: grid;
    /* One column that may shrink. With no template the implicit track is `auto`,
       which will not go below its content's minimum width: at 200% text size on
       a phone the Summary blocks measured 427px in a 247px column and the whole
       page scrolled sideways. minmax(0, 1fr) lets the blocks fit and their
       labels wrap instead. */
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(0.9rem, 2vw, 1.35rem);
    margin: 0 auto clamp(1.5rem, 3vw, 2.25rem);
    max-width: 72rem;
}

.why-summary-block {
    position: relative;
    /* A stacking context of its own, so .why-summary-toggle::before can sit at
       z-index:-1 -- behind the label, above THIS card's gradient. Without it
       the tint escapes to an ancestor context and paints behind the card. */
    isolation: isolate;
    /* Named so .why-summary-toggle can cancel them with a negative margin and
       bleed its hit area out to the card edge. Block-local, not :root -- these
       are layout, not theme, and deriveTheme knows nothing about them. */
    --why-summary-pad-y: clamp(1rem, 2vw, 1.35rem);
    --why-summary-pad-x: clamp(1.1rem, 3vw, 1.75rem);
    /* The gap between the header and the panel it opens, named for the same
       reason as the two above: something else has to be able to say "the OPEN
       geometry". That something is the pre-paint restore in landing-tabs.css,
       which shows a remembered-open panel before the block's own
       data-open="true" exists -- and the closed-state rule below would
       otherwise pull the panel up into the header by a whole pad-y. Measured at
       11.2px a card, 34px across the three. */
    --why-summary-gap: 0.35rem;
    padding: var(--why-summary-pad-y) var(--why-summary-pad-x);
    border: 1px solid color-mix(in srgb, var(--accent) 16%, transparent);
    border-left: 4px solid var(--accent);
    border-radius: 0.7rem;
    background: linear-gradient(100deg, color-mix(in srgb, var(--accent-soft) 35%, transparent), color-mix(in srgb, var(--surface-2) 72%, transparent));
    box-shadow: 0 0.75rem 2rem color-mix(in srgb, var(--accent) 7%, transparent);
}

.why-summary-label {
    display: inline-flex;
    align-items: center;
    margin-bottom: 0.35rem;
    color: var(--accent-text);
    font-size: clamp(0.9rem, 1.8vw, 1.08rem);
    font-weight: 800;
    letter-spacing: 0.045em;
    text-transform: uppercase;
}

.why-summary-label::after {
    width: 2.5rem;
    height: 2px;
    margin-left: 0.65rem;
    /* The theme's accent, not --success: the status green is fixed per mode,
       so the bar (and the hand beside it) stayed green in every theme. */
    background: var(--accent);
    content: '';
    opacity: 0.65;
}

/* Every summary block ships collapsed and its LABEL is the toggle, so the card
   reads the same closed as open. Resets only -- every visual property still
   comes from .why-summary-label above, which is why the two classes are worn
   together rather than this one restating them.

   The exception is the box: the label is the card's full-width header, so the
   whole top strip is the hit area and not just the words. width + the negative
   margin cancel the card's own padding, which is why that padding had to be
   named above. */
.why-summary-toggle {
    appearance: none;
    display: flex;
    align-items: center;
    width: calc(100% + 2 * var(--why-summary-pad-x));
    margin: calc(-1 * var(--why-summary-pad-y)) calc(-1 * var(--why-summary-pad-x)) var(--why-summary-gap);
    padding: var(--why-summary-pad-y) var(--why-summary-pad-x) var(--why-summary-gap);
    border: 0;
    border-radius: 0.7rem 0.7rem 0 0;
    background: none;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

/* Closed, the card IS the header: the toggle swallows the block's bottom
   padding too, so the whole card hovers and the whole card is the click
   target. The padding and the negative margin cancel exactly, so the collapsed
   card is the same height it was -- this buys hit area, not layout. */
.why-summary-block[data-open="false"] > .why-summary-toggle {
    margin-bottom: calc(-1 * var(--why-summary-pad-y));
    padding-bottom: var(--why-summary-pad-y);
    /* All four corners now, and a hair inside the card's own 0.7rem so the
       tint does not square off against the rounded border. */
    border-radius: 0.6rem;
}

/* The hover tint.
   A pseudo-element rather than a plain `background`, for one reason: on an
   EXPANDED card it spills 1.5rem past the header and fades out over the top of
   the panel, which a background painted inside the border box cannot do. It
   costs no layout (absolute) and steals no clicks (pointer-events: none), so
   the panel text underneath stays selectable. */
.why-summary-toggle::before {
    content: "";
    position: absolute;
    inset: 0 0 -1.5rem;
    z-index: -1;
    border-radius: inherit;
    background: linear-gradient(to bottom,
        color-mix(in srgb, var(--accent) 9%, transparent) 0,
        color-mix(in srgb, var(--accent) 9%, transparent) 58%,
        transparent 100%);
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
}

/* Collapsed there is nothing below to fade into, and the spill would hang off
   the bottom of the card -- so the tint stops at the edge and fills flat. */
.why-summary-block[data-open="false"] > .why-summary-toggle::before {
    inset: 0;
    background: color-mix(in srgb, var(--accent) 9%, transparent);
}

.why-summary-toggle:hover::before {
    opacity: 1;
}

.why-summary-toggle:focus-visible {
    /* --accent-text, not --accent: the raw seed token is a fill, and the
       repair layer derives this one to stay readable on every theme. */
    outline: 2px solid var(--accent-text);
    /* Inset: the toggle now spans the full card, so a positive offset would
       draw the ring outside the card's own border. */
    outline-offset: -3px;
}

/* The hand LEADS the label -- it is the control, and reading it before the word
   is what makes the card's state the first thing seen. It sits first in the
   markup too, so no `order` is needed; the ::after rule bar still closes the
   line. display: grid stacks the closed and open hands in one cell: both stay
   in flow, so the button's width never changes when the block opens, and the
   swap can cross-fade -- display: none cannot be transitioned. */
.why-summary-caret {
    display: grid;
    flex: 0 0 auto;
    margin-right: 0.55rem;
    /* Matches .why-summary-label::after, which paints the rule bar beside it in
       --accent. --accent-text, not --accent: this is a `color:` and the raw
       seed token is banned there by theme-token-usage.spec.mjs. */
    color: var(--accent-text);
    /* Optical nudge: align-items: center centres on the text box, which
       includes descender space the all-caps label never uses. */
    transform: translateY(-0.03em);
}

/* Filled AND stroked, unlike the outline-only icons elsewhere on the page: a
   stroke-only hand loses its counters below ~24px and reads as a grey lozenge.
   The 2px round join is also what rounds every corner of these plain polygons,
   and what keeps their weight matched to .info-icon and .matrix-icon. */
.why-summary-hand {
    grid-area: 1 / 1;
    width: 1.15em;
    height: 1.15em;
    pointer-events: none;
    transition: opacity 0.16s ease,
                transform 0.2s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.why-hand-closed { opacity: 1; transform: none; }
.why-hand-open   { opacity: 0; transform: scale(0.55) rotate(-12deg); }

.why-summary-block[data-open="true"] .why-hand-closed {
    opacity: 0;
    transform: scale(0.55) rotate(12deg);
}

.why-summary-block[data-open="true"] .why-hand-open {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    .why-summary-toggle::before,
    .why-summary-hand {
        transition: none;
    }

    /* The scale/rotate is the flourish, not the state -- opacity alone carries
       that, so reduced motion still gets a clean instant swap. */
    .why-hand-open,
    .why-summary-block[data-open="true"] .why-hand-closed {
        transform: none;
    }
}

.why-summary-block p {
    margin: 0;
    color: var(--text);
    font-size: clamp(1rem, 1.8vw, 1.16rem);
    line-height: 1.65;
}

.why-summary-block em {
    color: var(--text-muted);
}

.why-summary-block small {
    color: var(--text-muted);
    font-size: 0.78em;
}

/* `em` compounds. index.html nests <small> three deep in the Developers panel,
   which multiplied to 16px * 0.78^3 = ~7.6px of already-muted ink. Only the
   outermost level carries the step-down; the ones inside it are semantic. 
.why-summary-block small small {
    font-size: 1em; 
}
*/

.why-statement {
    /* Centred prose: no line left holding one word ("users.", "accept.."). */
    text-wrap: pretty;
    /* The theme's accent, not the status green: --success is fixed per mode, so
       the closing statement stayed green in every theme (2026-10-28). */
    background-color: color-mix(in srgb, var(--accent-soft) 45%, var(--surface));
    border-left: 4px solid var(--accent);
    padding: clamp(1rem, 2vw, 1.5rem);
    border-radius: 6px;
    margin-bottom: clamp(1rem, 3vw, 1.5rem);
}

.why-statement p {
    /* --accent-soft, not a translucent --accent wash. --accent-text is repaired
       against contentSurfaces() (lib/theme-derive.js:184), and a 27%-of-accent
       layer composited over the parent fill is not a member of that set — the
       pair measured 4.02:1 on the DEFAULT theme and missed AA on 26 of 50.
       --accent-soft is a sanctioned surface, so the repair layer now covers it
       by construction. */
    background: var(--accent-soft);
    text-align: center;
    width: fit-content;
    border-radius: 2.3rem;
    padding: 4px 20px;
    color: var(--accent-text);
    text-shadow: 0 0 1px var(--surface);
    box-shadow: 0 12px 20px 3px var(--surface);
}

/*
.why-statement p:last-child {
    margin: 0 auto;
}
*/

/* Avatar Tier - Card Art */

/* Status Tier */

.status-message {
    font-size: clamp(0.85rem, 1.5vw, 0.95rem);
    color: var(--text-faint);
    margin: 0;
}

