/*
 * Modern looks — shared base for Pure, Pulse, Feed, Bento, Stories, Chat,
 * Pins and Clips (R34C8 V2).
 *
 * Loaded INSTEAD of style.css when Theme Hub → Frontend design is one of the
 * modern looks (inc/frontend-design.php), followed by looks/<key>.css, which
 * sets the tokens below and the few layout differences of that look. Every
 * colour, radius and font here comes from a token, so a look never has to
 * restyle a component it does not change. Phone first; ≥768px tablet,
 * ≥1024px desktop. No horizontal scrolling at any width, no line clamps on
 * titles (owner: no mid-word cuts).
 *
 * Shared scripts rely on these hooks, kept from Classic: #search-overlay.active,
 * #mobile-menu.active, .mobile-menu-backdrop.active, #r34c8-cr-wrapper /
 * .r34c8-cr--open, .story-continue-wrap, .r34c8-upnext, .share-buttons,
 * .r34c8-live-story-alert.is-visible, .r34c8-toast.show, .am-lightbox.active,
 * .floating-share-bar.visible, #back-to-top, #reading-progress-bar.
 */

/* ---------- 1. Tokens (defaults = Pure; each look overrides) ---------- */
:root {
    --md-bg: #F2F2F7;
    --md-head-bg: #F2F2F7;
    --md-story-bg: #FFFFFF;
    --md-surface: #FFFFFF;
    --md-surface-2: #F2F2F7;
    --md-line: #E5E5EA;
    --md-ink: #111114;
    --md-text: #1C1C1E;
    --md-soft: #48484A;
    --md-mut: #636366;
    --md-accent: #0066E6;
    --md-accent-ink: #FFFFFF;
    --md-accent-text: #0066E6;
    --md-accent-soft: #E6EEFF;
    --md-accent-soft-ink: #0B2A5C;
    --md-btn: #111114;
    --md-btn-ink: #FFFFFF;
    --md-radius: 22px;
    --md-radius-sm: 14px;
    --md-pill: 999px;
    --md-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .06);
    --md-shadow-up: 0 2px 4px rgba(0, 0, 0, .05), 0 14px 34px rgba(0, 0, 0, .1);
    --md-border: 0 solid transparent;
    --md-font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --md-display: var(--md-font);
    --md-title-weight: 800;
    --md-title-track: -.025em;
    --md-wrap: 1279px;
    --md-gutter: 16px;
    --md-story: 19px;
    --md-logo: 26px;
    --md-ratio: 16 / 10;
    --md-cols: 3;
    --md-t1-bg: #E6EEFF; --md-t1-ink: #0B2A5C;
    --md-t2-bg: #FFEADF; --md-t2-ink: #5C2209;
    --md-t3-bg: #E3F5EC; --md-t3-ink: #0B4F2C;
    --md-t4-bg: #EEE8FF; --md-t4-ink: #2E1A73;
    --md-t5-bg: #FFF2D6; --md-t5-ink: #5C3D00;
}
.md-tone-1 { --tone-bg: var(--md-t1-bg); --tone-ink: var(--md-t1-ink); }
.md-tone-2 { --tone-bg: var(--md-t2-bg); --tone-ink: var(--md-t2-ink); }
.md-tone-3 { --tone-bg: var(--md-t3-bg); --tone-ink: var(--md-t3-ink); }
.md-tone-4 { --tone-bg: var(--md-t4-bg); --tone-ink: var(--md-t4-ink); }
.md-tone-5 { --tone-bg: var(--md-t5-bg); --tone-ink: var(--md-t5-ink); }

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body.md-design {
    margin: 0;
    background: var(--md-bg);
    color: var(--md-text);
    font-family: var(--md-font);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}
body.md-design.single { background: var(--md-story-bg); }
/* Base element rules carry zero specificity (:where) so every component
   class below wins over them regardless of order. */
:where(.md-design) :where(img, video, iframe) { max-width: 100%; }
:where(.md-design) :where(img) { height: auto; border: 0; }
:where(.md-design) :where(a) { color: inherit; text-decoration: none; }
:where(.md-design) :where(h1, h2, h3, h4, h5, h6) { margin: 0; font-family: var(--md-display); font-weight: var(--md-title-weight); letter-spacing: var(--md-title-track); line-height: 1.15; color: var(--md-ink); }
:where(.md-design) :where(p, figure, blockquote) { margin: 0; }
:where(.md-design) :where(ul, ol) { margin: 0; padding: 0; }
:where(.md-design) :where(button, input, textarea, select) { font: inherit; color: inherit; }
:where(.md-design) :focus-visible { outline: 3px solid var(--md-accent); outline-offset: 2px; border-radius: 6px; }
:where(.md-design) ::selection { background: var(--md-accent-soft); color: var(--md-ink); }
.screen-reader-text {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
#page.md-site { overflow-x: clip; min-height: 100vh; display: flex; flex-direction: column; }
.md-main { flex: 1 0 auto; padding-bottom: 32px; }
.md-wrap { width: 100%; max-width: var(--md-wrap); margin: 0 auto; padding-left: var(--md-gutter); padding-right: var(--md-gutter); }
.md-kicker { font: 700 12.5px/1.3 var(--md-font); letter-spacing: .06em; text-transform: uppercase; color: var(--md-mut); }
.md-meta { font: 500 13px/1.35 var(--md-font); color: var(--md-mut); }
.md-dot { margin: 0 .2em; }
.md-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 48px; padding: 12px 24px; border: 0; border-radius: var(--md-pill);
    background: var(--md-btn); color: var(--md-btn-ink);
    font: 700 15px/1 var(--md-font); cursor: pointer; text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.md-btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.md-chip {
    display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 6px 12px; border-radius: var(--md-pill);
    background: var(--md-surface-2); color: var(--md-soft); font: 600 13px/1.1 var(--md-font); text-decoration: none; white-space: nowrap;
}
a.md-chip:hover { color: var(--md-ink); }
.md-chip--cat { background: var(--md-accent-soft); color: var(--md-accent-soft-ink); font-weight: 700; }
.md-chips, .md-chipset { display: flex; flex-wrap: wrap; gap: 8px; }
.md-chipset a {
    display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: var(--md-pill);
    background: var(--md-surface-2); color: var(--md-ink); font: 600 13.5px/1 var(--md-font);
}
.md-chipset a span { color: var(--md-mut); font-weight: 500; }
.md-x {
    display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
    border: 0; border-radius: 50%; background: var(--md-surface-2); color: var(--md-ink); cursor: pointer;
}
.md-i { flex: none; }
@media (max-width: 767px) { .md-hide-phone { display: none !important; } }
@media (min-width: 768px) { .md-hide-desktop { display: none !important; } }

/* ---------- 3. Header ---------- */
.md-masthead { position: relative; z-index: 50; background: var(--md-head-bg); border-bottom: 1px solid var(--md-line); }
.md-masthead.is-sticky { position: sticky; top: 0; }
body.single .md-masthead, body.single .md-nav { background: var(--md-story-bg); }
body.admin-bar .md-masthead.is-sticky { top: 32px; }
@media (max-width: 782px) { body.admin-bar .md-masthead.is-sticky { top: 46px; } }
@media (max-width: 600px) { body.admin-bar .md-masthead.is-sticky { top: 0; } }
.md-head-in { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 62px; padding-top: 8px; padding-bottom: 8px; }
.md-brand { display: inline-flex; align-items: center; min-width: 0; min-height: 44px; color: var(--md-ink); }
.md-logo { display: block; height: var(--md-logo); width: auto; max-width: 60vw; object-fit: contain; }
.md-namelogo { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.md-mark {
    display: none; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 10px;
    background: var(--md-accent); color: var(--md-accent-ink); font: 800 13px/1 var(--md-font); letter-spacing: -.01em;
}
.md-name { font: 800 19px/1.05 var(--md-display); letter-spacing: -.02em; color: var(--md-ink); overflow-wrap: anywhere; }
.md-head-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.md-ico {
    display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
    border: 0; border-radius: 50%; background: var(--md-surface); color: var(--md-ink); cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .06); transition: transform .15s ease, background .15s ease;
}
.md-ico:active { transform: scale(.94); }
/* main.js swaps the <i>'s classes to fa-moon / fa-sun; we draw our own icon. */
#dark-mode-toggle i {
    display: block; width: 19px; height: 19px; font-size: 0; background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linejoin='round'%3E%3Cpath d='M20 14.5A8 8 0 0 1 9.5 4a8 8 0 1 0 10.5 10.5z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linejoin='round'%3E%3Cpath d='M20 14.5A8 8 0 0 1 9.5 4a8 8 0 1 0 10.5 10.5z'/%3E%3C/svg%3E") center / contain no-repeat;
}
#dark-mode-toggle i::before { content: none; }
html.dark-mode #dark-mode-toggle i {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4.5'/%3E%3Cpath d='M12 2v2.5M12 19.5V22M2 12h2.5M19.5 12H22M4.9 4.9l1.8 1.8M17.3 17.3l1.8 1.8M4.9 19.1l1.8-1.8M17.3 6.7l1.8-1.8'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4.5'/%3E%3Cpath d='M12 2v2.5M12 19.5V22M2 12h2.5M19.5 12H22M4.9 4.9l1.8 1.8M17.3 17.3l1.8 1.8M4.9 19.1l1.8-1.8M17.3 6.7l1.8-1.8'/%3E%3C/svg%3E");
}

