/* =========================================================================
   MTL Study · Bao Đậu Bách Khoa — kiểu dáng trang chủ
   Thứ tự: biến → reset → kiểu cơ bản → component → section → responsive

   Ràng buộc hiệu năng (xem brief mục 8):
   - không backdrop-filter
   - không box-shadow có bán kính mờ trên 8px
   - chỉ animate transform và opacity
   ========================================================================= */


/* =========================================================================
   1. BIẾN
   ========================================================================= */

:root {
  /* nền */
  --paper:      #F3F4EC;
  --paper-lift: #FCFCF8;
  --paper-sink: #E9EBE0;

  /* xanh */
  --forest-900: #14301A;
  --forest-700: #2C5A32;
  --forest-500: #4A7C4E;
  --forest-200: #BFD2BC;
  --forest-050: #E4EDE2;

  /* chữ
     --ink-faint trong brief là #8A9084, chỉ đạt 3,19:1 trên --paper-lift và
     2,96:1 trên --paper, trượt mức 4,5:1 cho chữ 13px. Đậm lên thành #666A61
     để đạt 5,37:1 / 4,99:1 / 4,59:1 trên ba nền. */
  --ink:        #1C1F1A;
  --ink-soft:   #5A6156;
  --ink-faint:  #666A61;

  /* đường kẻ */
  --line:        rgba(20, 48, 26, 0.12);
  --line-strong: rgba(20, 48, 26, 0.22);

  /* màu môn: chỉ dùng cho bìa tài liệu và chip đang chọn */
  --subject-toan: #14301A;
  --subject-li:   #1E4D6B;
  --subject-hoa:  #7A3B1E;
  --subject-van:  #4A3B7A;
  --subject-anh:  #1A5B4E;
  --subject-sinh: #4A7C4E;

  /* chữ */
  --font-display: "Lora", "Literata", Georgia, "Times New Roman", serif;
  --font-body: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  --fs-display: clamp(38px, 6vw, 60px);
  --fs-h1:      clamp(30px, 4.4vw, 44px);
  --fs-h2:      clamp(24px, 3.2vw, 32px);
  --fs-h3:      20px;
  --fs-body-lg: 18px;
  --fs-body:    16px;
  --fs-small:   14px;
  --fs-caption: 13px;

  /* nhịp dọc bậc 8 */
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 48px;
  --space-6: 64px;
  --space-7: 96px;
  --space-8: 128px;

  /* bo góc */
  --radius-chip: 4px;
  --radius-card: 12px;
  --radius-pill: 999px;

  /* khung */
  --container: 1200px;
  --gutter: 24px;
  --section-gap: var(--space-6);
  --topbar-height: 64px;

  /* bóng: tối đa 2px mờ, chỉ để tách mép */
  --shadow-hairline: 0 1px 2px rgba(20, 48, 26, 0.05);

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}


/* =========================================================================
   2. RESET
   ========================================================================= */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar-height) + var(--space-2));
}

body,
h1, h2, h3,
p, ul, ol, dl, dd, figure {
  margin: 0;
}

ul[class],
ol[class] {
  list-style: none;
  padding: 0;
}

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

button,
input {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
}

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

/* Các phần tử dùng thuộc tính hidden (menu thả, trạng thái rỗng, lớp phủ)
   không tự đặt display, nên quy tắc này thắng mà không cần !important. */
[hidden] {
  display: none;
}


/* =========================================================================
   3. KIỂU CƠ BẢN
   ========================================================================= */

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Tiếng Việt có hai tầng dấu chồng nhau. Không dòng chữ nào có
   line-height dưới 1.12, kể cả chữ display lớn. */
h1,
h2 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.18;
  letter-spacing: -0.015em;
  color: var(--forest-900);
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }

h3 {
  font-size: var(--fs-h3);
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
}

p {
  line-height: 1.7;
  max-width: 62ch;
}

.display {
  font-size: var(--fs-display);
  line-height: 1.14;
  letter-spacing: -0.02em;
}

.display em {
  font-style: italic;
  font-weight: 400;
  color: var(--forest-700);
}

:focus-visible {
  outline: 2px solid var(--forest-700);
  outline-offset: 2px;
}

