/* =====================================================================
   KairoLens Blog — khung "tech" của web-builder (trang chủ, chuyên mục) + chữ kiểu "doc" (trang bài)
   Bố cục: hero chữ lớn căn trái + bài mới nhất nổi bật có con số lớn; lưới bento bài; cột đọc 66 ký tự.
   QUY TẮC: màu chỉ ở :root (DESIGN.md mục 3). Chỗ khác dùng var(--…).
   ===================================================================== */
:root {
  --bg: #f4f4f2; --bg-2: #ebebe7; --fg: #111312; --muted: #575b58;
  --line: rgba(17, 19, 18, .1);
  --glass: rgba(255, 255, 255, .6); --glass-2: rgba(255, 255, 255, .85); --edge: rgba(255, 255, 255, .95);
  --shadow: 0 12px 40px -16px rgba(20, 30, 25, .22);
  --accent: #17714f; --accent-fg: #ffffff;
  --a1: #1f8a63; --a2: #c79a2b; --a3: #2f6ea8;
  --up: #17714f; --down: #b3261e;
  --ok: #17714f;
  --spot: rgba(255, 255, 255, .6);
  --aurora-opacity: .42;
  --btn-bg: var(--fg); --btn-fg: var(--bg);
  --cat-macro: #2a619a; --cat-crypto: #7f5a06; --cat-onchain: #17714f; --cat-markets: #6b4fa0;

  --font-display: "Inter Tight", "Be Vietnam Pro", system-ui, sans-serif;
  --font-body: "Be Vietnam Pro", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;

  --t-hero: clamp(2.9rem, 1.4rem + 6.4vw, 6.6rem);
  --t-h2: clamp(2.1rem, 1.3rem + 3.2vw, 3.9rem);
  --t-h3: clamp(1.15rem, 1rem + .5vw, 1.4rem);
  --t-post: clamp(2.1rem, 1.4rem + 2.8vw, 3.6rem);
  --t-lead: clamp(1.05rem, .98rem + .35vw, 1.22rem);
  --t-big: clamp(2.2rem, 1.6rem + 2.2vw, 3.2rem);
  --t-body: 1rem; --t-read: 1.125rem; --t-small: .875rem; --t-label: .75rem;
  --track-display: -0.04em;

  --r-lg: 26px; --r-md: 16px; --r-pill: 999px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --page: 1180px; --read: 44rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0b0c; --bg-2: #111214; --fg: #ededea; --muted: #9a9e9b; --line: rgba(255, 255, 255, .09);
    --glass: rgba(26, 28, 30, .55); --glass-2: rgba(42, 45, 48, .75); --edge: rgba(255, 255, 255, .14);
    --shadow: 0 12px 40px -14px rgba(0, 0, 0, .7); --accent: #5cc49a; --accent-fg: #06150f;
    --a1: #1d7a57; --a2: #a8801f; --a3: #2a5f93; --up: #5cc49a; --down: #f07a70; --ok: #5cc49a;
    --spot: rgba(255, 255, 255, .1); --aurora-opacity: .45;
    --cat-macro: #7fb0e6; --cat-crypto: #e0b850; --cat-onchain: #5cc49a; --cat-markets: #b9a2e8;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0b0c; --bg-2: #111214; --fg: #ededea; --muted: #9a9e9b; --line: rgba(255, 255, 255, .09);
  --glass: rgba(26, 28, 30, .55); --glass-2: rgba(42, 45, 48, .75); --edge: rgba(255, 255, 255, .14);
  --shadow: 0 12px 40px -14px rgba(0, 0, 0, .7); --accent: #5cc49a; --accent-fg: #06150f;
  --a1: #1d7a57; --a2: #a8801f; --a3: #2a5f93; --up: #5cc49a; --down: #f07a70; --ok: #5cc49a;
  --spot: rgba(255, 255, 255, .1); --aurora-opacity: .45;
  --cat-macro: #7fb0e6; --cat-crypto: #e0b850; --cat-onchain: #5cc49a; --cat-markets: #b9a2e8;
  color-scheme: dark;
}

