/* =========================================================
   Prebiotic.vn — Hệ thống style chung
   Phong cách: clean, y khoa, đáng tin cậy
   Font: Newsreader (serif display) + Geist (sans body)
   ========================================================= */

:root {
  /* Palette — Sapphire (mặc định) */
  --ink:        #0A1E2C;       /* navy gần đen */
  --ink-soft:   #1F3346;
  --muted:      #5C6F80;
  --line:       #DCE3EB;
  --line-soft:  #ECF0F4;
  --bg:         #FAFBFC;
  --bg-tint:    #F0F5F9;
  --paper:      #FFFFFF;

  --brand:      #0E5A8A;       /* xanh y khoa */
  --brand-deep: #0A4267;
  --brand-soft: #DBE8F2;
  --accent:     #5BB7A8;       /* mint */
  --accent-soft:#E2F2EE;
  --warn:       #C97B3A;

  /* Typography */
  --f-display:  'Newsreader', 'Times New Roman', serif;
  --f-sans:     'Geist', 'Geist Variable', system-ui, -apple-system, sans-serif;
  --f-mono:     'Geist Mono', ui-monospace, monospace;

  /* Spacing scale */
  --container:  1200px;
  --pad-x:      clamp(20px, 4vw, 56px);
  --gap-section:clamp(64px, 9vw, 128px);

  /* Radius */
  --r-sm: 6px;
  --r:    10px;
  --r-lg: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}

a {
  color: inherit;
  text-decoration: none;
}

img, svg { display: block; max-width: 100%; }

/* ---------- Typography ---------- */

h1, h2, h3, h4 {
  font-family: var(--f-display);
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0;
  text-wrap: balance;
}

h1 { font-size: clamp(44px, 6.4vw, 88px); line-height: 1.02; }
h2 { font-size: clamp(32px, 4.2vw, 56px); line-height: 1.08; }
h3 { font-size: clamp(22px, 2.2vw, 30px); line-height: 1.2; letter-spacing: -0.015em; }
h4 { font-size: 19px; line-height: 1.3; font-family: var(--f-sans); font-weight: 600; letter-spacing: -0.01em; }

p { margin: 0 0 1em; text-wrap: pretty; }
p.lead { font-size: clamp(18px, 1.6vw, 22px); line-height: 1.5; color: var(--ink-soft); max-width: 64ch; }

.eyebrow {
  font-family: var(--f-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: '';
  width: 22px;
  height: 1px;
  background: var(--brand);
  display: inline-block;
}

.serif-italic { font-family: var(--f-display); font-style: italic; font-weight: 400; }

/* ---------- Layout ---------- */

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding-left: var(--pad-x);
  padding-right: var(--pad-x);
}

section { padding-block: var(--gap-section); }
section.tight { padding-block: clamp(40px, 6vw, 80px); }

.divider { height: 1px; background: var(--line); }

/* ---------- Nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250,251,252,0.85);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--f-sans);
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: 17px;
  color: var(--ink);
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--accent) 0%, var(--brand) 60%, var(--brand-deep) 100%);
  position: relative;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.2);
}
.brand-mark::after{
  content:'';
  position:absolute; inset: 22%;
  border-radius:50%;
  background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.5), transparent 60%);
}
.brand-mark.sm { width: 20px; height: 20px; }
.brand small { color: var(--muted); font-weight: 400; font-size: 13px; margin-left: 2px; }

.nav-links {
  display: flex;
  gap: clamp(14px, 2vw, 28px);
  font-size: 14.5px;
  align-items: center;
}
.nav-links a {
  color: var(--ink-soft);
  padding: 6px 2px;
  border-bottom: 1.5px solid transparent;
  transition: color .15s, border-color .15s;
}
.nav-links a:hover { color: var(--brand); }
.nav-links a.active { color: var(--ink); border-bottom-color: var(--brand); }

.nav-cta {
  font-size: 13.5px;
  font-weight: 500;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  transition: background .15s;
}
.nav-cta:hover { background: var(--brand-deep); }
.nav-cta-mobile { display: none; }

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  padding: 0;
  flex-direction: column;
  gap: 4px;
}
.nav-toggle span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease;
}
.nav.open .nav-toggle span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.nav.open .nav-toggle span:nth-child(2) { opacity: 0; }
.nav.open .nav-toggle span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

@media (max-width: 820px){
  .nav-inner { position: relative; }
  .nav-toggle { display: inline-flex; }
  .nav-cta { display: none; }

  .nav-links { display: none; }
  .nav.open .nav-links {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(250,251,252,0.97);
    backdrop-filter: saturate(160%) blur(12px);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid var(--line);
    padding: 8px 20px 16px;
    box-shadow: 0 14px 24px rgba(0,0,0,0.06);
  }
  .nav.open .nav-links a {
    display: block;
    padding: 14px 4px;
    font-size: 16px;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
  }
  .nav.open .nav-links a:last-child { border-bottom: none; }
  .nav.open .nav-links a.active { border-bottom-color: var(--line); color: var(--brand); }
  .nav.open .nav-links a.nav-cta-mobile {
    display: inline-flex;
    align-self: flex-start;
    margin-top: 14px;
    padding: 11px 18px;
    border-bottom: none;
    border-radius: 999px;
    background: var(--ink);
    color: var(--paper);
    font-size: 14.5px;
  }
  .nav.open .nav-links a.nav-cta-mobile:hover { background: var(--brand-deep); color: var(--paper); }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-sans);
  font-size: 14.5px;
  font-weight: 500;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  transition: all .15s;
}
.btn:hover { background: var(--brand-deep); border-color: var(--brand-deep); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: var(--paper); }
.btn .arr { transition: transform .2s; }
.btn:hover .arr { transform: translateX(3px); }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--brand);
  font-weight: 500;
  font-size: 14.5px;
  border-bottom: 1px solid transparent;
  transition: border-color .15s;
}
.link-arrow:hover { border-bottom-color: var(--brand); }
.link-arrow .arr { transition: transform .2s; }
.link-arrow:hover .arr { transform: translateX(3px); }

/* ---------- Cards ---------- */

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 28px;
}

