/* ==========================================================================
   levels-blog — [lvl_blog_archive]
   --------------------------------------------------------------------------
   Own file on purpose: blocks.css is loaded on is_singular('post') only and
   belongs to the article body. This one is loaded only where the shortcode
   actually runs — today the Oxygen page #750 (/blog).

   Same rules as blocks.css, restated because this file stands alone:

   ⚠ The site's --text-color / --bg-color do NOT flip with dark mode. Oxygen
     switches the theme with a `body.dark-mode { color: … }` rule while the
     custom properties keep their light values. Nothing here ever sets a text
     colour from --text-color; body text is `inherit`, and everything that
     genuinely needs a mode-specific value is declared twice — once on :root
     (light) and once on body.dark-mode.

   ⚠ Oxygen's inline <style> underlines every link in the content area with an
     !important rule. The card link has to answer !important with !important,
     exactly like .lvl-related-links__card and .lvl-case-card__link.

   No font-family, no px font sizes — Oxygen owns the typography. Colours come
   from the site's own custom properties with the literal from
   docs/evidence/universal-css-vars.txt as a fallback.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Local token layer
   -------------------------------------------------------------------------- */

:root {
    --lvl-arch-accent: var(--brand-rose, #ce7aa3);
    --lvl-arch-accent-rgb: 206, 122, 163;
    /* The brand rose as text only reaches 2.6:1 on a near-white ground. The
       darkened rose below is the one used for text; the surface colour above
       is unchanged. */
    --lvl-arch-accent-text: #7d3556;

    --lvl-arch-surface: rgba(9, 9, 32, 0.045);
    --lvl-arch-surface-strong: rgba(9, 9, 32, 0.075);
    --lvl-arch-border: rgba(9, 9, 32, 0.14);
    --lvl-arch-shadow: 0 0.125rem 1.25rem rgba(9, 9, 32, 0.1);

    /* Secondary text (kicker, date, reading time, excerpt). An explicit value
       rather than `opacity`, so the contrast can actually be measured. */
    --lvl-arch-muted: #4a4b5e;

    --lvl-arch-max: 1200px;
    --lvl-arch-radius: 0.75rem;
    --lvl-arch-gap: clamp(1rem, 2vw, 1.75rem);
    --lvl-arch-ease: cubic-bezier(0.84, 0.05, 0.31, 0.93);
    --lvl-arch-tap: 2.75rem; /* 44px — minimum touch target */
}

body.dark-mode {
    /* The site's own dark-mode accent — brighter, so it carries on #090920. */
    --lvl-arch-accent: #ff80bf;
    --lvl-arch-accent-rgb: 255, 128, 191;
    --lvl-arch-accent-text: #ff80bf;

    --lvl-arch-surface: rgba(243, 245, 252, 0.05);
    --lvl-arch-surface-strong: rgba(243, 245, 252, 0.09);
    --lvl-arch-border: rgba(243, 245, 252, 0.18);
    --lvl-arch-shadow: 0 0.125rem 1.5rem rgba(0, 0, 0, 0.45);

    --lvl-arch-muted: #c2c5d4;
}

/* --------------------------------------------------------------------------
   Shell
   -------------------------------------------------------------------------- */

.lvl-arch {
    /* ⚠ never a variable here — see the note at the top of this file. */
    color: inherit;
    box-sizing: border-box;
    width: 100%;
    max-width: var(--lvl-arch-max, 1200px);
    margin-inline: auto;
}

.lvl-arch * {
    box-sizing: border-box;
}

.lvl-arch__header {
    margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
}

.lvl-arch__eyebrow {
    margin: 0 0 0.35rem;
    font-size: var(--base-xs, 0.8rem);
    line-height: 1.2;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--lvl-arch-muted);
}

.lvl-arch__heading {
    margin: 0;
    line-height: 1.1;
}

.lvl-arch__empty {
    margin: 0;
    padding: 2rem 0;
    color: var(--lvl-arch-muted);
}

/* --------------------------------------------------------------------------
   Category filter — plain links, hidden whenever there is only one category
   -------------------------------------------------------------------------- */

.lvl-arch__filter {
    margin-bottom: clamp(1.25rem, 2.5vw, 2rem);
}

.lvl-arch__filter-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.lvl-arch__filter-item {
    margin: 0;
}

.lvl-arch__filter-link,
.lvl-arch__filter-link:hover,
.lvl-arch__filter-link:focus,
.lvl-arch__filter-link:focus-visible {
    text-decoration: none !important;
}

.lvl-arch__filter-link {
    display: inline-flex;
    align-items: center;
    min-height: var(--lvl-arch-tap);
    padding: 0.5rem 1rem;
    border: 1px solid var(--lvl-arch-border);
    border-radius: 999px;
    color: inherit;
    font-size: var(--base-xs, 0.9rem);
    line-height: 1.2;
    transition: border-color 0.25s var(--lvl-arch-ease), background-color 0.25s var(--lvl-arch-ease);
}

.lvl-arch__filter-link:hover {
    border-color: var(--lvl-arch-accent);
    background: var(--lvl-arch-surface);
}

