/* ============================================================
   Blog — uses the app's design tokens so dark mode comes free.
   ============================================================ */

/* --- Admin: list + taxonomy --- */
.page-header__actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.blog-admin-filters { display: flex; gap: 1rem; flex-wrap: wrap; align-items: end; }
.blog-admin-filters label { display: flex; flex-direction: column; gap: .25rem; font-weight: 600; font-size: .85rem; }
.blog-admin-filters__search { flex: 1 1 240px; }
.blog-admin-table td { vertical-align: top; }
.blog-admin-title { font-weight: 600; }
.blog-admin-slug { font-size: .78rem; color: var(--muted); }
.blog-featured-badge { margin-left: .4rem; font-size: .68rem; vertical-align: middle; }
.blog-admin-actions { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }
.blog-pagination { display: flex; gap: 1rem; align-items: center; justify-content: center; margin: 1.5rem 0; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); display: flex; flex-direction: column; gap: 1rem; align-items: center; }

.blog-taxonomy-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; }
.blog-taxonomy-form { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.blog-taxonomy-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .5rem; }
.blog-taxonomy-list li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }

/* --- Admin: editor page --- */
.blog-edit-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.5rem; align-items: start; }
.blog-edit-main { min-width: 0; }
.blog-title-input { font-size: 1.6rem; font-weight: 700; padding: .65rem .85rem; margin-bottom: 1rem; }
.blog-editor-shell { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.25rem; min-height: 420px; box-shadow: var(--shadow-sm); }
.blog-editor-shell .codex-editor { color: var(--text); }
.blog-editor-shell .ce-block__content, .blog-editor-shell .ce-toolbar__content { max-width: 100%; }
.blog-edit-sidebar { display: flex; flex-direction: column; gap: 1.25rem; position: sticky; top: 1rem; }
.blog-edit-sidebar .settings-panel { margin: 0; }
.blog-edit-sidebar label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: .75rem; }
.blog-edit-sidebar label > input:not([type=checkbox]), .blog-edit-sidebar label > select, .blog-edit-sidebar label > textarea { margin-top: .25rem; font-weight: 400; }
.blog-check-row { display: flex; align-items: center; gap: .5rem; }
.blog-check-row .form-check-label { font-weight: 400; }
.blog-edit-buttons { display: flex; gap: .5rem; margin-top: .5rem; }
.blog-upload-label { display: flex; flex-direction: column; gap: .25rem; }
.blog-cover-preview { width: 100%; border-radius: 10px; border: 1px solid var(--line); margin-bottom: .5rem; }

/* --- Public: shell --- */
.blog-page { max-width: 1080px; margin: 0 auto; padding: 0 1.25rem; }
.blog-hero { text-align: center; padding: 3rem 1rem 2rem; }
.blog-hero__eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; color: var(--brand); font-weight: 700; margin: 0 0 .35rem; }
.blog-hero h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); margin: 0 0 .5rem; }
.blog-hero__sub { color: var(--muted); font-size: 1.05rem; max-width: 640px; margin: 0 auto; }
.blog-hero__rss { display: inline-block; margin-top: 1rem; font-size: .85rem; color: var(--brand-strong); font-weight: 600; }
.blog-loading, .blog-empty { text-align: center; color: var(--muted); padding: 3rem 1rem; }
.blog-empty h1 { color: var(--text); }

/* --- Public: featured --- */
.blog-featured { display: grid; grid-template-columns: 1.1fr 1fr; gap: 1.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; text-decoration: none; color: inherit; box-shadow: var(--shadow-md); margin-bottom: 2.5rem; transition: transform .15s ease, box-shadow .15s ease; }
.blog-featured:hover { transform: translateY(-2px); }
.blog-featured__media { background: var(--surface-soft); }
.blog-featured__media img { width: 100%; height: 100%; object-fit: cover; min-height: 240px; }
.blog-featured__body { padding: 1.75rem; display: flex; flex-direction: column; gap: .5rem; justify-content: center; }
.blog-featured__body h2 { margin: .25rem 0; font-size: 1.6rem; }
.blog-featured__body p { color: var(--muted); margin: 0; }

