/* ============================================================
   CORE VENTURES — DESIGN SYSTEM v1.0
   Single source of truth. Import first on every page.
   ============================================================ */

/* ── Google Fonts ────────────────────────────────────────── */
/* PERF-3: the @import that used to live here was removed — an @import inside a
   render-blocking stylesheet is only discovered AFTER this file is downloaded
   and parsed, adding a full round-trip in front of every font request. The same
   stylesheet is now requested directly from <head> (see Head.astro), in
   parallel with this file. Keep the two in sync if the family list changes. */

/* ── CSS Custom Properties ───────────────────────────────── */
:root {
  /* Brand palette — synced to logo cyan */
  --navy:       #001A3D;
  --navy-2:     #04244F;
  --navy-3:     #0A3168;
  --spark:      #3E8FE6;   /* azure accent (matches logo) — on dark bg */
  --spark-deep: #2456C0;   /* azure — on light bg, WCAG AA 6.63:1 */
  --spark-glow: rgba(62,143,230,.18);

  /* Neutral / text */
  --ink:        #0C1322;
  --ink-2:      #566077;
  --ink-3:      #677289;   /* A11Y-3: darkened from #8893A7 (3.10:1) → 4.83:1 on white, 4.51:1 on --bg-soft */
  --line:       #E5E9F0;
  --bg-soft:    #F5F7FB;
  --white:      #FFFFFF;

  /* Semantic */
  --text-on-dark:   #E8EAF0;
  --text-muted:     rgba(232,234,240,.55);
  --surface-dark:   rgba(255,255,255,.04);
  --surface-hover:  rgba(62,143,230,.08);
  --border-dark:    rgba(255,255,255,.08);
  --border-light:   #E5E9F0;
  /* A11Y-10: borders that CARRY MEANING (form controls, focusable boundaries)
     must reach 3:1 (WCAG 1.4.11). Purely decorative borders keep --border-light. */
  --border-input:      #8893A7;              /* 3.10:1 on #FFF, 2.89:1 on --bg-soft */
  --border-input-dark: rgba(255,255,255,.38); /* 3.47:1 on --navy, 3.36:1 on --navy-2 */

  /* Typography */
  /* Inter first (matches home); Be Vietnam Pro is the Vietnamese-diacritic fallback */
  --font-sans: 'Inter', 'Be Vietnam Pro', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Type scale (fluid) */
  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;
  --text-4xl:  2.25rem;
  --text-5xl:  3rem;
  --text-6xl:  3.75rem;
  --text-7xl:  4.5rem;

  /* Semantic fluid scale, interpolated from 320px to 1440px and capped beyond.
     This avoids plateaus between phone, tablet and laptop widths. */
  --title-page:      clamp(2rem, calc(1.571rem + 2.143vw), 3.5rem);
  --title-editorial: clamp(1.75rem, calc(1.464rem + 1.429vw), 2.75rem);
  --text-lead:       clamp(1rem, calc(.929rem + .357vw), 1.25rem);
  --hero-space:      clamp(2.5rem, calc(2.071rem + 2.143vw), 4rem);

  /* Spacing */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  /* FIX 2026-08-04: --space-7 bị dùng ở dich-vu/hop-tac/insights nhưng chưa
     bao giờ được định nghĩa → var() không hợp lệ → padding rơi về 0 (nội dung
     tràn khỏi khối). Bổ sung đúng thang 4pt giữa 6 (1.5) và 8 (2). */
  --space-7:  1.75rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* Layout */
  --container: 1200px;
  --container-sm: 760px;
  /* 84px quá cao so với chuẩn site doanh nghiệp (64–72px) — chiếm mất phần
     màn hình đầu tiên. Mọi khoảng đệm hero đều tính theo biến này nên đổi ở
     đây là cả trang tự co theo, không phải sửa từng chỗ. */
  --header-h: 68px;

  /* Radius */
  --r-sm:  6px;
  --r-md:  12px;
  --r-lg:  20px;
  --r-xl:  32px;
  --r-full: 9999px;

  /* Shadow */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
  --shadow-md:  0 4px 16px rgba(0,0,0,.16);
  --shadow-lg:  0 12px 40px rgba(0,0,0,.24);
  --shadow-spark: 0 0 32px rgba(62,143,230,.22);

  /* Motion */
  --ease-out:    cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast:    150ms;
  --dur-base:    250ms;
  --dur-slow:    400ms;
  --dur-enter:   600ms;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; }
ul, ol { list-style: none; }
input, textarea, select { font: inherit; }