/* Category bar: pills that wrap, never a sideways scroller. */
.md-nav { background: var(--md-head-bg); }
.md-nav-in { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 2px; padding-bottom: 10px; }
.md-tab {
    display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 8px 14px; border-radius: var(--md-pill);
    background: var(--md-surface); color: var(--md-ink); font: 600 13.5px/1 var(--md-font); white-space: nowrap;
    transition: background .15s ease, color .15s ease;
}
.md-tab:hover { color: var(--md-accent-text); }
.md-tab.is-on { background: var(--md-accent); color: var(--md-accent-ink); }
.md-tab-badge { display: none; }

/* Reading progress (story pages, Theme Hub switch) */
.md-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 99999; pointer-events: none; }
.md-progress #reading-progress-bar { height: 100%; width: 0; background: var(--md-accent); border-radius: 0 3px 3px 0; transition: width .1s ease-out; }

/* ---------- 4. Search overlay ---------- */
.search-overlay {
    position: fixed; inset: 0; z-index: 100000; display: flex; justify-content: center; align-items: flex-start;
    padding: 10vh 12px 24px; background: rgba(0, 0, 0, .45);
    opacity: 0; visibility: hidden; transition: opacity .22s ease, visibility .22s;
}
.search-overlay.active { opacity: 1; visibility: visible; }
.md-sheet {
    position: relative; width: 100%; max-width: 620px; max-height: 78vh; overflow: auto;
    padding: 14px 16px 16px; border-radius: var(--md-radius); background: var(--md-surface); color: var(--md-ink);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .28); transform: translateY(-8px) scale(.99); transition: transform .22s ease;
}
.search-overlay.active .md-sheet { transform: none; }
.md-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.md-sheet-title { font: var(--md-title-weight) 22px/1.1 var(--md-display); letter-spacing: var(--md-title-track); color: var(--md-ink); }
.md-search {
    display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 6px 6px 16px;
    border-radius: var(--md-pill); background: var(--md-surface-2); color: var(--md-mut);
}
/* On a page (not the search sheet) the box needs its own edge: the page colour is often the same as surface-2. */
.md-search:not(.search-overlay-form) { background: var(--md-surface); box-shadow: inset 0 0 0 1px var(--md-line); }
.md-search:not(.search-overlay-form):focus-within { box-shadow: inset 0 0 0 1px var(--md-line), 0 0 0 2px var(--md-accent); }
.md-search:focus-within { box-shadow: 0 0 0 2px var(--md-accent); }
.md-search input[type="search"] {
    flex: 1; width: 0; min-width: 0; height: 44px; padding: 0 4px; border: 0; background: transparent;
    font: 500 17px/1 var(--md-font); color: var(--md-ink); outline: none; -webkit-appearance: none; appearance: none;
}
.md-search input[type="search"]::-webkit-search-decoration, .md-search input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
.md-search input::placeholder { color: var(--md-mut); }
.md-search button {
    flex: none; height: 44px; padding: 0 18px; border: 0; border-radius: var(--md-pill);
    background: var(--md-accent); color: var(--md-accent-ink); font: 700 14px/1 var(--md-font); cursor: pointer;
}
.search-results-live { margin-top: 10px; }
.srl-item { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px 4px; border-top: 1px solid var(--md-line); color: var(--md-ink); }
.srl-item:hover .srl-title { color: var(--md-accent-text); }
.srl-thumb { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; background: var(--md-surface-2); }
.srl-thumb-placeholder { display: grid; place-items: center; color: var(--md-accent-text); }
.srl-title { font: 700 15.5px/1.3 var(--md-font); }
.srl-date { margin-top: 3px; font: 500 12.5px/1 var(--md-font); color: var(--md-mut); }
.srl-loading, .srl-no-results { padding: 14px 4px; font: 500 14px/1.4 var(--md-font); color: var(--md-mut); }

/* ---------- 5. Phone menu ---------- */
.mobile-menu-backdrop {
    position: fixed; inset: 0; z-index: 99990; background: rgba(0, 0, 0, .4);
    opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s;
}
.mobile-menu-backdrop.active { opacity: 1; visibility: visible; }
.md-menu {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 99995;
    width: min(360px, 88vw); overflow-y: auto; overscroll-behavior: contain;
    padding: 14px 14px calc(18px + env(safe-area-inset-bottom, 0px));
    background: var(--md-surface); color: var(--md-ink); box-shadow: -12px 0 40px rgba(0, 0, 0, .2);
    transform: translateX(105%); visibility: hidden; transition: transform .3s cubic-bezier(.2, .8, .2, 1), visibility .3s;
}
.md-menu.active { transform: none; visibility: visible; }
.md-menu-search { margin-bottom: 10px; }
.md-menu-links { list-style: none; padding: 0; border-radius: var(--md-radius-sm); background: var(--md-surface-2); overflow: hidden; }
.md-menu-links li + li a { border-top: 1px solid var(--md-line); }
.md-menu-links a {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    min-height: 52px; padding: 12px 14px; font: 600 17px/1.25 var(--md-font); color: var(--md-ink);
}
.md-menu-links a .md-i { color: var(--md-mut); }
.md-menu-links a[aria-current="page"] { color: var(--md-accent-text); }
.md-social { display: flex; flex-wrap: wrap; gap: 8px; }
.md-menu-social { padding: 16px 2px 0; }
.md-social a {
    display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
    background: var(--md-surface-2); color: var(--md-ink); font-size: 16px;
}

