:root {
  --primary: #0f766e;
  --primary-strong: #115e59;
  --primary-soft: #e6f4f1;
  --bg: #f7f8f7;
  --surface: #ffffff;
  --surface-subtle: #f0f2f1;
  --border: #e1e5e3;
  --text: #14201d;
  --text-muted: #4b5a56;
  --text-soft: #84918d;
  --warn-soft: #fff6e5;
  --warn: #8a5300;
  --image-bg: #0d1a1e;
  --radius: 14px;
  --shadow: 0 6px 20px -8px rgba(16, 32, 28, 0.18);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #2dd4bf;
    --primary-strong: #5eead4;
    --primary-soft: #12302c;
    --bg: #0c1110;
    --surface: #141b1a;
    --surface-subtle: #1b2422;
    --border: #2a3533;
    --text: #e8efed;
    --text-muted: #a5b3af;
    --text-soft: #6f7d79;
    --warn-soft: #2d2210;
    --warn: #f0b450;
    --image-bg: #05090a;
    --shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --primary: #2dd4bf;
  --primary-strong: #5eead4;
  --primary-soft: #12302c;
  --bg: #0c1110;
  --surface: #141b1a;
  --surface-subtle: #1b2422;
  --border: #2a3533;
  --text: #e8efed;
  --text-muted: #a5b3af;
  --text-soft: #6f7d79;
  --warn-soft: #2d2210;
  --warn: #f0b450;
  --image-bg: #05090a;
  --shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--font);
}
a { color: var(--primary); }
button { font: inherit; color: inherit; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.container { max-width: 1240px; margin: 0 auto; padding: 20px 16px 64px; }

/* Header */
.site-header { border-bottom: 1px solid var(--border); padding-bottom: 16px; margin-bottom: 20px; }
.top-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand { font-weight: 800; letter-spacing: -0.2px; color: var(--primary); text-decoration: none; font-size: 15px; }
.date-badge { color: var(--primary); background: var(--primary-soft); padding: 3px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.icon-btn {
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  width: 36px; height: 36px; cursor: pointer; display: inline-grid; place-items: center;
}
.icon-btn:hover { border-color: var(--primary); }
.page-title { font-size: clamp(22px, 4vw, 30px); line-height: 1.2; font-weight: 850; letter-spacing: -0.5px; margin: 14px 0 6px; }
.page-sub { margin: 0 0 14px; color: var(--text-muted); font-size: 14.5px; }

.search {
  width: 100%; max-width: 560px; height: 42px; border-radius: 999px; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text); padding: 0 18px; font-size: 15px; outline: none;
}
.search:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
  border-radius: 999px; padding: 5px 13px; font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; }
@media (max-width: 960px) { .layout { grid-template-columns: minmax(0, 1fr); } }

.section { margin-bottom: 36px; }
.section-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-bottom: 16px;
}
.section-title { font-size: 18px; font-weight: 800; margin: 0; }
.section-count { font-size: 13px; color: var(--text-soft); white-space: nowrap; }

/* Images + ⓘ credit */
.media { position: relative; background: var(--image-bg); overflow: hidden; }
.media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.media.contain img { object-fit: contain; }
.media.placeholder { display: grid; place-items: center; color: var(--text-soft); background: var(--surface-subtle); font-size: 28px; }
.credit-btn {
  position: absolute; right: 8px; bottom: 8px; width: 24px; height: 24px; border-radius: 50%;
  border: 0; background: rgba(0, 0, 0, 0.45); color: #fff; font-size: 13px; line-height: 24px;
  cursor: pointer; opacity: 0.75; padding: 0;
}
.credit-btn:hover, .credit-btn:focus-visible { opacity: 1; }
.credit-pop {
  position: absolute; right: 8px; bottom: 38px; max-width: min(320px, calc(100% - 16px));
  background: rgba(10, 16, 15, 0.92); color: #f1f5f4; font-size: 12px; line-height: 1.45;
  padding: 7px 10px; border-radius: 8px; z-index: 2;
}
.credit-pop a { color: #8ff0e0; }

/* Hero */
.hero {
  display: grid; grid-template-columns: 1.05fr 1fr; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin-bottom: 20px;
}
.hero .media { min-height: 300px; }
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; }
  .hero .media { min-height: 0; aspect-ratio: 16 / 10; }
}
.hero-body { padding: 22px 24px; display: flex; flex-direction: column; gap: 10px; }
.hero-title { font-size: clamp(19px, 2.4vw, 23px); line-height: 1.3; margin: 0; font-weight: 800; }

/* Cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.card {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; transition: border-color 0.15s, transform 0.15s;
}
.card:hover { border-color: var(--primary); transform: translateY(-2px); }
.card .media { aspect-ratio: 16 / 10; }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title { font-size: 16.5px; line-height: 1.38; margin: 0; font-weight: 750; }

.open-link { color: inherit; text-decoration: none; }
.open-link:hover { color: var(--primary); }
.open-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; font-weight: 700; }
.tag { color: var(--primary); background: var(--primary-soft); border-radius: 6px; padding: 2px 8px; }
.tag.study { color: var(--text-muted); background: var(--surface-subtle); }
.title-en { margin: 0; color: var(--text-soft); font-size: 13.5px; line-height: 1.4; }
.card .title-en, .card .point { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.card .title-en { -webkit-line-clamp: 2; }
[data-open] { cursor: pointer; }
.point { margin: 0; color: var(--text-muted); font-size: 14.5px; line-height: 1.5; padding-left: 12px; border-left: 3px solid var(--primary); }
.byline { margin: auto 0 0; color: var(--text-soft); font-size: 12.5px; line-height: 1.45; }
.byline strong { color: var(--text-muted); font-weight: 650; }

/* Brief list */
.brief-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.brief-list li { padding: 12px 16px; border-top: 1px solid var(--border); }
.brief-list li:first-child { border-top: 0; }
.brief-list .open-link { font-weight: 650; }

.more-btn {
  display: block; margin: 18px auto 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 9px 20px; font-weight: 650; cursor: pointer;
}
.more-btn:hover { border-color: var(--primary); }
.more-btn[hidden] { display: none; }

.state { text-align: center; color: var(--text-muted); padding: 40px 16px; border: 1px dashed var(--border); border-radius: var(--radius); }

/* Sidebar */
.side-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 18px; }
.side-box h2 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.4px; margin: 0 0 10px; color: var(--text-muted); }
.side-box p { margin: 0 0 8px; font-size: 14px; color: var(--text-muted); }
.journal-list { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.journal-list li { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-top: 1px solid var(--border); }
.journal-list li:first-child { border-top: 0; }
.journal-list span:last-child { color: var(--text-soft); }

.site-footer { border-top: 1px solid var(--border); margin-top: 24px; padding-top: 16px; font-size: 13.5px; color: var(--text-soft); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 8px; }

/* Trang văn bản: điều khoản, quyền riêng tư, nguồn ảnh */
.doc { max-width: 760px; }
.doc h1 { font-size: clamp(24px, 4vw, 30px); line-height: 1.25; margin: 8px 0 4px; }
.doc .updated { color: var(--text-soft); font-size: 14px; margin: 0 0 20px; }
.doc h2 { font-size: 19px; margin: 28px 0 8px; }
.doc h3 { font-size: 16px; margin: 20px 0 6px; }
.doc p, .doc li { color: var(--text-muted); }
.doc ul { padding-left: 22px; }
.doc li { margin: 4px 0; }
.doc .callout { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 12px 16px; }

/* Reader */
.reader {
  width: min(820px, calc(100% - 32px)); max-height: calc(100% - 32px); margin: auto; padding: 0; border: 0; border-radius: var(--radius);
  background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.reader::backdrop { background: rgba(8, 14, 13, 0.6); }
@media (max-width: 640px) { .reader { width: 100%; max-width: 100%; height: 100%; max-height: 100%; border-radius: 0; } }
.reader-head {
  position: sticky; top: 0; z-index: 3; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 14px 10px 20px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.reader-journal { font-size: 13px; font-weight: 750; color: var(--primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader .media { aspect-ratio: 16 / 9; }
.reader-body { padding: 20px 24px 28px; display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 640px) { .reader-body { padding: 18px 16px 24px; } }
.reader-title { font-size: clamp(20px, 3vw, 25px); line-height: 1.3; margin: 0; font-weight: 800; }
.reader-title-en { margin: 0; color: var(--text-soft); font-size: 15px; }
.reader-meta { margin: 0; font-size: 14px; color: var(--text-muted); display: grid; gap: 3px; }
.ai-note { margin: 0; background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.reader h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); margin: 6px 0 0; }
.reader p.summary { margin: 0; font-size: 16px; }
.reader ol.points { margin: 0; padding-left: 22px; display: grid; gap: 8px; }
.reader details { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; }
.reader details summary { cursor: pointer; font-weight: 650; font-size: 14px; }
.reader details p { font-size: 14.5px; color: var(--text-muted); white-space: pre-line; margin: 10px 0 0; }
.reader-actions { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 6px; }
.btn-primary {
  background: var(--primary); color: #fff; text-decoration: none; border-radius: 999px; padding: 10px 18px; font-weight: 700;
}
:root[data-theme="dark"] .btn-primary { color: #04211d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary { color: #04211d; } }
.btn-ghost { border: 1px solid var(--border); text-decoration: none; color: var(--text); border-radius: 999px; padding: 9px 16px; font-weight: 650; }
