/* Blog: /blog and /blog/{slug} (blog.php) */
/* One column: text, charts and the post header share the same left and right edges */
.blog {
    max-width: 840px;
    margin: 0 auto;
    padding: 40px 0 72px;
}
.blog-title {
    font-size: 32px;
    line-height: 1.2;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.blog-intro {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}
.blog-empty {
    color: var(--text-tertiary);
}
.blog-list {
    list-style: none;
    border-top: 1px solid var(--border-light);
}
.blog-list-item {
    display: block;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-light);
    color: inherit;
    text-decoration: none;
}
.blog-list-item time {
    font-size: 13px;
    color: var(--text-tertiary);
}
.blog-list-item h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 4px 0 6px;
    color: var(--text-primary);
}
.blog-list-item:hover h2 {
    color: var(--accent);
}
.blog-list-item p {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.55;
}

.blog-back {
    display: inline-block;
    font-size: 14px;
    color: var(--text-secondary);
    text-decoration: none;
    margin-bottom: 20px;
}
.blog-back:hover {
    color: var(--accent);
}
.blog-draft-note {
    background: var(--accent-light);
    color: var(--accent-hover);
    border-radius: var(--radius);
    padding: 8px 12px;
    font-size: 14px;
    margin-bottom: 16px;
}
.blog-meta {
    font-size: 14px;
    color: var(--text-tertiary);
    margin-bottom: 32px;
}

.blog-body {
    font-size: 17px;
    line-height: 1.7;
    color: var(--text-primary);
}
.blog-body > * + * {
    margin-top: 1em;
}
.blog-body h2 {
    font-size: 22px;
    line-height: 1.3;
    font-weight: 600;
    margin-top: 2em;
}
.blog-body h3 {
    font-size: 18px;
    font-weight: 600;
    margin-top: 1.6em;
}
.blog-body ul,
.blog-body ol {
    padding-left: 24px;
}
.blog-body li + li {
    margin-top: 0.4em;
}
.blog-body a {
    color: var(--accent);
    text-decoration: none;
}
.blog-body a:hover {
    text-decoration: underline;
}
.blog-body blockquote {
    border-left: 3px solid var(--border);
    padding-left: 16px;
    color: var(--text-secondary);
}

/* Data blocks (includes/blog.php) */
.blog-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
}
.blog-ranking {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}
.blog-ranking th,
.blog-ranking td {
    padding: 9px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}
.blog-ranking th {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-secondary);
}
.blog-ranking tbody tr:last-child td {
    border-bottom: none;
}
.blog-ranking .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.blog-ranking th.num:first-child,
.blog-ranking td.num:first-child {
    text-align: left;
    width: 3em;
    color: var(--text-tertiary);
}
.blog-body .blog-table-note {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-tertiary);
}
.rank-up { color: var(--success); }
.rank-down { color: var(--error); }
.rank-same { color: var(--text-tertiary); }
.rank-new {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
}