::selection {
  background: var(--forest-200);
  color: var(--forest-900);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--space-2);
  top: var(--space-1);
  z-index: 100;
  padding: var(--space-1) var(--space-2);
  background: var(--forest-900);
  color: var(--paper-lift);
  border-radius: var(--radius-chip);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: none;
}

.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: var(--section-gap);
}

.section-sink {
  background: var(--paper-sink);
}

.section-head {
  margin-bottom: var(--space-5);
}

.section-head p {
  margin-top: var(--space-1);
  color: var(--ink-soft);
}

/* Nhãn chữ hoa nhỏ: chỉ dùng hai lần trên cả trang (hero và người sáng lập). */
.eyebrow {
  margin-bottom: var(--space-2);
  font-size: var(--fs-caption);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--forest-700);
}

.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}


/* =========================================================================
   4. COMPONENT
   ========================================================================= */

/* ---- Nút -------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  min-height: 48px;
  padding: 0 var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: var(--fs-body);
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

/* Mỗi màn hình nhìn thấy chỉ có một nút tô đặc. main.js lo việc đổi nút ở
   thanh trên sang tô đặc khi không còn nút tô đặc nào khác trong tầm nhìn. */
.btn-solid {
  background: var(--forest-900);
  color: var(--paper-lift);
}

.btn-solid:hover {
  background: var(--forest-700);
}

.btn-outline {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--forest-900);
}

.btn-outline:hover {
  border-color: var(--forest-900);
}

.text-button {
  min-height: 44px;
  padding: 0 var(--space-1);
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--forest-700);
  text-decoration: underline;
  text-decoration-color: var(--forest-200);
  text-underline-offset: 4px;
}

.text-button:hover {
  text-decoration-color: currentColor;
}

/* ---- Thương hiệu ------------------------------------------------------ */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--forest-900);
  color: var(--paper-lift);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.12;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--forest-900);
}

/* ---- Chip lọc môn ----------------------------------------------------- */

.chips {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.chip {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-chip);
  background: var(--paper-lift);
  color: var(--ink-soft);
  font-size: var(--fs-small);
  font-weight: 500;
  line-height: 1.2;
  scroll-snap-align: start;
}

.chip:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.chip[aria-selected="true"] {
  background: var(--subject);
  border-color: var(--subject);
  color: var(--paper-lift);
}

/* "Tất cả" khác loại với sáu môn: tách bằng khoảng 24px và một vạch dọc. */
.chip-all {
  border-color: var(--line-strong);
  color: var(--forest-900);
  font-weight: 600;
}

.chip-all[aria-selected="true"] {
  background: var(--forest-900);
  border-color: var(--forest-900);
  color: var(--paper-lift);
}

.chip-divider {
  flex: 0 0 auto;
  width: 1px;
  height: 28px;
  margin-inline: calc(var(--space-3) - var(--space-1));
  background: var(--line-strong);
}

/* ---- Card tài liệu ---------------------------------------------------- */

.doc-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--paper-lift);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-hairline);
}

.doc-cover {
  position: relative;
  height: 140px;
  padding: var(--space-2);
  background: var(--subject);
  color: var(--paper-lift);
}

.doc-cover-name {
  display: block;
  font-size: var(--fs-caption);
  font-weight: 500;
  line-height: 1.4;
}

.doc-cover-symbol {
  position: absolute;
  right: var(--space-3);
  bottom: 6px;
  font-family: var(--font-display);
  font-size: 64px;
  font-weight: 400;
  line-height: 1.12;
  opacity: 0.9;
}

.doc-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: var(--space-2) var(--space-3) 0;
}

.doc-meta {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  max-width: none;
  font-size: var(--fs-caption);
  line-height: 1.4;
  color: var(--ink-faint);
}

.doc-title {
  margin-top: var(--space-1);
}

.doc-desc {
  margin-top: var(--space-1);
  margin-bottom: var(--space-3);
  font-size: var(--fs-small);
  line-height: 1.6;
  color: var(--ink-soft);
}

/* Hàng hành động luôn nằm đáy card; ::after phủ cả card để dễ chạm trên mobile. */
.doc-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
  min-height: 52px;
  margin-top: auto;
  border-top: 1px solid var(--line);
  margin-inline: calc(-1 * var(--space-3));
  padding-inline: var(--space-3);
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--forest-900);
}

