/* NétPDF — Chính sách hệ thống (Mộc Bản Editorial Theme) */

:root {
  --paper: #f3eee3;
  --paper-2: #fbf7ef;
  --paper-3: #ece4d5;
  --ink: #171a1d;
  --ink-2: #3d3a35;
  --muted: #686258;
  --line: #d8cfc0;
  --line-2: #bdb09d;
  --accent: #c8442a;
  --accent-2: #a9341f;
  --accent-soft: #f2ddd5;
  --on-accent: #fffaf3;
  --jade: #2f6b5e;
  --jade-soft: #dcebe4;
  --amber: #7f4f0f;
  --amber-soft: #f5e7cf;
  --shadow: 0 18px 44px rgba(23, 26, 29, 0.06);
  --shadow-soft: 0 1px 0 rgba(23, 26, 29, 0.04), 0 8px 20px rgba(23, 26, 29, 0.04);
  --radius: 14px;
  --radius-sm: 10px;
  --header-bg: rgba(243, 238, 227, 0.88);
  --font-ui: "Be Vietnam Pro", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "Cascadia Code", "Consolas", ui-monospace, SFMono-Regular, Menlo, monospace;
}

[data-theme="dark"] {
  --paper: #121311;
  --paper-2: #1b1b18;
  --paper-3: #24231f;
  --ink: #f0e9dc;
  --ink-2: #d2c9ba;
  --muted: #9b9384;
  --line: #38352e;
  --line-2: #4b463d;
  --accent: #ff6b4a;
  --accent-2: #ff8468;
  --accent-soft: #3a211b;
  --on-accent: #1a0f0b;
  --jade: #7cc7ae;
  --jade-soft: #1e322c;
  --amber: #e0a85a;
  --amber-soft: #332614;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
  --shadow-soft: 0 1px 0 rgba(0, 0, 0, 0.25), 0 10px 24px rgba(0, 0, 0, 0.22);
  --header-bg: rgba(18, 19, 17, 0.88);
}

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

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

a:hover {
  color: var(--accent-2);
}

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

button,
input {
  font: inherit;
}

code,
pre {
  font-family: var(--font-mono);
}

code {
  background: var(--paper-3);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.12em 0.42em;
  font-size: 0.87em;
  word-break: break-word;
}

/* Container */
.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Sticky Top Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  flex-wrap: wrap;
  padding: 10px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
  flex-shrink: 0;
}

.brand:hover {
  color: var(--ink);
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  object-fit: cover;
  box-shadow: var(--shadow-soft);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-domain {
  font-size: 11.5px;
  color: var(--muted);
  font-family: var(--font-mono);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
  background: var(--paper-3);
  color: var(--ink);
}

.nav-link.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  background: var(--paper-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px;
}

.lang-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.lang-btn:hover {
  color: var(--ink);
}

.lang-btn.is-active {
  background: var(--paper-2);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--ink);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.theme-btn:hover {
  background: var(--paper-3);
  border-color: var(--line-2);
}

/* Hero */
.hero {
  padding: 40px 0 28px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero-title {
  margin: 0 0 12px;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.hero-title-muted {
  color: var(--muted);
  font-weight: 600;
}

.hero-lede {
  margin: 0 0 20px;
  max-width: 680px;
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--muted);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  background: var(--paper-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
}

.meta-pill strong {
  color: var(--ink);
  font-weight: 600;
}

.meta-pill--jade {
  background: var(--jade-soft);
  border-color: transparent;
  color: var(--jade);
}

.meta-pill--amber {
  background: var(--amber-soft);
  border-color: transparent;
  color: var(--amber);
}

/* 4-card Highlights Grid */
.highlights-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.highlight-card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  box-shadow: var(--shadow-soft);
}

.highlight-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.highlight-label {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted);
}

/* Two-column Content Layout */
.layout-grid {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  gap: 28px;
  padding: 32px 0 56px;
  align-items: start;
}

/* Sidebar TOC */
.sidebar {
  position: sticky;
  top: 88px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sidebar-card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-soft);
}

.sidebar-heading {
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.toc-link {
  display: block;
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink-2);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.toc-link:hover {
  background: var(--paper-3);
  color: var(--ink);
}

.toc-link.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-primary {
  border: 0;
  background: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover {
  background: var(--accent-2);
  color: var(--on-accent);
}

.btn-secondary {
  border: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--ink);
}

.btn-secondary:hover {
  background: var(--paper-3);
  border-color: var(--line-2);
  color: var(--ink);
}

/* Main Document Card */
.doc-card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px 40px;
  box-shadow: var(--shadow);
}

.doc-section {
  scroll-margin-top: 88px;
}

