/* Car Dash, dashcarvn.com
   Design read: landing page sản phẩm cho tài xế Việt Nam, ngôn ngữ biển báo đường bộ + màn xe ban đêm.
   Dials: VARIANCE 7 / MOTION 5 / DENSITY 4.
   Quy tắc:
   - Một chủ đề cho cả trang, sáng hoặc tối theo máy người xem (prefers-color-scheme). Không đảo màu giữa trang.
   - Một màu nhấn: xanh biển chỉ dẫn. Đỏ chỉ có trong biểu tượng biển tốc độ (nhận diện sản phẩm).
   - Bo góc: 10px cho nút và ô nội dung; 22px chỉ cho khung thiết bị (màn hình xe).
   - Ảnh minh họa giao diện luôn tối vì chính app Car Dash là giao diện tối. */

:root {
  --bg: #eef1f2;
  --surface: #ffffff;
  --surface-2: #e3e7ea;
  --text: #16181b;
  --text-2: #4a5057;
  --rule: #cdd3d7;
  --accent: #0a5bb0;
  --accent-hover: #08498d;
  --accent-text: #0a5bb0;
  --accent-soft: #dbe7f5;
  --on-accent: #ffffff;
  --lane: #b9c1c7;
  --shadow: 0 24px 50px -24px rgba(16, 32, 52, 0.35);
  --limit-red: #d52b1e;

  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-body: "Be Vietnam Pro", system-ui, sans-serif;

  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lede: clamp(1.1rem, 1rem + 0.45vw, 1.35rem);
  --text-h1: clamp(2.6rem, 1rem + 3.2vw, 3.9rem);
  --text-h2: clamp(2rem, 1.5rem + 2vw, 3.1rem);

  --gutter: clamp(1rem, 0.4rem + 3vw, 3rem);
  --section: clamp(4.5rem, 3rem + 5vw, 8rem);
  --measure: 62ch;
  --r-ui: 10px;
  --r-device: 22px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1e22;
    --surface: #24282d;
    --surface-2: #2c3137;
    --text: #eef1f3;
    --text-2: #aab2ba;
    --rule: #373d44;
    --accent: #2a73c8;
    --accent-hover: #3a84d8;
    --accent-text: #7fb2ee;
    --accent-soft: #22344a;
    --on-accent: #ffffff;
    --lane: #e9edf0;
    --shadow: 0 30px 60px -24px rgba(0, 0, 0, 0.7);
  }
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,
h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h2 {
  font-size: var(--text-h2);
}

h3 {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.3;
}

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

a {
  color: var(--accent-text);
}

:focus-visible {
  outline: 3px solid var(--accent-text);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 20;
  padding: 0.6rem 1rem;
  border-radius: var(--r-ui);
  background: var(--accent);
  color: var(--on-accent);
}

.skip:focus {
  top: 1rem;
}

.icon {
  width: 30px;
  height: 30px;
  margin-bottom: 0.9rem;
  color: var(--accent-text);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 3.25rem;
  padding: 0 1.6rem;
  border: 2px solid var(--accent);
  border-radius: var(--r-ui);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.12s ease;
}

.btn:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn-ghost {
  background: transparent;
  border-color: var(--rule);
  color: var(--text);
}

.btn-ghost:hover {
  background: var(--surface);
  border-color: var(--text-2);
}

.btn-small {
  min-height: 2.6rem;
  padding: 0 1.05rem;
  font-size: 0.95rem;
}

.btn-on-accent {
  background: var(--surface);
  border-color: var(--surface);
  color: var(--text);
}

.btn-on-accent:hover {
  background: var(--bg);
  border-color: var(--bg);
}

.btn-icon {
  width: 20px;
  height: 20px;
}

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

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 2rem;
  height: 4.25rem;
  padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  text-decoration: none;
}

.top-nav {
  display: flex;
  gap: 1.75rem;
  margin-left: auto;
}