/* ---------- 6. Cards ---------- */
.md-card {
    position: relative; min-width: 0; display: flex; flex-direction: column;
    background: var(--md-surface); border: var(--md-border); border-radius: var(--md-radius);
    box-shadow: var(--md-shadow); overflow: hidden; transition: box-shadow .2s ease, transform .2s ease;
}
@media (hover: hover) { .md-card:hover { box-shadow: var(--md-shadow-up); transform: translateY(-2px); } }
.md-media { position: relative; display: block; overflow: hidden; aspect-ratio: var(--md-ratio); background: var(--md-surface-2); }
.md-media .md-img, .md-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.md-card-body { position: relative; display: flex; flex-direction: column; gap: 7px; min-width: 0; padding: 14px 16px 16px; flex: 1; }
.md-card-top { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; min-width: 0; }
.md-badge { display: none; }
.md-cat { font: 700 12px/1.2 var(--md-font); letter-spacing: .05em; text-transform: uppercase; color: var(--md-accent-text); }
.md-card-title { font: var(--md-title-weight) 17px/1.25 var(--md-display); letter-spacing: var(--md-title-track); color: var(--md-ink); text-wrap: pretty; overflow-wrap: break-word; }
.md-card-title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.md-card-title a:hover { color: var(--md-accent-text); }
.md-card-excerpt { font: 400 15.5px/1.5 var(--md-font); color: var(--md-soft); }
.md-read { display: none; }
.md-rank {
    position: absolute; top: 10px; left: 10px; z-index: 2; display: grid; place-items: center; min-width: 30px; height: 30px; padding: 0 8px;
    border-radius: var(--md-pill); background: var(--md-btn); color: var(--md-btn-ink); font: 800 13px/1 var(--md-font); font-variant-numeric: tabular-nums;
}

/* Social-app pieces, printed only for the looks that use them (see
   r34c8_modern_look_config): counts, part badge, short time, short title.
   Hidden here; each look shows and places its own. */
.md-stats, .md-when, .md-short, .md-part { display: none; }
.md-stats { position: relative; z-index: 2; align-items: center; gap: 2px; }
.md-stat {
    display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 8px;
    font: 700 14px/1 var(--md-font); color: var(--md-ink); font-variant-numeric: tabular-nums; white-space: nowrap;
}
a.md-stat:hover { color: var(--md-accent-text); }
.md-part {
    position: absolute; top: 10px; right: 10px; z-index: 2; padding: 6px 10px; border-radius: var(--md-pill);
    background: rgba(10, 10, 12, .72); color: #FFFFFF; font: 700 12px/1 var(--md-font); font-variant-numeric: tabular-nums;
}
.md-when { font: 500 13px/1.35 var(--md-font); color: var(--md-mut); white-space: nowrap; }
/* Reading bar split into one segment per part (Stories). */
.md-progress--parts { display: flex; gap: 4px; height: auto; padding: 6px 10px 0; }
.md-progress--parts .md-seg { flex: 1; display: flex; height: 3px; overflow: hidden; border-radius: 3px; background: color-mix(in srgb, var(--md-ink) 16%, transparent); }
.md-progress--parts .md-seg.is-done { background: var(--md-ink); }
.md-progress--parts #reading-progress-bar { height: 100%; border-radius: 0; background: var(--md-ink); }

/* Cover drawn from the story when it has no picture: its category, opening
   line and initial in the post's tone. */
.md-cover {
    position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; gap: 8px;
    padding: 14px 16px; background: var(--tone-bg); color: var(--tone-ink); overflow: hidden;
}
.md-cover-cat { font: 700 11.5px/1.2 var(--md-font); letter-spacing: .06em; text-transform: uppercase; opacity: .85; }
.md-cover-line { font: 800 19px/1.2 var(--md-display); letter-spacing: -.02em; text-wrap: pretty; overflow-wrap: break-word; }
.md-cover-mark { display: none; font: 800 26px/1 var(--md-display); }
/* No opening line to show (an empty story): the initial, large, in the middle. */
.md-cover:not(:has(.md-cover-line)) .md-cover-mark { display: block; align-self: center; margin: auto 0; font-size: clamp(40px, 22%, 88px); opacity: .9; }

/* Lead: the big story */
.md-card--lead .md-card-body { gap: 9px; padding: 16px 18px 18px; }
.md-card--lead .md-card-title { font-size: 25px; line-height: 1.12; text-wrap: balance; }
.md-card--lead .md-card-excerpt { font-size: 16px; }
.md-card--lead .md-cover-line { font-size: 26px; }

/* Tile: picture on top */
.md-card--tile .md-card-body { padding: 12px 14px 14px; }

/* Row and side: small square thumbnail + text */
.md-card--row, .md-card--side { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px; }
.md-card--row .md-media, .md-card--side .md-media { aspect-ratio: 1 / 1; border-radius: var(--md-radius-sm); }
.md-card--row .md-card-body, .md-card--side .md-card-body { padding: 0; gap: 4px; }
.md-card--row .md-card-title, .md-card--side .md-card-title { font-size: 16px; line-height: 1.3; }
.md-card--row .md-cover, .md-card--side .md-cover { align-items: center; justify-content: center; padding: 6px; }
.md-card--row .md-cover-cat, .md-card--row .md-cover-line, .md-card--side .md-cover-cat, .md-card--side .md-cover-line { display: none; }
.md-card--row .md-cover-mark, .md-card--side .md-cover-mark { display: block; }
.md-card--row .md-rank, .md-card--side .md-rank { top: 4px; left: 4px; min-width: 24px; height: 24px; font-size: 11.5px; }

/* ---------- 7. Lists, grids, panels, section heads ---------- */
.md-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 2px 12px; }
.md-sec-title { font: var(--md-title-weight) 22px/1.15 var(--md-display); letter-spacing: var(--md-title-track); color: var(--md-ink); }
.md-see-all { flex: none; margin: -14px 0; padding: 14px 0; font: 600 14px/1 var(--md-font); color: var(--md-accent-text); }
.md-see-all:hover { text-decoration: underline; text-underline-offset: 3px; }
.md-list { display: grid; gap: 10px; }
.md-stack { display: grid; gap: 16px; }
.md-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.md-panel { min-width: 0; padding: 16px; border-radius: var(--md-radius); background: var(--md-surface); border: var(--md-border); box-shadow: var(--md-shadow); }
.md-panel-title { margin-bottom: 6px; font: var(--md-title-weight) 19px/1.2 var(--md-display); letter-spacing: var(--md-title-track); color: var(--md-ink); }
.md-panel:has(.md-ranked:empty) { display: none; }
.md-ranked { list-style: none; counter-reset: md; }
.md-ranked li {
    display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 4px 8px; align-items: baseline; padding: 11px 0;
    border-top: 1px solid var(--md-line); font: 650 15.5px/1.32 var(--md-font); color: var(--md-ink);
}
.md-ranked li:first-child { border-top: 0; }
.md-ranked li::before { counter-increment: md; content: counter(md, decimal-leading-zero); font: 700 13px/1.5 var(--md-font); color: var(--md-mut); font-variant-numeric: tabular-nums; }
.md-ranked li .md-meta { grid-column: 2; display: block; }
.md-ranked li a:hover { color: var(--md-accent-text); }
.md-ranked--plain li { grid-template-columns: minmax(0, 1fr); }
.md-ranked--plain li::before { content: none; }
.md-ranked--plain li .md-meta { grid-column: 1; }
@media (max-width: 767px) {
    .md-grid .md-card--tile .md-card-excerpt, .md-grid .md-card--tile .md-meta { display: none; }
    .md-grid .md-card--tile .md-card-body { padding: 10px 12px 12px; gap: 5px; }
    .md-grid .md-card--tile .md-card-title { font-size: 15.5px; line-height: 1.26; }
    .md-grid .md-card--tile .md-cover { padding: 10px 12px; }
    .md-grid .md-card--tile .md-cover-line { font-size: 15px; }
    /* Category, search and archive lists read as compact rows on a phone. */
    .md-grid--cat { grid-template-columns: minmax(0, 1fr); gap: 10px; }
    .md-grid--cat .md-card--tile { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px; }
    .md-grid--cat .md-card--tile .md-media { aspect-ratio: 1 / 1; border-radius: var(--md-radius-sm); }
    .md-grid--cat .md-card--tile .md-card-body { padding: 0; }
    .md-grid--cat .md-card--tile .md-meta { display: inline; }
    .md-grid--cat .md-card--tile .md-card-title { font-size: 16px; }
    .md-grid--cat .md-card--tile .md-cover { align-items: center; justify-content: center; }
    .md-grid--cat .md-card--tile .md-cover-cat, .md-grid--cat .md-card--tile .md-cover-line { display: none; }
    .md-grid--cat .md-card--tile .md-cover-mark { display: block; }
}