.doc-action::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-card);
}

.doc-action .icon {
  width: 16px;
  height: 16px;
  transition: transform 0.18s var(--ease);
}

.doc-card:hover {
  border-color: var(--forest-500);
}

.doc-card:hover .doc-action .icon {
  transform: translate(2px, -2px);
}

.doc-action:focus-visible {
  outline: none;
}

.doc-action:focus-visible::after {
  outline: 2px solid var(--forest-700);
  outline-offset: 2px;
}

/* ---- Trạng thái rỗng -------------------------------------------------- */

.empty-state {
  grid-column: 1 / -1;
  padding: var(--space-6) var(--space-3);
  background: var(--paper-lift);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-card);
  text-align: center;
}

.empty-state p {
  margin: var(--space-1) auto var(--space-3);
  color: var(--ink-soft);
}


/* =========================================================================
   5. SECTION
   ========================================================================= */

/* ---- Thanh trên ------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-height);
  background: var(--paper);
  border-bottom: 1px solid transparent;
}

.topbar.is-scrolled {
  border-bottom-color: var(--line);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: 100%;
}

.scroll-sentinel {
  position: absolute;
  top: 0;
  height: 1px;
  width: 1px;
}

.nav-panel {
  display: flex;
  flex: 1;
  align-items: center;
  gap: var(--space-3);
}

.nav {
  margin-inline: auto;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--ink-soft);
}

.nav-link:hover,
.nav-toggle[aria-expanded="true"] {
  color: var(--forest-900);
  background: var(--forest-050);
}

.icon-chevron {
  width: 16px;
  height: 16px;
  transition: transform 0.18s var(--ease);
}

.nav-toggle[aria-expanded="true"] .icon-chevron {
  transform: rotate(180deg);
}

.nav-tools {
  position: relative;
}

.tools-menu {
  position: absolute;
  top: calc(100% + var(--space-1));
  left: 50%;
  z-index: 10;
  min-width: 260px;
  padding: var(--space-1);
  background: var(--paper-lift);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-card);
  box-shadow: 0 2px 8px rgba(20, 48, 26, 0.08);
  transform: translateX(-50%);
}

.tools-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: var(--space-1) 12px;
  border-radius: 8px;
  color: var(--forest-900);
}

.tools-item:hover {
  background: var(--forest-050);
}

.tools-title {
  display: block;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

.tools-note {
  display: block;
  font-size: var(--fs-caption);
  line-height: 1.4;
  color: var(--ink-faint);
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  width: 220px;
}

.search-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--ink-faint);
  pointer-events: none;
}

.search-input {
  width: 100%;
  min-height: 44px;
  padding: 0 var(--space-2) 0 40px;
  background: var(--paper-lift);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  font-size: var(--fs-small);
  line-height: 1.4;
  color: var(--ink);
}

.search-input::placeholder {
  color: var(--ink-faint);
}

.search-input:focus-visible {
  outline: 2px solid var(--forest-700);
  outline-offset: 2px;
  border-color: var(--forest-700);
}

.topbar-cta {
  min-height: 44px;
  padding: 0 20px;
  font-size: 15px;
}

.menu-button {
  display: none;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  border-radius: var(--radius-pill);
  color: var(--forest-900);
}

.menu-button .icon {
  width: 24px;
  height: 24px;
}

/* Thanh trên (z-index 40, sticky) tạo ngữ cảnh xếp lớp riêng, nên panel menu
   bên trong nó chỉ nổi được so với các lớp thấp hơn 40. Lớp phủ phải nằm dưới
   thanh trên, nếu không nó sẽ đè lên panel và nuốt mọi lần chạm. */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(20, 31, 26, 0.36);
  opacity: 0;
  transition: opacity 0.22s var(--ease);
}

.scrim.is-visible {
  opacity: 1;
}

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

/* Hero và thư viện cùng nền, nên hero không có đệm đáy: khoảng cách giữa hai
   phần chỉ là đệm đầu của thư viện, đúng một nhịp section. */
.hero {
  padding-block: var(--space-5) 0;
}

