/* CNC Dash Board — web marketing. Màu / cỡ chữ / khoảng cách chép từ bản thiết kế (design/). */

/* ---------- Font tự host (xem fonts/README.md) ---------- */
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/be-vietnam-pro-400-vietnamese.b0d9b8ae.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: "Be Vietnam Pro"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/be-vietnam-pro-400-latin.d25f70ff.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; }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("../fonts/be-vietnam-pro-600-vietnamese.84390824.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: "Be Vietnam Pro"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("../fonts/be-vietnam-pro-600-latin.14950d0a.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; }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/be-vietnam-pro-700-vietnamese.141f6c45.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: "Be Vietnam Pro"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/be-vietnam-pro-700-latin.cf841d2b.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; }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 800; font-display: swap;
  src: url("../fonts/be-vietnam-pro-800-vietnamese.58a2faf8.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: "Be Vietnam Pro"; font-style: normal; font-weight: 800; font-display: swap;
  src: url("../fonts/be-vietnam-pro-800-latin.8a5b5841.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; }
/* Font dự phòng trong lúc Be Vietnam Pro đang tải: Arial chỉnh cùng bề rộng + chiều cao dòng → chữ không xô bố cục khi đổi font.
   unicode-range đúng bằng bộ chữ của Be Vietnam Pro để ký hiệu khác (→ ⌀ ▶ 図) vẫn dùng font hệ thống như trước. */
@font-face { font-family: "BVP Fallback"; font-weight: 400; src: local("Arial"), local("ArialMT"), local("Roboto");
  size-adjust: 106.64%; ascent-override: 93.77%; descent-override: 24.85%; line-gap-override: 0%;
  unicode-range: U+0000-00FF, U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+2000-206F, U+20AB; }
@font-face { font-family: "BVP Fallback"; font-weight: 600; src: local("Arial Bold"), local("Arial-BoldMT"), local("Roboto Bold");
  size-adjust: 103.16%; ascent-override: 96.94%; descent-override: 25.69%; line-gap-override: 0%;
  unicode-range: U+0000-00FF, U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+2000-206F, U+20AB; }
@font-face { font-family: "BVP Fallback"; font-weight: 700; src: local("Arial Bold"), local("Arial-BoldMT"), local("Roboto Bold");
  size-adjust: 104.23%; ascent-override: 95.95%; descent-override: 25.43%; line-gap-override: 0%;
  unicode-range: U+0000-00FF, U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+2000-206F, U+20AB; }
@font-face { font-family: "BVP Fallback"; font-weight: 800; src: local("Arial Bold"), local("Arial-BoldMT"), local("Roboto Bold");
  size-adjust: 105.31%; ascent-override: 94.96%; descent-override: 25.16%; line-gap-override: 0%;
  unicode-range: U+0000-00FF, U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+2000-206F, U+20AB; }

/* ---------- Theme tokens ---------- */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #08090b; --veil: rgba(8, 9, 11, 0.86); --text: #f1eee9; --text-2: #b9b3ab; --muted: #8a847c;
  --accent: #f0a868; --accent-text: #f0a868; --line: #2a2724; --border: #3a3530; --chip: #16181c;
  --glow: rgba(201, 110, 40, 0.30); --glow-2: rgba(201, 110, 40, 0.10);
  --safe-bg: #17140f; --safe-line: #4a3620; --safe-text: #e7d6c2;
  --cta-bg: #f1eee9; --cta-fg: #08090b;
  --card: #121315;
  --ph-bg: #0f1114; --ph-line: #2a2d33; --ph-text: #8b929c;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f3ee; --veil: rgba(246, 243, 238, 0.88); --text: #17140f; --text-2: #4e4740; --muted: #6b635a;
  --accent: #f0a868; --accent-text: #9a4f0c; --line: #e2dbd1; --border: #cfc6ba; --chip: #ebe5dc;
  --glow: rgba(214, 120, 45, 0.22); --glow-2: rgba(214, 120, 45, 0.07);
  --safe-bg: #fbf1e4; --safe-line: #e8c49a; --safe-text: #4a3216;
  --cta-bg: #17140f; --cta-fg: #f6f3ee;
  --card: #ffffff;
  /* Màn hình điện thoại vẫn tối ở cả 2 theme (app vẽ nền tối). */
  --ph-bg: #0f1114; --ph-line: #2a2d33; --ph-text: #8b929c;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Be Vietnam Pro", "BVP Fallback", "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, system-ui, -apple-system, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  overflow-x: clip;
}
img, video { max-width: 100%; }
a { color: var(--accent-text); }
a:hover { color: var(--text); }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible { outline: 2px solid #f0a868; outline-offset: 2px; }
h1, h2, p, figure { margin: 0; }
/* Tiếng Nhật: ngắt dòng theo cụm từ (trình duyệt hỗ trợ auto-phrase), không cắt giữa từ katakana. */
:lang(ja) h1, :lang(ja) h2, :lang(ja) h3, :lang(ja) .lead { word-break: auto-phrase; }

/* "Bỏ qua tới nội dung": chỉ hiện khi nhận focus bằng bàn phím. */
.skip-link {
  position: absolute; left: 12px; top: -64px; z-index: 100;
  padding: 10px 16px; border-radius: 10px; background: var(--cta-bg); color: var(--cta-fg);
  font-weight: 700; font-size: 15px; text-decoration: none;
}
.skip-link:focus { top: 12px; color: var(--cta-fg); }
main:focus { outline: none; }

/* Gợi ý đổi ngôn ngữ (chỉ trang tĩnh): viên nổi ở đáy, không đẩy nội dung. */
.lang-hint {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 90;
  display: flex; align-items: center; gap: 4px; max-width: calc(100vw - 24px);
  padding: 4px 4px 4px 18px; border-radius: 999px;
  background: var(--cta-bg); color: var(--cta-fg); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  font-size: 15px; font-weight: 600; white-space: nowrap;
}
.lang-hint a { color: inherit; text-decoration: none; padding: 9px 4px; }
.lang-hint a:hover { color: inherit; text-decoration: underline; }
.lang-hint button {
  width: 40px; height: 40px; flex: none; border: 0; border-radius: 999px; background: transparent; color: inherit;
  font: inherit; cursor: pointer; opacity: 0.7;
}
.lang-hint button:hover { opacity: 1; }

.page { overflow-x: clip; }
.wrap { max-width: 1160px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
@media (max-width: 480px) { .wrap { padding-left: 16px; padding-right: 16px; } }

/* ---------- Header ---------- */
.topbar {
  position: relative;
  padding-top: 18px; padding-bottom: 18px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px 24px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 17px; color: var(--text); text-decoration: none;
}
.brand:hover { color: var(--text); }
.brand img { width: 32px; height: 32px; display: block; border-radius: 7px; }
.topbar-tools { display: flex; align-items: center; gap: 10px; }

.lang-switch { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--chip); }
.lang-switch button, .lang-switch a {
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
  min-height: 40px; min-width: 52px; padding: 0 14px;
  border: 0; border-radius: 999px; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 600;
  background: transparent; color: var(--text-2);
}
.lang-switch button[aria-pressed="true"], .lang-switch a[aria-current="true"] { background: var(--text); color: var(--bg); }

.theme-toggle {
  width: 48px; height: 48px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 999px; background: var(--chip); color: var(--text); cursor: pointer;
}
.theme-toggle svg { width: 20px; height: 20px; display: block; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .icon-sun { stroke: #f5c451; }
.theme-toggle .icon-moon { stroke: currentColor; display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding-top: 64px;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 22px;
}
.hero > * { position: relative; }
.hero-glow {
  position: absolute !important; left: 50%; top: 40px;
  width: 900px; height: 900px; margin-left: -450px; border-radius: 50%;
  background: radial-gradient(circle, var(--glow) 0%, var(--glow-2) 35%, transparent 65%);
  pointer-events: none;
}
.hero-icon {
  width: 128px; height: 128px; display: block; border-radius: 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.eyebrow {
  font-size: 14px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent-text);
}
h1 {
  max-width: 17em;
  font-size: clamp(30px, 4.4vw, 56px); line-height: 1.12; font-weight: 800; letter-spacing: -0.025em;
  text-wrap: balance;
}
.accent { color: var(--accent-text); }
.lead { max-width: 36em; color: var(--text-2); font-size: 19px; }
:lang(ja) h1, :lang(ja) h2 { letter-spacing: 0; word-break: auto-phrase; }

.cta-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-top: 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 30px; border-radius: 999px;
  font-weight: 700; text-decoration: none;
}
.btn-solid { background: var(--cta-bg); color: var(--cta-fg); }
.btn-solid:hover { color: var(--cta-fg); opacity: 0.9; }
.btn-ghost { border: 1px solid var(--border); background: var(--veil); color: var(--text); font-weight: 600; }
.btn-ghost:hover { border-color: var(--accent); }
.btn-accent { background: var(--accent); color: #08090b; }
.btn-accent:hover { color: #08090b; opacity: 0.9; }

/* ---------- Supported machines ---------- */
.machines {
  width: 100%; max-width: 660px; margin-top: 28px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.kicker {
  font-size: 13px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-2); line-height: 1.6;
}
.machine-grid { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.machine {
  border-radius: 18px; overflow: hidden; border: 1px solid var(--border); background: var(--card);
  display: flex; flex-direction: column; text-align: left;
}
.machine img { width: 100%; height: auto; aspect-ratio: 4 / 3; display: block; object-fit: cover; }
.machine figcaption { padding: 12px 16px 14px; display: flex; flex-direction: column; gap: 2px; }
.machine-name { font-size: clamp(17px, 2.4vw, 22px); font-weight: 800; letter-spacing: 0.1em; }
.machine-sub { font-size: 14px; line-height: 1.4; color: var(--text-2); }

/* ---------- Phone frame ---------- */
.phone {
  flex: 0 0 auto;
  width: 266px; height: 556px; border-radius: 44px; padding: 11px;
  background: linear-gradient(160deg, #4a4642, #1a1b1d 60%);
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.5);
}
.phone-accent { box-shadow: 0 40px 90px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(240, 168, 104, 0.22); }
:root[data-theme="light"] .phone { box-shadow: 0 30px 70px rgba(40, 30, 20, 0.28); }
:root[data-theme="light"] .phone-accent { box-shadow: 0 30px 70px rgba(40, 30, 20, 0.28), 0 0 0 1px rgba(240, 168, 104, 0.35); }
.phone-static img {
  width: 100%; height: 100%; display: block; object-fit: cover; object-position: top;
  border-radius: 34px; background: var(--ph-bg);
}

/* ---------- Carousels ---------- */
.showcase {
  margin-top: 56px;
  display: flex; justify-content: center; align-items: flex-start; flex-wrap: wrap;
  gap: 32px 48px;
}
.carousel { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.swipe {
  width: 100%; height: 100%;
  display: flex; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; border-radius: 34px; background: var(--ph-bg);
  scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
}
.swipe::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; width: 100%; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; }
.slide img, .slide video { width: 100%; height: 100%; display: block; object-fit: cover; object-position: top; }
/* Video 9:16 trong màn 244 × 534: contain (cover sẽ cắt mép tờ giấy / chữ), nền = nền video #0c1015. */
.slide-video { background: #0c1015; }
.slide-video video { object-fit: contain; object-position: center; }
/* Video phay: dải trống trên / dưới = màu mép trên / mép dưới của video (đo trên cả 26 s: #080e0f / #141414). */
.slide-video-mill { background: linear-gradient(#080e0f 0 50%, #141414 50% 100%); }
/* 3R race: mép trên / dưới #030911; RCR guiding stars: #04070f / #0d1426 (đo trên cả video). */
.slide-video-race { background: #030911; }
/* JAW ENMILL (kiểu terminal xanh): mép trên #030a07, dưới #020403. */
.slide-video-jaw { background: linear-gradient(#030a07 0 50%, #020403 50% 100%); }
/* ECCENTRIC TURNING: mép trên ≈ #090f10, dưới ≈ #131313. */
.slide-video-ecc { background: linear-gradient(#090f10 0 50%, #131313 50% 100%); }
.slide-video-stars { background: linear-gradient(#04070f 0 50%, #0d1426 50% 100%); }
/* MÁY TÍNH GIA CÔNG: mép trên ≈ #142634 (quầng xanh), dưới #0e1012. */
.slide-video-calc { background: linear-gradient(#142634 0 50%, #0e1012 50% 100%); }
/* Vùng chạm 44 px, bù bằng lề âm để vị trí chữ không đổi. */
.car-link { display: inline-block; padding: 11px 10px; margin: -5px 0 -11px; font-size: 14px; font-weight: 600; color: var(--accent-text); text-decoration: none; }
.car-link:hover { text-decoration: underline; }
/* Chỉ 1 slide: ẩn chấm, bộ đếm, gợi ý vuốt. */
.carousel.single .dots, .carousel.single .car-count, .carousel.single .car-hint { display: none; }

/* Ảnh tạm cho slide chưa có ảnh chụp (bước 2 thay bằng ảnh thật). */
.ph {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 24px; text-align: center;
  color: var(--ph-text);
  background:
    repeating-linear-gradient(0deg, transparent 0 23px, var(--ph-line) 23px 24px),
    repeating-linear-gradient(90deg, transparent 0 23px, var(--ph-line) 23px 24px),
    var(--ph-bg);
}
.ph-num {
  font-size: 44px; font-weight: 800; line-height: 1; color: #f0a868;
  font-variant-numeric: tabular-nums;
}
.ph-label { font-size: 17px; font-weight: 700; color: #e6e2dc; line-height: 1.3; text-wrap: balance; }
.ph-note {
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  border: 1px dashed #3d424a; background: rgba(15, 17, 20, 0.85);
}
.ph-video .ph-num::after {
  content: ""; display: block; margin: 14px auto 0;
  width: 0; height: 0; border-style: solid;
  border-width: 11px 0 11px 18px; border-color: transparent transparent transparent #f0a868;
}

.carousel figcaption { display: flex; flex-direction: column; align-items: center; gap: 4px; max-width: 266px; text-align: center; }
.car-title { font-size: 17px; font-weight: 700; color: var(--text); }
.dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 0; min-height: 44px; margin: -6px 0; }
.dots button {
  width: 30px; height: 44px; padding: 0; border: 0; background: transparent; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.dots span {
  display: block; width: 7px; height: 7px; border-radius: 999px; background: var(--border);
  transition: width 0.2s ease, background-color 0.2s ease;
}
.dots button[aria-current="true"] span { width: 18px; background: var(--accent); }
@media (prefers-reduced-motion: reduce) { .dots span { transition: none; } }
.car-count { font-size: 13px; color: var(--muted); }
.car-hint { font-size: 12px; color: var(--muted); }

/* ---------- Steps 01 / 02 ---------- */
.steps {
  max-width: 1060px; margin: 0 auto; padding: 88px 24px 0;
  display: flex; flex-direction: column; gap: 96px;
  scroll-margin-top: 24px;
}
.step { display: flex; flex-wrap: wrap; align-items: center; gap: 40px 64px; }
.step-reverse { flex-wrap: wrap-reverse; }
.step .phone { margin: 0 auto; }
.step-text { flex: 1 1 360px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.step-num { font-size: 14px; font-weight: 700; letter-spacing: 0.12em; color: var(--accent-text); }
.step-text h2 {
  font-size: clamp(28px, 3.4vw, 40px); line-height: 1.15; font-weight: 800; letter-spacing: -0.02em;
  text-wrap: balance;
}
.step-text p { max-width: 30em; color: var(--text-2); font-size: 18px; }
@media (max-width: 480px) { .steps { padding-left: 16px; padding-right: 16px; padding-top: 88px; gap: 72px; } }

/* ---------- Safety note ---------- */
.safe { padding-top: 72px; }
.safe p {
  padding: 18px 22px; border-radius: 14px;
  background: var(--safe-bg); border: 1px solid var(--safe-line); color: var(--safe-text);
  font-size: 15px;
}

/* ---------- Beta ---------- */
.beta {
  padding-top: 100px; padding-bottom: 110px;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 18px;
}
.beta h2 {
  font-size: clamp(30px, 4vw, 48px); line-height: 1.12; font-weight: 800; letter-spacing: -0.02em;
  text-wrap: balance;
}
.beta p { max-width: 32em; color: var(--text-2); font-size: 18px; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); }
.footer .wrap { padding-top: 26px; padding-bottom: 36px; font-size: 14px; color: var(--muted); }
.footer-in { display: flex; flex-direction: column; gap: 10px; }
.footer-in p { margin: 0; }
.foot-links { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.foot-links a { display: inline-flex; align-items: center; min-height: 44px; color: var(--text-2); font-weight: 600; text-decoration: none; }
.foot-links a:hover { color: var(--text); text-decoration: underline; }
.foot-tm { max-width: 52em; font-size: 13px; line-height: 1.5; }

/* ---------- Trang văn bản: Chính sách bảo mật / Hỗ trợ ---------- */
.doc-date { font-size: 14px; color: var(--muted); }
.doc { max-width: 760px; padding-top: 40px; padding-bottom: 96px; display: flex; flex-direction: column; gap: 36px; }
.doc-sec h2 { font-size: clamp(21px, 2.4vw, 26px); line-height: 1.3; margin-bottom: 10px; }
.doc-sec p { margin: 0 0 10px; color: var(--text-2); }
.doc-sec p b { color: var(--text); }
.doc-sec a { font-weight: 600; }
.doc-contact { padding: 22px 24px; border: 1px solid var(--border); border-radius: 18px; background: var(--card); }
.doc-mail { font-size: 20px; font-weight: 700; }
.doc-mail a { color: var(--accent-text); word-break: break-all; }

/* ---------- Small screens ---------- */
@media (max-width: 480px) {
  .hero { padding-top: 40px; gap: 18px; }
  .hero-icon { width: 104px; height: 104px; border-radius: 23px; }
  .lead { font-size: 17px; }
  .lang-switch button, .lang-switch a { min-width: 44px; padding: 0 10px; }
  .machine figcaption { padding: 10px 12px 12px; }
  .machine-sub { font-size: 13px; }
}

/* ---------- Thanh điều hướng ---------- */
.mainnav { display: flex; gap: 4px; margin-right: auto; margin-left: 12px; }
.mainnav a {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px;
  color: var(--text-2); text-decoration: none; font-size: 15px; font-weight: 600;
}
.mainnav a:hover { color: var(--text); background: var(--chip); }
.mainnav a[aria-current="page"] { color: var(--text); background: var(--chip); }
@media (max-width: 720px) {
  /* Điện thoại: brand + công cụ ở hàng 1, menu xuống hàng 2 trải đều. */
  .mainnav { order: 3; width: 100%; margin: 0; }
  .mainnav a { flex: 1 1 0; justify-content: center; }
}

/* ---------- Thư viện biên dạng ---------- */
.lib-hero {
  padding-top: 40px; padding-bottom: 8px;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 16px;
}
.lib-hero h1 { font-size: clamp(30px, 4vw, 48px); }
.filter-chips {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px;
}
.filter-chips button {
  min-height: 40px; padding: 0 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: transparent; color: var(--text-2);
  font: inherit; font-size: 14px; font-weight: 600;
}
.filter-chips button:hover { color: var(--text); border-color: var(--accent); }
.filter-chips button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip-n { opacity: 0.6; font-variant-numeric: tabular-nums; margin-left: 2px; }

.lib { display: flex; flex-direction: column; gap: 64px; padding-top: 48px; }
.pgroup[hidden] { display: none; }
.pgroup-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin-bottom: 20px;
  padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.pgroup-head h2 { font-size: clamp(24px, 2.6vw, 30px); font-weight: 800; letter-spacing: -0.01em; line-height: 1.2; }
.pgroup-head p { color: var(--muted); font-size: 15px; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 18px; }
.pcard {
  display: flex; flex-direction: column; border-radius: 16px; overflow: hidden;
  border: 1px solid var(--border); background: var(--card);
  scroll-margin-top: 24px;
}
/* Ảnh thẻ bài là thép trên nền tối ⇒ khung ảnh luôn tối ở cả 2 theme. */
.pcard-img { background: #0c0d10; aspect-ratio: 640 / 364; }
.pcard-img img { width: 100%; height: 100%; display: block; object-fit: cover; }
.pcard-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.pcard h3 {
  margin: 0; font-size: 17px; font-weight: 800; letter-spacing: 0.04em; line-height: 1.3;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.pcard p { margin: 0; color: var(--text-2); font-size: 15px; line-height: 1.55; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 4px; }
.tag {
  display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em; white-space: nowrap;
  background: var(--chip); color: var(--text-2);
}
.t-pro { background: var(--accent); color: #08090b; font-weight: 800; letter-spacing: 0.08em; }
.t-okuma { color: var(--accent-text); }
.t-sim { color: #4f9fd8; }
:root[data-theme="light"] .t-sim { color: #1f6aa5; }
.t-frames { color: #3fae7a; }
:root[data-theme="light"] .t-frames { color: #19693f; }
.lib + .safe { padding-top: 72px; padding-bottom: 96px; }

/* ---------- Tiêu đề khu vực (trang chủ) ---------- */
.section-head {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px;
  max-width: 760px; margin: 0 auto 40px;
}
.section-head h2 {
  font-size: clamp(28px, 3.6vw, 44px); line-height: 1.15; font-weight: 800; letter-spacing: -0.02em;
  text-wrap: balance;
}
.section-lead { color: var(--text-2); font-size: 18px; max-width: 34em; }

/* ---------- Giúp gì cho bạn ---------- */
.benefits { padding-top: 128px; scroll-margin-top: 24px; }
.benefit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr)); gap: 18px; }
.benefit {
  display: flex; flex-direction: column; gap: 10px;
  padding: 24px 22px 26px; border-radius: 18px;
  background: var(--card); border: 1px solid var(--border);
}
.benefit-icon {
  width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--glow-2); border: 1px solid var(--safe-line); margin-bottom: 4px;
}
.benefit-icon svg { width: 22px; height: 22px; fill: none; stroke: var(--accent-text); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.benefit h3 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.3; }
.benefit p { color: var(--text-2); font-size: 16px; }

/* ---------- Biên dạng (xem trước thư viện) ---------- */
.profiles-teaser { padding-top: 128px; scroll-margin-top: 24px; }
.ptiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.ptile {
  position: relative; display: block; border-radius: 14px; overflow: hidden; text-decoration: none;
  background: #0c0d10; border: 1px solid var(--border); aspect-ratio: 640 / 364;
}
.ptile img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform 0.25s ease; }
.ptile:hover img { transform: scale(1.04); }
.ptile-name {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 10px 8px;
  background: linear-gradient(transparent, rgba(8, 9, 11, 0.85));
  color: #f1eee9; font-size: 12px; font-weight: 800; letter-spacing: 0.06em;
  display: flex; align-items: center; gap: 6px;
}
.ptile-name .tag { height: 18px; padding: 0 6px; font-size: 10px; }
.ptile:hover, .ptile:focus-visible { border-color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .ptile img { transition: none; } .ptile:hover img { transform: none; } }
@media (max-width: 900px) { .ptiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } .ptile:nth-child(n+10) { display: none; } }
@media (max-width: 560px) { .ptiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .ptile:nth-child(n+10) { display: block; } }

.teaser-foot { display: flex; flex-direction: column; align-items: center; gap: 22px; margin-top: 28px; }
.group-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.group-links a {
  display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-2); text-decoration: none; font-size: 14px; font-weight: 600;
}
.group-links a:hover { color: var(--text); border-color: var(--accent); }

/* ---------- Cách dùng: 4 bước ---------- */
.howto { padding-top: 128px; scroll-margin-top: 24px; }
.howto-steps {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); gap: 28px 24px;
  counter-reset: none;
}
.howto-step { position: relative; display: flex; flex-direction: column; gap: 8px; padding-top: 22px; border-top: 1px solid var(--line); }
.howto-num {
  width: 36px; height: 36px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: #08090b; font-weight: 800; font-size: 17px; margin-bottom: 6px;
}
.howto-step h3 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.3; }
.howto-step p { color: var(--text-2); font-size: 16px; }

/* ---------- Lời kết ---------- */
.closing {
  padding-top: 100px; padding-bottom: 110px;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 18px;
}
.closing h2 {
  font-size: clamp(30px, 4vw, 48px); line-height: 1.12; font-weight: 800; letter-spacing: -0.02em; text-wrap: balance;
}
.closing p { max-width: 32em; color: var(--text-2); font-size: 18px; }

@media (max-width: 480px) {
  .benefits, .profiles-teaser, .howto { padding-top: 88px; }
  .section-head { margin-bottom: 28px; }
  .section-lead { font-size: 16px; }
  .closing { padding-top: 72px; padding-bottom: 80px; }
}

/* ---------- Hướng dẫn ---------- */
.guide-toc { padding-top: 16px; }
.guide-toc ol {
  list-style: none; margin: 0 auto; padding: 0; max-width: 900px;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
}
.guide-toc a {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px 0 6px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-2); text-decoration: none; font-size: 14px; font-weight: 600;
}
.guide-toc a:hover { color: var(--text); border-color: var(--accent); }
.toc-n {
  width: 28px; height: 28px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--chip); color: var(--accent-text); font-size: 13px; font-weight: 800;
}

.guide { max-width: 1060px; margin: 0 auto; padding: 72px 24px 0; display: flex; flex-direction: column; gap: 96px; }
.guide-ch { display: flex; flex-wrap: wrap; align-items: center; gap: 40px 64px; scroll-margin-top: 24px; }
.guide-rev { flex-direction: row-reverse; }
.guide-pics { flex: 0 0 auto; margin: 0 auto; display: flex; gap: 20px; }
.guide-pics .phone { margin: 0; }
.guide-pics.pair .phone { width: 220px; height: 460px; border-radius: 38px; padding: 9px; }
.guide-pics.pair .phone img { border-radius: 30px; }
.guide-text { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.guide-text h2 {
  font-size: clamp(26px, 3vw, 36px); line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; text-wrap: balance;
}
.guide-text p, .guide-text li { color: var(--text-2); font-size: 17px; }
.guide-text b { color: var(--text); font-weight: 700; }
.guide-text ul { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 8px; }
.guide-text li::marker { color: var(--accent-text); }
.guide-note {
  margin-top: 4px; padding: 12px 16px; border-radius: 12px;
  background: var(--chip); border-left: 3px solid var(--accent); font-size: 15px !important;
}
.no-pic .guide-text { max-width: 720px; margin: 0 auto; }
.guide + .safe { padding-top: 96px; }
.howto-more { display: flex; justify-content: center; margin-top: 36px; }

@media (max-width: 760px) {
  .guide-rev { flex-direction: column; }
  .guide-ch { flex-direction: column; align-items: stretch; }
  .guide-pics { justify-content: center; }
}
@media (max-width: 520px) {
  .guide { padding: 56px 16px 0; gap: 72px; }
  .guide-pics.pair { gap: 10px; }
  .guide-pics.pair .phone { width: 168px; height: 352px; border-radius: 30px; padding: 7px; }
  .guide-pics.pair .phone img { border-radius: 24px; }
}

/* Chương có 3 ảnh (09 Tiện ren): ảnh xếp một hàng phía trên chữ; điện thoại = dải vuốt ngang. */
/* min-width: 0 — không thì dải 3 ảnh (rộng ~700 px) kéo cả chương rộng ra, chữ tràn khỏi màn điện thoại. */
.guide-triple { flex-direction: column; align-items: stretch; min-width: 0; }
.guide-pics.triple { min-width: 0; max-width: 100%; }
.guide-triple .guide-text { max-width: 760px; margin: 0 auto; }
.guide-pics.triple { justify-content: center; gap: 20px; }
.guide-pics.triple .phone { width: 220px; height: 460px; border-radius: 38px; padding: 9px; }
.guide-pics.triple .phone img { border-radius: 30px; }
@media (max-width: 760px) {
  .guide-pics.triple {
    justify-content: flex-start; overflow-x: auto; scroll-snap-type: x mandatory;
    margin: 0 -16px; padding: 0 16px 8px; scrollbar-width: none;
  }
  .guide-pics.triple::-webkit-scrollbar { display: none; }
  .guide-pics.triple .phone { flex: 0 0 auto; scroll-snap-align: center; }
}

/* ---------- Video hướng dẫn (đầu trang Hướng dẫn) ---------- */
.tutorial {
  margin-top: 56px; padding-top: 40px; padding-bottom: 40px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 32px 56px;
  border-radius: 24px; background: var(--card); border: 1px solid var(--border);
  max-width: 1012px; scroll-margin-top: 24px;
}
.tutorial-media { flex: 0 0 auto; }
.tutorial .phone { margin: 0; }
/* Video 9:16 thu vừa màn 244 × 534 (không cắt chữ), nền = mép video #080d0e / #141414. */
.tutorial-video {
  width: 100%; height: 100%; display: block; object-fit: contain; border-radius: 34px;
  background: linear-gradient(#080d0e 0 50%, #141414 50% 100%);
}
.tutorial-text { flex: 1 1 340px; min-width: 0; max-width: 520px; display: flex; flex-direction: column; gap: 12px; }
.tutorial-text h2 { font-size: clamp(26px, 3vw, 36px); line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; text-wrap: balance; }
.tutorial-lead { color: var(--text-2); font-size: 17px; }
.tutorial-steps { margin: 4px 0 0; padding-left: 1.4em; display: flex; flex-direction: column; gap: 8px; }
.tutorial-steps li { color: var(--text-2); font-size: 16px; }
.tutorial-steps li::marker { color: var(--accent-text); font-weight: 800; }
.tutorial-steps b { color: var(--text); }
.toc-video { border-color: var(--accent) !important; color: var(--text) !important; }
.toc-video .toc-n { background: var(--accent); color: #08090b; }
.howto-more { gap: 12px; flex-wrap: wrap; }
@media (max-width: 520px) {
  .tutorial { margin-left: 16px; margin-right: 16px; padding: 28px 16px; border-radius: 20px; }
}

/* ---------- Chương 10 Máy tính gia công: lưới 9 bước, mỗi bước = ảnh + chữ ---------- */
.guide-calc { flex-direction: column; align-items: stretch; min-width: 0; }
.guide-calc > .guide-text { max-width: 760px; margin: 0 auto; flex: 0 0 auto; }
.calc-steps {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px 28px; counter-reset: none;
}
.calc-step { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 18px; min-width: 0; }
.calc-step .phone { width: 200px; height: 418px; border-radius: 34px; padding: 8px; margin: 0; }
.calc-step .phone img { border-radius: 27px; }
.calc-step figcaption { display: flex; flex-direction: column; gap: 6px; max-width: 300px; }
.calc-step h3 { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 800; line-height: 1.25; }
.calc-step figcaption { position: relative; padding-left: 40px; }
.calc-n {
  position: absolute; left: 0; top: -2px;
  width: 28px; height: 28px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--chip); color: var(--accent-text); font-size: 13px; font-weight: 800;
}
.calc-step p { margin: 0; color: var(--text-2); font-size: 15px; line-height: 1.5; }
.calc-step b { color: var(--text); font-weight: 700; }
.calc-note { max-width: 760px; margin: 0 auto; color: var(--text-2); }
.calc-note b { color: var(--text); }
@media (max-width: 900px) { .calc-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Điện thoại: ảnh nhỏ bên trái, chữ bên phải. */
@media (max-width: 560px) {
  .calc-steps { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .calc-step { flex-direction: row; align-items: flex-start; gap: 16px; }
  .calc-step .phone { flex: 0 0 auto; width: 128px; height: 268px; border-radius: 24px; padding: 6px; }
  .calc-step .phone img { border-radius: 19px; }
  .calc-step figcaption { padding-left: 0; padding-top: 36px; }
  .calc-n { top: 0; }
  .calc-step h3 { font-size: 17px; }
}

/* ---------- Dòng máy hỗ trợ: thẻ bấm được + popup thông tin (tools/machine-info.py) ---------- */
button.machine {
  font: inherit; color: inherit; padding: 0; cursor: pointer; width: 100%;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
button.machine:hover { border-color: var(--accent); transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) { button.machine { transition: none; } button.machine:hover { transform: none; } }
.machine-cap { padding: 12px 16px 14px; display: flex; flex-direction: column; gap: 2px; }
.machine-more {
  margin-top: 6px; font-size: 13px; font-weight: 700; color: var(--accent-text);
  display: inline-flex; align-items: center; gap: 6px;
}
.machine-more::after { content: "›"; font-size: 18px; line-height: 1; }
@media (max-width: 480px) { .machine-cap { padding: 10px 12px 12px; } .machine-more { font-size: 12px; } }

.mdialog {
  width: min(680px, calc(100% - 32px)); max-height: min(88vh, 900px); padding: 0;
  border: 1px solid var(--border); border-radius: 22px; background: var(--card); color: var(--text);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6); overflow: hidden;
}
.mdialog[open] { display: flex; flex-direction: column; }
.mdialog::backdrop { background: rgba(0, 0, 0, 0.62); }
.md-head {
  flex: 0 0 auto; display: flex; align-items: center; gap: 14px;
  padding: 14px 14px 14px 16px; border-bottom: 1px solid var(--line); background: var(--card);
}
.md-thumb { width: 64px; height: 48px; object-fit: cover; border-radius: 10px; flex: 0 0 auto; }
.md-titles { flex: 1; min-width: 0; }
.md-titles .eyebrow { font-size: 12px; }
.md-titles h2 { font-size: 26px; font-weight: 800; letter-spacing: 0.08em; line-height: 1.15; }
.md-close {
  flex: 0 0 auto; width: 44px; height: 44px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--chip); color: var(--text); font-size: 18px;
}
.md-body {
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: 18px 20px 28px; display: flex; flex-direction: column; gap: 26px;
}
.md-sub { color: var(--text-2); font-size: 15px; }
.md-sec { display: flex; flex-direction: column; gap: 10px; }
.md-sec h3 { margin: 0; font-size: 19px; font-weight: 800; line-height: 1.3; }
.md-sec p, .md-sec li { color: var(--text-2); font-size: 15px; line-height: 1.55; }
.md-sec b { color: var(--text); }
.md-sec ul, .md-sec ol { margin: 0; padding-left: 1.3em; display: flex; flex-direction: column; gap: 7px; }
.md-sec li::marker { color: var(--accent-text); font-weight: 800; }
.md-sec code, .md-sub code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.88em;
  padding: 1px 6px; border-radius: 6px; background: var(--chip); color: var(--text); white-space: nowrap;
}
.md-origin {
  padding: 16px; border-radius: 16px; border: 1px solid var(--safe-line); background: var(--glow-2);
}
.md-origin h3::before { content: "◎ "; color: var(--accent-text); }
.md-fig { margin: 4px 0; padding: 12px 10px 10px; border-radius: 12px; background: #0f1114; }
.md-fig figcaption { margin-top: 6px; color: #b9b3ab !important; font-size: 13px; line-height: 1.5; }
.md-fig figcaption b { color: #f1eee9; }
.md-svg { width: 100%; height: auto; display: block; font-family: ui-monospace, Menlo, monospace; font-size: 11px; }
.md-svg .cl { stroke: #5b6170; stroke-width: 1; stroke-dasharray: 10 3 2 3; }
.md-svg .chuck { fill: #3a3f48; }
.md-svg .part { fill: rgba(241, 238, 233, 0.10); stroke: #c9c4bc; stroke-width: 1.4; }
.md-svg .tool { fill: #6b7280; }
.md-svg .z-sub { stroke: #f0a868; stroke-width: 1.6; stroke-dasharray: 5 3; }
.md-svg .z-main { stroke: #5fb4f0; stroke-width: 1.6; stroke-dasharray: 5 3; }
.md-svg .t-sub { fill: #f0a868; font-weight: 700; }
.md-svg .t-main { fill: #5fb4f0; font-weight: 700; }
.md-svg .dim, .md-svg .ax { stroke: #b9b3ab; stroke-width: 1; }
.md-svg .arr { fill: #b9b3ab; }
.md-svg .t-dim, .md-svg .t-o { fill: #e6e2dc; font-weight: 700; }
.md-svg .o { fill: none; stroke: #f0a868; stroke-width: 1.6; }
.md-note {
  padding: 10px 14px; border-radius: 10px; background: var(--chip); border-left: 3px solid var(--accent);
  font-size: 14px !important;
}
.md-ex { padding: 10px 14px; border-radius: 10px; background: var(--chip); }
.md-codet { font-size: 13px !important; font-weight: 700; color: var(--muted) !important; margin-top: 4px; }
.md-code {
  margin: 0; padding: 12px 14px; border-radius: 12px; background: #0f1114; color: #d7f0dd;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; line-height: 1.55;
  overflow-x: auto; white-space: pre;
}
body.md-lock { overflow: hidden; }
/* Điện thoại: popup thành tấm trượt từ dưới lên, gần full màn. */
@media (max-width: 560px) {
  .mdialog {
    width: 100%; max-width: 100%; max-height: 92vh; margin: auto 0 0; border-radius: 22px 22px 0 0;
    border-left: 0; border-right: 0; border-bottom: 0;
  }
  .md-body { padding: 16px 16px 32px; }
  .md-origin { padding: 14px 12px; }
}
.mdialog:focus, .mdialog:focus-visible { outline: none; }
/* Video hướng dẫn thứ 2 (CR-H đọc bản vẽ): nền mép video = #0a0d11; khung ngay dưới video CR. */
.tutorial-2 { margin-top: 28px; flex-direction: row-reverse; }
.tutorial-video-crh { background: #0a0d11; }
@media (max-width: 760px) { .tutorial-2 { flex-direction: row; } }
.tutorial-3 { margin-top: 28px; }