/* ---------- Nền tảng ---------- */
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 400 var(--t-body)/1.6 var(--font-body); -webkit-font-smoothing: antialiased; }
img, svg, video { max-width: 100%; display: block; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3, p, figure { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
.d { font-family: var(--font-display); letter-spacing: var(--track-display); font-weight: 700; line-height: 1; text-wrap: balance; overflow-wrap: break-word; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.label { font-size: var(--t-label); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: 100%; max-width: var(--page); margin-inline: auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.wrap-read { width: 100%; max-width: calc(var(--read) + 32px); margin-inline: auto; padding-inline: 16px; }
.wrap-wide { width: 100%; max-width: calc(56rem + 32px); margin-inline: auto; padding-inline: 16px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 16px; z-index: 100; background: var(--bg); padding: 8px 12px; border-radius: 8px; }

.glass { position: relative; background: var(--glass); -webkit-backdrop-filter: blur(22px) saturate(170%); backdrop-filter: blur(22px) saturate(170%);
  box-shadow: inset 0 1px 0 var(--edge), inset 0 0 0 1px var(--line), var(--shadow); }

/* ---------- Menu viên thuốc ---------- */
.nav { position: fixed; z-index: 30; left: 50%; transform: translateX(-50%); top: calc(12px + env(safe-area-inset-top, 0px));
  display: flex; align-items: center; gap: 2px; padding: 6px; border-radius: var(--r-pill); max-width: calc(100% - 24px); }
.nav a, .nav button { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: var(--r-pill);
  font-size: var(--t-small); border: 0; background: none; cursor: pointer; white-space: nowrap; transition: background-color .3s var(--ease), color .3s var(--ease); }
.nav a:hover, .nav button:hover { background: var(--glass-2); }
.nav .icon { width: 44px; padding: 0; justify-content: center; flex: none; }
.nav .lang { min-width: 48px; justify-content: center; font-family: var(--font-mono); font-size: var(--t-label); letter-spacing: .06em; background: var(--btn-bg); color: var(--btn-fg); padding: 0 14px; }
.nav .lang:hover { background: var(--accent); color: var(--accent-fg); }
.brand { display: inline-flex; align-items: center; gap: 9px; font-family: var(--font-display); font-weight: 700; letter-spacing: -.03em; }
.logo { width: 22px; height: 22px; border-radius: 7px; flex: none; position: relative;
  background: conic-gradient(from 210deg, var(--a1), var(--a2), var(--a3), var(--a1)); }
.logo::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--bg); box-shadow: 0 0 0 1.5px var(--fg); }
@media (max-width: 860px) { .nav .hide-md { display: none; } }
@media (max-width: 520px) { .nav .hide-sm { display: none; } .nav { gap: 8px; } }

/* ---------- Hero ---------- */
.hero { position: relative; isolation: isolate; overflow: hidden; padding-block: calc(116px + env(safe-area-inset-top, 0px)) 72px; }
.aurora { position: absolute; inset: -20% -10% 0; z-index: -1; pointer-events: none; opacity: var(--aurora-opacity);
  background: radial-gradient(40% 50% at 14% 22%, var(--a1), transparent 70%), radial-gradient(34% 44% at 88% 18%, var(--a3), transparent 70%), radial-gradient(42% 48% at 58% 96%, var(--a2), transparent 70%);
  filter: blur(40px); animation: drift 24s var(--ease) infinite alternate; }
.aurora-soft { opacity: calc(var(--aurora-opacity) * .7); }
.hero::after, .page-head::after { content: ""; position: absolute; inset: auto 0 0; height: 120px; z-index: -1; background: linear-gradient(transparent, var(--bg)); }
@keyframes drift { to { transform: translate3d(3%, 4%, 0) scale(1.08); } }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: clamp(28px, 4vw, 56px); align-items: center; }
.hero-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 22px; min-width: 0; }
.hero h1 { font-size: var(--t-hero); }
.grad { background: linear-gradient(110deg, var(--a1), var(--a2) 55%, var(--a3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { max-width: 46ch; font-size: var(--t-lead); color: var(--muted); font-weight: 300; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 14px; border-radius: var(--r-pill); font-size: var(--t-small); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); } 70%, 100% { box-shadow: 0 0 0 8px transparent; } }

.feature { display: flex; flex-direction: column; border-radius: var(--r-lg); overflow: hidden; min-width: 0; transition: transform .25s var(--ease); }
.feature img { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; border-bottom: 1px solid var(--line); }
.feature-body { padding: 22px 24px 24px; display: flex; flex-direction: column; gap: 12px; }
.feature-ex { color: var(--muted); font-size: var(--t-small); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.feature h2 { font-family: var(--font-display); font-size: var(--t-h3); letter-spacing: -.02em; line-height: 1.25; text-wrap: balance; }

/* ---------- Nút ---------- */
.ctas { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: var(--r-pill);
  font-size: var(--t-body); font-weight: 500; border: 0; cursor: pointer; transition: transform .2s var(--ease), background-color .2s var(--ease); }
.btn-sm { min-height: 44px; padding: 0 16px; font-size: var(--t-small); }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--btn-bg); color: var(--btn-fg); }
.btn .arrow { transition: transform .2s var(--ease); }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { transform: translateY(-2px); }
  .btn:hover:active { transform: scale(.97); }
  .btn:hover .arrow { transform: translateX(3px); }
  .tile:hover, .feature:hover, .topic:hover { transform: translateY(-3px); }
}
.rise { animation: rise .9s var(--ease) both; animation-delay: calc(var(--i, 0) * 80ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); filter: blur(8px); } }