.hero-grid {
  display: grid;
  grid-template-columns: 55fr 45fr;
  align-items: center;
  gap: var(--space-5);
}

.hero-lede {
  margin-top: var(--space-3);
  font-size: var(--fs-body-lg);
  color: var(--ink-soft);
  max-width: 34em;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: var(--space-4);
}

.stats {
  display: flex;
  gap: var(--space-5);
  margin-top: var(--space-5);
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
}

.stat {
  display: flex;
  flex-direction: column-reverse;
}

.stat dd {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--forest-900);
}

.stat dt {
  font-size: var(--fs-caption);
  line-height: 1.4;
  color: var(--ink-soft);
}

/* Nội dung hero hiện lên đúng một lần khi tải trang. */
.hero-copy > * {
  animation: rise 0.6s var(--ease) both;
}

.hero-copy > :nth-child(2) { animation-delay: 0.05s; }
.hero-copy > :nth-child(3) { animation-delay: 0.1s; }
.hero-copy > :nth-child(4) { animation-delay: 0.15s; }
.hero-copy > :nth-child(5) { animation-delay: 0.2s; }

.hero-art {
  animation: fade 0.8s 0.1s var(--ease) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

@keyframes fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Minh họa hero: ba trang tài liệu trên mặt bàn giấy, có vệt sáng tự nhiên
   từ góc trên trái. Toàn bộ là HTML, không có ảnh, không có chữ nung. */
.hero-art {
  position: relative;
  aspect-ratio: 4 / 3;
  max-width: 100%;
  overflow: hidden;
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
  background:
    radial-gradient(120% 90% at 12% 0%, rgba(255, 252, 240, 0.95) 0%, rgba(255, 252, 240, 0) 55%),
    linear-gradient(160deg, #E6E9DC 0%, #DADFCD 100%);
}

.sheet {
  position: absolute;
  width: 46%;
  aspect-ratio: 3 / 4;
  background: var(--paper-lift);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(20, 48, 26, 0.08);
  overflow: hidden;
}

.sheet-back  { left: 12%; top: 16%; transform: rotate(-8deg); }
.sheet-mid   { left: 30%; top: 12%; transform: rotate(3deg); }
.sheet-front { left: 44%; top: 20%; transform: rotate(-2deg); }

.sheet-band {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  height: 32%;
  padding: 0 10% 4%;
  background: var(--subject);
  color: var(--paper-lift);
}

.sheet-symbol {
  font-family: var(--font-display);
  font-size: clamp(22px, 3.2vw, 38px);
  line-height: 1.12;
}

.sheet-back .sheet-band,
.sheet-mid .sheet-band {
  justify-content: flex-start;
}

.sheet-lines {
  display: grid;
  gap: 9%;
  padding: 12% 12% 0;
  height: 68%;
  align-content: start;
}

.sheet-lines i {
  display: block;
  height: 5px;
  border-radius: 3px;
  background: var(--paper-sink);
}

.sheet-lines i:nth-child(3n) { width: 62%; }
.sheet-lines i:nth-child(4n) { width: 80%; }

/* ---- Thư viện --------------------------------------------------------- */

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.result-count {
  flex: 0 0 auto;
  font-size: var(--fs-small);
  color: var(--ink-soft);
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}

/* ---- Vì sao chọn ------------------------------------------------------ */

.why-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: var(--space-6);
}

.why-lede {
  margin-top: var(--space-2);
  color: var(--ink-soft);
}

.reasons {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.reason {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: var(--space-2);
  align-items: start;
}

.reason-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: var(--paper-lift);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  color: var(--forest-700);
}

.reason h3 {
  font-size: 17px;
}

.reason p {
  margin-top: 2px;
  font-size: var(--fs-small);
  line-height: 1.6;
  color: var(--ink-soft);
}

/* Minh họa: một trang vở kẻ dòng, đánh dấu vài dòng trọng tâm. */
.why-art {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 5 / 4;
  max-width: 100%;
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
  background:
    radial-gradient(110% 80% at 90% 0%, rgba(255, 252, 240, 0.9) 0%, rgba(255, 252, 240, 0) 60%),
    linear-gradient(200deg, #E1E5D6 0%, #D6DCC8 100%);
  overflow: hidden;
}

.page {
  position: relative;
  display: grid;
  align-content: start;
  gap: 14px;
  width: 62%;
  aspect-ratio: 3 / 4;
  padding: 11% 10% 0 16%;
  background: var(--paper-lift);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(20, 48, 26, 0.08);
  transform: rotate(2deg);
}

.page-rule {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 10%;
  width: 1px;
  background: rgba(122, 59, 30, 0.25);
}

.page-line i {
  display: block;
  height: 5px;
  border-radius: 3px;
  background: var(--paper-sink);
}

.page-line-short i { width: 58%; }

.page-line-mark i {
  background: var(--forest-050);
  box-shadow: inset 0 -3px 0 var(--forest-200);
  height: 10px;
}

.page-formula {
  font-family: var(--font-display);
  font-size: clamp(14px, 1.6vw, 18px);
  font-style: italic;
  line-height: 1.4;
  color: var(--forest-900);
}

.page-check {
  position: absolute;
  right: 8%;
  bottom: 9%;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--forest-900);
  color: var(--paper-lift);
}

.page-check .icon {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

/* ---- Lộ trình --------------------------------------------------------- */

.steps {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
  counter-reset: step;
}

/* Đường ray nối các chấm, nằm đúng tâm chấm 32px. */
.steps::before {
  content: "";
  position: absolute;
  top: 15px;
  left: 16px;
  right: 16px;
  height: 2px;
  background: var(--forest-200);
}

.step {
  position: relative;
}

.step-dot {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-bottom: var(--space-2);
  border-radius: 50%;
  font-size: var(--fs-small);
  font-weight: 600;
  line-height: 1.12;
}

/* Đậm dần từ bước 1 tới bước 4. Tương phản số trên chấm đều trên 4,5:1. */
.step:nth-child(1) .step-dot { background: var(--forest-200); color: var(--forest-900); }
.step:nth-child(2) .step-dot { background: var(--forest-500); color: var(--paper-lift); }
.step:nth-child(3) .step-dot { background: var(--forest-700); color: var(--paper-lift); }
.step:nth-child(4) .step-dot { background: var(--forest-900); color: var(--paper-lift); }

.step h3 {
  font-size: 18px;
}

.step p {
  margin-top: 4px;
  font-size: var(--fs-small);
  line-height: 1.6;
  color: var(--ink-soft);
}

/* ---- Người sáng lập --------------------------------------------------- */

.founder-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: start;
  gap: var(--space-5);
}

.portrait {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 5;
  max-width: 100%;
  overflow: hidden;
  border-radius: var(--radius-card);
  border: 1px solid var(--line-strong);
  background:
    radial-gradient(100% 70% at 20% 0%, rgba(255, 252, 240, 0.9) 0%, rgba(255, 252, 240, 0) 60%),
    linear-gradient(170deg, #DDE3D2 0%, #CBD5C0 100%);
}

.portrait-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portrait-initials {
  font-family: var(--font-display);
  font-size: clamp(56px, 7vw, 88px);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--forest-900);
}

.founder-role {
  margin-top: 4px;
  font-size: var(--fs-body-lg);
  color: var(--forest-700);
}

.founder-role + p {
  margin-top: var(--space-2);
  color: var(--ink-soft);
}

.contact-cards {
  display: grid;
  gap: var(--space-2);
}

.contact-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: 168px;
  padding: var(--space-3);
  background: var(--paper-lift);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-card);
}

