/*
 * Landing page theo Figma "03 / 8x · Đỏ kem cổ điển · Chữ lớn" (node 40:107).
 * Token giữ đúng tên biến Figma; số đo desktop lấy từ frame 1536px (nội dung 1280px).
 * Figma chỉ có bản desktop: phần responsive và trạng thái hover/focus là suy ra.
 */

:root {
  /* Màu — Figma variables `heritage-*` */
  --heritage-bg: #fff8ec;
  --heritage-surface: #ffffff;
  --heritage-soft: #f7e9d4;
  --heritage-brand: #9a2027;
  --heritage-onBrand: #ffffff;
  --heritage-text: #2d2119;
  --heritage-muted: #625043;
  --heritage-border: #cbb99b;
  --heritage-brand-hover: #7e1a20; /* suy ra: Figma không có state hover */

  /* Khoảng cách, bo góc — Figma variables `classic-*` */
  --classic-space-12: 12px;
  --classic-space-16: 16px;
  --classic-space-20: 20px;
  --classic-space-24: 24px;
  --classic-space-32: 32px;
  --classic-space-40: 40px;
  --classic-space-64: 64px;
  --classic-radius-4: 4px;
  --classic-radius-8: 8px;
  --classic-radius-12: 12px;

  /* Text styles "Classic 8x–9x / …" — Arimo; Arial cùng metric nên không nhảy layout khi font tải chậm */
  --font-family: "Arimo", Arial, "Helvetica Neue", Helvetica, sans-serif;
  --type-display: 700 56px/66px var(--font-family);
  --type-heading: 700 42px/52px var(--font-family);
  --type-brand: 700 34px/40px var(--font-family);
  --type-card-title: 700 28px/36px var(--font-family);
  --type-body: 400 22px/34px var(--font-family);
  --type-button: 700 22px/28px var(--font-family);
  --type-compact-body: 400 20px/30px var(--font-family);
  --type-label: 700 20px/26px var(--font-family);
  --type-nav: 700 20px/26px var(--font-family);
  --type-legal: 400 18px/28px var(--font-family);

  /* Bố cục: ở 1536px, min(1280px, 100% - 96px) = 1280px, đúng lề 128px của Figma */
  --container: 1280px;
  --gutter: 48px;
  --section-space: var(--classic-space-64);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* = chiều cao .site-header ở ≥1280px để header bám không che tiêu đề mục khi bấm tab; đổi header thì đo lại */
  scroll-padding-top: 181px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  font: var(--type-body);
  color: var(--heritage-text);
  background: var(--heritage-bg);
  overflow-wrap: break-word;
}

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

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

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

:focus-visible {
  outline: 3px solid var(--heritage-text);
  outline-offset: 3px;
}

.container {
  width: min(var(--container), 100% - 2 * var(--gutter));
  margin-inline: auto;
}

/* ---------- Nút (component "Classic heritage / Button Primary|Secondary") ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--classic-space-12);
  min-height: 72px;
  padding: var(--classic-space-20) var(--classic-space-24);
  border: 2px solid transparent;
  border-radius: var(--classic-radius-8);
  font: var(--type-button);
  text-align: center;
  text-decoration: none;
}

.btn--primary {
  background: var(--heritage-brand);
  color: var(--heritage-onBrand);
}

.btn--primary:hover {
  background: var(--heritage-brand-hover);
}

.btn--secondary {
  background: var(--heritage-surface);
  border-color: var(--heritage-border);
  color: var(--heritage-brand);
}

.btn--secondary:hover {
  background: var(--heritage-soft);
  border-color: var(--heritage-brand);
}

/* ---------- 00 / Header & visible navigation ---------- */

/* Header bám mép trên khi cuộn (điện thoại tắt, xem @media 719px); nền đặc nằm ở .brand-bar và .main-nav.
   Viền đáy tách header khỏi section nền be cùng màu menu */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--heritage-border);
}

.brand-bar {
  background: var(--heritage-bg);
}

.brand-bar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--classic-space-24);
  min-height: 108px;
  padding-block: var(--classic-space-16);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--classic-space-24);
}

/* Ảnh nguồn 128×128 hiển thị 64×64 cho màn hình retina */
.brand__logo {
  flex: none;
  width: 64px;
  height: 64px;
}

.brand__text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand__name {
  font: var(--type-brand);
  color: var(--heritage-brand);
}

.brand__tagline {
  font: var(--type-compact-body);
  color: var(--heritage-muted);
}

/* 2 nút chính nằm trong header bám nên cuộn tới đâu cũng bấm được.
   Cao 56px (thấp hơn logo 64px) để header không cao thêm */