.top-nav a {
  color: var(--text-2);
  font-size: 0.95rem;
  text-decoration: none;
  transition: color 0.2s var(--ease);
}

.top-nav a:hover {
  color: var(--text);
}

/* ---------- Phần đầu ---------- */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 11fr) minmax(0, 12fr);
  gap: clamp(2rem, 4vw, 4rem);
  align-items: center;
  max-width: 1440px;
  margin: 0 auto;
  overflow-x: clip; /* màn hình xe tràn ra mép phải */
  padding: clamp(2.5rem, 5vw, 5rem) var(--gutter) clamp(4.5rem, 7vw, 7rem);
}

/* Vạch kẻ đường đứt quãng ở mép dưới phần đầu. */
.hero::after {
  content: "";
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: 1.5rem;
  height: 5px;
  border-radius: 3px;
  background: repeating-linear-gradient(90deg, var(--lane) 0 56px, transparent 56px 100px);
}

.hero h1 {
  font-size: var(--text-h1);
}

.lede {
  margin-top: 1.3rem;
  max-width: 34ch;
  font-size: var(--text-lede);
  line-height: 1.5;
  color: var(--text-2);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

/* Bản xem trước giao diện Car Dash trong khung màn hình xe (luôn tối như app thật). */
.screen {
  margin: 0 calc(-1 * var(--gutter) - 3vw) 0 0;
  padding: clamp(8px, 1vw, 13px);
  border-radius: var(--r-device);
  background: #0d0e10;
  box-shadow: 0 0 0 1px #3a3f45, var(--shadow);
  container-type: inline-size;
}

.dash {
  aspect-ratio: 16 / 9;
  display: grid;
  grid-template-columns: 22% 1fr 29%;
  gap: 1.2cqw;
  padding: 1.2cqw;
  border-radius: 12px;
  background: #0a0a0a;
  color: #fff;
  overflow: hidden;
}

.dash-side {
  display: flex;
  flex-direction: column;
  gap: 0.8cqw;
  min-width: 0;
}

.d-clock {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 5.6cqw;
  line-height: 1;
  text-align: center;
}

.d-date {
  font-size: 1.2cqw;
  color: #9da3aa;
  text-align: center;
}

.d-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4cqw;
  padding: 0.6cqw;
  border-radius: 0.8cqw;
  background: #141416;
  font-size: 1.2cqw;
  color: #d7dbe0;
}

.d-dot {
  width: 0.8cqw;
  height: 0.8cqw;
  border-radius: 50%;
  background: #30d158;
}

.d-gap {
  width: 0.8cqw;
}

.d-speed {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8cqw 1cqw;
  border-radius: 0.9cqw;
  background: #141416;
}

.d-speed b {
  font-family: var(--font-display);
  font-size: 4.8cqw;
  line-height: 1;
}

.d-speed small {
  margin-left: 0.3cqw;
  font-size: 1.1cqw;
  color: #9da3aa;
}

.d-sign,
.speed-sign {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: #16181b;
  font-family: var(--font-display);
  font-weight: 700;
}

.d-sign {
  width: 4.6cqw;
  height: 4.6cqw;
  border: 0.55cqw solid var(--limit-red);
  font-size: 2cqw;
}

.d-tile {
  display: flex;
  flex-direction: column;
  padding: 0.5cqw 1cqw;
  border-radius: 0.8cqw;
  background: #141416;
}

.d-tile b {
  font-family: var(--font-display);
  font-size: 2.7cqw;
  line-height: 1.05;
}

.d-tile small {
  font-size: 1cqw;
  color: #9da3aa;
  white-space: nowrap;
}

.d-dock {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6cqw;
}

.d-dock span {
  display: grid;
  place-items: center;
  height: 3.3cqw;
  border-radius: 0.8cqw;
  background: #232327;
  font-size: 1.05cqw;
}

