/* ==========================================================================
   AIOPNews — public site
   Editorial design system: brand blue + news red, serif headlines, sans UI.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
    --brand: #0b4fae;
    --brand-strong: #083b85;
    --navy: #0a1f44;
    --red: #d71920;
    --red-strong: #b0141a;

    --bg: #ffffff;
    --bg-soft: #f4f5f7;
    --surface: #ffffff;
    --ink: #111418;
    --text: #262a31;
    --muted: #535a66;
    --subtle: #6b7280;
    --rule: #e3e6ea;
    --rule-strong: #111418;
    --link: #0b4fae;
    --kicker: #c8161d;

    --serif: 'Source Serif 4', 'Noto Sans Tamil', Georgia, 'Times New Roman', serif;
    --sans: 'Inter', 'Noto Sans Tamil', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --reading-size: 1.1875rem;

    --radius: 6px;
    --radius-lg: 10px;
    --nav-h: 48px;
    --ease: cubic-bezier(.2, .7, .2, 1);

    /* Bootstrap bridges */
    --bs-body-font-family: var(--sans);
    --bs-body-bg: var(--bg);
    --bs-body-color: var(--text);
    --bs-border-color: var(--rule);
    --bs-primary-rgb: 11, 79, 174;
    --bs-link-color-rgb: 11, 79, 174;
    --bs-link-hover-color-rgb: 8, 59, 133;
}

[data-bs-theme="dark"] {
    --brand: #3b7ddd;
    --brand-strong: #2f69c0;
    --bg: #0f1216;
    --bg-soft: #171b21;
    --surface: #151920;
    --ink: #f2f4f7;
    --text: #d4d8de;
    --muted: #a6adb8;
    --subtle: #8f97a3;
    --rule: #272c35;
    --rule-strong: #e6e8eb;
    --link: #8db8ff;
    --kicker: #ff6b6b;

    --bs-body-bg: var(--bg);
    --bs-body-color: var(--text);
    --bs-border-color: var(--rule);
    --bs-link-color-rgb: 141, 184, 255;
    --bs-link-hover-color-rgb: 184, 212, 255;
}

[data-reading-size="sm"] { --reading-size: 1.0625rem; }
[data-reading-size="lg"] { --reading-size: 1.3125rem; }
[data-reading-size="xl"] { --reading-size: 1.4375rem; }

/* ---------- Base ---------- */
html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    font-size: 1rem;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1 0 auto; }

a { color: var(--link); }
img { max-width: 100%; }
::selection { background: rgba(11, 79, 174, .18); }

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 2px;
}

@media (min-width: 1200px) {
    .container { max-width: 1240px; }
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -100px;
    z-index: 2000;
    background: var(--ink);
    color: var(--bg);
    padding: .6rem 1rem;
    border-radius: var(--radius);
    font-weight: 600;
    text-decoration: none;
}
.skip-link:focus { top: 1rem; }

.visually-hidden-focusable:not(:focus):not(:focus-within) { position: absolute !important; }

/* ---------- Header ---------- */
.topbar {
    border-bottom: 1px solid var(--rule);
    font-size: .8125rem;
    color: var(--subtle);
}
.topbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 36px;
}
.topbar-links { display: flex; gap: 1.25rem; }
.topbar a { color: var(--muted); text-decoration: none; }
.topbar a:hover { color: var(--ink); }

.masthead .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 14px;
    padding-bottom: 14px;
}
.brand {
    display: flex;
    align-items: center;
    gap: .9rem;
    text-decoration: none;
    min-width: 0;
}
.brand-logo { height: 56px; width: auto; display: block; }
.brand-tagline {
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--subtle);
    border-left: 1px solid var(--rule);
    padding-left: .9rem;
    line-height: 1.35;
}
.masthead-actions { display: flex; align-items: center; gap: .5rem; }