.brand-bar__actions {
  display: flex;
  flex: none;
  gap: var(--classic-space-12);
}

.brand-bar__actions .btn {
  min-height: 56px;
  padding: var(--classic-space-12) var(--classic-space-20);
  font: var(--type-label);
  white-space: nowrap;
}

/* Nút ☰ chỉ hiện trên điện thoại khi nav.js đã chạy (xem @media 719px) */
.nav-toggle {
  display: none;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--heritage-border);
  border-radius: var(--classic-radius-4);
  background: var(--heritage-surface);
  color: var(--heritage-brand);
  cursor: pointer;
}

/* 3 vạch vẽ bằng CSS; khi menu mở, vạch giữa ẩn và 2 vạch còn lại xoay thành ✕ */
.nav-toggle__icon,
.nav-toggle__icon::before,
.nav-toggle__icon::after {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
}

.nav-toggle__icon {
  position: relative;
}

.nav-toggle__icon::before,
.nav-toggle__icon::after {
  content: "";
  position: absolute;
  left: 0;
}

.nav-toggle__icon::before {
  top: -7px;
}

.nav-toggle__icon::after {
  top: 7px;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__icon {
  background: transparent;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__icon::before {
  top: 0;
  transform: rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__icon::after {
  top: 0;
  transform: rotate(-45deg);
}

.main-nav {
  background: var(--heritage-soft);
}

/* 7 tab (5 tab Figma + CỘNG ĐỒNG, LIÊN HỆ theo brief); ô cao, viền, chữ giữ như Figma */
.main-nav__list {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.main-nav__item {
  display: flex;
}

.main-nav__link {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  padding: 8px 12px;
  border: 1px solid var(--heritage-border);
  background: var(--heritage-soft);
  color: var(--heritage-brand);
  font: var(--type-nav);
  text-align: center;
  text-decoration: none;
}

.main-nav__link:not([aria-current]):hover {
  background: var(--heritage-surface);
}

.main-nav__link[aria-current] {
  background: var(--heritage-brand);
  color: var(--heritage-onBrand);
}

.main-nav__link:focus-visible {
  outline-offset: -7px;
}

.main-nav__link[aria-current]:focus-visible {
  outline-color: var(--heritage-onBrand);
}

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

.hero {
  padding-block: var(--section-space);
  background: var(--heritage-bg);
}

.hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 704fr) minmax(0, 512fr);
  align-items: center;
  gap: var(--classic-space-64);
}

.hero__copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--classic-space-24);
}

.eyebrow {
  font: var(--type-label);
  color: var(--heritage-brand);
}

.hero__title {
  font: var(--type-display);
  color: var(--heritage-text);
}

.hero__lead {
  max-width: 660px;
}

.hero-art {
  overflow: hidden;
  border: 2px solid var(--heritage-border);
  border-radius: var(--classic-radius-12);
}

/* Khung cắt 512×400 của Figma; ảnh 1600×840 cắt phần giữa để giữ trọn hai con gà.
   height: auto để bỏ chiều cao 840 lấy từ thuộc tính height của thẻ img */
.hero-art__img {
  width: 100%;
  height: auto;
  aspect-ratio: 512 / 400;
  object-fit: cover;
}

/* ---------- Section chung ---------- */

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

.section--bg {
  background: var(--heritage-bg);
}

.section--surface {
  background: var(--heritage-surface);
}

.section--soft {
  background: var(--heritage-soft);
}

.section__inner {
  display: flex;
  flex-direction: column;
  gap: var(--classic-space-32);
}

.section-heading {
  display: flex;
  flex-direction: column;
  gap: var(--classic-space-16);
  text-align: center;
}

.section-heading__label {
  font: var(--type-label);
  color: var(--heritage-brand);
}

.section-heading__title {
  font: var(--type-heading);
  color: var(--heritage-brand);
}

.section-heading__desc {
  color: var(--heritage-muted);
}

.card {
  border: 1px solid var(--heritage-border);
  border-radius: var(--classic-radius-4);
  background: var(--heritage-surface);
}

.card__title {
  font: var(--type-card-title);
  color: var(--heritage-brand);
}

/* ---------- 02 / Giới thiệu ---------- */

.features {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--classic-space-16);
}

.feature {
  display: flex;
  flex-direction: column;
  gap: var(--classic-space-12);
  min-height: 132px;
  padding: var(--classic-space-24);
}

/* Ảnh giữ tỉ lệ gốc để thấy trọn ảnh (thẻ cùng hàng cao theo ảnh dọc).
   height: auto để bỏ chiều cao lấy từ thuộc tính height của thẻ img */
