/* ==========================================================================
   VIVPAK — Article layout variants (Round 2240 / Task 60)
   Loaded ONLY on posts that explicitly choose a non-classic layout, via
   cm_head()'s `extra_css` override. Nothing here touches the default pages.
   Bright / glassmorphic, consistent with the main design system.
   ========================================================================== */

.pl-article { display: block; }
.pl-layout,
.pl-mini-wrap {
    max-width: 1308px;
    margin-inline: auto;
    padding: calc(var(--nav-h) + 52px) var(--gutter) clamp(72px, 8vw, 120px);
}
.pl-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 44px;
    align-items: start;
}
.pl-main { min-width: 0; }
.pl-main > .crumbs { margin-bottom: 26px; }
.pl-main .display-2 { max-width: 900px; }
.pl-main .lead { max-width: 780px; margin-top: 18px; }
.pl-article .article-body { margin-top: 38px; max-width: 78ch; }
.pl-body > * + * { margin-top: 1.35em; }

/* shared bits ------------------------------------------------------------ */
.pl-meta {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    font-size: .8125rem; color: var(--steel); margin-bottom: 16px;
}
.pl-kicker {
    display: inline-block; font-size: .6875rem; font-weight: 700;
    letter-spacing: .12em; text-transform: uppercase; color: var(--pak);
}
.pl-author {
    display: flex; align-items: center; gap: 12px; margin-top: 26px;
    padding-bottom: 30px; border-bottom: 1px solid var(--line);
}
.pl-avatar {
    width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(140deg, var(--brand), var(--brand-2));
    color: #fff; font-size: .75rem; font-weight: 600;
}
.pl-author .a-name { font-size: .8125rem; font-weight: 600; }
.pl-author .a-role { font-size: .6875rem; color: var(--steel); }
.pl-tags { margin-top: 38px; }
.pl-cta { margin-top: 40px; }
.pl-rail { position: sticky; top: calc(var(--nav-h) + 24px); }

/* 1. HERO — full-bleed cover, title inside a light glass card -------------
   NOTE: the <article> itself carries the layout marker class "pl-hero", so the
   figure MUST NOT reuse it — .pl-hero-figure avoids the whole article being
   turned into a padded, overflow-hidden flex card. */
.pl-hero-figure {
    position: relative; margin: 28px 0 0; min-height: 430px;
    border-radius: var(--r-xl); overflow: hidden;
    background-size: cover; background-position: center;
    box-shadow: var(--shadow-lg); background-color: var(--surface-alt);
    display: flex; align-items: flex-end; padding: clamp(24px, 4vw, 46px);
}
.pl-hero-shade {
    position: absolute; inset: 0;
    background: linear-gradient(95deg, rgba(255,255,255,.94) 0%, rgba(255,255,255,.72) 42%, rgba(255,255,255,.10) 100%);
}
.pl-hero-inner {
    position: relative; width: min(660px, 100%);
    background: rgba(255,255,255,.86);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border: 1px solid rgba(255,255,255,.85);
    border-radius: var(--r-lg); padding: clamp(24px, 3.4vw, 40px);
    box-shadow: var(--shadow-md);
}
.pl-hero-inner h1 { margin-top: 12px; }
.pl-hero-inner .lead { margin-top: 12px; color: var(--ink-2); }
.pl-hero-meta { margin-top: 18px; font-size: .8125rem; color: var(--steel); }

/* 2. MAGAZINE — two-column intro, drop cap -------------------------------- */
.pl-mag-intro {
    display: grid; grid-template-columns: 1.12fr .88fr;
    gap: clamp(24px, 3vw, 44px); align-items: center; margin-top: 26px;
}
.pl-mag-intro .pl-author { border-bottom: 0; padding-bottom: 0; }
.pl-mag-figure {
    margin: 0; aspect-ratio: 4 / 5; border-radius: var(--r-xl);
    overflow: hidden; box-shadow: var(--shadow-lg); background: var(--surface-alt);
}
.pl-mag-figure img { width: 100%; height: 100%; object-fit: cover; }
.pl-magazine .pl-body > p:first-of-type::first-letter,
.pl-minimal .pl-body > p:first-of-type::first-letter {
    float: left; font-family: 'Montserrat', var(--brand), sans-serif;
    font-size: 3.5em; line-height: .84; font-weight: 700;
    padding: .06em .12em 0 0; color: var(--brand);
}

