/* Atlas Vault — nền trắng, chữ đen, tối giản. Ảnh 2D flat là nhân vật chính. */

:root {
  --bg: #ffffff;
  --ink: #111110;
  --ink-2: #3f3f3a;
  --dim: #8b8b83;
  --line: #e8e8e2;
  --line-2: #d0d0c8;
  --accent: #a63d21;
  --ok: #2f6b46;
  --warn: #8a6410;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --maxw: 1220px;
  --gut: 26px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.015em; margin: 0; }
p { margin: 0; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gut); }
.mono { font-family: var(--mono); font-size: 0.86em; letter-spacing: -0.01em; }
.dim { color: var(--dim); }
.num { font-variant-numeric: tabular-nums; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; z-index: 50; background: var(--ink); color: #fff; padding: 8px 14px; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ------------------------------------------------------------------ thanh trên */

.bar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.bar-in { display: flex; align-items: center; gap: 22px; height: 66px; }

.brand { display: inline-flex; align-items: center; gap: 10px; flex: none; }
.brand:hover { text-decoration: none; }
.mark {
  display: grid; place-items: center;
  width: 26px; height: 26px;
  background: var(--ink); color: #fff;
  font-family: var(--serif); font-size: 16px; line-height: 1;
  padding-bottom: 2px;
}
.brand-txt { font-family: var(--serif); font-size: 19px; letter-spacing: -0.01em; }
.brand-thin { color: var(--dim); margin-left: 4px; }

.find { display: flex; flex: 1 1 auto; max-width: 520px; }
.find input {
  flex: 1 1 auto; min-width: 0; height: 38px; padding: 0 14px;
  border: 1px solid var(--line-2); border-right: 0;
  background: #fff; color: var(--ink);
  font: inherit; font-size: 14.5px; border-radius: 0;
  -webkit-appearance: none; appearance: none;
}
.find input::placeholder { color: var(--dim); }
.find input:focus { outline: none; border-color: var(--ink); }
.find input:focus + button { border-color: var(--ink); background: var(--ink); color: #fff; }
.find button {
  height: 38px; padding: 0 18px;
  border: 1px solid var(--line-2); background: #fff; color: var(--ink);
  font: inherit; font-size: 13.5px; cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.find button:hover { background: var(--ink); color: #fff; border-color: var(--ink); }

.nav { display: flex; gap: 20px; margin-left: auto; flex: none; font-size: 13.5px; }
.nav a { color: var(--dim); padding: 4px 0; border-bottom: 1px solid transparent; }
.nav a:hover { color: var(--ink); text-decoration: none; }
.nav a.on { color: var(--ink); border-bottom-color: var(--ink); }

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

.hero { padding: 62px 0 34px; max-width: 760px; }
.hero-tight { padding: 46px 0 26px; }
.kicker {
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--dim); margin-bottom: 16px;
}
.hero h1 { font-size: clamp(2rem, 4.4vw, 3.15rem); line-height: 1.08; letter-spacing: -0.025em; }
.hero h1.q { overflow-wrap: anywhere; }
.lede {
  margin-top: 16px; color: var(--ink-2);
  font-size: 16.5px; line-height: 1.6; max-width: 62ch;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.chip {
  border: 1px solid var(--line); padding: 6px 13px;
  font-size: 13px; color: var(--ink-2);
  transition: border-color .15s ease, color .15s ease;
}
.chip:hover { border-color: var(--ink); color: var(--ink); text-decoration: none; }

/* ------------------------------------------------------------- đầu mục nội dung */

.sect-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; padding: 30px 0 0; margin-bottom: 18px;
  border-top: 1px solid var(--line);
}
.sect-head h2 {
  font-family: var(--sans); font-size: 12px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
}
.sect-head p { font-size: 12.5px; }

/* ----------------------------------------------------------------- lưới ảnh */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(206px, 1fr));
  gap: 30px 20px;
  padding-bottom: 12px;
}
.grid-sm { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 22px 16px; }

.tile { margin: 0; min-width: 0; }
.tile-link {
  display: block;
  border: 1px solid var(--line);
  background: #fff;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  transition: border-color .18s ease, transform .18s ease;
}
.tile-link:hover { border-color: var(--ink); transform: translateY(-2px); }
.tile-link:focus-visible { border-color: var(--ink); }
.tile img {
  display: block; width: 100%; height: 100%;
  object-fit: contain; background: #fff;
}
.tile figcaption {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin-top: 9px; font-size: 12.5px; line-height: 1.35;
}
.tile-slug { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-ai { color: var(--dim); flex: none; font-size: 11.5px; }

/* -------------------------------------------------------------------- thống kê */

.stats { padding-bottom: 40px; }

.kv {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin: 0 0 26px;
}
.kv-i { background: #fff; padding: 16px 18px 18px; }
.kv-i dt {
  font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim);
}
.kv-i dd {
  margin: 8px 0 0;
  font-family: var(--serif); font-size: 26px; line-height: 1;
  letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
}
.kv-i dd small {
  font-family: var(--sans); font-size: 12px; color: var(--dim);
  margin-left: 5px; letter-spacing: 0;
}

.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.tbl th {
  font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--dim); font-weight: 500;
}
.tbl td.num { text-align: right; }
.tbl tbody tr:hover { background: #fafaf8; }

.perai { margin-top: 22px; }
.perai summary {
  cursor: pointer; font-size: 12.5px; color: var(--dim);
  padding: 8px 0; list-style: none;
}
.perai summary::-webkit-details-marker { display: none; }
.perai summary::before { content: "+ "; }
.perai[open] summary::before { content: "− "; }
.perai summary:hover { color: var(--ink); }

.dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--line-2); margin-right: 7px; vertical-align: 1px;
}
.dot.ok { background: var(--ok); }

