/* ==========================================================================
   Blog - /blog.php (listing + detail)
   Loaded only on the blog. Colour, type and layout tokens are inherited
   from style.css / result-ui.css / record.css.
   ========================================================================== */

.section--blog { margin-bottom: 16px; }
.section--blog .crumbs { margin-bottom: 8px; }

/* --------------------------------------------------------------------------
   Stats row inside the dark hero
   -------------------------------------------------------------------------- */
.blog-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}
.blog-stats__item {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 84px;
    padding: 7px 13px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .16);
}
.blog-stats__item strong {
    font-size: var(--font-size-lg);
    font-weight: var(--weight-bold);
    color: var(--accent);
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}
.blog-stats__item span {
    font-size: var(--font-size-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: #9fb0c3;
}

/* --------------------------------------------------------------------------
   Toolbar: search + category chips + sort
   -------------------------------------------------------------------------- */
.blog-toolbar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    margin-bottom: 12px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.blog-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.blog-search__icon {
    position: absolute;
    left: 11px;
    width: 16px;
    height: 16px;
    color: var(--ink-mute);
    pointer-events: none;
}
.blog-search__input {
    flex: 1 1 200px;
    min-width: 0;
    min-height: 42px;
    padding: 9px 38px 9px 34px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--ground);
    font-family: inherit;
    font-size: var(--font-size-sm-plus);
    font-weight: var(--weight-medium);
    color: var(--ink);
}
.blog-search__input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    background: #fff;
    border-color: var(--accent);
}
.blog-search__clear {
    position: absolute;
    right: 96px;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--line);
    color: var(--ink-soft);
}
.blog-search__clear .icon { width: 12px; height: 12px; }
.blog-search__clear:hover { background: var(--ink); color: #fff; }
.blog-search__btn {
    min-height: 42px;
    padding: 0 18px;
    border-radius: 8px;
    background: var(--brand);
    color: var(--accent);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-wide);
}
.blog-search__btn:hover { background: #232f45; color: var(--accent); }

.blog-toolbar__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.blog-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.blog-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 13px;
    border-radius: 999px;
    background: var(--ground);
    border: 1px solid var(--line);
    color: var(--ink-soft);
    font-size: var(--font-size-sm);
    font-weight: var(--weight-semibold);
    white-space: nowrap;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.blog-chip:hover {
    background: var(--next-bg);
    border-color: var(--next);
    color: var(--next);
    text-decoration: none;
}
.blog-chip.is-active {
    background: var(--brand);
    border-color: var(--brand);
    color: var(--accent);
}
.blog-chip__count {
    display: inline-grid;
    place-items: center;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    border-radius: 999px;
    background: rgba(16, 20, 24, .1);
    font-size: var(--font-size-xs);
    font-weight: var(--weight-bold);
    color: inherit;
}
.blog-chip.is-active .blog-chip__count {
    background: rgba(245, 179, 1, .25);
    color: var(--accent);
}

.blog-sort {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--font-size-sm);
    font-weight: var(--weight-semibold);
    color: var(--ink-mute);
}
.blog-sort__select {
    min-height: 36px;
    padding: 5px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--ground);
    font-family: inherit;
    font-size: var(--font-size-sm);
    font-weight: var(--weight-semibold);
    color: var(--ink);
    cursor: pointer;
}
.blog-sort__select:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

/* --------------------------------------------------------------------------
   Featured (latest) post
   -------------------------------------------------------------------------- */
.blog-featured {
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
    margin-bottom: 14px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-top: 4px solid var(--accent);
    border-radius: 14px;
    box-shadow: 0 6px 20px rgba(16, 20, 24, .08);
    color: var(--ink);
    transition: transform .16s ease, box-shadow .16s ease;
}
.blog-featured:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(11, 94, 168, .16);
    text-decoration: none;
}
.blog-featured__media {
    display: block;
    background: var(--ground);
    line-height: 0;
}
.blog-featured__media img {
    width: 100%;
    height: 170px;
    object-fit: cover;
}
.blog-featured__body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
    padding: 15px 14px 16px;
}
.blog-featured__badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 11px;
    border-radius: 999px;
    background: var(--live);
    color: #fff;
    font-size: var(--font-size-xs);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-wider);
    text-transform: uppercase;
}
.blog-featured__title {
    font-size: clamp(1.15rem, 2vw + .8rem, 1.55rem);
    font-weight: var(--weight-bold);
    line-height: var(--line-heading);
    color: var(--brand);
}
.blog-featured:hover .blog-featured__title { color: var(--next); }
.blog-featured__excerpt {
    font-size: var(--font-size-sm-plus);
    line-height: var(--line-normal);
    color: var(--ink-soft);
}

