/* Điện Báo Paper — Ghost 6 theme
   Visual source: docs/dienbao_theme_sample/editorial-mock.html
   Functional contract: infra/ghost-theme/dienbao-paper/README.md (content.js labels,
   navigation, subscribe conditions, related posts, Koenig cards)
*/

:root {
    --paper: #f6f2e9;
    --paper-deep: #eee8dc;
    --ink: #1d302c;
    --muted: #67736b;
    --line: #d7d1c4;
    --red: #b84e35;
    --green: #25483e;

    /* Not in the mock: accent for the "Thông tin chưa thống nhất" disputed-info
       callout (content.js db-callout--disputed), kept in the paper palette. */
    --amber: #8a5a24;
    --amber-bg: #f1e4c8;

    --serif: "Noto Serif", Georgia, serif;
    --sans: "Be Vietnam Pro", Arial, sans-serif;

    /* Ghost 6 custom fonts: site owner can override heading/body fonts from
       Settings -> Brand. Fall back to the theme's own fonts when unset. */
    --font-heading: var(--gh-font-heading, var(--serif));
    --font-body: var(--gh-font-body, var(--sans));
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--red); }
a:focus-visible { outline: 2px solid var(--red); outline-offset: 4px; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; cursor: pointer; }

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 100;
    background: var(--ink);
    color: var(--paper);
    padding: 8px 16px;
}
.skip-link:focus { left: 16px; top: 8px; }
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.shell { width: min(100% - 64px, 1192px); margin-inline: auto; }
.micro { font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--red); font-size: 10px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.eyebrow::before { content: ""; width: 18px; height: 2px; background: currentColor; }

/* Masthead */
.masthead { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 112px; }
.masthead-brand { text-align: center; }
.masthead-logo { max-height: 44px; width: auto; }
.wordmark { display: block; font-family: var(--font-heading); font-weight: 800; font-size: clamp(36px, 4.4vw, 61px); letter-spacing: -.08em; line-height: 1; }
.wordmark-mark { color: var(--red); display: inline-block; width: .62em; height: .62em; margin-left: .06em; vertical-align: .08em; }
.masthead-action { display: inline-flex; align-items: center; min-height: 44px; justify-self: end; border: 1px solid var(--ink); padding: 10px 17px; font-size: 11px; font-weight: 800; letter-spacing: .02em; transition: background .2s, color .2s; }
.masthead-action:hover { background: var(--ink); color: var(--paper); }