/* Charts (includes/blog.php). Ink and chrome follow the chart palette, not the series colours. */
.blog-figure {
    margin: 2.2em 0;
    padding: 24px 28px 20px;
    background: #fcfcfb;
    border: 1px solid rgba(11, 11, 11, 0.08);
    border-radius: var(--radius-lg);
}
.fig-title {
    font-size: 17px;
    font-weight: 600;
    line-height: 1.35;
    color: #0b0b0b;
}
.blog-body .fig-sub {
    margin-top: 4px;
    font-size: 14px;
    line-height: 1.5;
    color: #52514e;
}
.fig-legend {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin: 14px 0 0;
    padding: 0 !important;
    font-size: 13px;
    color: #52514e;
}
.fig-legend li {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0 !important;
}
.fig-swatch {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex: none;
}
.blog-body .fig-note {
    margin-top: 14px;
    font-size: 12px;
    color: #898781;
}
.fig-table {
    margin-top: 16px;
    font-size: 13px;
}
.fig-table summary {
    cursor: pointer;
    color: #52514e;
    font-weight: 500;
    width: fit-content;
}
.fig-table summary:hover { color: var(--accent); }
.fig-table[open] summary { margin-bottom: 10px; }
.fig-table .blog-table-wrap { background: #fff; }

/* Horizontal bars: label | bar with its value at the tip */
.bar-chart {
    margin-top: 18px;
    display: grid;
    gap: 6px;
}
.bc-row {
    display: grid;
    grid-template-columns: 190px 1fr;
    align-items: center;
    gap: 14px;
    min-height: 26px;
}
.bc-label {
    font-size: 14px;
    color: #0b0b0b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.blog-body .bc-label a { color: #0b0b0b; }
.blog-body .bc-label a:hover { color: var(--accent); }
.bc-rank {
    display: inline-block;
    width: 24px;
    color: #898781;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}
.bc-track {
    display: flex;
    align-items: center;
    gap: 8px;
}
.bc-bar {
    position: relative;
    display: block;
    height: 18px;
    width: calc(var(--w) * (100% - 64px));
    border-radius: 0 4px 4px 0;
    outline: none;
    transition: filter 0.15s;
}
/* Highlighted rows: name and value in a darker step of the bar's blue, which reads as text on the light surface */
.blog-body .bc-row--em .bc-label a,
.bc-row--em .bc-label,
.bc-row--em .bc-value {
    color: #1c5cab;
    font-weight: 600;
}
.bc-row--em .bc-rank { color: #1c5cab; }
.bc-value {
    font-size: 13px;
    color: #52514e;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Hover / focus tooltip on any mark with data-tip */
.bc-bar:hover,
.bc-bar:focus-visible,
.split-part:hover,
.split-part:focus-visible { filter: brightness(0.92); }
.bc-bar[data-tip]:hover::after,
.bc-bar[data-tip]:focus-visible::after,
.split-part[data-tip]:hover::after,
.split-part[data-tip]:focus-visible::after {
    content: attr(data-tip);
    position: absolute;
    left: 0;
    bottom: calc(100% + 8px);
    z-index: 5;
    padding: 6px 10px;
    border-radius: 6px;
    background: #0b0b0b;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Tall segmented bar: one whole split into parts, share printed inside */
.split-bar {
    display: flex;
    gap: 2px;
    margin-top: 16px;
    height: 28px;
}
.split-part {
    position: relative;
    flex-basis: 0;
    min-width: 2px;
    display: flex;
    align-items: center;
    padding-left: 8px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    outline: none;
    cursor: default;
}

/* Head-to-head pairs */
.pair-chart {
    margin-top: 18px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px 40px;
}
.pair { display: grid; gap: 6px; align-content: start; }
.pair .bc-row { grid-template-columns: 130px 1fr; }
.pair .bar-chart { margin: 0; }
.pair-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e1e0d9;
}
.pair-group {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #52514e;
}
.pair-gap {
    font-size: 13px;
    color: #898781;
    white-space: nowrap;
}

/* Key numbers */
.blog-stat-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin: 2em 0;
}
.blog-stat {
    padding: 18px 18px 16px;
    background: #fcfcfb;
    border: 1px solid rgba(11, 11, 11, 0.08);
    border-radius: var(--radius-lg);
}
.blog-stat-value {
    font-size: 30px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.01em;
    color: #0b0b0b;
}
.blog-stat-label {
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.4;
    color: #52514e;
}

@media (max-width: 800px) {
    .pair-chart { grid-template-columns: 1fr; }
    .blog-stat-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .blog { padding-top: 20px; }
    .blog-title { font-size: 26px; }
    .blog-ranking { font-size: 14px; }
    .blog-ranking th,
    .blog-ranking td { padding: 8px; }
    .blog-ranking td:nth-child(2) { white-space: normal; }
    .blog-figure { padding: 18px 16px 16px; margin-left: -4px; margin-right: -4px; }
    .bc-row { grid-template-columns: 1fr; gap: 2px; }
    .bar-chart { gap: 10px; }
    .pair .bc-row { grid-template-columns: 1fr; }
    .blog-stat-value { font-size: 24px; }
}

/* Call-to-action box inside a post: <div class="blog-cta"><p class="blog-cta-kicker">…</p><p class="blog-cta-title">…</p><p>…</p><a class="blog-cta-btn" href="…">…</a></div> */
.blog-body .blog-cta {
    margin: 2.4em 0;
    padding: 26px 28px;
    border-radius: var(--radius-lg);
    background: #0d366b;
    color: #fff;
}
.blog-body .blog-cta p { color: #cde2fb; font-size: 16px; }
.blog-body .blog-cta .blog-cta-kicker {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #86b6ef;
}
.blog-body .blog-cta .blog-cta-title {
    margin-top: 6px;
    font-size: 21px;
    font-weight: 700;
    line-height: 1.3;
    color: #fff;
}
.blog-body .blog-cta > * + * { margin-top: 10px; }
.blog-body .blog-cta .blog-cta-btn {
    display: inline-block;
    margin-top: 16px;
    padding: 10px 18px;
    border-radius: 8px;
    background: #fff;
    color: #0d366b;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
}
.blog-body .blog-cta .blog-cta-btn:hover { background: #cde2fb; text-decoration: none; }
.blog-body .blog-cta .blog-cta-btn + .blog-cta-btn { margin-left: 8px; background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.35); }
.blog-body .blog-cta .blog-cta-btn + .blog-cta-btn:hover { background: rgba(255,255,255,0.08); }

/* ---------- /blog index ---------- */
.blog-index { max-width: 1040px; }
.blog-hero {
    padding: 8px 0 32px;
    margin-bottom: 32px;
    border-bottom: 1px solid var(--border-light);
}
.blog-kicker {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
}
.blog-hero-title {
    margin-top: 10px;
    max-width: 760px;
    font-size: 40px;
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}
.blog-hero-intro {
    margin-top: 14px;
    max-width: 640px;
    font-size: 18px;
    line-height: 1.55;
    color: var(--text-secondary);
}

/* Featured (latest) post: photo on the left, text on the right */
.blog-featured {
    border: 1px solid rgba(11, 11, 11, 0.08);
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 8px 24px rgba(11, 11, 11, 0.05);
}
.blog-featured-link {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    color: inherit;
    text-decoration: none;
}
.blog-featured--no-img .blog-featured-link { grid-template-columns: 1fr; }
.blog-featured-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px 44px;
}
.blog-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    font-size: 13px;
    color: var(--text-tertiary);
}
.blog-badge {
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: var(--accent-light);
    color: var(--accent-hover);
    font-size: 12px;
    font-weight: 600;
}
.blog-featured-title {
    margin-top: 14px;
    font-size: 28px;
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}
.blog-featured-desc {
    margin-top: 12px;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-secondary);
}
.blog-read-more {
    margin-top: auto;
    padding-top: 22px;
    font-size: 15px;
    font-weight: 600;
    color: var(--accent);
}
.blog-featured-link:hover .blog-featured-title,
.blog-card:hover .blog-card-title { color: var(--accent); }
.blog-featured-link:hover .blog-read-more span,
.blog-card:hover .blog-read-more span { margin-left: 3px; }
.blog-read-more span { transition: margin 0.15s; }

/* Earlier posts: one column, date on the left */
.blog-section-title {
    margin: 48px 0 4px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}
.blog-grid {
    list-style: none;
    border-top: 1px solid var(--border-light);
}
.blog-grid li { border-bottom: 1px solid var(--border-light); }
.blog-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 32px;
    gap: 24px;
    align-items: start;
    padding: 28px 12px;
    margin: 0 -12px;
    border-radius: var(--radius-lg);
    color: inherit;
    text-decoration: none;
    transition: background 0.15s;
}
.blog-card:hover { background: var(--bg-secondary); }
.blog-card .blog-card-meta { margin-top: 10px; }
.blog-card-title {
    font-size: 20px;
    line-height: 1.3;
    font-weight: 600;
    color: var(--text-primary);
}
.blog-card-desc {
    margin-top: 8px;
    max-width: 680px;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-secondary);
}
.blog-card-arrow {
    padding-top: 2px;
    font-size: 20px;
    color: var(--text-tertiary);
    transition: transform 0.15s, color 0.15s;
}
.blog-card:hover .blog-card-arrow { color: var(--accent); transform: translateX(3px); }