/* --------------------------------------------------------------------------
   Post grid + cards
   -------------------------------------------------------------------------- */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.blog-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background: var(--paper);
    border: 1px solid var(--line);
    border-left: 4px solid var(--accent);
    border-radius: 12px;
    box-shadow: var(--shadow);
    color: var(--ink);
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.blog-card:hover {
    transform: translateY(-3px);
    border-color: var(--next);
    border-left-color: var(--accent);
    box-shadow: 0 12px 24px rgba(11, 94, 168, .16);
    text-decoration: none;
}
.blog-card__media {
    display: block;
    background: var(--ground);
    line-height: 0;
    border-bottom: 1px solid var(--line-soft);
}
.blog-card__media img {
    width: 100%;
    height: 130px;
    object-fit: cover;
}
.blog-card__body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    gap: 7px;
    padding: 12px 12px 13px;
}
.blog-card__cat {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--next-bg);
    border: 1px solid #c8ddf5;
    color: var(--next);
    font-size: var(--font-size-xs);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
}
.blog-card__title {
    font-size: var(--font-size-md);
    font-weight: var(--weight-bold);
    line-height: 1.35;
    color: var(--brand);
    overflow-wrap: break-word;
}
.blog-card:hover .blog-card__title { color: var(--next); }
.blog-card__excerpt {
    flex: 1 1 auto;
    font-size: var(--font-size-sm);
    line-height: var(--line-normal);
    color: var(--ink-mute);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.blog-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding-top: 7px;
    margin-top: auto;
    border-top: 1px dashed var(--line);
    font-size: var(--font-size-xs);
    font-weight: var(--weight-semibold);
    color: var(--ink-mute);
}
.blog-card__meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.blog-card__meta-item .icon { width: 13px; height: 13px; }
.blog-card__meta-item--go {
    margin-left: auto;
    color: var(--next);
}
.blog-card:hover .blog-card__meta-item--go { color: var(--brand); }

/* --------------------------------------------------------------------------
   Pagination + prev/next post cards
   -------------------------------------------------------------------------- */
.blog-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 16px 0 4px;
}
.blog-pager__link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 38px;
    padding: 6px 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    color: var(--ink-soft);
    font-size: var(--font-size-sm);
    font-weight: var(--weight-semibold);
    box-shadow: var(--shadow);
}
.blog-pager__link .icon { width: 14px; height: 14px; }
.blog-pager__link:hover {
    background: var(--next-bg);
    border-color: var(--next);
    color: var(--next);
    text-decoration: none;
}
.blog-pager__link.is-current {
    background: var(--brand);
    border-color: var(--brand);
    color: var(--accent);
}
.blog-pager__link.is-disabled {
    opacity: .45;
    pointer-events: none;
}
.blog-pager__gap {
    padding: 0 3px;
    color: var(--ink-mute);
}

.blog-pager--single {
    align-items: stretch;
}
.blog-pager__card {
    flex: 1 1 220px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 11px 13px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow);
    color: var(--ink);
    min-width: 0;
}
.blog-pager__card:hover {
    border-color: var(--next);
    background: var(--next-bg);
    text-decoration: none;
}
.blog-pager__card--empty {
    visibility: hidden;
    box-shadow: none;
    border: 0;
}
.blog-pager__card--next { text-align: right; }
.blog-pager__dir {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: var(--font-size-xs);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-wider);
    text-transform: uppercase;
    color: var(--next);
}
.blog-pager__card--next .blog-pager__dir { justify-content: flex-end; }
.blog-pager__dir .icon { width: 13px; height: 13px; }
.blog-pager__title {
    font-size: var(--font-size-sm-plus);
    font-weight: var(--weight-bold);
    line-height: 1.35;
    color: var(--brand);
    overflow-wrap: break-word;
}
.blog-pager__note {
    font-size: var(--font-size-xs);
    color: var(--ink-mute);
}

/* --------------------------------------------------------------------------
   Detail: meta row, share row, reading progress
   -------------------------------------------------------------------------- */
.section--blog .blog-card__cat {
    margin-top: 6px;
    background: rgba(255, 255, 255, .1);
    border-color: rgba(255, 255, 255, .28);
    color: var(--accent);
}
.section--blog .blog-card__cat:hover {
    background: rgba(245, 179, 1, .2);
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
}