.icon-btn {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid var(--rule);
    background: transparent;
    color: var(--ink);
    font-size: 1.05rem;
    line-height: 1;
    transition: background .15s ease, border-color .15s ease;
}
.icon-btn:hover { background: var(--bg-soft); }
.icon-btn--plain { border-color: transparent; }

/* Dark mode: the logo artwork needs a light plate to stay legible */
[data-bs-theme="dark"] .brand-logo,
[data-bs-theme="dark"] .nav-mini-logo img,
[data-bs-theme="dark"] .footer-logo {
    background: #fff;
    border-radius: 8px;
    padding: 3px 6px;
}

/* Search panel */
.search-panel { border-top: 1px solid var(--rule); background: var(--bg-soft); }
.search-panel .container { padding-top: 1.25rem; padding-bottom: 1.25rem; }
.search-field {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: 999px;
    padding: .35rem .35rem .35rem 1.1rem;
    max-width: 44rem;
}
.search-field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11, 79, 174, .15); }
.search-field i { color: var(--subtle); }
.search-field input {
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ink);
    font-size: 1.05rem;
    padding: .45rem .25rem;
    min-width: 0;
}
.search-field button {
    border: 0;
    background: var(--ink);
    color: var(--bg);
    border-radius: 999px;
    padding: .55rem 1.2rem;
    font-weight: 600;
    font-size: .9rem;
}
.search-field button:hover { background: var(--brand); color: #fff; }

/* Section navigation (sticky) */
.nav-sentinel { height: 1px; margin-bottom: -1px; }
.section-nav {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: var(--bg);
    border-top: 1px solid var(--rule-strong);
    border-bottom: 1px solid var(--rule);
    transition: box-shadow .2s ease;
}
.section-nav.is-stuck { box-shadow: 0 2px 12px rgba(0, 0, 0, .07); }
.section-nav .container {
    display: flex;
    align-items: center;
    gap: .5rem;
    height: var(--nav-h);
}
.nav-mini-logo { display: none; flex-shrink: 0; margin-right: .35rem; }
.nav-mini-logo img { height: 30px; width: auto; display: block; }
.section-nav.is-stuck .nav-mini-logo { display: block; }
.nav-search { display: none; }
.section-nav.is-stuck .nav-search { display: inline-flex; }

.section-links {
    display: flex;
    flex: 1;
    min-width: 0;
    height: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 0 0 -.7rem;
    padding: 0;
    list-style: none;
    -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent);
    mask-image: linear-gradient(90deg, #000 92%, transparent);
}
.section-links::-webkit-scrollbar { display: none; }
.section-links a {
    position: relative;
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 .7rem;
    white-space: nowrap;
    font-size: .875rem;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
}
.section-links a:hover { color: var(--link); }
.section-links a.active::after {
    content: '';
    position: absolute;
    left: .7rem;
    right: .7rem;
    bottom: -1px;
    height: 3px;
    background: var(--red);
}

/* Mobile drawer */
.drawer { --bs-offcanvas-width: 320px; --bs-offcanvas-bg: var(--bg); --bs-offcanvas-color: var(--text); }
.drawer .offcanvas-header { border-bottom: 1px solid var(--rule); }
.drawer-title {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--subtle);
    margin: 1.25rem 0 .25rem;
}
.drawer-links { list-style: none; margin: 0; padding: 0; }
.drawer-links a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .75rem 0;
    border-bottom: 1px solid var(--rule);
    color: var(--ink);
    font-family: var(--serif);
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
}
.drawer-links a i { color: var(--subtle); font-size: .8rem; }
.drawer-links--small a { font-family: var(--sans); font-size: .925rem; font-weight: 500; }