/* ------------------------------------------------------------ trạng thái chờ vẽ */

.pending {
  border: 1px solid var(--line);
  padding: 26px 26px 22px;
  margin: 8px 0 34px;
  max-width: 620px;
}
.pending-top { display: flex; align-items: center; gap: 12px; font-size: 15px; }
.pending-top strong { font-weight: 600; }
.pending-top .mono { margin-left: auto; font-size: 12px; }
.pending > p { margin-top: 12px; font-size: 14px; }
.pending.done { border: 0; padding: 0; max-width: 240px; }

.pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .28; transform: scale(.72); }
}

.track { position: relative; height: 2px; background: var(--line); overflow: hidden; margin-top: 20px; }
.track-run {
  position: absolute; top: 0; left: 0; height: 100%; width: 34%;
  background: var(--ink);
  animation: run 1.6s cubic-bezier(.5, 0, .5, 1) infinite;
}
@keyframes run {
  0% { left: -34%; }
  100% { left: 100%; }
}

.bad { color: var(--accent); }

/* ------------------------------------------------------------------- nhật ký */

.log { list-style: none; margin: 0 0 40px; padding: 0; border-top: 1px solid var(--line); }
.log-row {
  display: grid;
  grid-template-columns: 132px 62px 84px minmax(0, 1fr) 92px;
  gap: 14px; align-items: baseline;
  padding: 11px 0; border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.log-ts { color: var(--dim); font-size: 11.5px; }
.log-lv { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }
.lv-info .log-lv { color: var(--ink-2); }
.lv-warn .log-lv { color: var(--warn); }
.lv-error .log-lv { color: var(--accent); }
.log-mod { color: var(--dim); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; }
.log-msg { min-width: 0; overflow-wrap: anywhere; }
.log-ago { color: var(--dim); font-size: 12px; text-align: right; }
.log-meta { grid-column: 1 / -1; }
.log-meta summary { cursor: pointer; font-size: 11.5px; color: var(--dim); }
.log-meta pre {
  margin: 8px 0 0; padding: 10px 12px;
  background: #fafaf8; border: 1px solid var(--line);
  font-family: var(--mono); font-size: 11.5px;
  white-space: pre-wrap; overflow-wrap: anywhere;
}

/* --------------------------------------------------------------------- trống */

.empty {
  border: 1px dashed var(--line-2);
  padding: 54px 26px; text-align: center;
  margin: 10px 0 40px;
}
.empty-t { font-family: var(--serif); font-size: 22px; margin-bottom: 8px; }
.empty p + p { color: var(--dim); font-size: 14.5px; }

/* ---------------------------------------------------------------------- lỗi */

.err { padding: 84px 0 100px; max-width: 620px; }
.err-code { font-size: 12px; letter-spacing: 0.14em; color: var(--dim); }
.err h1 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); margin-top: 14px; line-height: 1.15; }
.err-actions { display: flex; gap: 10px; margin-top: 30px; }

.btn {
  display: inline-block; padding: 10px 20px;
  background: var(--ink); color: #fff;
  font-size: 13.5px; border: 1px solid var(--ink);
  transition: background .15s ease, color .15s ease, opacity .15s ease;
}
.btn:hover { text-decoration: none; opacity: .86; }
.btn-ghost { background: #fff; color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: #fff; opacity: 1; }

/* -------------------------------------------------------------------- chân trang */

.foot { border-top: 1px solid var(--line); margin-top: 20px; }
.foot-in {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 26px 0 34px; font-size: 12.5px; color: var(--dim);
}

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

@media (max-width: 860px) {
  :root { --gut: 18px; }
  .bar-in { height: auto; padding: 12px 0; flex-wrap: wrap; gap: 12px; }
  .find { order: 3; flex-basis: 100%; max-width: none; }
  .nav { margin-left: auto; }
  .hero { padding: 40px 0 26px; }
  .hero-tight { padding: 34px 0 22px; }
}

@media (max-width: 760px) {
  .log-row { grid-template-columns: 1fr auto; row-gap: 4px; }
  .log-mod, .log-msg, .log-ago { grid-column: 1 / -1; }
  .log-ago { text-align: left; }
}

@media (max-width: 900px) {
  .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .grid, .grid-sm { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 14px; }
  .hero h1 { font-size: 1.85rem; }
  .foot-in { flex-direction: column; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