.lvl-arch__filter-link.is-active {
    border-color: var(--lvl-arch-accent);
    background: var(--lvl-arch-surface-strong);
}

/* --------------------------------------------------------------------------
   Grid
   -------------------------------------------------------------------------- */

.lvl-arch__grid {
    display: grid;
    gap: var(--lvl-arch-gap);
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
}

.lvl-arch--cols-2 .lvl-arch__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.lvl-arch__item {
    display: flex;
    min-width: 0;
    margin: 0;
}

.lvl-arch__item--featured {
    grid-column: span 2;
}

/* --------------------------------------------------------------------------
   Card
   --------------------------------------------------------------------------
   The whole card is the click target: .lvl-arch__link stretches over it with
   an ::after overlay. That keeps exactly one <a> per card — one tab stop, one
   accessible name, and a hit area far past the 44px minimum.
   -------------------------------------------------------------------------- */

.lvl-arch__card {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--lvl-arch-border);
    border-radius: var(--lvl-arch-radius);
    background: var(--lvl-arch-surface);
    color: inherit;
    transition: border-color 0.25s var(--lvl-arch-ease), box-shadow 0.25s var(--lvl-arch-ease),
        background-color 0.25s var(--lvl-arch-ease), transform 0.25s var(--lvl-arch-ease);
}

.lvl-arch__card:hover,
.lvl-arch__card:focus-within {
    border-color: var(--lvl-arch-accent);
    background: var(--lvl-arch-surface-strong);
    box-shadow: var(--lvl-arch-shadow);
}

/* Media box: always present, always 3:2, so a row of cards lines up and a
   missing thumbnail does not collapse the card. */
.lvl-arch__media {
    position: relative;
    display: block;
    flex: 0 0 auto;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    background: var(--lvl-arch-surface-strong);
}

.lvl-arch__media--empty {
    background:
        linear-gradient(
            135deg,
            rgba(var(--lvl-arch-accent-rgb), 0.22) 0%,
            rgba(var(--lvl-arch-accent-rgb), 0.04) 100%
        );
}

.lvl-arch__img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: cover;
    object-position: center;
}

.lvl-arch__body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1 1 auto;
    padding: clamp(1rem, 2vw, 1.375rem);
}

.lvl-arch__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: var(--base-xs, 0.8rem);
    line-height: 1.3;
    color: var(--lvl-arch-muted);
}