.contact-head {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: var(--space-2);
  align-items: center;
}

.contact-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-card);
  background: var(--forest-050);
  color: var(--forest-700);
}

.contact-card h3 {
  font-size: 17px;
}

.contact-detail {
  font-size: var(--fs-small);
  line-height: 1.5;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.contact-detail a {
  color: var(--forest-900);
  font-weight: 600;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

/* ---- Chân trang ------------------------------------------------------- */

.footer {
  padding-block: var(--space-5);
  border-top: 1px solid var(--line);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  align-items: start;
  gap: var(--space-5);
}

.footer-brand p {
  margin-top: var(--space-1);
  font-size: var(--fs-small);
  color: var(--ink-soft);
}

.footer-links {
  display: grid;
  gap: 2px;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: var(--fs-small);
  color: var(--ink-soft);
}

.footer-links a:hover {
  color: var(--forest-900);
}

.copyright {
  align-self: end;
  font-size: var(--fs-caption);
  color: var(--ink-faint);
  text-align: right;
}


/* =========================================================================
   6. RESPONSIVE — điểm ngắt 1024px và 640px, thêm 768px cho lề trang
   ========================================================================= */

@media (min-width: 768px) {
  :root {
    --gutter: 40px;
  }
}

@media (min-width: 1025px) {
  :root {
    --section-gap: var(--space-7);
  }
}

/* ---- Tablet và nhỏ hơn ------------------------------------------------ */

@media (max-width: 1024px) {
  /* Thanh trên: panel trượt từ phải. */
  .menu-button {
    display: grid;
  }

  .topbar-inner {
    justify-content: space-between;
  }

  .brand {
    margin-right: auto;
  }

  .nav-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
    width: min(360px, 88vw);
    padding: calc(var(--topbar-height) + var(--space-2)) var(--space-3) var(--space-4);
    background: var(--paper-lift);
    border-left: 1px solid var(--line-strong);
    overflow-y: auto;
    visibility: hidden;
    transform: translateX(100%);
    transition: transform 0.26s var(--ease), visibility 0s linear 0.26s;
  }

  .nav-panel.is-open {
    visibility: visible;
    transform: none;
    transition: transform 0.26s var(--ease), visibility 0s;
  }

  .nav {
    order: 2;
    margin: 0;
  }

  .search {
    order: 1;
    width: 100%;
  }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
  }

  .nav-link {
    justify-content: space-between;
    width: 100%;
    min-height: 52px;
    padding: 0 12px;
    border-radius: 8px;
    font-size: var(--fs-body);
  }

  .tools-menu {
    position: static;
    min-width: 0;
    margin: 2px 0 var(--space-1);
    border-color: var(--line);
    box-shadow: none;
    transform: none;
  }

  /* Nút menu nằm trên panel để còn đóng được. */
  .menu-button {
    position: relative;
    z-index: 60;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: var(--space-5);
  }

  .hero-art {
    aspect-ratio: 16 / 10;
  }

  .doc-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .why-grid {
    grid-template-columns: 1fr;
    gap: var(--space-5);
  }

  .why-art {
    aspect-ratio: 16 / 10;
  }

  .page {
    width: auto;
    height: 82%;
  }

  .founder-grid {
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  }

  .contact-cards {
    grid-column: 1 / -1;
    grid-template-columns: 1fr 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .copyright {
    grid-column: 1 / -1;
    text-align: left;
  }
}

/* ---- Điện thoại ------------------------------------------------------- */

@media (max-width: 640px) {
  .topbar-cta {
    display: none;
  }

  .hero {
    padding-top: var(--space-4);
  }

  .hero-actions .btn {
    flex: 1 1 auto;
  }

  .stats {
    gap: var(--space-4);
  }

  .stat dd {
    font-size: 24px;
  }

  /* Chip cuộn ngang, bắt điểm dừng, mép phải hé một phần chip kế tiếp. */
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .chips {
    margin-inline: calc(-1 * var(--gutter));
    padding-inline: var(--gutter) 40px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--gutter);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .chips::-webkit-scrollbar {
    display: none;
  }

  .doc-grid {
    grid-template-columns: 1fr;
  }

  /* Lộ trình: cột dọc, đường ray chạy dọc bên trái các chấm. */
  .steps {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .steps::before {
    top: 16px;
    bottom: 16px;
    left: 15px;
    right: auto;
    width: 2px;
    height: auto;
  }

  .step {
    display: grid;
    grid-template-columns: 32px 1fr;
    column-gap: var(--space-2);
  }

  .step-dot {
    grid-row: span 2;
    margin-bottom: 0;
  }

  .founder-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .portrait {
    max-width: 320px;
  }

  .contact-cards {
    grid-template-columns: 1fr;
  }

  .contact-card {
    min-height: 0;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }
}


/* =========================================================================
   Tôn trọng người dùng tắt chuyển động. Chỗ duy nhất dùng !important.
   ========================================================================= */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