/* ── Typography utilities ────────────────────────────────── */
.text-balance  { text-wrap: balance; }
.text-pretty   { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; font-weight: 700; line-height: 1.1; letter-spacing: -0.025em; }
p { text-wrap: pretty; }

/* ── Container ───────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-6);
}
.container-sm {
  width: 100%;
  max-width: var(--container-sm);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

/* ── Section spacing ─────────────────────────────────────── */
.section     { padding-block: var(--space-24); }
.section-sm  { padding-block: var(--space-16); }
.section-lg  { padding-block: var(--space-32); }

/* ── Background variants ─────────────────────────────────── */
.bg-navy   { background: var(--navy); }
.bg-navy-2 { background: var(--navy-2); }
.bg-soft   { background: var(--bg-soft); }
.bg-white  { background: var(--white); }

/* ── Text on dark ────────────────────────────────────────── */
.on-dark           { color: var(--text-on-dark); }
.on-dark p         { color: rgba(232,234,240,.75); }
.on-dark h1, .on-dark h2, .on-dark h3 { color: var(--white); }

/* ── Eyebrow label ───────────────────────────────────────── */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  /* A11Y-2 (WCAG 1.4.3): eyebrow is 12px text → needs 4.5:1.
     --spark #3E8FE6 on white = 3.35:1 (FAIL) → default to --spark-deep #2456C0 = 6.63:1.
     Token values are unchanged; only the usage context is switched.
     Dark surfaces keep --spark (5.17:1 on --navy) — see override below. */
  color: var(--spark-deep);
}
/* Mô-típ đề mục 2026-08-04: gạch ngang bị thay bằng KHỐI VUÔNG XOAY 45°,
   trích từ khối lập phương trong logo Core Ventures. Gạch ngang là mô-típ
   template phổ thông, không gắn với nhận diện nào. Khối này lặp lại ở mọi
   đề mục nên trở thành dấu hiệu riêng của site.
   Dựng bằng 2 lớp: lõi đặc + viền ngoài mảnh (gợi mặt khối lập phương). */
.eyebrow::before {
  content: '';
  display: block;
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  background: var(--spark-deep);
  transform: rotate(45deg);
  border-radius: 1px;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--spark-deep) 26%, transparent),
              0 0 0 4px color-mix(in srgb, var(--spark-deep) 9%, transparent);
}
/* Dark surfaces: restore the brand --spark (passes 5.17:1 on --navy / 4.58:1 on --navy-2). */
.page-hero .eyebrow,
.bg-navy .eyebrow,
.on-dark .eyebrow,
.dark .eyebrow,
.card-dark .eyebrow,
.deals .eyebrow,
.consult .eyebrow,
.xb-band .eyebrow { color: var(--spark); }
.page-hero .eyebrow::before,
.bg-navy .eyebrow::before,
.on-dark .eyebrow::before,
.dark .eyebrow::before,
.card-dark .eyebrow::before,
.deals .eyebrow::before,
.consult .eyebrow::before,
.xb-band .eyebrow::before {
  background: var(--spark);
  box-shadow: 0 0 0 1px rgba(62,143,230,.30), 0 0 0 4px rgba(62,143,230,.11);
}
/* khoảng cách hợp với khối vuông (nhỏ hơn gạch 20px nên cần thoáng hơn) */
.eyebrow { gap: var(--space-3); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.75em 1.75em;
  border-radius: var(--r-full);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: .02em;
  transition: transform var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out),
              background var(--dur-base);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--spark);
  color: var(--navy);
}
.btn-primary:hover { box-shadow: var(--shadow-spark); }

.btn-ghost {
  background: transparent;
  color: var(--text-on-dark);
  /* A11Y-10: a button's own boundary is a UI component -> needs 3:1.
     --border-dark (rgba(255,255,255,.08)) is 1.24:1 on navy. */
  border: 1px solid var(--border-input-dark);
}
.btn-ghost:hover {
  background: var(--surface-hover);
  border-color: var(--spark);
  color: var(--spark);
}

.btn-outline-dark {
  background: transparent;
  color: var(--spark-deep);
  border: 1.5px solid var(--spark-deep);
}
.btn-outline-dark:hover {
  background: var(--spark-deep);
  color: var(--white);
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  padding: var(--space-8);
  transition: box-shadow var(--dur-base) var(--ease-out),
              transform var(--dur-base) var(--ease-out),
              border-color var(--dur-base);
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  border-color: var(--spark-deep);
}