/* ---------- Mục ---------- */
.section { padding-block: clamp(56px, 7vw, 104px); }
.section-tight { padding-top: 8px; }
.band { background: var(--bg-2); border-block: 1px solid var(--line); }
.sh { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 24px; margin-bottom: 28px; }
.sh h2 { font-size: var(--t-h2); }
.sh p { color: var(--muted); font-size: var(--t-small); max-width: 38ch; }
.more { display: flex; justify-content: flex-start; margin-top: 24px; }

/* ---------- Thẻ bài ---------- */
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: var(--t-label); color: var(--muted); letter-spacing: .02em; }
.cat-tag { font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--c, var(--accent)); }
[data-cat="macro"] { --c: var(--cat-macro); } [data-cat="crypto"] { --c: var(--cat-crypto); }
[data-cat="onchain"] { --c: var(--cat-onchain); } [data-cat="markets"] { --c: var(--cat-markets); }
.card-big { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-top: auto; }
.card-big .big { font-family: var(--font-display); font-size: var(--t-big); letter-spacing: -.045em; line-height: 1; font-weight: 700; color: var(--c, var(--fg)); overflow-wrap: anywhere; }

.bento { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: minmax(210px, auto); grid-auto-flow: dense; }
.tile { position: relative; overflow: hidden; border-radius: var(--r-lg); padding: 24px; display: flex; flex-direction: column; gap: 10px; min-width: 0; transition: transform .25s var(--ease); }
.tile::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .4s var(--ease);
  background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%), var(--spot), transparent 45%); }