/* Breaking bar */
.breaking { border-bottom: 1px solid var(--rule); background: var(--bg-soft); }
.breaking .container {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 46px;
}
.breaking-label {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    flex-shrink: 0;
    background: var(--red);
    color: #fff;
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: .3rem .6rem;
    border-radius: 3px;
}
.breaking-label::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
}
.breaking-list {
    display: flex;
    gap: 2rem;
    overflow-x: auto;
    scrollbar-width: none;
    list-style: none;
    margin: 0;
    padding: 0;
    min-width: 0;
}
.breaking-list::-webkit-scrollbar { display: none; }
.breaking-list li { position: relative; flex-shrink: 0; }
.breaking-list li + li::before {
    content: '';
    position: absolute;
    left: -1rem;
    top: 50%;
    width: 4px;
    height: 4px;
    margin-top: -2px;
    border-radius: 50%;
    background: var(--subtle);
}
.breaking-list a {
    color: var(--ink);
    font-weight: 600;
    font-size: .9rem;
    text-decoration: none;
    white-space: nowrap;
}
.breaking-list a:hover { text-decoration: underline; }

/* ---------- Story building blocks ---------- */
.kicker {
    display: inline-block;
    margin-bottom: .4rem;
    font-family: var(--sans);
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--kicker);
    text-decoration: none;
    line-height: 1.3;
}
a.kicker:hover { text-decoration: underline; }

.headline {
    font-family: var(--serif);
    font-optical-sizing: auto;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.22;
    letter-spacing: -.005em;
    margin: 0 0 .45rem;
}
.headline a { color: inherit; text-decoration: none; }
.headline a:hover {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}
.headline-xl { font-size: clamp(1.75rem, 3vw, 2.4rem); line-height: 1.12; letter-spacing: -.015em; }
.headline-lg { font-size: clamp(1.25rem, 2vw, 1.5rem); line-height: 1.2; }
.headline-md { font-size: 1.2rem; }
.headline-sm { font-size: 1.05rem; line-height: 1.28; }
.headline-xs { font-size: .975rem; line-height: 1.3; font-weight: 600; }

.dek {
    color: var(--muted);
    font-size: .975rem;
    line-height: 1.5;
    margin: 0 0 .6rem;
}
.dek-lg { font-size: 1.1rem; }
.clamp-2, .clamp-3 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-2 { -webkit-line-clamp: 2; }
.clamp-3 { -webkit-line-clamp: 3; }

.meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    font-size: .78rem;
    color: var(--subtle);
    line-height: 1.4;
}
.meta > * + *::before {
    content: '·';
    margin: 0 .45rem;
}
.meta a { color: inherit; text-decoration: none; }
.meta a:hover { color: var(--ink); }

.media {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--bg-soft);
    aspect-ratio: 16 / 9;
    margin-bottom: .85rem;
}
.media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .5s var(--ease);
}
a.media:hover img { transform: scale(1.03); }
.media--3x2 { aspect-ratio: 3 / 2; }
.media--4x3 { aspect-ratio: 4 / 3; }
.media-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--navy) 0%, var(--brand-strong) 100%);
}
.media-fallback img {
    width: 38%;
    height: auto;
    object-fit: contain;
    filter: brightness(0) invert(1);
    opacity: .28;
    transform: none !important;
}

/* Story variants */
.story { position: relative; }

.story--lead .media { margin-bottom: 1rem; }
.story--lead .dek { font-size: 1.1rem; }

.story--horizontal {
    display: grid;
    grid-template-columns: 1fr 34%;
    gap: 1.5rem;
    align-items: start;
}
.story--horizontal .media { margin: 0; order: 2; }
.story--horizontal .story-body { order: 1; }

.story--mini {
    display: grid;
    grid-template-columns: 1fr 96px;
    gap: .9rem;
    align-items: start;
}
.story--mini .media { margin: 0; aspect-ratio: 4 / 3; order: 2; }
.story--mini .story-body { order: 1; }

.story-list > .story + .story,
.story-list > * + * {
    border-top: 1px solid var(--rule);
    padding-top: 1rem;
    margin-top: 1rem;
}
.story-list--tight > * + * { padding-top: .8rem; margin-top: .8rem; }

@media (max-width: 575.98px) {
    .story--horizontal { grid-template-columns: 1fr 110px; gap: 1rem; }
    .story--horizontal .media { aspect-ratio: 1 / 1; }
    .story--horizontal .headline-lg { font-size: 1.1rem; }
    .story--horizontal .dek { display: none; }
}

