/* docs.phucnt.org — trang mục lục. Cùng bộ chữ và màu giấy với apps.phucnt.org.
   File này chỉ dùng cho trang mục lục và trang 404; các site được mirror giữ nguyên CSS của chúng. */

:root {
  --bg: #f4f1ea;
  --ink: #17181d;
  --muted: #5a5d66;
  --line: #d9d4c7;
  --wash: #ebe6da;
  --field: #fbf9f4;
  --gold: #c98f1c;
  --violet: #6c3bd2;
  --plum: #4a2a73;
  --display: "Bricolage Grotesque", "Be Vietnam Pro", system-ui, sans-serif;
  --body: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --pad: clamp(20px, 5vw, 56px);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1014;
    --ink: #ece8de;
    --muted: #a3a49e;
    --line: #2a2b32;
    --wash: #191a20;
    --field: #15161b;
    --gold: #f0c26a;
    --violet: #a488f5;
    --plum: #d07fbb;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

svg { display: block; }
a { color: inherit; }
h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 var(--pad); }
.nowrap { white-space: nowrap; }

:focus-visible { outline: 3px solid currentColor; outline-offset: 3px; border-radius: 6px; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 10;
  padding: 10px 14px; border-radius: 8px;
  background: var(--ink); color: var(--bg); text-decoration: none; font-weight: 600;
}
.skip:focus { top: 12px; }

/* ───────────── đầu trang ───────────── */

.hero { padding: 28px 0 clamp(28px, 4vw, 48px); }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--display); font-weight: 700; font-size: 18px; letter-spacing: -0.01em;
  text-decoration: none;
}
.brand-dim { color: var(--muted); font-weight: 500; }
.topnav { display: flex; gap: clamp(14px, 2vw, 26px); font-size: 0.94rem; font-weight: 500; }
.topnav a { color: var(--muted); text-decoration: none; white-space: nowrap; transition: color 0.2s var(--ease); }
.topnav a:hover { color: var(--ink); }

.hero-title {
  margin-top: clamp(40px, 7vw, 96px);
  max-width: 17ch;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.3rem, 6.4vw, 4.8rem);
  line-height: 1.08;
  letter-spacing: -0.028em;
  text-wrap: balance;
}

.hero-lede {
  margin-top: clamp(16px, 2.2vw, 26px);
  max-width: 46ch;
  font-size: clamp(1.04rem, 1.45vw, 1.24rem);
  line-height: 1.55;
  color: var(--muted);
  text-wrap: pretty;
}

/* ô lọc: chỉ hiện khi có JS */
.finder { display: none; margin-top: clamp(26px, 3.4vw, 40px); max-width: 560px; position: relative; }
.js .finder { display: block; }
.finder svg { position: absolute; left: 18px; top: 18px; width: 20px; height: 20px; color: var(--muted); pointer-events: none; }
.finder input {
  width: 100%; height: 56px; padding: 0 20px 0 50px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--field); color: var(--ink);
  font: inherit; font-size: 1.02rem;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.finder input::placeholder { color: var(--muted); opacity: 0.9; }
.finder input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 14%, transparent); }
.finder-count { margin-top: 10px; padding-left: 20px; min-height: 1.5em; font-size: 0.9rem; color: var(--muted); }

/* ───────────── các nhóm ───────────── */

.group { padding-top: clamp(40px, 6vw, 76px); }
.group--agent { --tone: var(--gold); }
.group--app   { --tone: var(--violet); }
.group--sach  { --tone: var(--plum); }
.group--khac  { --tone: var(--muted); }