/* ---------- 8. Home ---------- */
.md-home { display: grid; gap: 30px; padding-top: 14px; }
.md-hello { display: grid; gap: 2px; margin: 0 2px 14px; }
.md-hello-date { font: 600 12.5px/1.3 var(--md-font); letter-spacing: .05em; text-transform: uppercase; color: var(--md-mut); }
.md-hello-title { font: var(--md-title-weight) 34px/1.05 var(--md-display); letter-spacing: -.035em; color: var(--md-ink); }
.md-hero-grid { display: grid; gap: 14px; }
.md-hero-side { display: grid; gap: 10px; align-content: start; }
.md-block { display: grid; }
.md-block.has-bg { padding: 18px 12px; border-radius: var(--md-radius); background: var(--md-section-bg); }
.md-split { display: grid; gap: 14px; }

/* ---------- 9. Story ---------- */
.md-story-layout { display: grid; gap: 26px; }
.md-story { min-width: 0; padding-top: 12px; }
.md-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; font: 600 13px/1.3 var(--md-font); color: var(--md-mut); }
.md-crumbs a:hover { color: var(--md-accent-text); }
.md-archive > .md-crumbs, .md-page > .md-crumbs { padding-top: 14px; margin-bottom: 0; }
.md-figure { position: relative; margin: 0 0 12px; overflow: hidden; border-radius: var(--md-radius); background: var(--md-surface-2); }
.md-figure.has-ratio img { width: 100%; height: 100%; object-fit: cover; }
.md-figure img { display: block; width: 100%; }
.md-figure figcaption { padding: 8px 4px 0; font: 400 13.5px/1.45 var(--md-font); color: var(--md-mut); }
.md-story-head { display: grid; gap: 14px; margin: 16px 0 20px; }
.md-story-title { font: var(--md-title-weight) 30px/1.08 var(--md-display); letter-spacing: -.035em; text-wrap: balance; overflow-wrap: break-word; color: var(--md-ink); }
.md-byline { display: flex; align-items: center; gap: 10px; min-width: 0; }
.md-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: none; background: var(--md-surface-2); }
.md-byline-text { display: grid; gap: 1px; min-width: 0; }
.md-byline-name { font: 700 14.5px/1.25 var(--md-font); color: var(--md-ink); }
.md-share { display: flex; flex-wrap: wrap; gap: 8px; }
.md-share .share-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 44px; height: 44px; padding: 0 14px;
    border: 0; border-radius: var(--md-pill); background: var(--md-surface-2); color: var(--md-ink);
    font: 700 14px/1 var(--md-font); text-decoration: none; transition: filter .15s ease, background .15s ease;
}
.md-share .share-btn:hover { filter: brightness(.96); }
.md-share .share-btn-facebook-full { background: #1871E3; color: #fff; padding: 0 18px; }
.md-share .share-btn-facebook-full:hover { color: #fff; filter: brightness(1.08); }

/* Story text */
.md-prose { font-family: var(--md-font); font-size: var(--md-story); line-height: 1.68; color: var(--md-text); overflow-wrap: break-word; }
.md-prose > * + * { margin-top: 1em; }
.md-prose p { margin: 0 0 1em; }
.md-prose > p:last-child { margin-bottom: 0; }
.md-prose a { color: var(--md-accent-text); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.md-prose strong, .md-prose b { color: var(--md-ink); font-weight: 700; }
.md-prose h2, .md-prose h3, .md-prose h4 { margin: 1.5em 0 .55em; color: var(--md-ink); line-height: 1.22; }
.md-prose h2 { font-size: 1.3em; }
.md-prose h3 { font-size: 1.15em; }
.md-prose h4 { font-size: 1.05em; }
.md-prose ul, .md-prose ol { margin: 0 0 1em; padding-left: 1.3em; }
.md-prose li { margin: .35em 0; }
.md-prose blockquote, .md-prose .wp-block-quote {
    margin: 1.4em 0; padding: 20px 22px; border: 0; border-radius: var(--md-radius);
    background: var(--md-accent-soft); color: var(--md-accent-soft-ink); font-weight: 700; font-size: 1.08em; line-height: 1.45;
}
.md-prose blockquote p:last-child { margin-bottom: 0; }
.md-prose blockquote cite { display: block; margin-top: 8px; font: 600 14px/1.3 var(--md-font); font-style: normal; opacity: .8; }
.md-prose hr { height: 0; margin: 2em auto; border: 0; border-top: 1px solid var(--md-line); width: 40%; }
.md-prose img { border-radius: var(--md-radius-sm); }
.md-prose figure { margin: 1.4em 0; }
.md-prose figcaption, .md-prose .wp-caption-text { margin-top: 6px; font: 400 14px/1.45 var(--md-font); color: var(--md-mut); text-align: center; }
.md-prose .wp-caption { max-width: 100%; }
.md-prose .aligncenter { display: block; margin-left: auto; margin-right: auto; }
.md-prose .alignleft, .md-prose .alignright { max-width: 50%; }
.md-prose .alignleft { float: left; margin: .3em 1em .6em 0; }
.md-prose .alignright { float: right; margin: .3em 0 .6em 1em; }
.md-prose iframe, .md-prose embed, .md-prose video { display: block; max-width: 100%; margin: 1.2em auto; }
.md-prose .wp-block-embed__wrapper { position: relative; }
.md-prose table { width: 100%; border-collapse: collapse; margin: 1.2em 0; font: 500 15px/1.45 var(--md-font); display: block; overflow-x: auto; }
.md-prose th, .md-prose td { padding: 8px 10px; border-bottom: 1px solid var(--md-line); text-align: left; }
.md-prose pre, .md-prose code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85em; }
.md-prose pre { overflow-x: auto; padding: 12px; border-radius: var(--md-radius-sm); background: var(--md-surface-2); }
.md-prose::after { content: ""; display: table; clear: both; }
/* Lead paragraph (Theme Hub switch): the first paragraph reads a touch larger and bolder. */
body.has-lead-paragraph .md-story .md-prose > p:first-of-type { font-size: 1.12em; font-weight: 700; line-height: 1.45; color: var(--md-ink); letter-spacing: -.01em; }
.page-links { display: flex; flex-wrap: wrap; gap: 6px; margin: 1em 0; font: 700 14px/1 var(--md-font); }
.page-links span { display: inline-grid; place-items: center; min-width: 36px; height: 36px; border-radius: 50%; background: var(--md-surface-2); }

/* Table of contents (Theme Hub switch) */
.r34c8-toc { margin: 0 0 1.4em; padding: 16px 18px 12px; border-radius: var(--md-radius); background: var(--md-surface-2); font: 600 15px/1.4 var(--md-font); }
.r34c8-toc-title { margin-bottom: 6px; font: var(--md-title-weight) 17px/1.2 var(--md-display); color: var(--md-ink); }
.r34c8-toc ol { padding-left: 1.2em; }
.r34c8-toc li { margin: 5px 0; }
.r34c8-toc a { color: var(--md-ink); text-decoration: none; }
.r34c8-toc a:hover { color: var(--md-accent-text); }

/* Highlights (Theme Hub → Emotional highlight). Inline styles carry each
   style's colour; these rules give the two designed styles their shape. */
.emo-highlight { -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.emo-highlight.emo-style-dialogue {
    --emo-color: #E11D48;
    padding: .04em .26em .06em; border-radius: .3em; font-weight: 650; font-style: normal;
    color: color-mix(in srgb, var(--emo-color) 78%, #111114); background: color-mix(in srgb, var(--emo-color) 9%, transparent);
}
/* A paragraph that is only a line of dialogue becomes a quote card. */
.emo-highlight.emo-style-dialogue.emo-quote-block {
    display: block; width: fit-content; max-width: 100%; margin: .5em 0 .3em; padding: .75em 1em .7em;
    border-radius: var(--md-radius-sm); background: color-mix(in srgb, var(--emo-color) 9%, var(--md-surface));
    color: var(--md-ink); font-weight: 700; line-height: 1.45;
    -webkit-box-decoration-break: slice; box-decoration-break: slice;
}
.emo-highlight.emo-style-dialogue.emo-tone-shout { font-weight: 800; }
.emo-highlight.emo-style-dialogue.emo-tone-ask { font-style: italic; }
.emo-highlight.emo-style-dialogue.emo-tone-pause { font-weight: 500; }
.md-prose p:has(> .emo-quote-block:only-child) + p:has(> .emo-quote-block:only-child) { margin-top: -.2em; }
html.dark-mode .emo-highlight.emo-style-dialogue, html.md-dark-only .emo-highlight.emo-style-dialogue { color: color-mix(in srgb, var(--emo-color) 55%, #FFFFFF); background: color-mix(in srgb, var(--emo-color) 18%, transparent); }
html.dark-mode .emo-highlight.emo-style-dialogue.emo-quote-block, html.md-dark-only .emo-highlight.emo-style-dialogue.emo-quote-block { color: var(--md-ink); background: color-mix(in srgb, var(--emo-color) 16%, var(--md-surface)); }
.emo-highlight.emo-style-bubble {
    --emo-color: #E11D48;
    position: relative; display: inline-block; max-width: 100%; margin: .2em 0 .55em; padding: .55em 1em .58em;
    border: 1px solid color-mix(in srgb, var(--emo-color) 28%, transparent); border-radius: 1.15em;
    background: var(--md-surface); color: var(--md-ink); font-weight: 700; line-height: 1.45;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .08); -webkit-box-decoration-break: slice; box-decoration-break: slice;
}
.emo-highlight.emo-style-bubble::after {
    content: ""; position: absolute; left: 18px; bottom: -9px; border-style: solid; border-width: 10px 11px 0 0;
    border-color: var(--md-surface) transparent transparent transparent;
}
.emo-highlight.emo-style-bubble .emo-bubble-mark { display: inline-block; margin-right: .04em; color: var(--emo-color); font-size: 1.6em; font-weight: 900; line-height: .7; vertical-align: -.08em; }
.emo-highlight.emo-style-bubble .emo-style-bubble-nested { color: inherit; font-weight: 800; }

/* Continue Reading (content-reveal.js) */
.r34c8-cr { position: relative; }
.r34c8-cr--collapsed { overflow: hidden; }
.r34c8-cr--open { overflow: visible !important; max-height: none !important; }
.r34c8-cr-overlay {
    display: none; position: absolute; left: 0; right: 0; bottom: 0; z-index: 10; height: 160px;
    align-items: flex-end; justify-content: center; padding-bottom: 14px; pointer-events: none;
    background: linear-gradient(to bottom, color-mix(in srgb, var(--md-story-bg) 0%, transparent) 0%, color-mix(in srgb, var(--md-story-bg) 88%, transparent) 45%, var(--md-story-bg) 78%);
    transition: opacity .4s ease;
}
.r34c8-cr-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 54px; padding: 14px 30px;
    border: 0; border-radius: var(--md-pill); background: var(--md-accent); color: var(--md-accent-ink); cursor: pointer;
    font: 700 16.5px/1 var(--md-font); pointer-events: auto; touch-action: manipulation;
    -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
    box-shadow: 0 10px 24px color-mix(in srgb, var(--md-accent) 35%, transparent); transition: transform .15s ease, box-shadow .15s ease;
}
.r34c8-cr-btn:hover { transform: translateY(-2px); }
.r34c8-cr-btn:active { transform: scale(.97); }
.r34c8-cr-btn.r34c8-cr-anim { animation: mdNudge 2.6s ease-in-out infinite; }
.r34c8-cr-btn--loading { opacity: .75; pointer-events: none; }
.r34c8-cr-part { margin-top: 8px; }
.r34c8-cr-end { margin: 30px 0 14px; text-align: center; font: 700 15px/1.3 var(--md-font); color: var(--md-mut); }
@keyframes mdNudge { 0%, 70%, 100% { transform: translateY(0); } 80% { transform: translateY(-3px); } 90% { transform: translateY(1px); } }

/* Part 1 / Part 2 card */
.md-parts { display: grid; gap: 12px; margin: 1.8em 0 .6em; padding: 16px; border-radius: var(--md-radius); background: var(--md-surface-2); font-family: var(--md-font); }
.md-parts-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.md-parts-label { font: 700 15px/1.25 var(--md-font); color: var(--md-ink); }
.md-parts-steps { display: flex; gap: 4px; flex: none; }
.md-parts-steps span { display: block; width: 22px; height: 5px; border-radius: 5px; background: var(--md-line); }
.md-parts-steps span.is-on { background: var(--md-accent); }
.md-parts-next {
    display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 64px; padding: 12px 12px 12px 20px;
    border-radius: var(--md-radius-sm); background: var(--md-accent); color: var(--md-accent-ink) !important; text-decoration: none !important;
    box-shadow: 0 10px 24px color-mix(in srgb, var(--md-accent) 30%, transparent); transition: transform .15s ease;
}
.md-parts-next:hover { transform: translateY(-2px); }
.md-parts-text { display: grid; gap: 3px; min-width: 0; }
.md-parts-cta { font: 800 17px/1.2 var(--md-font); }
.md-parts-sub { font: 500 13.5px/1.3 var(--md-font); opacity: .88; }
.md-parts-arrow { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 50%; background: color-mix(in srgb, var(--md-accent-ink) 18%, transparent); }
.md-parts-back { display: inline-flex; align-items: center; gap: 6px; justify-self: start; font: 600 14px/1 var(--md-font); color: var(--md-mut) !important; text-decoration: none !important; }
.md-parts--end .md-parts-links { display: flex; flex-wrap: wrap; gap: 16px; font: 600 14px/1 var(--md-font); }
.md-parts-links a { display: inline-flex; align-items: center; gap: 4px; color: var(--md-accent-text) !important; text-decoration: none !important; }
/* Classic's floating Part bar, when the "floating" style is saved, is not used here. */
.story-floating-bar { display: none !important; }

.md-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 6px; }
.md-author { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 14px; align-items: center; margin: 22px 0 8px; box-shadow: none; background: var(--md-surface-2); }
.md-author-avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.md-author-text { display: grid; gap: 3px; min-width: 0; }
.md-author-name { font: 700 17px/1.2 var(--md-font); color: var(--md-ink); }
.md-author p { font: 400 15px/1.5 var(--md-font); color: var(--md-soft); }
.md-postnav { margin: 22px 0 6px; }
.md-postnav .nav-links { display: grid; gap: 10px; }
.md-postnav a { display: grid; gap: 4px; padding: 14px 16px; border-radius: var(--md-radius-sm); background: var(--md-surface-2); }
.md-postnav a:hover .md-pn-title { color: var(--md-accent-text); }
.md-pn-label { display: inline-flex; align-items: center; gap: 6px; font: 600 12.5px/1 var(--md-font); color: var(--md-mut); }
.md-pn-title { font: 700 16px/1.3 var(--md-font); color: var(--md-ink); }
.md-postnav .nav-next a { text-align: right; justify-items: end; }
.md-related { margin-top: 28px; }
.md-upnext {
    display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; align-items: center; margin: 24px 0 6px; padding: 12px;
    border-radius: var(--md-radius); background: var(--md-surface-2); color: var(--md-ink);
}
.md-upnext-media { position: relative; display: block; overflow: hidden; aspect-ratio: 1 / 1; border-radius: var(--md-radius-sm); background: var(--md-surface); }
.md-upnext-media img, .md-upnext-media .md-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.md-upnext-media .md-cover { align-items: center; justify-content: center; padding: 6px; }
.md-upnext-media .md-cover-cat, .md-upnext-media .md-cover-line { display: none; }
.md-upnext-media .md-cover-mark { display: block; }
.md-upnext-body { display: grid; gap: 4px; min-width: 0; }
.md-upnext-kicker { font: 700 12.5px/1.2 var(--md-font); letter-spacing: .05em; text-transform: uppercase; color: var(--md-accent-text); }
.md-upnext-kicker span { color: var(--md-mut); }
.md-upnext-title { font: 700 16.5px/1.3 var(--md-font); }
.md-upnext-cta { display: inline-flex; align-items: center; gap: 5px; font: 600 14px/1 var(--md-font); color: var(--md-accent-text); }

/* Comments */
.md-comments { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--md-line); }
.md-comments .comment-list { list-style: none; padding: 0; margin: 14px 0 20px; }
.md-comments .comment-list .children { list-style: none; padding-left: 16px; margin-top: 10px; }
.md-comments .comment-body { margin-bottom: 12px; padding: 14px; border-radius: var(--md-radius-sm); background: var(--md-surface-2); font-size: 16px; line-height: 1.55; }
.md-comments .comment-author { display: flex; align-items: center; gap: 10px; font: 700 15px/1.2 var(--md-font); }
.md-comments .comment-author .avatar { border-radius: 50%; }
.md-comments .comment-author .says { display: none; }
.md-comments .comment-metadata { margin: 4px 0 8px; font: 500 12.5px/1.2 var(--md-font); color: var(--md-mut); }
.md-comments .reply a { font: 700 13px/1 var(--md-font); color: var(--md-accent-text); }
.md-comment-form { display: grid; gap: 12px; margin-top: 10px; }
.md-comments .cf-note { font: 400 13.5px/1.4 var(--md-font); color: var(--md-mut); }
.md-comments .cf-field { display: grid; gap: 6px; }
.md-comments .cf-field label { font: 600 14px/1.2 var(--md-font); color: var(--md-ink); }
.md-comments .cf-field input[type="text"], .md-comments .cf-field input[type="email"], .md-comments .cf-field input[type="url"], .md-comments .cf-field textarea {
    width: 100%; padding: 12px 14px; border: 1px solid var(--md-line); border-radius: var(--md-radius-sm); background: var(--md-surface);
    font: 400 16px/1.4 var(--md-font); color: var(--md-ink);
}
.md-comments .cf-field input:focus, .md-comments .cf-field textarea:focus { border-color: var(--md-accent); outline: none; }
.md-comments .cf-cookies-label { display: flex; align-items: flex-start; gap: 8px; font: 400 13.5px/1.4 var(--md-font); color: var(--md-mut); }
.md-comments .required { color: #E11D48; }
.md-comments .optional { color: var(--md-mut); }

/* ---------- 10. Sidebar widgets ---------- */
.md-aside { display: grid; gap: 18px; align-content: start; min-width: 0; }
.md-news { display: grid; justify-items: start; gap: 8px; }
.md-news-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--md-accent-soft); color: var(--md-accent-text); }
.md-news h2 { font-size: 19px; }
.md-news p { font: 400 15px/1.5 var(--md-font); color: var(--md-soft); }

/* ---------- 11. Archives ---------- */
.md-archive, .md-feed { display: grid; gap: 20px; padding-top: 14px; }
.md-page-head { display: grid; gap: 6px; }
.md-page-title { font: var(--md-title-weight) 32px/1.08 var(--md-display); letter-spacing: -.035em; text-wrap: balance; overflow-wrap: break-word; color: var(--md-ink); }
.md-page-desc { font: 400 16.5px/1.55 var(--md-font); color: var(--md-soft); }
.md-page-desc p { margin: 0; }
.md-page-search { margin-top: 8px; max-width: 560px; }
.md-columns { display: grid; gap: 24px; }
.md-columns-main { min-width: 0; }
.md-pages { margin-top: 20px; }
.md-pages .nav-links { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; }
.md-pages .page-numbers {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 44px; height: 44px; padding: 0 14px;
    border-radius: var(--md-pill); background: var(--md-surface); color: var(--md-ink); font: 700 15px/1 var(--md-font);
}
.md-pages .page-numbers.current { background: var(--md-accent); color: var(--md-accent-ink); }
.md-pages a.page-numbers:hover { color: var(--md-accent-text); }
.md-pages .dots { background: transparent; }
.md-empty { display: grid; justify-items: start; gap: 12px; }
.md-empty h1, .md-empty h2 { font-size: 23px; }
.md-empty .md-list { width: 100%; }

/* ---------- 12. Pages ---------- */
.md-page { display: grid; gap: 16px; padding-top: 14px; }
.md-plain, .md-pubpage { padding: 18px var(--md-gutter) 24px; margin: 0 calc(-1 * var(--md-gutter)); border-radius: 0; box-shadow: none; }
.md-page-head--plain { margin-bottom: 14px; }
.md-page-hero { position: relative; display: grid; gap: 8px; margin: -18px calc(-1 * var(--md-gutter)) 18px; padding: 28px var(--md-gutter) 22px; background: var(--md-accent-soft); color: var(--md-accent-soft-ink); overflow: hidden; }
.md-page-hero .md-page-title { color: inherit; }
.md-page-hero.has-image { min-height: 230px; align-content: end; color: #fff; }
.md-page-hero.has-image img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.md-page-hero.has-image::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 20%, rgba(0, 0, 0, .72)); }
.md-page-hero.has-image > *:not(img) { position: relative; z-index: 1; color: #fff; }
.md-page-hero p { font: 400 16.5px/1.5 var(--md-font); }

/* ---------- 13. 404 ---------- */
.md-404 { display: grid; gap: 22px; padding-top: 18px; }
.md-404-sheet { display: grid; justify-items: center; gap: 12px; text-align: center; padding-top: 34px; padding-bottom: 34px; }
.md-404-mark { font: 800 84px/1 var(--md-display); letter-spacing: -.06em; color: var(--md-accent-text); }
.md-404-img { display: block; width: 100%; margin: 0 auto 8px; border-radius: var(--md-radius); }
.md-404-text { max-width: 46ch; font: 400 16.5px/1.55 var(--md-font); color: var(--md-soft); }
.md-404-search { width: 100%; max-width: 480px; }

/* ---------- 14. Footer ---------- */
.md-foot { margin-top: 12px; background: var(--md-surface); color: var(--md-ink); border-top: 1px solid var(--md-line); }
.md-foot-in { display: grid; gap: 24px; padding-top: 28px; padding-bottom: 18px; }
.md-foot-brand { display: grid; justify-items: start; gap: 10px; }
.md-foot .md-logo { height: calc(var(--md-logo) + 4px); }
.md-foot-desc { max-width: 52ch; font: 400 15px/1.55 var(--md-font); color: var(--md-soft); }
.md-foot-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 16px; }
.md-foot-title { margin-bottom: 6px; font: 700 12px/1.2 var(--md-font); letter-spacing: .06em; text-transform: uppercase; color: var(--md-mut); }
.md-foot-col ul { list-style: none; display: grid; gap: 0; }
.md-foot-col a { display: inline-block; padding: 7px 0; font: 600 15px/1.25 var(--md-font); color: var(--md-ink); }
.md-foot-col a:hover { color: var(--md-accent-text); }
.md-foot-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; padding-bottom: 24px; border-top: 1px solid var(--md-line); }
.md-copy { font: 500 13px/1.4 var(--md-font); color: var(--md-mut); }