.feature__img {
  width: 100%;
  height: auto;
  border-radius: var(--classic-radius-4);
}

.feature__desc {
  font: var(--type-compact-body);
  color: var(--heritage-muted);
}

/* Thẻ bấm được: link nằm ở tiêu đề (tên link ngắn cho trình đọc màn hình),
   ::after phủ cả thẻ để bấm ảnh hay mô tả cũng mở link */
.feature--link {
  position: relative;
}

.feature--link:hover {
  border-color: var(--heritage-brand);
}

.feature__link {
  color: inherit;
  text-decoration: none;
}

.feature__link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--classic-radius-4);
}

/* Khung focus bao cả thẻ thay vì chỉ quanh chữ tiêu đề (cùng kiểu :focus-visible chung) */
.feature__link:focus-visible {
  outline: none;
}

.feature__link:focus-visible::after {
  outline: 3px solid var(--heritage-text);
  outline-offset: 3px;
}

/* Khối giới thiệu dưới 4 thẻ; padding như thẻ Hỏi đáp */
.about {
  display: flex;
  flex-direction: column;
  gap: var(--classic-space-16);
  padding: 28px var(--classic-space-32);
}

/* Reset chung tắt dấu đầu dòng của ul; danh sách trường gà cần hiện lại */
.about__list {
  display: flex;
  flex-direction: column;
  gap: var(--classic-space-12);
  padding-left: 1.25em;
  list-style: disc;
}

/* ---------- 03 / Thể loại ---------- */

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

.category {
  display: flex;
  flex-direction: column;
  gap: var(--classic-space-20);
  min-height: 358px;
  padding: 28px;
}

.category__icon {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.category__desc {
  font: var(--type-compact-body);
}

/* ---------- 04 / Lịch & kênh ---------- */

.sources {
  display: flex;
  flex-direction: column;
  gap: var(--classic-space-16);
}

.source {
  display: flex;
  align-items: center;
  gap: var(--classic-space-24);
  min-height: 160px;
  padding: var(--classic-space-24);
}

.source__num {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: var(--heritage-soft);
  color: var(--heritage-brand);
  font: var(--type-card-title);
}

/* Figma: khối mô tả rộng 788px, cao 96px, chữ canh trên; nút nằm ngay sau (không dạt mép phải) */
.source__body {
  display: flex;
  flex: 0 1 788px;
  flex-direction: column;
  gap: var(--classic-space-12);
  min-width: 0;
  min-height: 96px;
}

.source__name {
  font: var(--type-card-title);
  color: var(--heritage-text);
}

.source__note {
  font: var(--type-compact-body);
  color: var(--heritage-muted);
}

/* Mục Cộng đồng chỉ có một dòng chữ: bỏ chiều cao tối thiểu để chữ canh giữa theo số và nút */
.sources--community .source__body {
  min-height: 0;
}

.source__action {
  flex: none;
  width: 284px;
}

.notice {
  display: flex;
  align-items: center;
  min-height: 76px;
  padding: var(--classic-space-20) var(--classic-space-24);
  background: var(--heritage-soft);
  font: var(--type-compact-body);
}

/* ---------- 05 / Hỏi đáp ---------- */

.faq {
  display: flex;
  flex-direction: column;
  gap: var(--classic-space-16);
}

.faq__item {
  display: flex;
  flex-direction: column;
  gap: var(--classic-space-16);
  padding: 28px var(--classic-space-32);
}

/* ---------- 06 / CTA ---------- */

.cta {
  padding-block: var(--section-space);
  background: var(--heritage-brand);
  color: var(--heritage-onBrand);
}

.cta__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--classic-space-32);
  text-align: center;
}

.cta__title {
  font: var(--type-heading);
}

.cta__action {
  width: 430px;
  max-width: 100%;
}

.cta :focus-visible {
  outline-color: var(--heritage-onBrand);
}

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

.site-footer {
  padding-block: var(--classic-space-40);
  background: var(--heritage-surface);
}

.site-footer__inner {
  display: flex;
  flex-direction: column;
  gap: var(--classic-space-12);
  font: var(--type-legal);
  color: var(--heritage-muted);
}

/* ---------- Responsive (suy ra — Figma chưa có frame mobile) ---------- */

