/* GeoWard — hướng dẫn sử dụng.
 *
 * Ngôn ngữ thị giác: hồ sơ hành chính địa chính. Nền giấy hơi ngả lam, mực xanh navy,
 * con dấu đỏ chỉ dùng đúng một lần cho cảnh báo pháp lý. Số đo luôn đặt bằng font
 * đẳng khoảng — nhìn là biết "đây là số đo được", không phải chữ diễn giải.
 *
 * Không dùng webfont: máy demo chạy offline, và Segoe UI phủ đủ dấu tiếng Việt.
 */

:root {
  --paper: #e9edf3;
  --card: #ffffff;
  --ink: #101f36;
  --ink-soft: #52627a;
  --rule: #c6d0de;
  --accent: #1a5fb4;
  --accent-soft: #e8eff9;
  --stamp: #b3261e;
  --high: #d2321c;
  --mid: #b3760a;
  --low: #6b7889;
  --measure: 74ch;

  --sans: "Segoe UI", "Noto Sans", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Mono", Consolas, ui-monospace, "Courier New", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.65 var(--sans);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:focus-visible, .btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

code, .data, pre { font-family: var(--mono); font-size: 0.9em; }
.data { font-variant-numeric: tabular-nums; }
code { background: var(--accent-soft); padding: 1px 5px; border-radius: 3px; }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: #fff; padding: 10px 16px; z-index: 10;
}
.skip:focus { left: 0; }

/* ---------------------------------------------------------------- hero */

.hero {
  background: var(--ink);
  color: #eef2f8;
  padding: 52px 28px 46px;
  /* Lưới toạ độ mờ — nhắc tới bản đồ địa chính, không tranh chỗ với chữ. */
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 34px 34px;
}

.hero-inner {
  max-width: 1120px; margin: 0 auto;
  display: flex; gap: 44px; align-items: center; justify-content: space-between;
}
.hero-text { max-width: 62ch; }

.eyebrow {
  margin: 0 0 12px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.09em;
  text-transform: uppercase; color: #8fa8c9;
}

h1 {
  margin: 0;
  font-size: clamp(40px, 6.5vw, 68px);
  font-weight: 800; letter-spacing: -0.035em; line-height: 0.98;
}

.lede { margin: 16px 0 26px; font-size: 18px; color: #ccd8e8; }
.lede em { color: #fff; font-style: normal; border-bottom: 2px solid var(--accent); }

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-block; padding: 11px 22px; border-radius: 4px;
  border: 1px solid #43597a; color: #dce6f3; text-decoration: none;
  font-weight: 600; font-size: 15px;
}
.btn:hover { background: #1c2c44; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #16509b; }

/* Con dấu — chỗ duy nhất được phép "to tiếng" trên trang. */
.stamp {
  flex: none;
  width: 216px; padding: 16px 12px;
  border: 3px double var(--stamp); border-radius: 6px;
  color: #ff8a7d;
  text-align: center; text-transform: uppercase;
  transform: rotate(-6deg);
  opacity: 0.95;
}
.stamp strong {
  display: block; margin: 7px 0;
  font-size: 21px; font-weight: 800; line-height: 1.15; letter-spacing: 0.03em;
}
.stamp-top, .stamp-bottom {
  display: block; font-family: var(--mono);
  font-size: 10px; letter-spacing: 0.16em; color: #e8776a;
}

/* ------------------------------------------------------------- layout */

.shell {
  max-width: 1120px; margin: 0 auto; padding: 0 28px 72px;
  display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 52px;
}

.toc { position: sticky; top: 26px; align-self: start; padding-top: 40px; }
.toc-title {
  margin: 0 0 10px; font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft);
}
.toc ol { margin: 0; padding: 0; list-style: none; counter-reset: toc; }
.toc li { counter-increment: toc; margin-bottom: 3px; }
.toc a {
  display: block; padding: 5px 0 5px 30px; position: relative;
  font-size: 14px; color: var(--ink-soft); text-decoration: none;
  border-left: 2px solid var(--rule);
}
.toc a::before {
  content: counter(toc, decimal-leading-zero);
  position: absolute; left: 10px;
  font-family: var(--mono); font-size: 11px; color: #93a3b8;
}
.toc a:hover { color: var(--accent); border-left-color: var(--accent); background: var(--accent-soft); }

main { padding-top: 40px; min-width: 0; }

section { margin-bottom: 60px; scroll-margin-top: 22px; }
section p, section ul, section ol, section dl { max-width: var(--measure); }

h2 {
  display: flex; align-items: baseline; gap: 14px;
  margin: 0 0 16px; padding-bottom: 11px;
  border-bottom: 2px solid var(--ink);
  font-size: 25px; font-weight: 700; letter-spacing: -0.02em;
}
.num { font-family: var(--mono); font-size: 15px; font-weight: 400; color: var(--accent); }

h3 { margin: 26px 0 8px; font-size: 17px; font-weight: 700; }

/* -------------------------------------------------------- components */

.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(258px, 1fr)); gap: 18px; }
.panel { background: var(--card); border: 1px solid var(--rule); border-radius: 6px; padding: 6px 20px 16px; }
.panel h3 { margin-top: 14px; font-size: 15px; text-transform: uppercase; letter-spacing: 0.05em; }
.panel ul { margin: 0; padding-left: 19px; }
.panel li { margin: 6px 0; }
.panel-yes { border-top: 4px solid var(--accent); }
.panel-no { border-top: 4px solid var(--stamp); }
.panel-no h3 { color: var(--stamp); }