/* ---------- 15. Ads ---------- */
.r34c8-ic-ad { display: block; width: 100%; margin: 20px 0; clear: both; }
.r34c8-lazy-ad { display: block; width: 100%; }
.md-prose .r34c8-ic-ad, .md-prose .r34c8-lazy-ad { margin: 1.4em 0; }
.ad-slot { clear: both; width: 100%; margin: 20px 0; text-align: center; overflow: visible; }
.ad-slot ins.adsbygoogle { display: block !important; width: 100%; min-height: 90px; }
.ad-slot-label, .ad-slot-divider span { display: block; margin-bottom: 8px; font: 600 10.5px/1 var(--md-font); letter-spacing: .1em; text-transform: uppercase; color: var(--md-mut); }
.ad-slot-divider { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.ad-slot-divider::before, .ad-slot-divider::after { content: ""; flex: 1; height: 1px; background: var(--md-line); }
.ad-slot-banner { display: block; width: 100%; min-height: 90px; margin: 0 auto; text-align: center; }
.ad-slot-incontent { display: block; width: 100%; min-height: 250px; margin: 20px auto; text-align: center; }
.ad-slot-sidebar { display: block; width: 100%; min-height: 250px; margin-bottom: 20px; text-align: center; }
.ad-slot-sticky-bottom {
    position: fixed; left: 0; right: 0; bottom: env(safe-area-inset-bottom, 0px); z-index: 999; display: none; min-height: 60px;
    padding: 8px 16px; background: var(--md-surface); box-shadow: 0 -2px 12px rgba(0, 0, 0, .12);
}
.ad-slot-sticky-bottom.active { display: flex; align-items: center; justify-content: center; }
.ad-slot.ad-preview-mode, .ad-slot-sticky-bottom.ad-preview-mode { border: 2px dashed #3b82f6 !important; background: rgba(59, 130, 246, .05) !important; min-height: 100px; display: flex !important; flex-direction: column; align-items: center; justify-content: center; }
.md-grid > .r34c8-lazy-ad, .md-grid > .r34c8-ic-ad, .md-grid > .ad-hide-mobile, .md-grid > .r34c8-ad-fw, .md-grid > [id^="_mgwidget"], .md-grid > [data-type="_mgwidget"], .md-grid > ins.adsbygoogle,
.md-grid > div:not(.md-card), .md-grid > script + div { grid-column: 1 / -1; width: 100%; }
@media (max-width: 767px) {
    .ad-slot { margin: 18px 0; }
    .ad-slot-banner, .ad-slot-incontent { min-height: 50px; }
    [id^="_mgwidget_"], [data-type="_mgwidget"] { max-width: 100% !important; width: 100% !important; min-width: 0 !important; box-sizing: border-box !important; overflow: visible !important; }
    [id^="_mgwidget_"] *, [data-type="_mgwidget"] * { max-width: 100% !important; min-width: 0 !important; }
    [id^="_mgwidget_"] iframe, [data-type="_mgwidget"] iframe, [id^="_mgwidget_"] img, [data-type="_mgwidget"] img { max-width: 100% !important; height: auto !important; }
    body.r34c8-ads-fw [id^="_mgwidget_"], body.r34c8-ads-fw [data-type="_mgwidget"] { width: 100vw !important; max-width: 100vw !important; margin-left: calc(50% - 50vw) !important; margin-right: calc(50% - 50vw) !important; }
    body.r34c8-ads-fw .md-grid > [id^="_mgwidget_"], body.r34c8-ads-fw .md-grid > [data-type="_mgwidget"], body.r34c8-ads-fw .md-grid > .r34c8-ic-ad, body.r34c8-ads-fw .md-grid > .r34c8-ad-fw { width: 100% !important; max-width: 100% !important; margin-left: 0 !important; margin-right: 0 !important; }
    body.single .md-prose .r34c8-ic-ad, body.single .md-prose .r34c8-ad-fw, body.single .md-prose [id^="_mgwidget_"], body.single .md-prose [data-type="_mgwidget"] { width: 100% !important; max-width: 100% !important; min-width: 0 !important; margin-left: 0 !important; margin-right: 0 !important; }
}

/* ---------- 16. Shared feature pieces ---------- */
.back-to-top-btn {
    position: fixed; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 9999;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
    width: 48px; height: 56px; padding: 0; border: 0; border-radius: var(--md-pill); cursor: pointer;
    background: var(--md-btn); color: var(--md-btn-ink); box-shadow: 0 8px 22px rgba(0, 0, 0, .22);
    opacity: 0; pointer-events: none; transform: translateY(20px); transition: opacity .3s ease, transform .3s ease;
}
.back-to-top-btn .btt-pct { display: block; font: 700 10px/1 var(--md-font); }

.am-lightbox {
    position: fixed; inset: 0; z-index: 999999; display: flex; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, .92); opacity: 0; visibility: hidden; transition: opacity .3s ease, visibility .3s; cursor: zoom-out;
}
.am-lightbox.active { opacity: 1; visibility: visible; }
.am-lightbox img { max-width: 94vw; max-height: 86vh; object-fit: contain; border-radius: var(--md-radius-sm); cursor: default; }
.am-lightbox-close { position: absolute; top: 12px; right: 12px; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .16); color: #fff; font-size: 24px; cursor: pointer; }
.am-lightbox-caption { position: absolute; left: 50%; bottom: 18px; max-width: min(600px, 90vw); padding: 8px 14px; transform: translateX(-50%); border-radius: var(--md-radius-sm); background: rgba(0, 0, 0, .6); color: #fff; font: 500 14px/1.4 var(--md-font); text-align: center; }
.am-lightbox-caption:empty { display: none; }

.r34c8-toast {
    position: fixed; left: 50%; bottom: 30px; z-index: 100000; padding: 12px 22px; border-radius: var(--md-pill);
    background: var(--md-btn); color: var(--md-btn-ink); font: 600 14px/1.2 var(--md-font); pointer-events: none;
    opacity: 0; transform: translate(-50%, 20px); transition: opacity .3s ease, transform .3s ease; box-shadow: 0 8px 22px rgba(0, 0, 0, .25);
}
.r34c8-toast.show { opacity: 1; transform: translate(-50%, 0); }

.floating-share-bar { position: fixed; top: 50%; left: calc(50% - var(--md-wrap) / 2 - 56px); z-index: 9990; display: flex; flex-direction: column; gap: 6px; opacity: 0; visibility: hidden; transform: translateY(-50%); transition: opacity .3s, visibility .3s; }
.floating-share-bar.visible { opacity: 1; visibility: visible; }
.floating-share-bar a { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--md-surface); color: var(--md-ink); box-shadow: var(--md-shadow); font-size: 15px; }
.floating-share-bar a:hover { color: var(--md-accent-text); }
@media (max-width: 1400px) { .floating-share-bar { display: none !important; } }

/* Live story alert (main.js) */
.r34c8-live-story-alert[hidden], .r34c8-live-story-alert [hidden] { display: none !important; }
.r34c8-live-story-alert {
    position: fixed; top: var(--r34c8-live-alert-top, 76px); right: max(12px, env(safe-area-inset-right, 0px)); z-index: 9980;
    width: min(380px, calc(100vw - 24px)); overflow: hidden; border-radius: var(--md-radius); color: var(--md-ink);
    background: var(--md-surface); border: var(--md-border); box-shadow: 0 18px 44px rgba(0, 0, 0, .2);
    opacity: 0; transform: translateY(-12px); pointer-events: none;
    transition: opacity .24s ease, transform .28s cubic-bezier(.2, .8, .2, 1), top .18s ease;
}
.r34c8-live-story-alert.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.r34c8-live-story-alert__announcement { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.r34c8-live-story-alert__link { display: grid; grid-template-columns: 60px minmax(0, 1fr); gap: 12px; align-items: center; min-height: 84px; padding: 12px 42px 12px 12px; color: inherit !important; text-decoration: none !important; }
.r34c8-live-story-alert__media { display: block; width: 60px; height: 60px; overflow: hidden; border-radius: var(--md-radius-sm); background: var(--md-accent-soft); }
.r34c8-live-story-alert__image, .r34c8-live-story-alert__fallback { width: 100%; height: 100%; }
.r34c8-live-story-alert__image { display: block; object-fit: cover; }
.r34c8-live-story-alert__fallback { display: flex; align-items: center; justify-content: center; color: var(--md-accent-text); font-size: 22px; }
.r34c8-live-story-alert__copy { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.r34c8-live-story-alert__eyebrow { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 4px; font: 700 12px/1 var(--md-font); letter-spacing: .05em; text-transform: uppercase; color: var(--md-accent-text); }
.r34c8-live-story-alert__pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--md-accent); animation: mdPulse 1.8s ease-out infinite; }
.r34c8-live-story-alert__title { display: -webkit-box; overflow: hidden; font: 700 15px/1.3 var(--md-font); color: var(--md-ink); -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.r34c8-live-story-alert__meta { display: block; overflow: hidden; max-width: 100%; margin-top: 5px; font: 500 12px/1.2 var(--md-font); color: var(--md-mut); text-overflow: ellipsis; white-space: nowrap; }
.r34c8-live-story-alert__close { position: absolute; top: 6px; right: 6px; z-index: 3; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--md-mut); font: 400 22px/1 Arial, sans-serif; cursor: pointer; }
.r34c8-live-story-alert__close:hover { background: var(--md-surface-2); color: var(--md-ink); }
@keyframes mdPulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--md-accent) 45%, transparent); } 100% { box-shadow: 0 0 0 9px transparent; } }