.group-head {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: baseline; gap: 6px 14px;
  padding-bottom: 14px; border-bottom: 1px solid var(--ink);
}
.group-tile { align-self: center; width: 14px; height: 14px; border-radius: 4px; background: var(--tone); }
.group-head h2 { font-family: var(--display); font-weight: 700; font-size: clamp(1.3rem, 2.2vw, 1.7rem); line-height: 1.2; letter-spacing: -0.018em; }
.group-count { font-size: 0.9rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.group-note { grid-column: 2 / -1; font-size: 0.96rem; color: var(--muted); }

.site { border-bottom: 1px solid var(--line); }

.row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 32px;
  align-items: center;
  gap: clamp(16px, 2.4vw, 36px);
  padding: 22px clamp(0px, 1.2vw, 18px);
  text-decoration: none;
  isolation: isolate;
}
.row::before {
  content: "";
  position: absolute; inset: 0 0 -1px; z-index: -1;
  background: var(--wash);
  border-radius: 16px;
  opacity: 0;
  transform: scaleY(0.84);
  transition: opacity 0.22s var(--ease), transform 0.28s var(--ease);
}
.row-main { display: grid; gap: 5px; min-width: 0; }
.row-name {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(1.25rem, 2.3vw, 1.8rem); line-height: 1.16; letter-spacing: -0.02em;
  text-wrap: balance;
}
.row-desc { max-width: 62ch; color: var(--muted); font-size: clamp(0.95rem, 1.15vw, 1.04rem); line-height: 1.5; text-wrap: pretty; }
.row-meta { font-size: 0.86rem; font-weight: 500; letter-spacing: 0.01em; color: var(--muted); white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.row-arrow { justify-self: end; font-family: var(--display); font-size: 1.4rem; line-height: 1; color: var(--tone); transition: transform 0.28s var(--ease); }

@media (hover: hover) {
  .row:hover::before { opacity: 1; transform: none; }
  .row:hover .row-arrow { transform: translate(4px, -4px); }
}
.row:active::before { opacity: 1; transform: none; }

/* danh sách trang của một site */
.pages { padding: 0 clamp(0px, 1.2vw, 18px) 20px; margin-top: -6px; }
.pages summary {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 36px; padding: 0 14px 0 12px;
  border: 1px solid var(--line); border-radius: 999px;
  font-size: 0.88rem; font-weight: 500; color: var(--muted);
  cursor: pointer; list-style: none; user-select: none;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.pages summary::-webkit-details-marker { display: none; }
.pages summary::before {
  content: ""; width: 7px; height: 7px; margin-top: -3px;
  border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
  transform: rotate(45deg); transition: transform 0.2s var(--ease), margin 0.2s var(--ease);
}
.pages[open] summary::before { transform: rotate(-135deg); margin-top: 3px; }
.pages summary:hover { color: var(--ink); border-color: var(--ink); }

.page-list { margin-top: 14px; columns: 2; column-gap: clamp(24px, 4vw, 56px); }
.page-list li { break-inside: avoid; }
.page-list a {
  display: grid; gap: 1px; padding: 8px 0 8px 14px;
  border-left: 2px solid var(--line);
  text-decoration: none;
  transition: border-color 0.2s var(--ease);
}
.page-list a:hover { border-left-color: var(--tone); }
.page-title { font-size: 0.98rem; line-height: 1.4; font-weight: 500; }
.page-path { font-family: var(--mono); font-size: 0.76rem; color: var(--muted); overflow-wrap: anywhere; }

.empty { margin-top: clamp(40px, 6vw, 72px); font-size: 1.1rem; color: var(--muted); }

@media (max-width: 720px) {
  .row { grid-template-columns: minmax(0, 1fr) 24px; gap: 6px 12px; padding: 18px 0; }
  .row-main { grid-column: 1; grid-row: 1; }
  .row-meta { grid-column: 1 / -1; grid-row: 2; text-align: left; }
  .row-arrow { grid-column: 2; grid-row: 1; align-self: start; margin-top: 4px; font-size: 1.2rem; }
  .row::before { inset: 0 calc(var(--pad) * -0.5) -1px; }
  .pages { padding: 0 0 18px; }
  .page-list { columns: 1; }
  .group-head { grid-template-columns: auto minmax(0, 1fr); }
  .group-count { grid-column: 2; }
  .topnav a:not(:first-child) { display: none; }
}

/* ───────────── chân trang ───────────── */

.foot { margin-top: clamp(56px, 8vw, 104px); padding: 36px 0 56px; border-top: 1px solid var(--line); font-size: 0.92rem; }
.foot-in { display: grid; gap: 6px; max-width: 60ch; }
.foot-dim { color: var(--muted); }
.foot a { text-underline-offset: 3px; text-decoration-thickness: 1px; }

@media (prefers-reduced-motion: reduce) {
  .row::before, .row-arrow, .pages summary, .pages summary::before, .page-list a, .finder input, .topnav a { transition: none; }
}