/* Column rules on wide screens */
@media (min-width: 992px) {
    .lg-rule { border-left: 1px solid var(--rule); }
}

/* ---------- Section headings ---------- */
.section { margin-bottom: 3rem; }
.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    border-top: 3px solid var(--rule-strong);
    padding-top: .65rem;
    margin-bottom: 1.25rem;
}
.section-head h2,
.section-head h3 {
    margin: 0;
    font-family: var(--sans);
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--ink);
}
.section-head h2 a,
.section-head h3 a { color: inherit; text-decoration: none; }
.section-head h2 a:hover,
.section-head h3 a:hover { color: var(--link); }
.section-head .more {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--link);
    text-decoration: none;
    white-space: nowrap;
}
.section-head .more:hover { text-decoration: underline; }
.section-head--sm { border-top-width: 2px; margin-bottom: 1rem; }
.section-head--sm h2,
.section-head--sm h3 { font-size: .8rem; }

.live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: .45rem;
    border-radius: 50%;
    background: var(--red);
    box-shadow: 0 0 0 3px rgba(215, 25, 32, .18);
    vertical-align: middle;
}

/* ---------- Home ---------- */
.home-top { padding-top: 1.75rem; }

.latest-rail { list-style: none; margin: 0; padding: 0; }
.latest-rail li {
    display: grid;
    grid-template-columns: 3.6rem 1fr;
    gap: .5rem;
    padding: .75rem 0;
    border-top: 1px solid var(--rule);
}
.latest-rail li:first-child { border-top: 0; padding-top: 0; }
.rail-time {
    font-size: .72rem;
    font-weight: 700;
    color: var(--red);
    font-variant-numeric: tabular-nums;
    padding-top: .2rem;
    white-space: nowrap;
}

.ranked { list-style: none; counter-reset: rank; margin: 0; padding: 0; }
.ranked li {
    counter-increment: rank;
    display: grid;
    grid-template-columns: 2.1rem 1fr;
    gap: .5rem;
    padding: .8rem 0;
    border-top: 1px solid var(--rule);
}
.ranked li:first-child { border-top: 0; padding-top: 0; }
.ranked li::before {
    content: counter(rank);
    font-family: var(--serif);
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
    color: var(--red);
}
.ranked a {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.3;
    color: var(--ink);
    text-decoration: none;
}
.ranked a:hover { text-decoration: underline; text-underline-offset: 3px; }
.ranked .meta { margin-top: .3rem; }

@media (min-width: 992px) {
    .ranked--row {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 0;
    }
    .ranked--row li,
    .ranked--row li:first-child {
        border-top: 0;
        padding: 0 1.1rem;
        border-left: 1px solid var(--rule);
    }
    .ranked--row li:first-child { border-left: 0; padding-left: 0; }
}
@media (min-width: 576px) and (max-width: 991.98px) {
    .ranked--row { display: grid; grid-template-columns: 1fr 1fr; column-gap: 2rem; }
    .ranked--row li:nth-child(2) { border-top: 0; padding-top: 0; }
}

.trending-band {
    background: var(--bg-soft);
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    padding: 1.5rem 0 1.75rem;
    margin-bottom: 3rem;
}
.trending-band .section-head { border-top: 0; padding-top: 0; }

.widget { margin-bottom: 2.25rem; }