.d-dock span:last-child {
  background: #40c8ff;
  color: #00141d;
}

.dash-map {
  position: relative;
  min-width: 0;
  border-radius: 1.2cqw;
  overflow: hidden;
}

.dash-map svg {
  display: block;
  width: 100%;
  height: 100%;
}

.d-route {
  position: absolute;
  left: 1cqw;
  right: 1cqw;
  top: 1cqw;
  padding: 0.8cqw 1.1cqw;
  border-radius: 0.8cqw;
  background: #0a5bb0;
  font-size: 1.3cqw;
  font-weight: 600;
}

.dash-apps {
  display: grid;
  grid-template-rows: 3fr 2fr;
  gap: 1.2cqw;
  min-width: 0;
}

.d-app {
  display: flex;
  flex-direction: column;
  gap: 0.8cqw;
  padding: 1.2cqw;
  border-radius: 1.2cqw;
  background: #f5f6f7;
  color: #16181b;
  font-size: 1.2cqw;
}

.d-app-name {
  font-weight: 600;
}

.d-app-row {
  display: flex;
  flex-direction: column;
  gap: 0.6cqw;
}

.d-app-row i {
  display: block;
  height: 2.6cqw;
  border-radius: 0.6cqw;
  background: #e2e6e9;
}

.d-app-btn {
  margin-top: auto;
  display: grid;
  place-items: center;
  height: 3.4cqw;
  border-radius: 0.8cqw;
  background: #11a35a;
  color: #fff;
  font-weight: 600;
}

.d-app-music {
  background: #17181b;
  color: #fff;
}

.d-bars {
  margin-top: auto;
  display: flex;
  align-items: flex-end;
  gap: 0.5cqw;
  height: 4cqw;
}

.d-bars i {
  flex: 1;
  height: 40%;
  border-radius: 0.3cqw;
  background: #40c8ff;
}

.d-bars i:nth-child(2) { height: 80%; }
.d-bars i:nth-child(3) { height: 55%; }
.d-bars i:nth-child(4) { height: 100%; }
.d-bars i:nth-child(5) { height: 65%; }

/* ---------- Khung chung của các phần ---------- */

main > section:not(.hero):not(.download) {
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--section) var(--gutter) 0;
}

.section-sub {
  margin-top: 0.9rem;
  color: var(--text-2);
}

/* ---------- Tính năng: lưới bento 7 ô ---------- */

.bento {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: minmax(13rem, auto);
  gap: 1rem;
  margin-top: 2.5rem;
}

.cell {
  display: flex;
  flex-direction: column;
  grid-column: span 4;
  padding: 1.6rem;
  border: 1px solid var(--rule);
  border-radius: var(--r-ui);
  background: var(--surface);
  transition: border-color 0.25s var(--ease);
}

.cell:hover {
  border-color: var(--accent-text);
}

.cell p {
  color: var(--text-2);
  font-size: 0.98rem;
}

/* Ô lớn: app trong khung, kèm sơ đồ bố cục như màn chọn bố cục trong app. */
.cell-frames {
  grid-column: span 7;
  grid-row: span 2;
  background: var(--surface-2);
}

.mini-layout {
  display: grid;
  grid-template-columns: 0.55fr 1.4fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 8px;
  margin-top: auto;
  padding-top: 1.6rem;
  min-height: 11rem;
}

.mini-layout > span {
  border-radius: 8px;
}

.ml-side {
  grid-row: span 2;
  background: #0a0a0a;
}

.ml-pane {
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px dashed var(--rule);
  color: var(--text-2);
  font-size: 0.9rem;
  font-weight: 500;
}

.ml-map {
  grid-row: span 2;
  background: var(--accent-soft);
  border-style: solid;
  border-color: transparent;
  color: var(--accent-text);
}

.cell-map {
  grid-column: span 5;
  background: var(--accent-soft);
  border-color: transparent;
}