/* Cookie notice (printed with its own inline styles; these take over) */
body.md-design .am-cookie-popup {
    border-radius: var(--md-radius); border: var(--md-border); font-family: var(--md-font); color: var(--md-ink);
    background: var(--md-surface); box-shadow: 0 18px 44px rgba(0, 0, 0, .22);
}
body.md-design .am-cookie-icon { background: var(--md-accent-soft); color: var(--md-accent-text); }
body.md-design .am-cookie-text { color: var(--md-soft); }
body.md-design .am-cookie-text strong { color: var(--md-ink); }
body.md-design .am-cookie-text a { color: var(--md-accent-text); }
body.md-design .am-cookie-btn { border-radius: var(--md-pill); background: var(--md-accent); border-color: var(--md-accent); color: var(--md-accent-ink); }
body.md-design .am-cookie-btn-reject { border-radius: var(--md-pill); background: var(--md-surface-2); border-color: var(--md-surface-2); color: var(--md-ink); }

/* App-Like Display (Theme Hub → Mobile) */
html.r34c8-no-zoom, html:has(> body.r34c8-no-zoom), body.r34c8-no-zoom { touch-action: pan-x pan-y; }
body.r34c8-no-zoom .md-head, body.r34c8-no-zoom .md-nav { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
html.r34c8-no-overscroll, html:has(> body.r34c8-no-overscroll), body.r34c8-no-overscroll { overscroll-behavior-y: none; }

/* ---------- 17. Tablet ≥768px ---------- */
@media (min-width: 768px) {
    :root { --md-gutter: 24px; }
    .md-head-in { min-height: 70px; }
    .md-tab { min-height: 40px; padding: 9px 16px; font-size: 14px; }
    .md-nav-in { gap: 8px; padding-bottom: 12px; }
    .md-name { font-size: 22px; }
    .md-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
    .md-grid--cat { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md-list--two { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .md-card--lead .md-card-title { font-size: 30px; }
    .md-hello-title { font-size: 42px; }
    .md-story-title { font-size: 40px; }
    .md-page-title { font-size: 40px; }
    .md-postnav .nav-links { grid-template-columns: 1fr 1fr; }
    .md-postnav .nav-previous:only-child { grid-column: 1; }
    .md-postnav .nav-next:only-child { grid-column: 2; }
    .md-plain, .md-pubpage { margin: 0; padding: 28px 34px 32px; border-radius: var(--md-radius); }
    .md-page-hero { margin: -28px -34px 22px; padding: 38px 34px 28px; border-radius: var(--md-radius) var(--md-radius) 0 0; }
    .md-foot-in { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 40px; }
    .md-foot-cols { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
    .md-home { gap: 38px; padding-top: 22px; }
    .md-upnext { grid-template-columns: 130px minmax(0, 1fr); }
    .back-to-top-btn { right: 24px; bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- 18. Desktop ≥1024px ---------- */
@media (min-width: 1024px) {
    :root { --md-gutter: 28px; }
    .md-hero-grid { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 22px; align-items: start; }
    .md-card--lead .md-card-title { font-size: 34px; }
    .md-grid { grid-template-columns: repeat(var(--md-cols, 3), minmax(0, 1fr)); gap: 22px; }
    .md-block--grid .md-grid { grid-template-columns: repeat(var(--md-cols, 4), minmax(0, 1fr)); }
    .md-grid--cat { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md-grid--cat.md-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .md-grid--related { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .md-split { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 22px; align-items: start; }
    .md-story-layout { justify-content: center; grid-template-columns: minmax(0, 760px); padding-top: 18px; }
    .md-story-layout.has-aside { grid-template-columns: minmax(0, 760px) 320px; gap: 40px; }
    .md-aside.is-sticky { position: sticky; top: 110px; }
    .md-columns.has-aside { grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; align-items: start; }
    .md-page { justify-items: center; }
    .md-page > * { width: 100%; max-width: 880px; }
    .md-page > .md-pubpage { max-width: 1100px; }
    .md-feed { max-width: 720px; margin: 0 auto; }
    .md-404 { max-width: 1100px; }
}

/* ---------- 19. Motion & print ---------- */
@media (prefers-reduced-motion: reduce) {
    .md-design *, .md-design *::before, .md-design *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
    .md-masthead, .md-nav, .md-foot, .md-aside, .back-to-top-btn, .ad-slot, .ad-slot-sticky-bottom, .md-share, .md-postnav, .md-related,
    .md-upnext, .md-comments, .search-overlay, .mobile-menu, .mobile-menu-backdrop, #reading-progress-container, .r34c8-cr-overlay,
    .floating-share-bar, .am-lightbox, .r34c8-live-story-alert { display: none !important; }
    body.md-design { background: #fff; }
}