.doc-section + .doc-section {
  margin-top: 32px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.doc-section h2 {
  margin: 0 0 12px;
  font-size: 20px;
  line-height: 1.3;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.sec-num {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}

.doc-section h3 {
  margin: 20px 0 8px;
  font-size: 15.5px;
  font-weight: 600;
  color: var(--ink);
}

.doc-section p {
  margin: 0 0 12px;
  color: var(--ink-2);
}

.doc-section p:last-child {
  margin-bottom: 0;
}

.doc-section ul,
.doc-section ol {
  margin: 8px 0 14px;
  padding-left: 22px;
  color: var(--ink-2);
}

.doc-section li + li {
  margin-top: 6px;
}

.doc-section strong {
  color: var(--ink);
}

/* Callout Boxes */
.callout {
  margin: 16px 0;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--paper-3);
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-2);
}

.callout--jade {
  background: var(--jade-soft);
  border-color: transparent;
  border-left: 3px solid var(--jade);
}

.callout--amber {
  background: var(--amber-soft);
  border-color: transparent;
  border-left: 3px solid var(--amber);
}

.callout-title {
  display: block;
  margin-bottom: 4px;
  font-weight: 700;
  color: var(--ink);
}

/* Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 14px 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 520px;
}

th,
td {
  text-align: left;
  padding: 12px 14px;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

tr:last-child td {
  border-bottom: 0;
}

th {
  background: var(--paper-3);
  color: var(--ink);
  font-weight: 600;
  font-size: 13px;
}

td {
  color: var(--ink-2);
}

/* License Component Cards & Collapsible License Blocks */
.lib-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0 18px;
}

.lib-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.lib-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.lib-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}

.badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--paper-3);
  border: 1px solid var(--line);
  color: var(--ink-2);
}

.badge--jade {
  background: var(--jade-soft);
  border-color: transparent;
  color: var(--jade);
}

.lib-desc {
  margin: 0 0 8px;
  font-size: 13.5px;
  color: var(--ink-2);
}

.lib-meta {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}

details.license-box {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  overflow: hidden;
}

details.license-box summary {
  padding: 13px 16px;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  background: var(--paper-3);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

details.license-box summary::after {
  content: "+";
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--muted);
}

details.license-box[open] summary::after {
  content: "−";
}

details.license-box pre {
  margin: 0;
  padding: 16px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-2);
  white-space: pre-wrap;
  word-break: break-word;
  border-top: 1px solid var(--line);
}

/* Contact Grid */
.contact-box {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.contact-item {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.contact-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 4px;
}

.contact-val {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  word-break: break-word;
}

/* Error / Redirect Standalone Card */
.center-wrap {
  padding: 64px 0 80px;
}

.status-card {
  max-width: 580px;
  margin: 0 auto;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px;
  box-shadow: var(--shadow);
}

.status-card h1 {
  margin: 0 0 12px;
  font-size: 28px;
  line-height: 1.25;
}

.status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--paper-2);
  padding: 28px 0 36px;
  font-size: 13px;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-links a {
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 500;
}

.footer-links a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.footer-note {
  margin: 8px 0 0;
  max-width: 680px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
}

/* Responsive */
@media (max-width: 960px) {
  .highlights-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .layout-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .sidebar {
    position: static;
  }

  .doc-card {
    padding: 26px 24px;
  }

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

@media (max-width: 640px) {
  .container {
    padding: 0 16px;
  }

  .highlights-grid,
  .lib-grid {
    grid-template-columns: 1fr;
  }

  .doc-card {
    padding: 22px 18px;
  }

  .header-inner {
    gap: 10px;
  }

  .main-nav {
    width: 100%;
    order: 3;
    padding-top: 6px;
    border-top: 1px solid var(--line);
  }
}

/* Print */
@media print {
  :root,
  [data-theme="dark"] {
    --paper: #ffffff;
    --paper-2: #ffffff;
    --paper-3: #f6f6f6;
    --ink: #000000;
    --ink-2: #1f1f1f;
    --muted: #555555;
    --line: #d0d0d0;
    --accent: #000000;
    --accent-soft: #efefef;
  }

  body {
    background: #ffffff;
    color: #000000;
    font-size: 11.5pt;
  }

  .site-header,
  .sidebar,
  .site-footer,
  .header-actions {
    display: none !important;
  }

  .hero {
    padding: 0 0 14pt;
  }

  .layout-grid {
    display: block;
    padding: 14pt 0 0;
  }

  .doc-card {
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .highlights-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 8pt;
  }

  .highlight-card {
    box-shadow: none;
    padding: 8pt;
  }

  a {
    color: #000000;
  }
}