.tile:hover::after { opacity: 1; }
.tile h3 { font-family: var(--font-display); font-size: var(--t-h3); letter-spacing: -.02em; line-height: 1.25; text-wrap: balance; }
.tile p { color: var(--muted); font-size: var(--t-small); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-cover { margin: -24px -24px 6px; width: calc(100% + 48px); max-width: none; aspect-ratio: 16 / 9; object-fit: cover; border-bottom: 1px solid var(--line); }
.w2 { grid-column: span 2; } .h2 { grid-row: span 2; } .w4 { grid-column: 1 / -1; }
.bento-bg { position: relative; isolation: isolate; }
.bento-bg::before { content: ""; position: absolute; inset: 10% 5%; z-index: -1; filter: blur(70px); opacity: calc(var(--aurora-opacity) * .6);
  background: radial-gradient(40% 50% at 20% 30%, var(--a1), transparent 70%), radial-gradient(40% 50% at 80% 70%, var(--a3), transparent 70%); }
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.cards .tile { min-height: 200px; }

/* ---------- Chuyên mục ---------- */
.topics { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.topic { display: flex; flex-direction: column; gap: 10px; padding: 24px; border-radius: var(--r-lg); background: var(--bg); border: 1px solid var(--line); min-width: 0; transition: transform .25s var(--ease), border-color .25s var(--ease); }
.topic:hover { border-color: var(--c); }
.topic-count { font-size: var(--t-big); line-height: 1; color: var(--c); }
.topic h3 { font-family: var(--font-display); font-size: var(--t-h3); letter-spacing: -.02em; }
.topic p { color: var(--muted); font-size: var(--t-small); }
.topic-go { margin-top: auto; display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-small); font-weight: 500; }

/* ---------- Dải tác giả ---------- */
.cta-band { border-radius: var(--r-lg); padding: clamp(28px, 6vw, 64px); display: flex; flex-direction: column; align-items: flex-start; gap: 18px;
  background: radial-gradient(60% 80% at 100% 0%, color-mix(in srgb, var(--a1) 30%, transparent), transparent 70%), var(--bg-2); border: 1px solid var(--line); }
.cta-band h2 { font-size: var(--t-h2); max-width: 18ch; }
.band-text { max-width: 60ch; }

/* ---------- Đầu trang danh sách ---------- */
.page-head { position: relative; isolation: isolate; overflow: hidden; padding-block: calc(120px + env(safe-area-inset-top, 0px)) 40px; }
.page-head .wrap { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.page-head h1 { font-size: var(--t-hero); }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 24px; }
.search { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 16px; border-radius: var(--r-pill); flex: 1 1 280px; max-width: 420px; color: var(--muted); }
.search input { flex: 1; min-width: 0; min-height: 44px; border: 0; background: none; outline: none; font: inherit; color: var(--fg); }
.search:focus-within { box-shadow: inset 0 0 0 2px var(--accent), var(--shadow); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-links { margin-bottom: 24px; }
.fchip { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--bg); font-size: var(--t-small); cursor: pointer; transition: background-color .2s var(--ease), color .2s var(--ease); }
.fchip:hover { background: var(--bg-2); }
.fchip[aria-pressed="true"], .fchip[aria-current="page"] { background: var(--btn-bg); color: var(--btn-fg); border-color: transparent; }
.empty { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; padding: 40px 0; color: var(--muted); }

/* ---------- Trang bài ---------- */
.post { padding-top: calc(112px + env(safe-area-inset-top, 0px)); }
.post-head { display: flex; flex-direction: column; gap: 16px; }
.post-title { font-family: var(--font-display); font-size: var(--t-post); letter-spacing: -.035em; line-height: 1.08; text-wrap: balance; overflow-wrap: break-word; }
.byline { font-size: var(--t-small); color: var(--muted); }
.byline a, .prose a:not(.btn), .sources a, .about-contact a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.keybox, .post-foot { width: calc(100% - 32px); max-width: var(--read); padding-inline: 0; }
.keybox { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1px; margin-top: 28px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; padding: 0; }
.keybox .key { background: var(--bg); padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.keybox .big { font-family: var(--font-display); font-size: var(--t-big); letter-spacing: -.045em; line-height: 1; }
.keybox .muted { font-size: var(--t-small); }
.ticker { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: var(--t-small); }
.ticker li { display: inline-flex; align-items: baseline; gap: 6px; }
.ticker span { color: var(--muted); }
.ticker i { font-style: normal; }
.ticker .up { color: var(--up); } .ticker .down { color: var(--down); }
.ticker-sm { font-size: var(--t-label); gap: 6px 14px; }
.post-cover { margin-top: 28px; }
.post-cover img { width: 100%; border-radius: var(--r-md); border: 1px solid var(--line); }
.prose { margin-top: 32px; font-size: var(--t-read); line-height: 1.75; }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { font-family: var(--font-display); font-size: 1.6rem; letter-spacing: -.02em; line-height: 1.25; margin-top: 1.8em; }
.prose h3 { font-family: var(--font-display); font-size: 1.25rem; margin-top: 1.5em; }
.prose blockquote { margin-inline: 0; padding-left: 18px; border-left: 3px solid var(--accent); color: var(--muted); }
.prose img { border-radius: var(--r-md); border: 1px solid var(--line); }
.prose table { width: 100%; border-collapse: collapse; font-size: var(--t-small); display: block; overflow-x: auto; }
.prose th, .prose td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; font-variant-numeric: tabular-nums; }
.prose code { font-family: var(--font-mono); font-size: .9em; background: var(--bg-2); padding: 2px 6px; border-radius: 6px; }
.prose ul, .prose ol { padding-left: 1.3em; }
.post-foot { margin-top: 40px; padding-top: 28px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 22px; }
.sources ul { margin: 8px 0 0; padding-left: 1.2em; font-size: var(--t-small); }
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.share .label { margin-right: 6px; }
.disclaimer { font-size: var(--t-small); color: var(--muted); }

/* ---------- Giới thiệu ---------- */
.about-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.about-item { border-radius: var(--r-lg); padding: 26px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.about-item h2 { font-family: var(--font-display); font-size: var(--t-h3); letter-spacing: -.02em; }
.about-item p { color: var(--muted); }
.about-contact { margin-top: 36px; display: flex; flex-direction: column; gap: 10px; }
.ctas-left { justify-content: flex-start; }

/* ---------- Chân trang ---------- */
.footer { padding-block: 48px 36px; color: var(--muted); font-size: var(--t-small); border-top: 1px solid var(--line); }
.footer .wrap { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr)); gap: 24px; }
.foot-brand { display: flex; flex-direction: column; gap: 10px; max-width: 34ch; }
.foot-brand .brand { color: var(--fg); min-height: 44px; }
.foot-links { display: flex; flex-direction: column; }
.footer a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }
.footer a:hover { color: var(--fg); }
.foot-copy { grid-column: 1 / -1; padding-top: 16px; border-top: 1px solid var(--line); }

/* ---------- Co giãn ---------- */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; }
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .bento { grid-template-columns: 1fr; } .w2, .w4 { grid-column: auto; } .h2 { grid-row: auto; }
  .tile { padding: 22px; border-radius: 22px; } .card-cover { margin: -22px -22px 6px; width: calc(100% + 44px); }
  .topics, .about-grid { grid-template-columns: 1fr; }
  .keybox { grid-template-columns: 1fr; }
  .footer .wrap { grid-template-columns: 1fr 1fr; } .foot-brand { grid-column: 1 / -1; }
  .prose { font-size: 1.0625rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
