/* Tokens, typography, chrome (top bar, footer), shared components. */
:root {
  --scale: 1;
  --paper: #f8f2e4;
  --paper-2: #f0e7d3;
  --paper-3: #e6dabf;
  --card: #fffaf0;
  --ink: #2b2117;
  --ink-soft: #5e5142;
  --ink-faint: #8a7b68;
  --line: rgba(74, 52, 20, 0.16);
  --green: #2f5233;
  --green-deep: #1e3823;
  --green-soft: #dfe8d8;
  --gold: #b8861f;
  --gold-bright: #f2c230;
  --lacquer: #a8500f;
  --lacquer-soft: #f3e2cf;
  --red: #a3271b;
  --blue: #1d4f8c;
  --shadow: 0 1px 2px rgba(60, 40, 10, 0.08), 0 8px 24px rgba(60, 40, 10, 0.08);
  --radius: 10px;
  --font-display: 'Playfair Display', 'Noto Serif', Georgia, 'Times New Roman', serif;
  --font-body: 'Noto Serif', Georgia, 'Times New Roman', serif;
  --font-ui: 'Be Vietnam Pro', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  --wrap: 1180px;
  --read: 720px;
  --bar: 58px;
}

:root[data-theme='dark'] {
  --paper: #171411;
  --paper-2: #1f1b16;
  --paper-3: #2a251d;
  --card: #211d17;
  --ink: #ece2cd;
  --ink-soft: #c2b59d;
  --ink-faint: #94866f;
  --line: rgba(236, 226, 205, 0.14);
  --green: #7fae7a;
  --green-deep: #14251a;
  --green-soft: #22301f;
  --gold: #e0b24a;
  --gold-bright: #f2c230;
  --lacquer: #e09a55;
  --lacquer-soft: #33261a;
  --red: #e2776a;
  --blue: #7fb0ea;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--bar) + 60px);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  outline: none;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--green);
  text-underline-offset: 3px;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.18;
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

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

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--green-deep);
  color: #fff;
  padding: 8px 14px;
  z-index: 100;
}
.skip:focus {
  left: 8px;
  top: 8px;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 20px;
}

.muted {
  color: var(--ink-faint);
}

.kicker {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}

/* ---------- progress ---------- */
#progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  z-index: 60;
  pointer-events: none;
}
#progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--gold-bright);
}

/* ---------- top bar ---------- */
#topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--green-deep);
  color: #f4ecd8;
  border-bottom: 2px solid var(--gold-bright);
}
.bar {
  height: var(--bar);
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}
.brand-mark {
  width: 30px;
  height: 30px;
  flex: none;
  color: var(--gold-bright);
}
.brand-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--gold-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav {
  display: flex;
  gap: 2px;
  margin-left: 10px;
  flex: 1;
  min-width: 0;
}
.nav a {
  color: #e9dfc8;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 6px;
  white-space: nowrap;
}
.nav a:hover {
  background: rgba(255, 255, 255, 0.08);
}
.nav a[aria-current='page'] {
  color: var(--green-deep);
  background: var(--gold-bright);
}
.tools {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
}
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}
.icon-btn svg {
  width: 20px;
  height: 20px;
}
.search-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
  color: #e9dfc8;
  font-size: 14px;
}
.search-btn svg {
  width: 16px;
  height: 16px;
}
.search-btn kbd {
  font: 11px var(--font-ui);
  opacity: 0.7;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  padding: 0 4px;
}
.lang {
  display: inline-flex;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  overflow: hidden;
}
.lang button {
  border: 0;
  background: transparent;
  color: #e9dfc8;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 10px;
  min-width: 40px;
}
.lang button[aria-pressed='true'] {
  background: var(--gold-bright);
  color: var(--green-deep);
}
.menu-btn {
  display: none;
}

@media (max-width: 1120px) {
  .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin: 0;
    padding: 8px 12px 14px;
    flex-direction: column;
    background: var(--green-deep);
    border-bottom: 2px solid var(--gold-bright);
  }
  .nav.open {
    display: flex;
  }
  .nav a {
    padding: 12px;
    font-size: 16px;
  }
  .menu-btn {
    display: inline-grid;
  }
  .search-btn span,
  .search-btn kbd {
    display: none;
  }
  .search-btn {
    padding: 0 10px;
    border: 0;
    background: transparent;
  }
  .search-btn svg {
    width: 20px;
    height: 20px;
  }
  .font-btn {
    display: none;
  }
}
@media (max-width: 420px) {
  .brand-name {
    font-size: 15px;
  }
}

/* ---------- footer ---------- */
#footer {
  margin-top: 64px;
  background: var(--green-deep);
  color: #d9cfb8;
  font-size: 13px;
}
#footer .wrap {
  padding-top: 26px;
  padding-bottom: 30px;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}
#footer p {
  max-width: 70ch;
}
#footer a {
  color: var(--gold-bright);
}
body[data-route='sach'] #footer,
body[data-route='ban-do'] #footer {
  display: none;
}

/* ---------- buttons, chips, cards ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 8px;
  border: 1px solid var(--green);
  background: var(--green);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
}
:root[data-theme='dark'] .btn {
  color: #10200f;
}
.btn:hover {
  filter: brightness(1.08);
}
.btn.ghost {
  background: transparent;
  color: var(--green);
}
.btn.gold {
  background: var(--gold-bright);
  border-color: var(--gold-bright);
  color: var(--green-deep);
}
.btn.on-dark {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.5);
  color: #fff;
}
.btn.small {
  padding: 7px 12px;
  font-size: 13px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
}
button.chip:hover,
a.chip:hover {
  border-color: var(--green);
  color: var(--green);
}
.chip[aria-pressed='true'],
.chip.active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
:root[data-theme='dark'] .chip[aria-pressed='true'],
:root[data-theme='dark'] .chip.active {
  color: #10200f;
}
.chip .count {
  font-size: 11px;
  opacity: 0.7;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--paper-3);
  color: var(--ink-soft);
}
.badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.badge.special {
  background: #f6dfa0;
  color: #6b4a00;
}
.badge.national {
  background: #f1cfc6;
  color: #8a2015;
}
.badge.city {
  background: #cfdcf0;
  color: #1c4680;
}
.badge.none {
  background: var(--paper-3);
  color: var(--ink-faint);
}
:root[data-theme='dark'] .badge.special {
  background: #4a3a10;
  color: #f2cf6b;
}
:root[data-theme='dark'] .badge.national {
  background: #47211b;
  color: #f0a79c;
}
:root[data-theme='dark'] .badge.city {
  background: #1d3050;
  color: #a9c8f2;
}

.empty {
  max-width: 520px;
  margin: 80px auto;
  padding: 0 20px;
  text-align: center;
  display: grid;
  gap: 14px;
  justify-items: center;
}

.spinner {
  margin: 90px auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--gold);
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.page-head {
  padding: 34px 0 18px;
}
.page-head h1 {
  font-size: clamp(28px, 4.2vw, 42px);
  color: var(--green);
}
.page-head p {
  margin-top: 8px;
  color: var(--ink-soft);
  max-width: 70ch;
}

.section-title {
  font-size: clamp(24px, 3vw, 32px);
  color: var(--green);
}
.section-lead {
  margin-top: 6px;
  color: var(--ink-soft);
  max-width: 68ch;
}

.note {
  font-size: 13px;
  color: var(--ink-faint);
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