.feature-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 28px 26px;
  transition: border-color .15s, transform .15s;
}
.feature-card:hover { border-color: var(--brand); }
.feature-card .num {
  font-family: var(--f-display);
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.feature-card h3 { font-size: 22px; }
.feature-card p { color: var(--muted); margin: 0; font-size: 15px; }

/* ---------- Hero common ---------- */

.hero {
  padding-top: clamp(48px, 7vw, 96px);
  padding-bottom: clamp(48px, 7vw, 96px);
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: clamp(40px, 6vw, 80px);
  align-items: center;
}
@media (max-width: 880px){ .hero-grid{ grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */

.footer {
  border-top: 1px solid var(--line);
  background: var(--paper);
  padding: 56px 0 32px;
  font-size: 14px;
  color: var(--muted);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(2, 1fr);
  gap: 40px;
  margin-bottom: 48px;
}
.footer h5 { font-family: var(--f-sans); font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink); margin: 0 0 16px; }
.footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.footer a:hover { color: var(--brand); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
@media (max-width: 720px){
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-bottom { flex-direction: column; gap: 12px; align-items: flex-start; }
}

/* ---------- Badges & chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 500;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-deep);
}
.chip.mint { background: var(--accent-soft); color: #1F6B5F; }
.chip.outline { background: transparent; border: 1px solid var(--line); color: var(--ink-soft); }

/* ---------- Stat block ---------- */
.stat-num {
  font-family: var(--f-display);
  font-size: clamp(48px, 6vw, 84px);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--brand-deep);
}
.stat-label {
  font-size: 13px;
  color: var(--muted);
  margin-top: 12px;
  max-width: 22ch;
}

/* ---------- Utility ---------- */
.muted { color: var(--muted); }
.ink-soft { color: var(--ink-soft); }
.center { text-align: center; }
.mx-auto { margin-left: auto; margin-right: auto; }
.maxw-60 { max-width: 60ch; }
.maxw-70 { max-width: 70ch; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; } .mt-5 { margin-top: 48px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; } .mb-4 { margin-bottom: 32px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
@media (max-width: 880px){
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px){
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* Collapse inline multi-column grids on mobile so content stays readable. */
@media (max-width: 760px){
  [style*="grid-template-columns"]{
    grid-template-columns: 1fr !important;
    gap: 28px !important;
  }
  [style*="border-right"]{ border-right: none !important; }
  [style*="border-left"]{ border-left: none !important; }
}

/* ---------- Palette variants (Tweak switch) ---------- */
body[data-palette="ocean"] {
  --brand: #0E5A8A;
  --brand-deep: #0A4267;
  --brand-soft: #DBE8F2;
  --accent: #5BB7A8;
  --accent-soft: #E2F2EE;
}
body[data-palette="midnight"] {
  --brand: #1B3A6B;
  --brand-deep: #0F2547;
  --brand-soft: #DDE4F0;
  --accent: #7AAACD;
  --accent-soft: #E5EEF6;
  --ink: #0C1B33;
  --ink-soft: #1E2D49;
}
body[data-palette="cyan"] {
  --brand: #0B7A8D;
  --brand-deep: #08596A;
  --brand-soft: #D2EAEF;
  --accent: #88BFC9;
  --accent-soft: #E6F2F4;
}

body[data-font="serif"] h1,
body[data-font="serif"] h2,
body[data-font="serif"] h3 { font-family: var(--f-display); font-weight: 400; }
body[data-font="sans"] h1,
body[data-font="sans"] h2,
body[data-font="sans"] h3 { font-family: var(--f-sans); font-weight: 600; letter-spacing: -0.025em; }

body[data-density="airy"] { --gap-section: clamp(96px, 12vw, 160px); }
body[data-density="compact"] { --gap-section: clamp(48px, 6vw, 80px); }