.chip-list { display: flex; flex-wrap: wrap; gap: .45rem; list-style: none; margin: 0; padding: 0; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem .8rem;
    border: 1px solid var(--rule);
    border-radius: 999px;
    color: var(--ink);
    background: var(--surface);
    font-size: .8125rem;
    font-weight: 500;
    text-decoration: none;
    transition: background .15s ease, border-color .15s ease;
}
.chip:hover { background: var(--bg-soft); border-color: var(--subtle); color: var(--ink); }
.chip .count { color: var(--subtle); font-size: .75rem; }
.chip.active { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* ---------- Sponsored (affiliate) card ---------- */
.promo {
    container-type: inline-size;
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    background: var(--surface);
    padding: 1rem;
}
.promo-inner { display: grid; gap: .9rem; }
@container (min-width: 460px) {
    .promo-inner { grid-template-columns: 170px 1fr; align-items: center; gap: 1.25rem; }
}
.promo-label {
    display: block;
    font-size: .66rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--subtle);
}
.promo-media {
    aspect-ratio: 4 / 3;
    background: var(--bg-soft);
    border-radius: var(--radius);
    overflow: hidden;
}
.promo-media img { width: 100%; height: 100%; object-fit: contain; display: block; }
.promo-title {
    font-family: var(--serif);
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1.25;
    color: var(--ink);
    margin: .3rem 0;
}
.promo-desc { font-size: .875rem; color: var(--muted); margin: 0 0 .8rem; }
.promo-cta {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    background: var(--ink);
    color: var(--bg);
    padding: .5rem .95rem;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s ease;
}
.promo-cta:hover { background: var(--brand); color: #fff; }

/* ---------- Page heads (section, tag, search, static) ---------- */
.page-head {
    padding: 2rem 0 1.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--rule);
}
.eyebrow {
    display: inline-block;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--kicker);
    margin-bottom: .5rem;
    text-decoration: none;
}
.page-title {
    font-family: var(--serif);
    font-optical-sizing: auto;
    font-weight: 700;
    font-size: clamp(2.1rem, 5vw, 3.4rem);
    line-height: 1.05;
    letter-spacing: -.02em;
    color: var(--ink);
    margin: 0 0 .6rem;
}
.page-desc {
    font-family: var(--serif);
    font-size: 1.15rem;
    line-height: 1.5;
    color: var(--muted);
    max-width: 46rem;
    margin: 0 0 .75rem;
}
.page-count { font-size: .85rem; color: var(--subtle); margin: 0; }
.page-head .chip-list { margin-top: 1rem; }

.crumbs {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    list-style: none;
    margin: 0 0 .75rem;
    padding: 0;
    font-size: .8125rem;
    color: var(--subtle);
}
.crumbs li + li::before { content: '/'; margin-right: .35rem; color: var(--rule-strong); opacity: .35; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }

.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--muted);
}
.empty-state i { font-size: 2.5rem; color: var(--subtle); display: block; margin-bottom: 1rem; }
.empty-state h2 { font-family: var(--serif); font-size: 1.6rem; color: var(--ink); }

/* ---------- Article page ---------- */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: var(--red);
    z-index: 1100;
}

.article-page { padding-top: 2rem; }
.article-head { max-width: 50rem; }
.article-title {
    font-family: var(--serif);
    font-optical-sizing: auto;
    font-weight: 700;
    font-size: clamp(2rem, 4.4vw, 3.05rem);
    line-height: 1.1;
    letter-spacing: -.018em;
    color: var(--ink);
    margin: .15rem 0 1rem;
}
.article-dek {
    font-family: var(--serif);
    font-size: clamp(1.15rem, 1.8vw, 1.35rem);
    line-height: 1.45;
    color: var(--muted);
    margin: 0 0 1.5rem;
}

.byline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem 1rem;
    padding: .9rem 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    margin-bottom: 1.75rem;
}
.byline-author { display: flex; align-items: center; gap: .7rem; }
.avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--navy);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .9rem;
}
.byline-name { font-weight: 700; color: var(--ink); font-size: .9rem; line-height: 1.3; }
.byline-meta { font-size: .8rem; color: var(--subtle); line-height: 1.3; }
.byline-tools { margin-left: auto; display: flex; align-items: center; gap: .4rem; }
.tool-btn {
    height: 36px;
    min-width: 36px;
    padding: 0 .6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    border-radius: 999px;
    border: 1px solid var(--rule);
    background: transparent;
    color: var(--ink);
    font-size: .85rem;
    font-weight: 600;
    text-decoration: none;
    line-height: 1;
    transition: background .15s ease;
}
.tool-btn:hover { background: var(--bg-soft); color: var(--ink); }
.tool-btn:disabled { opacity: .35; cursor: default; }
.tool-btn.is-done { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.article-figure { margin: 0 0 2rem; }
.article-figure img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius);
    background: var(--bg-soft);
}