@media (max-width: 860px) {
    .blog-featured-link { grid-template-columns: 1fr; }
    .blog-featured-img { min-height: 0; aspect-ratio: 16 / 9; height: auto; }
}
@media (max-width: 640px) {
    .blog-card { grid-template-columns: 1fr; padding: 22px 8px; margin: 0 -8px; }
    .blog-card-arrow { display: none; }
    .blog-card-title { font-size: 18px; }
    .blog-hero-title { font-size: 30px; }
    .blog-hero-intro { font-size: 16px; }
    .blog-featured-main { padding: 26px 22px; }
    .blog-featured-title { font-size: 23px; }
}

/* Cover images (sql/73-add-blog-cover-images.sql) */
.blog-cover { margin: -8px 0 36px; }
.blog-cover img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--radius-lg);
    background: var(--bg-tertiary);
}
.blog-cover figcaption {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-tertiary);
}
.blog-cover figcaption a { color: inherit; text-decoration: underline; text-decoration-color: var(--border); }
.blog-cover figcaption a:hover { color: var(--text-secondary); }

.blog-featured-img {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 300px;
    object-fit: cover;
    background: var(--bg-tertiary);
}

.blog-card { grid-template-columns: minmax(0, 1fr) 200px; }
.blog-card-img {
    display: block;
    width: 200px;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--radius);
    background: var(--bg-tertiary);
}
@media (max-width: 640px) {
    .blog-featured-img { min-height: 0; aspect-ratio: 16 / 9; height: auto; }
    .blog-card { grid-template-columns: 1fr; }
    .blog-card-img { order: -1; width: 100%; margin-bottom: 4px; }
}