.blog-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 10px;
}
.blog-meta__item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--font-size-sm);
    font-weight: var(--weight-semibold);
    color: #b9c6d8;
}
.blog-meta__icon { width: 14px; height: 14px; color: var(--accent); }

.blog-share {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    margin-top: 13px;
}
.blog-share__label {
    font-size: var(--font-size-xs);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-wider);
    text-transform: uppercase;
    color: #9fb0c3;
}
.blog-share__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 5px 13px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .22);
    color: #e6ecf4;
    font-family: inherit;
    font-size: var(--font-size-xs);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.blog-share__btn .icon { width: 14px; height: 14px; }
.blog-share__btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #141414;
    transform: translateY(-1px);
    text-decoration: none;
}
.blog-share__btn.is-done {
    background: var(--done);
    border-color: var(--done);
    color: #fff;
}

.blog-progress {
    position: sticky;
    top: 0;
    z-index: 60;
    height: 4px;
    background: var(--line-soft);
    overflow: hidden;
}
.blog-progress__bar {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--next));
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform .1s linear;
}

/* --------------------------------------------------------------------------
   Detail: table of contents, article body, tags
   -------------------------------------------------------------------------- */
.blog-toc {
    margin: 14px 0;
    padding: 13px 14px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-left: 4px solid var(--next);
    border-radius: 10px;
    box-shadow: var(--shadow);
}
.blog-toc__title {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: var(--font-size-sm-plus);
    font-weight: var(--weight-bold);
    color: var(--brand);
    margin-bottom: 7px;
}
.blog-toc__title .icon { width: 15px; height: 15px; color: var(--next); }
.blog-toc__list {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 5px;
}
.blog-toc__list a {
    font-size: var(--font-size-sm-plus);
    font-weight: var(--weight-semibold);
    color: var(--next);
    text-decoration: none;
}
.blog-toc__list a:hover { text-decoration: underline; }
.blog-toc__list a.is-current {
    color: var(--brand);
    font-weight: var(--weight-bold);
}

.blog-article__media {
    margin: 14px 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    line-height: 0;
    box-shadow: var(--shadow);
}
.blog-article__media img {
    width: 100%;
    height: auto;
    max-height: 340px;
    object-fit: cover;
}

.blog-article__body h2 {
    scroll-margin-top: 16px;
}

.blog-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 16px 0 4px;
    padding-top: 12px;
    border-top: 1px solid var(--line-soft);
}
.blog-tags__label {
    font-size: var(--font-size-xs);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-wider);
    text-transform: uppercase;
    color: var(--ink-mute);
}
.blog-tag {
    display: inline-flex;
    padding: 4px 11px;
    border-radius: 999px;
    background: var(--ground);
    border: 1px solid var(--line);
    color: var(--ink-soft);
    font-size: var(--font-size-xs);
    font-weight: var(--weight-semibold);
}
.blog-tag:hover {
    background: var(--next-bg);
    border-color: var(--next);
    color: var(--next);
    text-decoration: none;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (min-width: 768px) {
    .blog-featured { flex-direction: row; }
    .blog-featured__media {
        flex: 0 0 44%;
        max-width: 44%;
    }
    .blog-featured__media img {
        height: 100%;
        min-height: 220px;
        object-fit: cover;
    }
    .blog-featured__body {
        flex: 1 1 auto;
        justify-content: center;
        padding: 20px 20px;
        gap: 9px;
    }
    .blog-toolbar { padding: 14px; }
    .blog-search__clear { right: 108px; }
    .blog-grid { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
    .blog-card__media img { height: 150px; }
    .blog-card__body { padding: 14px; }
}

@media (max-width: 480px) {
    .blog-search__clear { right: 88px; }
    .blog-search__btn { padding: 0 14px; }
    .blog-toolbar__row { flex-direction: column; align-items: stretch; }
    .blog-chips { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 3px; scrollbar-width: none; }
    .blog-chips::-webkit-scrollbar { display: none; }
    .blog-sort { justify-content: space-between; }
    .blog-pager__card--next { text-align: left; }
    .blog-pager__card--next .blog-pager__dir { justify-content: flex-start; }
    .blog-pager__card--empty { display: none; }
    .blog-stats__item { min-width: 72px; padding: 6px 10px; }
}

@media (prefers-reduced-motion: reduce) {
    .blog-featured,
    .blog-card,
    .blog-share__btn,
    .blog-progress__bar { transition: none; }
    .blog-featured:hover,
    .blog-card:hover { transform: none; }
}