table.spec {
  width: 100%; max-width: var(--measure);
  border-collapse: collapse; background: var(--card);
  border: 1px solid var(--rule); margin: 14px 0; font-size: 15px;
}
table.spec th, table.spec td { border-bottom: 1px solid var(--rule); padding: 10px 13px; text-align: left; vertical-align: top; }
table.spec thead th { background: var(--ink); color: #fff; font-size: 13px; letter-spacing: 0.03em; }
table.spec tbody tr:last-child td { border-bottom: 0; }
table.spec .r { text-align: right; font-family: var(--mono); font-weight: 700; white-space: nowrap; }
.pos { color: #16733a; }
.neg { color: var(--stamp); }
table.qa td:first-child { font-weight: 600; width: 34%; }

.callout {
  max-width: var(--measure);
  background: var(--card); border-left: 4px solid var(--accent);
  padding: 13px 17px; border-radius: 0 5px 5px 0; margin: 18px 0;
}
.callout-warn { border-left-color: #c9820a; background: #fdf6e7; }

ol.steps { counter-reset: step; list-style: none; margin: 18px 0; padding: 0; }
ol.steps > li {
  counter-increment: step; position: relative;
  padding: 0 0 20px 52px; border-left: 2px solid var(--rule); margin-left: 15px;
}
ol.steps > li:last-child { border-left-color: transparent; padding-bottom: 0; }
ol.steps > li::before {
  content: counter(step);
  position: absolute; left: -16px; top: 0;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
ol.steps h3 { margin: 3px 0 4px; font-size: 16px; }
ol.steps p { margin: 0; color: var(--ink-soft); }

.chip {
  display: inline-block; padding: 1px 9px; border-radius: 3px;
  font-size: 12px; font-weight: 700; color: #fff; vertical-align: middle;
}
.chip-high { background: var(--high); }
.chip-mid { background: var(--mid); }
.chip-low { background: var(--low); }

/* --------------------------------------------- 04: anatomy (signature) */

.feature { background: var(--card); border: 1px solid var(--rule); border-radius: 8px; padding: 26px 28px 30px; }
.feature h2 { margin-top: 0; }
.feature-lede { font-size: 17px; color: var(--ink-soft); }
.feature-lede em { color: var(--ink); font-style: normal; font-weight: 600; }

.anatomy { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 30px; margin: 22px 0 8px; align-items: start; }

.specimen { margin: 0; position: sticky; top: 22px; }
.specimen figcaption {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--ink-soft); margin-bottom: 7px;
}
.popup {
  border: 1px solid var(--rule); border-radius: 6px; padding: 13px 15px;
  background: #fcfdfe; box-shadow: 0 3px 14px rgba(16, 31, 54, 0.09); font-size: 13px;
}
.popup h4 { margin: 0 0 9px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.rows > div { display: grid; grid-template-columns: auto 1fr 22px; gap: 8px; padding: 3px 0; align-items: baseline; }
.rows dt { color: var(--ink-soft); white-space: nowrap; }
.rows dd { margin: 0; text-align: right; }
.rows dd.mk {
  justify-self: end; align-self: center;
  width: 18px; height: 18px; border: 1.5px solid var(--accent); border-radius: 50%;
  color: var(--accent); font-family: var(--mono); font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.rows dd.mk:empty { border: 0; }
.evidence { border-top: 1px solid var(--rule); margin-top: 8px; padding-top: 8px; }
.reason { background: var(--accent-soft); border-radius: 4px; padding: 8px 10px; margin: 9px 0 0; font-size: 12.5px; }
.crops { display: flex; gap: 7px; margin-top: 9px; }
.crops span {
  flex: 1; height: 54px; border: 1px dashed var(--rule); border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--ink-soft); background: #f2f5f9;
}

.legend h3 { margin-top: 0; }
ol.marks { counter-reset: mk; list-style: none; margin: 0; padding: 0; }
ol.marks li {
  counter-increment: mk; position: relative;
  padding: 7px 0 7px 34px; border-bottom: 1px solid var(--rule); font-size: 14.5px;
}
ol.marks li:last-child { border-bottom: 0; }
ol.marks li::before {
  content: counter(mk); position: absolute; left: 0; top: 8px;
  width: 21px; height: 21px; border: 1.5px solid var(--accent); border-radius: 50%;
  color: var(--accent); font-family: var(--mono); font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.verdict { margin-top: 26px; border-top: 2px solid var(--ink); padding-top: 18px; }
.verdict h3 { margin-top: 0; }
.verdict ul { margin: 0; padding-left: 20px; max-width: var(--measure); }
.verdict li { margin: 8px 0; }

/* ------------------------------------------------------------- bands */

.bands { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin: 18px 0; max-width: var(--measure); }
.band { background: var(--card); border: 1px solid var(--rule); border-radius: 6px; padding: 14px 16px; }
.band .data { display: block; margin: 7px 0 4px; font-weight: 700; }
.band p { margin: 0; font-size: 14px; color: var(--ink-soft); }

dl.faq { max-width: var(--measure); }
dl.faq dt { font-weight: 700; margin-top: 18px; }
dl.faq dd { margin: 5px 0 0; color: var(--ink-soft); }
pre {
  background: var(--ink); color: #dbe6f4; padding: 11px 14px;
  border-radius: 5px; overflow-x: auto; margin: 8px 0;
}
pre code { background: none; color: inherit; padding: 0; }

.page-footer { border-top: 1px solid var(--rule); padding-top: 18px; color: var(--ink-soft); font-size: 14px; }
.page-footer p { margin: 4px 0; }
.fine { font-size: 13px; }

/* ----------------------------------------------------------- responsive */

@media (max-width: 940px) {
  .shell { grid-template-columns: 1fr; gap: 0; padding: 0 20px 56px; }
  .toc { position: static; padding-top: 30px; }
  .toc ol { columns: 2; }
  .hero-inner { flex-direction: column; align-items: flex-start; gap: 30px; }
  .stamp { align-self: center; }
  .anatomy { grid-template-columns: 1fr; }
  .specimen { position: static; max-width: 380px; }
  .feature { padding: 22px 18px 24px; }
}

@media (max-width: 560px) {
  body { font-size: 15px; }
  .hero { padding: 36px 20px 34px; }
  .toc ol { columns: 1; }
  table.spec { font-size: 14px; }
  table.spec th, table.spec td { padding: 8px 10px; }
  table.qa td:first-child { width: auto; }
}

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

@media print {
  body { background: #fff; }
  .hero { background: #fff; color: #000; }
  .hero h1, .lede { color: #000; }
  .toc, .hero-actions, .skip { display: none; }
  .shell { grid-template-columns: 1fr; }
  section { break-inside: avoid; }
}