.card-dark {
  background: var(--surface-dark);
  border: 1px solid var(--border-dark);
  border-radius: var(--r-lg);
  padding: var(--space-8);
  transition: background var(--dur-base), border-color var(--dur-base);
}
.card-dark:hover {
  background: rgba(255,255,255,.06);
  border-color: var(--spark);
}

/* ── Divider ─────────────────────────────────────────────── */
.divider { height: 1px; background: var(--line); margin-block: var(--space-8); }
.divider-dark { height: 1px; background: var(--border-dark); }

/* ── Grid helpers ────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-8); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-8); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-6); }

/* ── Flex helpers ────────────────────────────────────────── */
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }

/* ── Scroll reveal base (GSAP targets) ───────────────────── */
/* PERF-1: hiding these is gated behind `html.js-anim`, a class set by the
   inline bootstrap in Base.astro ONLY when (a) JS runs, (b) the page actually
   ships GSAP (`route.gsap`) and (c) the user did not ask for reduced motion.
   The same inline script drops the class again after a hard timeout, so a slow
   / failed / blocked GSAP download can never leave the page blank. Without JS
   the selectors below simply never match → full content, no animation. */
html.js-anim .reveal      { opacity: 0; transform: translateY(28px); }
html.js-anim .reveal-left { opacity: 0; transform: translateX(-28px); }
html.js-anim .reveal-up   { opacity: 0; transform: translateY(16px); }

/* PERF-1: first-viewport content (page hero) must NEVER wait on JS — it is the
   LCP element on 11 pages. It animates in with a pure-CSS entrance that starts
   at first paint; core.js skips `.page-hero` when wiring GSAP reveals so the
   two never fight. Same easing/duration family as the home hero (`heroIn`). */
@keyframes tvHeroIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: none; }
}
html.js-anim .page-hero .reveal,
html.js-anim .page-hero .reveal-left,
html.js-anim .page-hero .reveal-up {
  animation: tvHeroIn .8s cubic-bezier(.16, 1, .3, 1) both;
}
/* Cascade the hero children (eyebrow → h1 → lead paragraph → …) without JS.
   Kept to 70ms steps and 3 levels: the H1 is the LCP element on most pages, so
   its entrance must not be pushed back by more than a frame or two. */
html.js-anim .page-hero .reveal ~ .reveal { animation-delay: .07s; }
html.js-anim .page-hero .reveal ~ .reveal ~ .reveal { animation-delay: .14s; }
html.js-anim .page-hero .stagger-group .reveal-up { animation-delay: .21s; }
html.js-anim .page-hero .stagger-group .reveal-up ~ .reveal-up { animation-delay: .28s; }

/* ── Reduced motion overrides ────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .reveal, .reveal-left, .reveal-up,
  html.js-anim .reveal, html.js-anim .reveal-left, html.js-anim .reveal-up {
    opacity: 1;
    transform: none;
  }
  html.js-anim .page-hero .reveal,
  html.js-anim .page-hero .reveal-left,
  html.js-anim .page-hero .reveal-up { animation: none; }
}

/* Mobile browsers and embedded webviews can suspend ScrollTrigger while the
   address bar/viewport is settling. Never make business-critical copy depend
   on a scroll animation on small screens: keep every reveal target readable
   and let desktop retain the progressive entrance effect. */
@media (max-width: 767px) {
  html.js-anim .reveal,
  html.js-anim .reveal-left,
  html.js-anim .reveal-up {
    opacity: 1;
    transform: none;
    animation: none !important;
  }
}

/* ── Page hero (inner pages) ─────────────────────────────── */
.page-hero {
  background: var(--navy);
  /* One vertical rhythm for every inner-page hero. Individual pages may add
     a visual or KPI below this opening stack, but may not alter its spacing. */
  --hero-top-space: clamp(3.5rem, 6vw, 5.5rem);
  --hero-crumb-gap: clamp(1.5rem, 2.5vw, 2rem);
  --hero-label-gap: clamp(1.25rem, 2vw, 1.5rem);
  --hero-title-gap: clamp(1.25rem, 2.5vw, 1.75rem);
  padding-top: calc(var(--header-h) + var(--hero-top-space));
  padding-bottom: clamp(3rem, 5vw, 4.5rem);
  color: var(--white);
}
.page-hero .breadcrumb { margin: 0 0 var(--hero-crumb-gap); }
.page-hero .eyebrow { margin: 0 0 var(--hero-label-gap); }
.page-hero h1 {
  max-inline-size: min(18ch, 100%);
  font-size: var(--title-page);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.06;
  color: var(--white);
  margin: 0 0 var(--hero-title-gap);
  text-wrap: balance;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}