/* Nav */
.nav-rule { border-top: 2px solid var(--ink); border-bottom: 1px solid var(--ink); }
.nav { display: flex; justify-content: center; }
.nav-desktop { max-width: 100%; overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
.nav-desktop::-webkit-scrollbar { display: none; }
.nav-mobile { display: none; }
.nav ul { display: flex; justify-content: center; gap: clamp(16px, 2.5vw, 34px); margin: 0 auto; }
.nav li { flex: 0 0 auto; }
.nav a { display: flex; align-items: center; min-height: 44px; padding-block: 10px; color: #42534c; font-size: 13px; font-weight: 700; }
.nav a.nav-current,
.nav .nav-current a,
.nav li.nav-current a { color: var(--red); }

/* The first row and the news rail share the same split from the top. */
.listing-shell { padding-top: 34px; }
.story-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 326px;
    gap: 32px;
    border-top: 2px solid var(--ink);
    border-bottom: 1px solid var(--ink);
}
.stories { min-width: 0; }
.story {
    padding: 25px 0;
    border-bottom: 1px solid var(--line);
}
.story:last-child { border-bottom: 0; }
.story-media {
    display: block;
    width: 100%;
    margin: 12px 0;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 2px;
}
.story-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.story-body { min-width: 0; }
.story .eyebrow { margin-bottom: 8px; }
.story h2 {
    margin: 0 0 8px;
    font-family: var(--font-heading);
    font-size: clamp(20px, 2vw, 25px);
    line-height: 1.35;
    letter-spacing: -.04em;
}
.story--lead h2 { font-size: clamp(24px, 2.35vw, 31px); }
.story p { margin: 0 0 9px; color: #4f5d54; font-size: 15px; line-height: 1.65; }
.story-time { display: block; color: var(--muted); font-size: 12px; }

.rail { min-width: 0; border-left: 1px solid var(--line); padding: 22px 0 22px 24px; }
.rail h2 { margin: 0 0 5px; font-family: var(--font-heading); font-size: 22px; letter-spacing: -.04em; }
.rail-list { margin: 0; padding: 0; list-style: none; }
.rail-item { padding: 15px 0; border-bottom: 1px solid var(--line); }
.rail-item:last-child { border-bottom: 0; }
.rail-item a { display: block; font-family: var(--font-heading); font-size: 15px; font-weight: 700; line-height: 1.5; }
.rail-item time { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
.story-layout:not(:has(.rail)) { grid-template-columns: minmax(0, 1fr); }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: center; padding-block: 16px 32px; }
.inline-action { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 16px; color: var(--red); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.inline-action:hover { color: var(--ink); }
.inline-action[aria-disabled="true"] { opacity: .6; pointer-events: none; cursor: default; }

/* Signup band */
.signup { margin-top: 8px; background: var(--green); color: var(--paper); }
.signup .shell { display: flex; align-items: center; justify-content: space-between; gap: 30px; padding-block: 44px; }
.signup .micro { color: #d1ac85; }
.signup h2 { max-width: 620px; margin: 9px 0 0; font-family: var(--font-heading); font-size: clamp(22px, 2.7vw, 34px); font-weight: 500; letter-spacing: -.04em; line-height: 1.4; }
.signup a { display: inline-flex; align-items: center; min-height: 44px; flex: none; padding: 11px 18px; background: var(--paper); color: var(--ink); font-size: 13px; font-weight: 800; }
.signup a:hover { background: #e8d7c2; color: var(--ink); }

/* Footer */
.footer { padding-block: 25px 38px; color: var(--muted); font-size: 11px; }
.footer-nav { display: flex; flex-wrap: wrap; align-items: center; }
.footer-nav:empty { display: none; }
.footer-link:hover { color: var(--red); }
.footer-sep { color: var(--line); margin: 0 8px; }
.footer-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; }
.footer-bottom strong { color: var(--ink); font-family: var(--font-heading); font-size: 17px; }

@media (max-width: 920px) {
    .story-layout { display: block; }
    .rail { display: none; }
}
@media (max-width: 760px) {
    .shell { width: min(100% - 36px, 580px); }
    .masthead { grid-template-columns: 1fr auto; min-height: 80px; gap: 12px; }
    .masthead-spacer { display: none; }
    .masthead-brand { text-align: left; }
    .wordmark { font-size: clamp(28px, 7vw, 37px); }
    .masthead-action { display: inline-flex; align-items: center; min-height: 44px; padding: 9px 12px; font-size: 11px; }
    .nav-rule { border-bottom: 1px solid var(--line); }
    .nav { display: block; }
    .nav-desktop { display: none; }
    .nav-mobile { display: block; }
    .nav summary { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; font-weight: 700; cursor: pointer; list-style: none; }
    .nav summary::-webkit-details-marker { display: none; }
    .nav summary::after { content: ""; width: 8px; height: 8px; flex: none; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .2s; }
    .nav details[open] summary::after { transform: rotate(225deg); }
    .nav summary:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }
    .nav details[open] summary { border-bottom: 1px solid var(--line); }
    .nav ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; padding: 6px 0; margin: 0; }
    .nav a { min-height: 44px; display: flex; align-items: center; padding: 9px 0; font-size: 13px; }
    .listing-shell { padding-top: 18px; }
    .story { padding: 19px 0; }
    .story h2, .story--lead h2 { font-size: clamp(18px, 4.7vw, 22px); line-height: 1.35; }
    .story p { font-size: 15px; line-height: 1.55; }
    .story .eyebrow { margin-bottom: 6px; font-size: 10px; }
    .signup .shell { display: block; padding-block: 30px; }
    .signup h2 { margin: 0 0 16px; }
    .footer-bottom { justify-content: flex-start; }
}
@media (max-width: 420px) {
    .story h2, .story--lead h2 { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition: none !important; }
}

/* ----------------------------------------------------------------------
   Archive header (tag.hbs)
   ---------------------------------------------------------------------- */
.archive-header { padding: 32px 0 24px; margin-top: 8px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.archive-header__eyebrow { color: var(--red); margin: 0 0 10px; }
.archive-header__title { margin: 0 0 10px; font-family: var(--font-heading); font-size: clamp(28px, 4vw, 44px); font-weight: 700; letter-spacing: -.05em; }
.archive-header__description { margin: 0; max-width: 620px; color: var(--muted); font-size: 14px; line-height: 1.8; }

/* ----------------------------------------------------------------------
   Post / page reading column
   ---------------------------------------------------------------------- */
.post-wrap { max-width: 720px; padding-top: 40px; padding-bottom: 56px; }
.post-header { margin-bottom: 28px; }
.post-header__meta { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.post-header__tag::before { display: none; }
.post-header__time { color: var(--muted); font-size: 11px; }
.post-header__title { margin: 0 0 14px; font-family: var(--font-heading); font-size: clamp(30px, 4.4vw, 48px); font-weight: 700; line-height: 1.2; letter-spacing: -.05em; }
.post-header__dateline { margin: 0; color: var(--muted); font-size: 13px; }

.post-feature-image { margin: 0 0 32px; }
.post-feature-image img { width: 100%; border-radius: 2px; }
.post-feature-image figcaption { margin-top: 10px; color: var(--muted); font-size: 12px; text-align: center; }

/* gh-content: post body typography */
.gh-content { color: #33453d; font-size: 16px; line-height: 1.85; }
.gh-content > p { margin: 0 0 18px; }
.gh-content a { color: var(--red); text-decoration: none; }
.gh-content a:hover { text-decoration: underline; }
.gh-content ul, .gh-content ol { margin: 0 0 18px; padding-left: 4px; }
.gh-content ul > li, .gh-content ol > li { position: relative; padding-left: 22px; margin-bottom: 10px; line-height: 1.8; }
.gh-content ul > li::before { content: ''; position: absolute; left: 0; top: 11px; width: 6px; height: 6px; background: var(--red); }
.gh-content ol { counter-reset: gh-ol; }
.gh-content ol > li { padding-left: 26px; }
.gh-content ol > li::before {
    counter-increment: gh-ol;
    content: counter(gh-ol) '.';
    position: static;
    width: auto; height: auto;
    background: none;
    color: var(--red);
    font-weight: 700;
    margin-right: 6px;
}
.gh-content h2, .gh-content h3 {
    font-family: var(--font-heading);
    color: var(--ink);
    letter-spacing: -.03em;
    margin: 36px 0 14px;
}
.gh-content figure { margin: 0 0 26px; }
.gh-content figure img { width: 100%; border-radius: 2px; }
.gh-content figcaption { margin-top: 8px; color: var(--muted); font-size: 12px; text-align: center; }
.gh-content blockquote {
    margin: 0 0 18px;
    padding-left: 18px;
    border-left: 3px solid var(--red);
    font-family: var(--font-heading);
    font-style: normal;
    color: var(--ink);
}

/* Baseline without JS: a leading <strong> in a paragraph reads as an axiom */
.gh-content > p > strong:first-child {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--ink);
}

/* content.js enhancements (labels are a contract with worker/news_ai/publish_ghost.py,
   see infra/ghost-theme/dienbao-paper/README.md) */
.gh-content .db-update {
    display: block;
    color: var(--red);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    margin-bottom: 18px;
}
.gh-content .db-lede {
    font-family: var(--font-heading);
    font-size: 19px;
    line-height: 1.65;
    color: var(--ink);
}
.gh-content .db-label {
    display: block;
    color: var(--red);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    margin: 28px 0 10px;
}
.db-callout {
    background: var(--paper-deep);
    border-left: 3px solid var(--red);
    padding: 18px 20px;
    margin: 0 0 18px;
}
.db-callout > .db-callout__label {
    display: block;
    color: var(--red);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    margin-bottom: 8px;
}
.db-callout p, .db-callout ul { margin: 0; }
.db-callout--context, .db-callout--next {
    background: transparent;
    border: 0;
    padding: 0;
    margin: 24px 0;
}
.db-callout--context > .db-callout__label,
.db-callout--next > .db-callout__label { color: var(--ink); }
.db-callout--disputed {
    background: var(--amber-bg);
    border-left-color: var(--amber);
}
.db-callout--disputed > .db-callout__label { color: var(--amber); }
.db-callout--disputed ul > li::before { background: var(--amber); }
.db-callout--practical { border-left-color: var(--green); }
.db-callout--practical > .db-callout__label { color: var(--green); }
.db-callout--practical ul > li::before { background: var(--green); }
.db-callout--explainer { border-left-color: var(--muted); }
.db-callout--explainer > .db-callout__label { color: var(--muted); }
.db-callout--explainer > .db-callout__question { margin-bottom: 8px; color: var(--ink); }

.db-sources {
    border-top: 1px solid var(--line);
    margin-top: 36px;
    padding-top: 18px;
}
.db-sources > .db-sources__heading {
    display: block;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    margin-bottom: 12px;
}
.db-sources ul { font-size: 13px; line-height: 1.8; color: var(--muted); }
.db-sources a { color: var(--ink); }

.db-source-count { color: var(--muted); font-size: 13px; margin: 18px 0; }

/* Related posts */
.related-posts { border-top: 1px solid var(--line); padding-top: 22px; margin-top: 28px; }
.related-posts__title { font-family: var(--font-heading); font-size: 20px; letter-spacing: -.03em; margin: 0 0 8px; }
.related-posts__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.related-posts__row:last-child { border-bottom: none; }
.related-posts__link { font-family: var(--font-heading); font-weight: 700; color: var(--ink); }
.related-posts__link:hover { color: var(--red); }
.related-posts__time { flex-shrink: 0; color: var(--muted); font-size: 12px; }

/* Page / error */
.page { padding-bottom: 56px; }
.error-page { padding: 96px 0; text-align: center; }
.error-page__code { color: var(--muted); font-size: 13px; font-weight: 700; margin: 0 0 10px; }
.error-page__title { font-family: var(--font-heading); font-size: 30px; font-weight: 700; margin: 0 0 20px; }

@media (max-width: 760px) {
    .post-wrap { padding-top: 28px; padding-bottom: 40px; }
    .archive-header { padding-top: 20px; }
    .gh-content { font-size: 16px; line-height: 1.78; overflow-wrap: anywhere; }
    .gh-content .db-lede { font-size: 18px; }
    .related-posts__row { align-items: flex-start; flex-direction: column; gap: 4px; }
}

/* ----------------------------------------------------------------------
   Koenig cards: width classes + basic card styles
   ---------------------------------------------------------------------- */
.kg-width-wide {
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    max-width: 1040px;
    width: auto;
}
.kg-width-full {
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    max-width: none;
    width: 100vw;
}
.post-wrap .kg-width-wide, .post-wrap .kg-width-full { max-width: 100%; width: 100%; margin-left: 0; margin-right: 0; }
.kg-width-wide img, .kg-width-full img { width: 100%; }

.kg-card { margin-bottom: 26px; }
.kg-image-card img { border-radius: 2px; }
.kg-gallery-container { display: flex; flex-direction: column; gap: 4px; }
.kg-gallery-row { display: flex; gap: 4px; }
.kg-gallery-image img { border-radius: 2px; }
.kg-embed-card { margin-bottom: 26px; }
.kg-embed-card iframe { width: 100%; }
.kg-bookmark-card .kg-bookmark-container {
    display: flex;
    border: 1px solid var(--line);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
}
.kg-bookmark-content { padding: 16px; flex: 1 1 auto; }
.kg-bookmark-title { font-family: var(--font-heading); font-weight: 700; color: var(--ink); }
.kg-bookmark-description { font-size: 13px; color: var(--muted); margin-top: 4px; }
.kg-bookmark-metadata { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.kg-bookmark-icon { width: 16px; height: 16px; }
.kg-bookmark-author, .kg-bookmark-publisher { color: var(--muted); }
.kg-bookmark-thumbnail { flex: 0 0 160px; }
.kg-bookmark-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.kg-callout-card {
    display: flex;
    gap: 12px;
    background: var(--paper-deep);
    padding: 16px;
    margin-bottom: 26px;
}
.kg-callout-emoji { flex-shrink: 0; }
.kg-callout-text { margin: 0; }

/* content.js: an image that fails to load is hidden entirely (never a
   broken icon or alt text). */
.db-image-hidden { display: none !important; }
