/* ============================================================
   AAVE.VN Cluster — Shared Style
   Design match: file gốc aave.vn
   Font: DM Sans + DM Serif Display + JetBrains Mono
   Palette: Navy #142459 · Blue #1651c8 · White #fbfcff
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --navy:      #142459;
  --navy-dark: #0d1830;
  --blue:      #1651c8;
  --blue-mid:  #3b70e8;
  --blue-light:#7eb4ff;
  --blue-pale: #a5c4f8;
  --bg:        #fbfcff;
  --bg2:       #f4f8ff;
  --bg3:       #edf4ff;
  --border:    #d0e2ff;
  --text:      #0f172a;
  --text-mid:  #2d3f5e;
  --text-dim:  #5c7a9e;
  --green:     #059669;
  --red:       #dc2626;
  --yellow:    #d97706;
  --sans:      'DM Sans', system-ui, sans-serif;
  --serif:     'DM Serif Display', Georgia, serif;
  --mono:      'JetBrains Mono', 'Courier New', monospace;
  --max-w:     860px;
  --radius:    8px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.78;
  font-size: clamp(14px, 2.2vw, 15.5px);
  -webkit-font-smoothing: antialiased;
}

/* ── PROGRESS BAR ── */
#reading-progress,
#rp {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: linear-gradient(90deg, var(--blue), var(--blue-mid));
  z-index: 1000; transition: width .1s linear;
}

/* ── TOPBAR ── */
.topbar {
  background: var(--navy);
  padding: 9px clamp(14px,4vw,24px);
  display: flex; flex-wrap: wrap;
  align-items: center; justify-content: space-between;
  gap: 4px;
  font-size: clamp(11px, 2.8vw, 13px);
  border-bottom: 2px solid var(--blue-mid);
  position: sticky; top: 0; z-index: 100;
}
.topbar-brand,
.topbar-logo {
  font-weight: 700; color: #fff; letter-spacing: .5px;
  display: flex; align-items: center; gap: 9px;
  text-decoration: none; font-family: var(--sans);
}
.topbar-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--blue-light); flex-shrink: 0;
  animation: pulse 2.5s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.35} }