/* --- Public: cards grid --- */
.blog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; margin-bottom: 2.5rem; }
.blog-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-sm); transition: transform .15s ease, box-shadow .15s ease; }
.blog-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.blog-card__link { text-decoration: none; color: inherit; display: flex; flex-direction: column; height: 100%; }
.blog-card__media { aspect-ratio: 16 / 9; background: var(--surface-soft); }
.blog-card__media img { width: 100%; height: 100%; object-fit: cover; }
.blog-card__body { padding: 1.1rem 1.2rem 1.3rem; display: flex; flex-direction: column; gap: .4rem; flex: 1; }
.blog-card__body h3 { margin: 0; font-size: 1.15rem; line-height: 1.35; }
.blog-card__body p { color: var(--muted); margin: 0; font-size: .92rem; flex: 1; }
.blog-card__category, .blog-card__badge { display: inline-block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--brand-strong); }
.blog-card__badge { color: var(--brand-contrast); background: var(--brand); padding: .15rem .5rem; border-radius: 999px; align-self: flex-start; }
.blog-card__meta { display: flex; gap: .4rem; flex-wrap: wrap; color: var(--muted); font-size: .8rem; margin-top: .25rem; }

/* --- Public: article --- */
.blog-article { max-width: 760px; }
.blog-article__header { padding: 2rem 0 1rem; }
.blog-article__crumbs { display: flex; gap: .4rem; align-items: center; font-size: .85rem; color: var(--muted); margin-bottom: .75rem; }
.blog-article__crumbs a { color: var(--brand-strong); text-decoration: none; }
.blog-article__header h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0 0 .5rem; }
.blog-article__lede { font-size: 1.2rem; color: var(--muted); margin: .5rem 0; }
.blog-article__meta { display: flex; gap: .5rem; flex-wrap: wrap; color: var(--muted); font-size: .9rem; }
.blog-article__cover { margin: 1.5rem 0; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.blog-article__cover img { width: 100%; display: block; }
.blog-article__tags { display: flex; gap: .5rem; flex-wrap: wrap; margin: 2rem 0 1rem; }
.blog-tag-chip { font-size: .82rem; color: var(--brand-strong); background: var(--brand-soft); padding: .3rem .7rem; border-radius: 999px; text-decoration: none; }
.blog-admin-edit { display: block; width: max-content; margin: 0 0 .75rem auto; }
.blog-search { display: flex; gap: .5rem; margin: 1.25rem auto .25rem; max-width: 620px; width: 100%; }
.blog-search__field { position: relative; flex: 1 1 auto; display: flex; align-items: center; }
.blog-search__icon { position: absolute; left: .95rem; width: 1.05rem; height: 1.05rem; color: var(--muted); pointer-events: none; }
.blog-search__input.form-control { border-radius: 999px; padding: .62rem 2.2rem .62rem 2.6rem; height: auto; }
.blog-search__clear { position: absolute; right: 1rem; color: var(--muted); text-decoration: none; font-size: .85rem; line-height: 1; }
.blog-search__clear:hover { color: var(--text); }
.blog-search__btn { border-radius: 999px; padding-left: 1.4rem; padding-right: 1.4rem; }
/* Admin posts list: searchable Vendor/Exam combobox */
.blog-combo { position: relative; }
.blog-combo__button { width: 100%; text-align: left; cursor: pointer; }
.blog-combo__backdrop { position: fixed; inset: 0; z-index: 40; background: transparent; }
.blog-combo__panel { position: absolute; z-index: 41; top: calc(100% + 4px); left: 0; min-width: 18rem; max-width: 26rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-md); padding: .45rem; }
.blog-combo__search { margin-bottom: .4rem; }
.blog-combo__list { max-height: 17rem; overflow-y: auto; display: flex; flex-direction: column; }
.blog-combo__group { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: .4rem .5rem .15rem; }
.blog-combo__opt { display: block; width: 100%; text-align: left; background: none; border: none; padding: .35rem .5rem; border-radius: 6px; cursor: pointer; font-size: .9rem; color: var(--text); }
.blog-combo__opt:hover { background: var(--surface-soft); }
.blog-combo__opt--vendor { font-weight: 600; }
.blog-combo__empty { padding: .5rem; color: var(--muted); font-size: .85rem; }
.blog-article__exams { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; margin: 1rem 0; }
.blog-article__exams-label { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.blog-exam-chips { display: flex; gap: .5rem; flex-wrap: wrap; }
.blog-exam-chip { font-size: .82rem; font-weight: 600; color: var(--brand-contrast); background: var(--brand); padding: .3rem .7rem; border-radius: 999px; text-decoration: none; }
.blog-exam-chip:hover { filter: brightness(.95); }
.blog-vendor-chip { color: var(--brand-strong); background: transparent; border: 1px solid var(--brand); }
/* Admin editor: searchable, grouped exam/vendor picker */
.blog-exam-search { margin-bottom: .5rem; }
.blog-selected-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .5rem; }
.blog-sel-chip { font-size: .78rem; font-weight: 600; color: var(--brand-contrast); background: var(--brand); border: none; padding: .2rem .55rem; border-radius: 999px; cursor: pointer; }
.blog-sel-chip--vendor { background: var(--brand-strong); }
.blog-sel-chip:hover { filter: brightness(.95); }
.blog-exam-picker { display: flex; flex-direction: column; gap: .35rem; max-height: 18rem; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: .5rem .6rem; }
.blog-vendor-group { display: flex; flex-direction: column; gap: .2rem; padding-bottom: .35rem; }
.blog-vendor-group + .blog-vendor-group { border-top: 1px solid var(--line); padding-top: .35rem; }
.blog-vendor-row__hint { font-size: .72rem; color: var(--muted); }
.blog-exam-row { padding-left: 1.1rem; }
.blog-article__footer { margin: 2rem 0 1rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.blog-preview-banner { margin: 1rem auto 0; padding: .75rem 1.1rem; border-radius: 10px; background: #fff3cd; border: 1px solid #ffe69c; color: #664d03; font-size: .9rem; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.blog-preview-banner strong { text-transform: uppercase; letter-spacing: .04em; font-size: .78rem; }
.blog-preview-banner a { margin-left: auto; color: #664d03; font-weight: 700; }
.blog-related { margin: 1rem auto 3rem; }
.blog-related h2 { margin-bottom: 1.25rem; }

/* --- Rendered content typography --- */
.blog-content { font-size: 1.08rem; line-height: 1.75; color: var(--text); }
.blog-content > * + * { margin-top: 1.15rem; }
.blog-content h2 { font-size: 1.6rem; margin-top: 2.25rem; }
.blog-content h3 { font-size: 1.3rem; margin-top: 1.85rem; }
.blog-content h4 { font-size: 1.1rem; margin-top: 1.5rem; }
.blog-content a { color: var(--brand-strong); }
.blog-content ul, .blog-content ol { padding-left: 1.5rem; }
.blog-content li { margin: .35rem 0; }
.blog-content img { max-width: 100%; height: auto; border-radius: 10px; }
.blog-content figure { margin: 1.5rem 0; }
.blog-content figure.blog-figure--stretched img { width: 100%; }
.blog-content figcaption { text-align: center; font-size: .85rem; color: var(--muted); margin-top: .5rem; }
.blog-content blockquote { border-left: 4px solid var(--brand); padding: .25rem 0 .25rem 1.1rem; margin: 0; color: var(--text); font-style: italic; }
.blog-content .blog-quote { margin: 1.5rem 0; }
.blog-content pre.blog-code { background: var(--surface-soft); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.1rem; overflow-x: auto; font-size: .9rem; }
.blog-content pre.blog-code code { white-space: pre; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: none; padding: 0; }
.blog-content code { background: var(--brand-soft); padding: .1rem .35rem; border-radius: 5px; font-size: .9em; }
.blog-content hr.blog-delimiter { border: none; text-align: center; margin: 2rem 0; }
.blog-content hr.blog-delimiter::before { content: "* * *"; color: var(--muted); letter-spacing: .5em; }
.blog-content .blog-callout { background: var(--brand-soft); border-radius: 10px; padding: 1rem 1.25rem; }
.blog-content .blog-callout strong { display: block; margin-bottom: .25rem; }
.blog-content table.blog-table { width: 100%; border-collapse: collapse; }
.blog-content table.blog-table th, .blog-content table.blog-table td { border: 1px solid var(--line); padding: .5rem .7rem; text-align: left; }
.blog-content table.blog-table th { background: var(--surface-soft); }
.blog-content .blog-embed__frame { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: 10px; }
.blog-content .blog-embed__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.blog-content .blog-checklist { list-style: none; padding-left: 0; }
.blog-content .blog-check { margin-right: .35rem; }

@media (max-width: 820px) {
    .blog-edit-grid { grid-template-columns: 1fr; }
    .blog-edit-sidebar { position: static; }
    .blog-featured { grid-template-columns: 1fr; }
    .blog-featured__media img { min-height: 200px; }
}

/* --- Media picker + library + editor toolbar --- */
.blog-editor-toolbar { display: flex; gap: .5rem; margin-bottom: .5rem; }
.blog-cover-actions { display: flex; gap: .5rem; margin: .5rem 0; flex-wrap: wrap; }

.media-picker__backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .55); display: flex; align-items: center; justify-content: center; z-index: 1050; padding: 1rem; }
.media-picker { background: var(--surface); color: var(--text); border-radius: 14px; width: min(900px, 96vw); max-height: 88vh; display: flex; flex-direction: column; box-shadow: var(--shadow-md); overflow: hidden; }
.media-picker__head { display: flex; gap: .6rem; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.media-picker__head h3 { margin: 0; margin-right: auto; }
.media-picker__search { max-width: 260px; }
.media-picker__upload-btn { position: relative; overflow: hidden; cursor: pointer; }
.media-picker__error { padding: 0 1.25rem; }
.media-picker__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .85rem; padding: 1.25rem; overflow-y: auto; }
.media-picker__empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 2rem; }
.media-picker__pager { display: flex; gap: 1rem; align-items: center; justify-content: center; padding: .75rem; border-top: 1px solid var(--line); }

