/* ==========================================================================
   Mầm Chồi Lá — core.css
   Token, chữ nghĩa, khung trang. Không có gì thuộc hệ 3 chặng ở file này.
   Hệ 3 chặng nằm ở journey.css.
   ========================================================================== */

/* --- Font: self-host, subset vietnamese + latin ------------------------- */

@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/newsreader-600-vietnamese.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169,
    U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309,
    U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/newsreader-600-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Plus Jakarta Sans là variable font: một file phục vụ cả 400 và 600. */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/jakarta-vietnamese.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169,
    U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309,
    U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/jakarta-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --- Token --------------------------------------------------------------- */

:root {
  /* Bề mặt và chữ */
  --bg:        #F7F5F9;
  --surface:   #FDFCFE;
  --ink:       #2B2436;
  --ink-soft:  #6E6479;
  --rule:      #DED8E4;

  /* Dải chặng: hue xoay đều 330° → 264° → 215°.
     Khai báo một lần ở đây, journey.css chỉ ánh xạ lại. */
  --c-mam:       #9C3D6B;
  --c-choi:      #6A44A8;
  --c-la:        #2F5FA8;
  --c-mam-soft:  #F4E8EF;
  --c-choi-soft: #EDE8F6;
  --c-la-soft:   #E6EDF7;

  /* Chữ nghĩa */
  --font-display: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-text: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;

  /* Spacing: hệ nhân 1.5 từ 8px */
  --s1: 0.5rem;    /*  8 */
  --s2: 0.75rem;   /* 12 */
  --s3: 1.125rem;  /* 18 */
  --s4: 1.6875rem; /* 27 */
  --s5: 2.5rem;    /* 40 */
  --s6: 3.75rem;   /* 60 */
  --s7: 5.625rem;  /* 90 */

  --r: 6px;
  --r-pill: 999px;

  --measure: 37rem;
  --rail-w: 8.75rem; /* 140px */
}

/* --- Reset --------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 1.125rem;   /* 18px */
  line-height: 1.75;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }

/* --- Chữ nghĩa ----------------------------------------------------------- */

h1, h2 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2rem, 1.42rem + 2.6vw, 2.75rem); /* 32 → 44 */
  line-height: 1.15;
  letter-spacing: -0.012em;
}

h2 {
  font-size: clamp(1.625rem, 1.34rem + 1.27vw, 2rem); /* 26 → 32 */
  line-height: 1.25;
  letter-spacing: -0.008em;
  margin-top: var(--s6);
  margin-bottom: var(--s3);
}

h3 {
  font-family: var(--font-text);
  font-weight: 600;
  font-size: 1.375rem; /* 22 */
  line-height: 1.35;
  margin: var(--s5) 0 var(--s2);
  color: var(--ink);
}

p { margin: 0 0 var(--s4); }

ul, ol { margin: 0 0 var(--s4); padding-left: var(--s4); }
li { margin-bottom: var(--s2); }
li::marker { color: var(--ink-soft); }

strong { font-weight: 600; }

blockquote {
  margin: var(--s5) 0;
  padding-left: var(--s4);
  border-left: 3px solid var(--rule);
  color: var(--ink-soft);
}

/* Ngắt biên tập: một vạch ngắn canh trái, không phải đường kẻ hết chiều rộng */
.rule {
  border: 0;
  width: 4rem;
  height: 2px;
  background: var(--rule);
  margin: var(--s5) 0;
  border-radius: var(--r-pill);
}

/* --- Link ---------------------------------------------------------------- */

a {
  color: var(--stage, var(--ink));
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in srgb, var(--stage, var(--ink)) 35%, transparent);
  transition: text-decoration-color 120ms ease;
}

a:hover {
  text-decoration-color: currentColor;
}

a:focus-visible {
  outline: 2px solid var(--stage, var(--ink));
  outline-offset: 3px;
  border-radius: 2px;
}

/* --- Khung trang --------------------------------------------------------- */

.shell {
  max-width: 68rem;
  margin: 0 auto;
  padding: 0 var(--s4);
}

@media (max-width: 30rem) {
  .shell { padding: 0 var(--s3); }
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  color: var(--ink);
  padding: var(--s2) var(--s3);
  border-radius: var(--r);
  z-index: 20;
}
.skip:focus {
  left: var(--s3);
  top: var(--s3);
}

/* --- Header -------------------------------------------------------------- */

.masthead {
  padding: var(--s5) 0 var(--s3);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s2) var(--s4);
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}
.wordmark:hover { text-decoration: none; }

/* Ba chữ mang ba màu chặng — đây là chỗ người đọc học bảng mã màu */
.wordmark i { font-style: normal; }
.wordmark .w-mam  { color: var(--c-mam); }
.wordmark .w-choi { color: var(--c-choi); }
.wordmark .w-la   { color: var(--c-la); }

.masthead-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s3);
}

.masthead-link {
  font-size: 0.875rem;
  color: var(--ink-soft);
  text-decoration-color: var(--rule);
}
.masthead-link:hover { color: var(--ink); }

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

.foot {
  margin-top: var(--s7);
  padding: var(--s5) 0 var(--s6);
  border-top: 1px solid var(--rule);
  font-size: 0.875rem;
  color: var(--ink-soft);
}

.foot nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s3);
  margin-bottom: var(--s3);
}

.foot a {
  color: var(--ink-soft);
  text-decoration-color: var(--rule);
}
.foot a:hover { color: var(--ink); }

.foot p { margin: 0; max-width: var(--measure); }

/* --- Tôn trọng prefers-reduced-motion ----------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