/* Ô tốc độ: luôn tối như màn hình app, cho biển giới hạn nổi bật đúng như trên xe. */
.cell-speed {
  grid-column: span 5;
  background: #0f1012;
  border-color: #0f1012;
  color: #f2f4f5;
}

.cell-speed p {
  color: #b4bbc2;
}

.speed-demo {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.speed-demo b {
  font-family: var(--font-display);
  font-size: 3.4rem;
  line-height: 1;
}

.speed-demo small {
  margin-right: auto;
  color: #9da3aa;
  font-size: 1rem;
}

.speed-sign {
  width: 3.6rem;
  height: 3.6rem;
  border: 0.45rem solid var(--limit-red);
  font-size: 1.6rem;
}

.obd-demo {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 1rem;
}

.obd-demo span {
  flex: 1;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.8rem;
}

.obd-demo b {
  display: block;
  font-family: var(--font-display);
  font-size: 1.6rem;
  line-height: 1.05;
  color: var(--text);
}

.cell-wide {
  grid-column: span 12;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.cell-wide > div {
  max-width: 42ch;
}

.cell-wide .swatches {
  justify-content: flex-end;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.swatches li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.8rem 0.4rem 0.45rem;
  border-radius: 999px;
  background: #0a0a0a;
  color: #f2f4f5;
  font-size: 0.85rem;
}

.swatches li::before {
  content: "";
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: var(--c);
}

.swatches li:nth-child(1) { --c: #40c8ff; }
.swatches li:nth-child(2) { --c: #7ab4ff; }
.swatches li:nth-child(3) { --c: #4fe3d2; }
.swatches li:nth-child(4) { --c: #c7a2ff; }
.swatches li:nth-child(5) { --c: #ff8cc6; }
.swatches li:nth-child(6) { --c: #e6e6eb; }

/* ---------- Máy chạy được: so sánh hai cột ---------- */

.devices h2 {
  margin-bottom: 2.25rem;
}

.device-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 2px solid var(--text);
}

.device {
  padding: 2rem 2.5rem 0 0;
}

.device + .device {
  padding-left: 2.5rem;
  border-left: 1px solid var(--rule);
}

.device-icon {
  width: 44px;
  height: 44px;
  margin-bottom: 1rem;
  color: var(--accent-text);
}

.device p {
  color: var(--text-2);
}

.devices-note {
  margin-top: 1.5rem;
  color: var(--text-2);
  font-size: 0.95rem;
}

/* ---------- Các bước: đúng là một chuỗi nên có số ---------- */

.steps h2 {
  margin-bottom: 2.25rem;
}

.step-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.step-list li {
  counter-increment: step;
}

.step-list li::before {
  content: counter(step);
  display: block;
  margin-bottom: 0.5rem;
  font-family: var(--font-display);
  font-size: 3.6rem;
  font-weight: 700;
  line-height: 1;
  color: var(--accent-text);
}

.step-list p {
  color: var(--text-2);
}

/* ---------- Bảng giá ---------- */

.plans {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-top: 2.5rem;
  border-top: 2px solid var(--text);
}

.plan {
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.2rem 1.8rem;
  border-right: 1px solid var(--rule);
}

.plan:last-child {
  border-right: 0;
}

.plan h3 {
  color: var(--text-2);
  font-size: 1.02rem;
}

.price {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1.05;
}

.apps {
  margin: 0.25rem 0 1rem;
  font-weight: 600;
}

.plan ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-2);
  font-size: 0.95rem;
}

.plan li + li {
  margin-top: 0.35rem;
}

.plan-pick {
  border-radius: 0 0 var(--r-ui) var(--r-ui);
  border-right-color: transparent;
  background: var(--accent);
  color: var(--on-accent);
}

.plan-pick h3,
.plan-pick ul {
  color: color-mix(in srgb, var(--on-accent) 82%, var(--accent));
}

.plan-flag {
  margin-top: auto;
  padding-top: 1rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.pricing-note {
  margin-top: 1.4rem;
  color: var(--text-2);
  font-size: 0.95rem;
}

/* ---------- Tải về ---------- */

.download {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  max-width: calc(1440px - 2 * var(--gutter));
  margin: var(--section) auto 0;
  margin-inline: max(var(--gutter), calc((100% - 1440px) / 2 + var(--gutter)));
  padding: clamp(2rem, 4vw, 3.25rem);
  border-radius: var(--r-ui);
  background: var(--accent);
  color: var(--on-accent);
}

.download p {
  margin-top: 0.6rem;
  color: color-mix(in srgb, var(--on-accent) 82%, var(--accent));
}

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

.faq {
  max-width: 62rem;
}

.faq h2 {
  margin-bottom: 1.5rem;
}

.faq details {
  border-bottom: 1px solid var(--rule);
}

.faq summary {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 0;
  font-size: 1.08rem;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  font-family: var(--font-display);
  font-size: 1.8rem;
  line-height: 0.8;
  color: var(--accent-text);
  transition: transform 0.25s var(--ease);
}

.faq details[open] summary::after {
  transform: rotate(45deg);
}

.faq details p {
  padding-bottom: 1.3rem;
  color: var(--text-2);
}

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

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1440px;
  margin: var(--section) auto 0;
  padding: 2rem var(--gutter) 2.5rem;
  border-top: 1px solid var(--rule);
  color: var(--text-2);
  font-size: 0.95rem;
}

.foot nav {
  display: flex;
  gap: 1.5rem;
}

/* ---------- Chuyển động ----------
   1) Mở trang: màn hình xe "khởi động", tuyến đường vẽ ra (kể đúng sản phẩm làm gì).
   2) Cuộn: nội dung chính hiện dần khi vào màn hình (CSS scroll-driven, không dùng sự kiện scroll).
   Tắt hết khi người xem bật giảm chuyển động. */

@media (prefers-reduced-motion: no-preference) {
  .dash {
    animation: boot 0.9s var(--ease) 0.1s both;
  }

  .d-route-line {
    stroke-dasharray: 420;
    animation: route 1.6s var(--ease) 0.6s both;
  }

  @supports (animation-timeline: view()) {
    .reveal {
      animation: rise linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 45%;
    }
  }
}

@keyframes boot {
  from { opacity: 0; filter: brightness(2) saturate(0); }
  to { opacity: 1; filter: none; }
}

@keyframes route {
  from { stroke-dashoffset: 420; }
  to { stroke-dashoffset: 0; }
}

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

/* ---------- Màn nhỏ ---------- */

@media (max-width: 1100px) {
  .plans {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .plan {
    border-bottom: 1px solid var(--rule);
  }

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

  .cell-frames,
  .cell-map,
  .cell-speed {
    grid-column: span 6;
  }

  .cell-frames {
    grid-column: span 12;
    grid-row: auto;
  }

  .cell {
    grid-column: span 6;
  }

  .cell-wide {
    grid-column: span 12;
  }
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .screen {
    margin-right: 0;
  }

  .top-nav {
    display: none;
  }

  .top .btn-small {
    margin-left: auto;
  }

  .cell-wide {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 680px) {
  .bento,
  .plans,
  .step-list,
  .device-split {
    grid-template-columns: minmax(0, 1fr);
  }

  .cell,
  .cell-frames,
  .cell-map,
  .cell-speed,
  .cell-wide {
    grid-column: auto;
  }

  .plan {
    border-right: 0;
  }

  .device,
  .device + .device {
    padding: 1.75rem 0 0;
    border-left: 0;
  }

  .device + .device {
    margin-top: 1.75rem;
    border-top: 1px solid var(--rule);
  }

  .hero::after {
    background: repeating-linear-gradient(90deg, var(--lane) 0 36px, transparent 36px 66px);
  }
}