/* 3. DIGEST — 21:9 band + automatic table of contents --------------------- */
/* The band is a direct child of .pl-main: full column width, 21:9, and
   explicitly min-width:0 so an aspect-ratio box can never stretch past the
   column and slide underneath the sticky .pl-rail. */
.pl-band {
    margin: 32px 0 0;
    width: 100%; max-width: 100%; min-width: 0;
    aspect-ratio: 21 / 9;
    border-radius: var(--r-xl); overflow: hidden;
    box-shadow: var(--shadow-lg); background: var(--surface-alt);
}
.pl-band img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pl-toc-wide { margin-top: 24px; }
.pl-toc-wide ol {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 30px;
}
/* Legacy grid kept for backwards compatibility with older markup. */
.pl-digest-grid {
    display: grid; grid-template-columns: minmax(0, 1fr) 300px;
    gap: 20px; margin-top: 32px; align-items: stretch;
}
.pl-toc { border-radius: var(--r-lg); }
.pl-toc ol { list-style: none; margin: 14px 0 0; padding: 0; counter-reset: pltoc; }
.pl-toc li { margin-bottom: 9px; }
.pl-toc li a {
    display: flex; align-items: baseline; gap: 11px; font-size: .9rem;
    color: var(--ink-2); text-decoration: none; line-height: 1.45;
}
.pl-toc li a:hover { color: var(--pak); }
.pl-toc li a span {
    flex: 0 0 22px; height: 22px; border-radius: 6px;
    background: var(--brand-soft); color: var(--brand);
    font-size: .6875rem; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
}
.pl-digest-cover {
    margin: 0; border-radius: var(--r-lg); overflow: hidden;
    box-shadow: var(--shadow-md); background: var(--surface-alt);
    aspect-ratio: 4 / 3; min-width: 0; max-width: 100%;
}
.pl-digest-cover img { width: 100%; height: 100%; object-fit: cover; }
/* Long technical comparison tables inside article bodies must scroll
   horizontally on narrow screens. A table's min-content width can exceed the
   reading column (390px viewport: 384px table in a 350px column), which used
   to push the whole page sideways. Scoped to variant articles only — this
   stylesheet is loaded exclusively on those pages. */
.pl-article .article-body table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.pl-digest .article-body h2 { scroll-margin-top: calc(var(--nav-h) + 24px); }

/* 4. SPOTLIGHT — accent bar + glass body card ----------------------------- */
.pl-spot-intro { display: flex; gap: 24px; align-items: stretch; margin-top: 26px; }
.pl-spot-bar {
    flex: 0 0 8px; border-radius: 8px;
    background: linear-gradient(180deg, var(--pak), var(--brand-2));
}
.pl-spot-cover {
    margin: 30px 0 0; aspect-ratio: 21 / 9; border-radius: var(--r-xl);
    overflow: hidden; box-shadow: var(--shadow-lg); background: var(--surface-alt);
}
.pl-spot-cover img { width: 100%; height: 100%; object-fit: cover; }
.pl-spot-body {
    max-width: none !important; padding: clamp(22px, 3vw, 38px) !important;
    border-radius: var(--r-lg);
}

/* 5. MINIMAL — no rail, no cover, narrow reading column ------------------- */
.pl-mini-wrap { max-width: 800px; }
.pl-minimal .display-2 { max-width: none; }
.pl-minimal .lead { max-width: none; font-size: 1.2rem; }
.pl-minimal .pl-author { border-bottom: 0; padding-bottom: 8px; }
.pl-minimal .pl-body {
    font-size: 1.16rem; line-height: 1.9; max-width: none;
    border-top: 1px solid var(--line); padding-top: 34px;
}
.pl-minimal .pl-cta { margin-top: 56px; }

/* responsive -------------------------------------------------------------- */
@media (max-width: 1020px) {
    .pl-layout { grid-template-columns: 1fr; gap: 36px; }
    .pl-rail { position: static; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
}
@media (max-width: 760px) {
    .pl-layout, .pl-mini-wrap { padding-top: calc(var(--nav-h) + 32px); gap: 28px; }
    .pl-mag-intro, .pl-digest-grid { grid-template-columns: 1fr; }
    .pl-mag-figure { aspect-ratio: 16 / 10; }
    .pl-band { aspect-ratio: 16 / 10; margin-top: 24px; }
    .pl-toc-wide ol { grid-template-columns: 1fr; }
    .pl-hero-figure { min-height: 340px; }
    .pl-spot-intro { gap: 14px; }
    .pl-rail { grid-template-columns: 1fr; }
    .pl-article .article-body { margin-top: 28px; max-width: none; }
}