.media-tile { display: flex; flex-direction: column; gap: .25rem; padding: .4rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); cursor: pointer; text-align: left; transition: border-color .12s ease, transform .12s ease; }
.media-tile:hover { border-color: var(--brand); transform: translateY(-2px); }
.media-tile__thumb { aspect-ratio: 1 / 1; border-radius: 7px; overflow: hidden; background: var(--app-bg); display: flex; align-items: center; justify-content: center; }
.media-tile__thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-tile__name { font-size: .8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-tile__meta { font-size: .72rem; color: var(--muted); }
.media-tile__actions { display: flex; gap: .35rem; margin-top: .15rem; }

.confirm-dialog { background: var(--surface); color: var(--text); border-radius: 14px; width: min(520px, 96vw); padding: 1.5rem; box-shadow: var(--shadow-md); }
.confirm-dialog h2 { margin-top: 0; }
.confirm-dialog__actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1.25rem; }
.blog-delete-report ul { margin: .5rem 0 0; padding-left: 1.25rem; }
.blog-delete-report a { color: var(--brand-strong); }

.media-library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }

/* --- Media library: categories + usage drill-down --- */
.media-upload-controls { display: flex; gap: .5rem; align-items: center; }
.media-upload-controls .form-control { max-width: 160px; }
.media-cat { display: inline-block; font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--brand-strong); background: var(--brand-soft); padding: .05rem .4rem; border-radius: 999px; }
.media-picker__filter { max-width: 170px; }
.media-tile--card { gap: .35rem; }
.media-tile__usage { font-size: .75rem; }
.media-usage-toggle { background: none; border: none; padding: 0; color: var(--brand-strong); font-size: .75rem; cursor: pointer; font-weight: 600; }
.media-usage-list { list-style: none; margin: .25rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .15rem; }
.media-usage-list a { color: var(--brand-strong); }
.media-unused { color: var(--muted); font-size: .72rem; }