/* Menu luôn hiện, không hamburger: 1 hàng 7 ô chỉ vừa nhãn một dòng từ 1280px; dưới mốc đó xếp 4 + 3 */
@media (max-width: 1279px) {
  /* Menu 2 hàng: header cao 221px (720–899px có giá trị riêng, xem @media 899px) */
  html {
    scroll-padding-top: 221px;
  }

  .main-nav__list {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .main-nav__item {
    grid-column: span 3;
  }

  .main-nav__item:nth-child(n + 5) {
    grid-column: span 4;
  }

  .main-nav__link {
    min-height: 56px;
    padding: 8px 4px;
  }
}

@media (max-width: 1099px) {
  /* Ẩn dòng mô tả dưới tên để logo và 2 nút header vẫn nằm một hàng */
  .brand__tagline {
    display: none;
  }

  .hero__inner {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--classic-space-40);
  }

  .hero-art {
    width: 100%;
    max-width: 512px;
  }
}

@media (max-width: 899px) {
  html {
    scroll-padding-top: 277px; /* = header: thanh logo + hàng nút 164px, menu 2 hàng 113px */
  }

  /* Không đủ chỗ cho logo và 2 nút trên một hàng: 2 nút xuống hàng riêng, chia đôi bề ngang.
     order: 1 để trên điện thoại nút ☰ vẫn nằm cùng hàng logo */
  .brand-bar__inner {
    flex-wrap: wrap;
    row-gap: var(--classic-space-12);
  }

  .brand-bar__actions {
    order: 1;
    width: 100%;
  }

  .brand-bar__actions .btn {
    flex: 1 1 0;
  }

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

  .category {
    min-height: 0;
  }

  .source {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: var(--classic-space-20);
    min-height: 0;
  }

  .source__body {
    min-height: 0;
  }

  .source__action {
    grid-column: 1 / -1;
    width: 100%;
  }
}

/* Điện thoại: giảm một bậc cỡ chữ nhưng nội dung vẫn ≥ 18px */
@media (max-width: 719px) {
  :root {
    --gutter: 20px;
    --section-space: 48px;
    --type-display: 700 40px/48px var(--font-family);
    --type-heading: 700 32px/40px var(--font-family);
    --type-brand: 700 28px/34px var(--font-family);
    --type-card-title: 700 24px/32px var(--font-family);
    --type-body: 400 20px/30px var(--font-family);
    --type-button: 700 20px/26px var(--font-family);
    --type-compact-body: 400 18px/28px var(--font-family);
    --type-label: 700 18px/24px var(--font-family);
    --type-nav: 700 18px/24px var(--font-family);
    --type-legal: 400 16px/24px var(--font-family);
  }

  /* Header trên điện thoại cao hơn nửa màn hình nên không bám */
  html {
    scroll-padding-top: 0;
  }

  .site-header {
    position: static;
  }

  .brand-bar__inner {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--classic-space-12);
    min-height: 0;
  }

  /* 2 cột, TRANG ĐẦU chiếm trọn hàng đầu: mọi nhãn vừa một dòng từ 320px */
  .main-nav__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .main-nav__item,
  .main-nav__item:nth-child(n + 5) {
    grid-column: auto;
  }

  .main-nav__item:first-child {
    grid-column: 1 / -1;
  }

  /* Màn hẹp không đủ chỗ cho nhãn một dòng: cho xuống 2 dòng thay vì tràn ngang */
  .brand-bar__actions .btn {
    min-height: 48px;
    padding: 8px var(--classic-space-12);
    white-space: normal;
    text-wrap: balance;
  }

  /* Có nav.js: header gọn bám mép trên, menu mở bằng nút ☰ và đè lên nội dung (không đẩy trang).
     Không có JS: giữ header đầy đủ, không bám như các rule phía trên */
  html.js {
    scroll-padding-top: 153px; /* = header gọn: 2×12px padding + logo 48px + 12px + hàng nút 68px (nhãn 2 dòng khi màn < 436px) + viền 1px */
  }

  .js .site-header {
    position: sticky;
  }

  .js .brand-bar__inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding-block: var(--classic-space-12);
  }

  .js .brand {
    gap: var(--classic-space-12);
  }

  .js .brand__logo {
    width: 48px;
    height: 48px;
  }

  .js .brand__tagline {
    display: none;
  }

  .js .nav-toggle {
    display: flex;
  }

  .js .main-nav {
    display: none;
    position: absolute;
    top: calc(100% + 1px);
    right: 0;
    left: 0;
    border-bottom: 1px solid var(--heritage-border);
    box-shadow: 0 8px 16px rgb(0 0 0 / 0.12);
  }

  .js .is-nav-open .main-nav {
    display: block;
  }

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

  .feature {
    min-height: 0;
  }

  .source {
    padding: var(--classic-space-20);
  }

  .notice {
    padding: var(--classic-space-16) var(--classic-space-20);
  }

  .faq__item,
  .about {
    padding: var(--classic-space-24) var(--classic-space-20);
  }

  .cta__action {
    width: 100%;
  }
}