.article-body { max-width: 42rem; }

.article-foot { max-width: 42rem; margin-top: 2.5rem; }
.article-foot-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    padding: 1rem 0;
    border-top: 1px solid var(--rule);
}
.article-foot-row:last-child { border-bottom: 1px solid var(--rule); }
.article-foot-label {
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--subtle);
    margin-right: .5rem;
}
.share-btn {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--rule);
    color: var(--ink);
    font-size: 1rem;
    text-decoration: none;
    background: transparent;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.share-btn:hover { color: #fff; border-color: transparent; }
.share-btn.facebook:hover { background: #1877f2; }
.share-btn.x:hover { background: #000; }
.share-btn.whatsapp:hover { background: #25d366; }
.share-btn.telegram:hover { background: #229ed9; }
.share-btn.linkedin:hover { background: #0a66c2; }
.share-btn.copy:hover { background: var(--ink); color: var(--bg); }

@media (min-width: 992px) {
    .rail-sticky { position: sticky; top: calc(var(--nav-h) + 1.5rem); }
}

/* Article body typography (articles + static pages) */
.article-content {
    font-family: var(--serif);
    font-size: var(--reading-size);
    line-height: 1.75;
    color: var(--text);
    overflow-wrap: break-word;
    font-feature-settings: "kern", "liga";
}
.article-content > *:first-child { margin-top: 0; }
.article-content p { margin: 0 0 1.35em; }
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
    font-family: var(--serif);
    font-weight: 700;
    color: var(--ink);
    line-height: 1.25;
    letter-spacing: -.01em;
    margin: 1.9em 0 .6em;
}
.article-content h2 { font-size: 1.5em; }
.article-content h3 { font-size: 1.22em; }
.article-content h4,
.article-content h5,
.article-content h6 { font-size: 1.05em; }
.article-content a {
    color: var(--link);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}
.article-content a:hover { text-decoration-thickness: 2px; }
.article-content strong,
.article-content b { color: var(--ink); font-weight: 700; }
.article-content ul,
.article-content ol { margin: 0 0 1.35em; padding-left: 1.4em; }
.article-content li { margin-bottom: .5em; padding-left: .2em; }
.article-content li::marker { color: var(--subtle); }
.article-content blockquote {
    margin: 2em 0;
    padding: .1em 0 .1em 1.25em;
    border-left: 3px solid var(--red);
    font-size: 1.1em;
    font-style: italic;
    color: var(--ink);
}
.article-content blockquote p:last-child { margin-bottom: 0; }
.article-content img,
.article-content video,
.article-content iframe {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 2em auto;
    border-radius: var(--radius);
}
.article-content iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; }
.article-content figure { margin: 2em 0; }
.article-content figure img { margin: 0 auto; }
.article-content figcaption {
    font-family: var(--sans);
    font-size: .8125rem;
    color: var(--subtle);
    margin-top: .6rem;
}
.article-content hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5em 0; opacity: 1; }
.article-content table {
    width: 100%;
    margin: 2em 0;
    border-collapse: collapse;
    font-family: var(--sans);
    font-size: .85em;
    line-height: 1.5;
}
.article-content th,
.article-content td {
    padding: .6em .8em;
    border-bottom: 1px solid var(--rule);
    text-align: left;
    vertical-align: top;
}
.article-content th { color: var(--ink); font-weight: 600; background: var(--bg-soft); }
.article-content code {
    font-size: .85em;
    background: var(--bg-soft);
    padding: .15em .4em;
    border-radius: 4px;
    color: var(--ink);
}
.article-content pre {
    background: var(--bg-soft);
    padding: 1em 1.25em;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: .85em;
    margin: 0 0 1.5em;
}
.article-content pre code { background: none; padding: 0; }

/* ---------- Static pages ---------- */
.prose-page { max-width: 46rem; margin: 0 auto; }
.prose-page .article-content { --reading-size: 1.125rem; }

.ad-hero {
    background: var(--navy);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: clamp(2rem, 5vw, 3.5rem);
    margin: 2rem 0 2.5rem;
}
.ad-hero .eyebrow { color: #ff8a8f; }
.ad-hero h1 {
    font-family: var(--serif);
    font-weight: 700;
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    line-height: 1.05;
    letter-spacing: -.02em;
    margin: 0 0 .75rem;
    color: #fff;
}
.ad-hero p { font-size: 1.15rem; color: rgba(255, 255, 255, .82); max-width: 36rem; margin-bottom: 1.5rem; }
.stat {
    border-top: 3px solid var(--rule-strong);
    padding-top: .8rem;
}
.stat-number {
    font-family: var(--serif);
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.1;
}
.stat-label { color: var(--muted); font-size: .9rem; }
.feature-item i { font-size: 1.4rem; color: var(--brand); }
.feature-item h3 { font-family: var(--serif); font-size: 1.15rem; font-weight: 700; color: var(--ink); margin: .5rem 0 .35rem; }
.feature-item p { color: var(--muted); font-size: .95rem; margin: 0; }
.data-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.data-table th {
    text-align: left;
    font-size: .72rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--subtle);
    font-weight: 700;
    padding: .6rem .75rem .6rem 0;
    border-bottom: 1px solid var(--rule-strong);
}
.data-table td { padding: .8rem .75rem .8rem 0; border-bottom: 1px solid var(--rule); color: var(--text); }
.data-table td:first-child { font-weight: 600; color: var(--ink); }

/* ---------- Buttons ---------- */
.btn-ink {
    --bs-btn-bg: var(--ink);
    --bs-btn-color: var(--bg);
    --bs-btn-border-color: var(--ink);
    --bs-btn-hover-bg: var(--brand);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-bg: var(--brand-strong);
    --bs-btn-active-color: #fff;
    --bs-btn-active-border-color: var(--brand-strong);
    --bs-btn-font-weight: 600;
    border-radius: 999px;
}
.btn-line {
    --bs-btn-color: var(--ink);
    --bs-btn-border-color: var(--rule);
    --bs-btn-hover-bg: var(--bg-soft);
    --bs-btn-hover-color: var(--ink);
    --bs-btn-hover-border-color: var(--subtle);
    --bs-btn-active-bg: var(--bg-soft);
    --bs-btn-active-color: var(--ink);
    --bs-btn-font-weight: 600;
    border-radius: 999px;
}
.btn-light-solid {
    --bs-btn-bg: #fff;
    --bs-btn-color: var(--navy);
    --bs-btn-border-color: #fff;
    --bs-btn-hover-bg: #e8eefb;
    --bs-btn-hover-color: var(--navy);
    --bs-btn-hover-border-color: #e8eefb;
    --bs-btn-font-weight: 700;
    border-radius: 999px;
}

/* ---------- Pagination ---------- */
.pagination {
    --bs-pagination-color: var(--ink);
    --bs-pagination-bg: var(--surface);
    --bs-pagination-border-color: var(--rule);
    --bs-pagination-hover-color: var(--ink);
    --bs-pagination-hover-bg: var(--bg-soft);
    --bs-pagination-hover-border-color: var(--rule);
    --bs-pagination-focus-color: var(--ink);
    --bs-pagination-focus-bg: var(--bg-soft);
    --bs-pagination-focus-box-shadow: 0 0 0 3px rgba(11, 79, 174, .2);
    --bs-pagination-active-color: var(--bg);
    --bs-pagination-active-bg: var(--ink);
    --bs-pagination-active-border-color: var(--ink);
    --bs-pagination-disabled-color: var(--subtle);
    --bs-pagination-disabled-bg: var(--surface);
    --bs-pagination-disabled-border-color: var(--rule);
    gap: .35rem;
    flex-wrap: wrap;
    justify-content: center;
}
.pagination .page-link {
    border-radius: var(--radius) !important;
    min-width: 2.5rem;
    text-align: center;
    font-weight: 600;
    font-size: .9rem;
}
.pagination-wrap { margin-top: 2.5rem; }
.pagination-wrap nav > div:first-child { display: none !important; }
.pagination-wrap nav > div:last-child { flex-direction: column; align-items: center !important; gap: .75rem; }
.pagination-wrap .small.text-muted { color: var(--subtle) !important; }

/* ---------- Footer ---------- */
.site-footer {
    background: var(--bg-soft);
    border-top: 1px solid var(--rule);
    margin-top: 4rem;
    padding-top: 3rem;
    font-size: .9rem;
}
.footer-logo { height: 52px; width: auto; display: block; }
.footer-tagline {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--subtle);
    margin: .9rem 0 .5rem;
}
.footer-about { color: var(--muted); max-width: 22rem; margin: 0; }
.footer-col h2 {
    font-family: var(--sans);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--ink);
    margin: 0 0 .9rem;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: .55rem; }
.footer-col a { color: var(--muted); text-decoration: none; }
.footer-col a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

.newsletter p { color: var(--muted); margin-bottom: .75rem; }
.newsletter-form { display: flex; gap: .4rem; }
.newsletter-form input {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--rule);
    background: var(--surface);
    color: var(--ink);
    border-radius: 999px;
    padding: .55rem 1rem;
    font-size: .9rem;
}
.newsletter-form input:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11, 79, 174, .15); }
.newsletter-form button {
    border: 0;
    background: var(--ink);
    color: var(--bg);
    border-radius: 999px;
    padding: .55rem 1.1rem;
    font-weight: 600;
    font-size: .875rem;
    white-space: nowrap;
}
.newsletter-form button:hover { background: var(--brand); color: #fff; }
.newsletter-form button:disabled { opacity: .6; }
.newsletter-status { font-size: .8125rem; margin-top: .5rem; min-height: 1.2em; }
.newsletter-status.is-ok { color: #1a7f37; }
.newsletter-status.is-error { color: var(--kicker); }
[data-bs-theme="dark"] .newsletter-status.is-ok { color: #4ac26b; }
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.footer-bottom {
    border-top: 1px solid var(--rule);
    margin-top: 2.5rem;
    padding: 1.1rem 0;
    color: var(--subtle);
    font-size: .8125rem;
}
.footer-bottom .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; }
.footer-bottom a { color: var(--subtle); text-decoration: none; }
.footer-bottom a:hover { color: var(--ink); }

/* Back to top */
.to-top {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1030;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: var(--ink);
    color: var(--bg);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { background: var(--brand); color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .brand-logo { height: 46px; }
}

@media (max-width: 767.98px) {
    :root { --reading-size: 1.0625rem; }
    [data-reading-size="sm"] { --reading-size: 1rem; }
    [data-reading-size="lg"] { --reading-size: 1.1875rem; }
    [data-reading-size="xl"] { --reading-size: 1.3125rem; }

    .masthead .container { padding-top: 10px; padding-bottom: 10px; }
    .brand-logo { height: 40px; }
    .article-page { padding-top: 1.25rem; }
    .byline-tools { margin-left: 0; }
    .article-content table { display: block; overflow-x: auto; }
    .section { margin-bottom: 2.5rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

@media print {
    .topbar, .masthead, .section-nav, .search-panel, .breaking, .site-footer,
    .to-top, .reading-progress, .article-rail, .article-foot, .byline-tools,
    .promo, .related { display: none !important; }
    body { background: #fff; color: #000; }
    .article-content { font-size: 12pt; line-height: 1.5; }
    .article-content a { color: #000; }
}