.page-hero p {
  font-size: var(--text-lead);
  line-height: 1.6;
  color: rgba(232,234,240,.7);
  max-width: 60ch;
  margin: 0;
}
/* Service heroes already identify their location with a breadcrumb. Repeating
   the generic "Dịch vụ" eyebrow consumes space without adding information. */
.page-hero .breadcrumb + .svc-hero .eyebrow { display: none; }
.page-hero .svc-hero { align-items: start; }
/* Align the service visual to the heading, rather than centering it against
   the whole copy block. This removes the top-heavy gap on the visual side. */
@media (min-width: 901px) {
  .page-hero .svc-hero__visual {
    /* The SVG reserves a label row above its main value. Offset the complete
       scene so its primary value, not its invisible viewBox edge, aligns with
       the H1 in the copy column. */
    margin-top: -3.5rem;
  }
}
/* ── Hero atmosphere (syncs the home hero vibe across every sub-page) ──
   ::before = dotted grid + spark glow on the right, fading downward.
   ::after  = faint concentric orbital rings echoing the home dashboard scene.
   Purely decorative + pointer-events:none → no interaction/a11y impact. */
.page-hero { position: relative; overflow: hidden; }
.page-hero > .container,
.page-hero > * { position: relative; z-index: 2; }
.page-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 64% 56% at 86% 32%, var(--spark-glow), transparent 70%),
    radial-gradient(circle at 1px 1px, rgba(255,255,255,.05) 1px, transparent 0),
    linear-gradient(180deg, transparent 58%, rgba(0,8,20,.45));
  background-size: 100% 100%, 26px 26px, 100% 100%;
  -webkit-mask-image: linear-gradient(180deg, #000 62%, transparent);
          mask-image: linear-gradient(180deg, #000 62%, transparent);
}
/* The dotted field carries the brand atmosphere. A decorative orbital ring
   competes with required Vietnamese headlines, so it is intentionally absent. */

/* ── Tag/badge ───────────────────────────────────────────── */
.tag {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: .06em;
  padding: .25em .75em;
  border-radius: var(--r-full);
  border: 1px solid var(--border-light);
  color: var(--ink-2);
}
.tag-cyan {
  border-color: rgba(62,143,230,.3);
  color: var(--spark-deep);
  background: rgba(62,143,230,.06);
}

/* ── Stat/KPI ────────────────────────────────────────────── */
.kpi-value {
  font-size: clamp(var(--text-3xl), 4vw, var(--text-5xl));
  font-weight: 800;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  color: var(--spark);
  line-height: 1;
}
.kpi-label {
  font-size: var(--text-sm);
  color: rgba(232,234,240,.6);
  margin-top: var(--space-2);
}

/* ── Section header block ────────────────────────────────── */
.section-header { margin-bottom: var(--space-12); }
.section-header h2 {
  font-size: clamp(var(--text-2xl), 3.5vw, var(--text-4xl));
  margin-top: var(--space-3);
  margin-bottom: var(--space-4);
}
.section-header p {
  font-size: var(--text-lg);
  color: var(--ink-2);
  max-width: 560px;
}
.section-header.center { text-align: center; }
.section-header.center p { margin-inline: auto; }

/* ── Scrollbar (chromium) ────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--navy-2); }
::-webkit-scrollbar-thumb { background: var(--navy-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--spark); }

/* ── Focus visible ───────────────────────────────────────── */
:focus-visible { outline: 2px solid var(--spark); outline-offset: 3px; }

/* ── Screen-reader-only utility (A11Y-11 heading ladder) ─────
   Keeps a heading in the a11y/outline tree without changing the visual design. */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ── Skip link (A11Y-5, WCAG 2.4.1 / 2.4.7) ──────────────────
   Base.astro hides it off-screen inline; these rules bring it back on focus.
   !important is required to beat that inline style. */
.skip-link:focus,
.skip-link:focus-visible {
  position: fixed !important;
  left: var(--space-4) !important;
  top: var(--space-4) !important;
  width: auto !important;
  height: auto !important;
  overflow: visible !important;
  z-index: 9999;
  background: var(--navy);
  color: var(--white);
  padding: .75em 1.25em;
  border-radius: var(--r-md);
  border: 2px solid var(--spark);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-lg);
}

/* ── Responsive breakpoints ──────────────────────────────── */
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  :root { --header-h: 58px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .container, .container-sm { padding-inline: var(--space-5); }
  .section { padding-block: var(--space-16); }
  .section-lg { padding-block: var(--space-20); }
}