.lvl-arch__kicker {
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.lvl-arch__date::before,
.lvl-arch__time::before {
    content: "·";
    margin-right: 0.5rem;
}

.lvl-arch__title {
    margin: 0;
    font-size: var(--base-lg, 1.25rem);
    line-height: 1.28;
    /* F-pattern: the title is what the eye scans, so it stays dominant but
       never runs past three lines. */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/*
 * Oxygen underlines every link in the content area with an !important rule
 * (universal.css, cross-origin so it cannot be inspected from here). A card
 * title underlined across three lines reads as body copy, not as a card. This
 * is the one place that has to answer !important with !important.
 */
.lvl-arch__link,
.lvl-arch__link:hover,
.lvl-arch__link:focus,
.lvl-arch__link:focus-visible {
    text-decoration: none !important;
}

.lvl-arch__link {
    color: inherit;
    /* The affordance the underline used to carry, on hover only. */
    background-image: linear-gradient(currentColor, currentColor);
    background-repeat: no-repeat;
    background-position: 0 100%;
    background-size: 0 1px;
    transition: background-size 0.25s var(--lvl-arch-ease);
}

.lvl-arch__card:hover .lvl-arch__link,
.lvl-arch__link:focus-visible {
    background-size: 100% 1px;
}

/* The stretched link: the anchor's own box stays the title text (so the
   accessible name and the focus ring hug the words), while this overlay makes
   the whole card clickable. */
.lvl-arch__link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}

.lvl-arch__excerpt {
    margin: 0;
    font-size: var(--base-xs, 0.95rem);
    line-height: 1.5;
    color: var(--lvl-arch-muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lvl-arch__cta {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: auto 0 0;
    padding-top: 0.5rem;
    font-size: var(--base-xs, 0.9rem);
    line-height: 1.2;
    color: var(--lvl-arch-accent-text);
}

.lvl-arch__cta svg {
    flex: 0 0 auto;
    transition: transform 0.25s var(--lvl-arch-ease);
}

.lvl-arch__card:hover .lvl-arch__cta svg,
.lvl-arch__card:focus-within .lvl-arch__cta svg {
    transform: translateX(0.2rem);
}

/* --------------------------------------------------------------------------
   Featured card — first post of page one, two columns wide
   -------------------------------------------------------------------------- */

@media (min-width: 62rem) {
    .lvl-arch__card--featured {
        display: grid;
        grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
        align-items: stretch;
    }

    .lvl-arch__card--featured .lvl-arch__media {
        height: 100%;
        aspect-ratio: auto;
        min-height: 16rem;
    }

    /*
     * A featured card without a thumbnail keeps no empty half: the tinted
     * fallback tile earns its place in the grid (it holds a row of cards in
     * line) but stretched across the full width of the lead card it is just a
     * void above the headline.
     */
    .lvl-arch__card--featured.lvl-arch__card--no-media {
        grid-template-columns: minmax(0, 1fr);
    }

    .lvl-arch__card--featured.lvl-arch__card--no-media .lvl-arch__media {
        display: none;
    }

    .lvl-arch__card--featured.lvl-arch__card--no-media .lvl-arch__body {
        min-height: 14rem;
    }

    .lvl-arch__card--featured .lvl-arch__body {
        justify-content: center;
        padding: clamp(1.5rem, 3vw, 2.5rem);
    }

    .lvl-arch__card--featured .lvl-arch__title {
        font-size: var(--base-40, 1.75rem);
        -webkit-line-clamp: 3;
        line-clamp: 3;
    }

    .lvl-arch__card--featured .lvl-arch__excerpt {
        -webkit-line-clamp: 4;
        line-clamp: 4;
    }
}

/* --------------------------------------------------------------------------
   Pagination
   -------------------------------------------------------------------------- */

.lvl-arch__pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: clamp(2rem, 4vw, 3rem);
}

.lvl-arch__pages {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.lvl-arch__pages-item {
    margin: 0;
}

.lvl-arch__pagination a,
.lvl-arch__pagination a:hover,
.lvl-arch__pagination a:focus,
.lvl-arch__pagination a:focus-visible,
.lvl-arch__pagination span {
    text-decoration: none !important;
}

.lvl-arch__pagination .page-numbers,
.lvl-arch__page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: var(--lvl-arch-tap);
    min-height: var(--lvl-arch-tap);
    padding: 0.5rem 0.875rem;
    border: 1px solid var(--lvl-arch-border);
    border-radius: var(--lvl-arch-radius);
    color: inherit;
    font-size: var(--base-xs, 0.95rem);
    line-height: 1.2;
    transition: border-color 0.25s var(--lvl-arch-ease), background-color 0.25s var(--lvl-arch-ease);
}

.lvl-arch__pagination a:hover {
    border-color: var(--lvl-arch-accent);
    background: var(--lvl-arch-surface);
}

.lvl-arch__pagination .page-numbers.current {
    border-color: var(--lvl-arch-accent);
    background: var(--lvl-arch-surface-strong);
    font-weight: 500;
}

.lvl-arch__pagination .page-numbers.dots {
    min-width: 1.5rem;
    border-color: transparent;
    color: var(--lvl-arch-muted);
}

/* --------------------------------------------------------------------------
   Focus visibility (WCAG) — never removed
   -------------------------------------------------------------------------- */

.lvl-arch a:focus-visible {
    outline: 2px solid var(--lvl-arch-accent);
    outline-offset: 3px;
    border-radius: 0.375rem;
}

/*
 * The card title is a -webkit-box with overflow:hidden (the three-line clamp),
 * and that box clips the outline of the inline link inside it — measured on
 * 15.09.2026: top and bottom edge of the ring were simply gone. So the ring
 * moves to the card, which is also the honest shape of the target: the whole
 * card is what Enter activates.
 *
 * The rule above stays as the fallback for engines without :has() (and serves
 * the pagination and filter links either way).
 */
.lvl-arch__card:has(.lvl-arch__link:focus-visible) {
    outline: 2px solid var(--lvl-arch-accent);
    outline-offset: 3px;
}

.lvl-arch__card:has(.lvl-arch__link:focus-visible) .lvl-arch__link:focus-visible {
    outline: none;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 62rem) {
    .lvl-arch__grid,
    .lvl-arch--cols-2 .lvl-arch__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 40rem) {
    /*
     * A side gutter of its own, so the cards never touch the screen edge when
     * the shortcode sits somewhere without Oxygen's 20px section padding (a
     * plain page, a widget). On #750 it simply adds to that padding.
     */
    .lvl-arch {
        padding-inline: 1rem;
    }

    .lvl-arch__grid,
    .lvl-arch--cols-2 .lvl-arch__grid {
        grid-template-columns: minmax(0, 1fr);
    }

    /* 390px: the featured card is simply a card. */
    .lvl-arch__item--featured {
        grid-column: auto;
    }

    .lvl-arch__pages {
        order: -1;
        width: 100%;
        justify-content: center;
    }

    /* Prev and next share the row underneath the numbers. */
    .lvl-arch__page {
        flex: 1 1 0;
        min-width: 0;
    }
}

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .lvl-arch *,
    .lvl-arch *::before,
    .lvl-arch *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }

    .lvl-arch__card:hover .lvl-arch__cta svg,
    .lvl-arch__card:focus-within .lvl-arch__cta svg {
        transform: none;
    }
}

/* --------------------------------------------------------------------------
   Print
   -------------------------------------------------------------------------- */

@media print {
    .lvl-arch__media,
    .lvl-arch__cta,
    .lvl-arch__pagination {
        display: none;
    }
}