/* --- Media detail (admin) --- */
.media-tile__name { color: var(--brand-strong); text-decoration: none; }
.media-tile__name:hover { text-decoration: underline; }
.media-detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.5rem; align-items: start; }
.media-detail-preview { max-width: 100%; border-radius: 10px; border: 1px solid var(--line); }
.media-detail-facts { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; margin: 1rem 0 0; font-size: .85rem; }
.media-detail-facts dt { color: var(--muted); font-weight: 600; }
.media-detail-facts dd { margin: 0; word-break: break-all; }
.media-detail-usage { margin-top: 1.25rem; }
.media-detail-usage ul { margin: .25rem 0 0; padding-left: 1.1rem; }
.media-detail-side label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: .75rem; }
.media-detail-side label > input, .media-detail-side label > textarea { margin-top: .25rem; font-weight: 400; }

/* --- Media detail (public) --- */
.media-public { max-width: 760px; }
.media-public__figure { margin: 1.5rem 0; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-soft); }
.media-public__figure img { width: 100%; display: block; }
.media-public h1 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); margin: 0 0 .35rem; }
.media-public__meta { display: flex; gap: .5rem; color: var(--muted); font-size: .9rem; }
.media-public__description { font-size: 1.1rem; line-height: 1.7; }
.media-public__usage { margin-top: 1.5rem; }
.media-public__usage ul { padding-left: 1.2rem; }
.media-public__usage a { color: var(--brand-strong); }

@media (max-width: 820px) {
    .media-detail-grid { grid-template-columns: 1fr; }
}