.topbar-nav { display: flex; gap: 22px; flex-wrap: wrap; }
.topbar-nav a { color: var(--blue-light); text-decoration: none; font-weight: 500; transition: color .15s; }
.topbar-nav a:hover { color: #fff; text-decoration: underline; }
.topbar-nav a.active { color: #fff; }

/* ── BREADCRUMB ── */
.breadcrumb {
  display: block; width: 100%; box-sizing: border-box;
  padding: 14px clamp(12px,4vw,24px) 0;
  font-size: 12.5px; color: var(--text-dim);
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.breadcrumb a { color: var(--blue); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* ── HERO ── */
.hero {
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 45%, var(--blue) 100%);
  color: #fff;
  padding: clamp(40px,7vw,72px) clamp(16px,6vw,48px) clamp(36px,6vw,60px);
  text-align: center; position: relative; overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(59,112,232,.25) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(14,165,233,.15) 0%, transparent 40%);
}
.hero > * { position: relative; z-index: 1; }

.hero-label {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25);
  border-radius: 20px; padding: 4px clamp(12px,3vw,16px);
  font-size: clamp(10px,2vw,12px); letter-spacing: 1.5px;
  text-transform: uppercase; margin-bottom: clamp(14px,3vw,20px);
  color: var(--blue-pale); font-weight: 500;
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(22px, 5vw, 44px);
  font-weight: 400; line-height: 1.2;
  margin-bottom: clamp(10px,2.5vw,16px); color: #fff;
  max-width: 800px; margin-left: auto; margin-right: auto;
}
.hero h1 em { font-style: italic; color: var(--blue-pale); }

.hero-sub {
  font-size: clamp(14px, 2.4vw, 16px);
  color: var(--blue-pale); line-height: 1.72;
  max-width: 600px; margin: 0 auto 24px; font-weight: 300;
}
.hero-meta {
  display: flex; justify-content: center; flex-wrap: wrap;
  gap: 20px; font-size: 12.5px; color: var(--blue-light);
  border-top: 1px solid rgba(255,255,255,.15);
  padding-top: 20px; max-width: 560px; margin: 0 auto;
}
.hero-meta span { display: flex; align-items: center; gap: 7px; }

/* ── TOC ── */
.toc-wrap {
  max-width: var(--max-w); margin: 0 auto;
  padding: 28px clamp(12px,4vw,24px) 0;
}
.toc {
  background: var(--navy);
  border-radius: var(--radius); padding: 20px 24px;
  border: 1px solid var(--navy);
}
.toc-title {
  font-size: 11px; text-transform: uppercase;
  letter-spacing: .1em; color: var(--blue-pale);
  margin-bottom: 14px; font-weight: 600;
}
.toc ol { padding-left: 20px; }
.toc li { margin-bottom: 5px; }
.toc a {
  color: var(--blue-light); text-decoration: none; font-size: 13.5px;
  transition: color .15s;
}
.toc a:hover { color: #fff; }

/* ── MAIN CONTENT ── */
.content {
  max-width: var(--max-w); margin: 0 auto;
  padding: 44px clamp(12px,4vw,24px) 80px;
}
.section { margin-bottom: 60px; }

.section-label {
  display: inline-block;
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  color: var(--blue); letter-spacing: .08em; text-transform: uppercase;
  border: 1px solid var(--border); border-radius: 4px;
  padding: 2px 8px; margin-bottom: 10px;
  background: var(--bg3);
}

h2 {
  font-family: var(--serif);
  font-size: clamp(1.3rem, 3vw, 1.75rem);
  font-weight: 400; color: var(--text);
  margin-bottom: 18px; line-height: 1.3;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}
h3 {
  font-size: 1rem; font-weight: 600;
  color: var(--text); margin: 24px 0 10px;
}
p { margin-bottom: 14px; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
strong { font-weight: 600; }

/* ── CALLOUT ── */
.callout {
  border-left: 3px solid; border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 18px; margin: 20px 0; font-size: 14px;
}
.callout.info   { border-color: var(--blue);   background: #edf4ff; }
.callout.warn   { border-color: var(--yellow);  background: #fffbeb; }
.callout.danger { border-color: var(--red);     background: #fef2f2; }
.callout.good   { border-color: var(--green);   background: #f0fdf4; }
.callout-title {
  font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; margin-bottom: 6px;
}
.callout.info   .callout-title { color: var(--blue); }
.callout.warn   .callout-title { color: var(--yellow); }
.callout.danger .callout-title { color: var(--red); }
.callout.good   .callout-title { color: var(--green); }

/* ── CODE ── */
pre {
  background: var(--navy-dark); border: 1px solid var(--navy);
  border-radius: var(--radius); padding: 18px 20px;
  overflow-x: auto; margin: 18px 0;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.65;
  color: var(--blue-pale);
}
code { font-family: var(--mono); font-size: 13px; }
p code, li code {
  background: var(--bg3); color: var(--blue);
  padding: 2px 6px; border-radius: 4px;
  font-size: 12.5px; border: 1px solid var(--border);
}

/* ── TABLE ── */
.table-wrap { overflow-x: auto; margin: 20px 0; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead tr { background: var(--navy); }
th {
  text-align: left; padding: 10px 14px;
  font-family: var(--mono); font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--blue-pale); font-weight: 500;
}
td { padding: 11px 14px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg2); }

/* ── FORMULA ── */
.formula {
  background: var(--navy-dark);
  border: 1px solid var(--navy); border-left: 3px solid var(--blue-mid);
  border-radius: var(--radius); padding: 18px 22px; margin: 18px 0;
  font-family: var(--mono); font-size: 13.5px; color: var(--blue-pale);
  text-align: center; line-height: 1.8;
}

/* ── DEFINITION CARD ── */
.def-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px; margin: 14px 0;
}
.def-term {
  font-family: var(--mono); font-size: 12.5px; font-weight: 500;
  color: var(--blue); margin-bottom: 6px;
}
.def-body { font-size: 14px; color: var(--text-mid); }

/* ── STEP LIST ── */
.steps { list-style: none; counter-reset: step; }
.steps li {
  counter-increment: step;
  display: flex; gap: 14px;
  margin-bottom: 16px; align-items: flex-start;
}
.steps li::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  color: #fff; background: var(--blue);
  border-radius: 5px; min-width: 34px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  margin-top: 3px; flex-shrink: 0;
}

/* ── RELATED / CLUSTER NAV ── */
.related {
  background: var(--navy);
  padding: 44px clamp(12px,4vw,24px);
}
.related-inner { max-width: var(--max-w); margin: 0 auto; }
.related-title {
  font-family: var(--mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--blue-pale); margin-bottom: 22px;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}
.related-card {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius); padding: 14px 16px;
  text-decoration: none; display: block;
  transition: border-color .2s, background .2s;
}
.related-card:hover {
  border-color: var(--blue-light);
  background: rgba(255,255,255,.12);
  text-decoration: none;
}
.related-card.pillar {
  border-color: rgba(126,180,255,.4);
  background: rgba(22,81,200,.2);
}
.related-card-label {
  font-family: var(--mono); font-size: 10px;
  color: var(--blue-light); text-transform: uppercase;
  letter-spacing: .08em; margin-bottom: 5px;
}
.related-card.pillar .related-card-label { color: #ffd700; }
.related-card-title {
  font-size: 13px; font-weight: 500;
  color: #fff; line-height: 1.4;
}

/* ── FOOTER ── */
footer {
  background: var(--navy-dark);
  border-top: 2px solid var(--navy);
  padding: 28px clamp(12px,4vw,24px);
  text-align: center;
  font-size: 12.5px; color: var(--blue-pale);
}
footer a { color: var(--blue-light); }
footer a:hover { color: #fff; }
footer p { margin-bottom: 6px; }

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  .topbar-nav { display: none; }
  .hero { padding: 36px 16px 32px; }
  .content { padding: 28px 14px 60px; }
  .related { padding: 32px 14px; }
}

/* ── CLUSTER NAV ── */
.cluster-nav{background:linear-gradient(135deg,#fffbeb,#fef9c3);border:1px solid #fde68a;border-radius:clamp(8px,2vw,12px);padding:clamp(18px,4vw,32px) clamp(16px,4vw,32px);margin-bottom:clamp(14px,3vw,28px);}
.cluster-nav-title{font-size:clamp(11px,2.5vw,12px);text-transform:uppercase;letter-spacing:1.5px;color:#92400e;font-family:system-ui,sans-serif;margin-bottom:clamp(14px,3vw,20px);font-weight:700;}
.cluster-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:clamp(10px,2vw,14px);}
.cluster-card{background:#fff;border:1px solid #fde68a;border-radius:8px;padding:clamp(12px,2.5vw,16px);text-decoration:none;display:block;transition:box-shadow .2s,border-color .2s;}
.cluster-card:hover{border-color:#b45309;box-shadow:0 2px 12px rgba(180,83,9,.12);}
.cluster-tag{font-size:10px;text-transform:uppercase;letter-spacing:1px;color:#b45309;font-family:system-ui,sans-serif;font-weight:700;margin-bottom:5px;}
.cluster-title{font-size:clamp(13px,3vw,14px);font-weight:600;color:#0c0a09;font-family:system-ui,sans-serif;line-height:1.4;margin-bottom:4px;}
.cluster-desc{font-size:clamp(11px,2.5vw,12px);color:#6b7280;font-family:system-ui,sans-serif;line-height:1.5;}
