:root {
  --bg: #f5f5f0;
  --bg-strong: #eaeae2;
  --paper: #ffffff;
  --paper-2: #fafaf6;
  --ink: #1a1a1a;
  --muted: #5c5c5c;
  --line: #d4d4cc;
  --accent: #7a4422;
  --accent-strong: #5e3218;
  --good: #2a7a3e;
  --warn: #8a6010;
  --danger: #a03028;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 15px;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Segoe UI", sans-serif;
  background: var(--bg);
  line-height: 1.7;
}

a {
  color: var(--accent-strong);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.shell {
  width: min(960px, calc(100vw - 40px));
  margin: 0 auto;
}

/* ── Header ── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
  background: rgba(245, 245, 240, 0.92);
  border-bottom: 1px solid var(--line);
}

.header-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
  padding: 12px 0;
}

.brand {
  display: inline-block;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.01em;
}

.brand-subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-left: auto;
}

.language-switch {
  display: flex;
  gap: 4px;
  align-items: center;
}

.language-label {
  color: var(--muted);
  font-size: 0.8rem;
  margin-right: 4px;
}

.nav-link {
  padding: 5px 10px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.85rem;
  background: transparent;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
  background: rgba(0, 0, 0, 0.04);
  text-decoration: none;
  color: var(--ink);
}

.nav-link.is-active {
  color: var(--ink);
  background: var(--paper);
  border-color: var(--line);
  font-weight: 600;
}

/* ── Main content ── */

main.shell {
  padding: 32px 0 64px;
}

/* ── Hero ── */

.hero {
  display: grid;
  gap: 16px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-weight: 700;
  line-height: 1.3;
}

h1 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

h2 {
  font-size: 1.2rem;
}

.hero-copy {
  margin: 8px 0 0;
  max-width: 65ch;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.7;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Badges & Chips ── */

.meta-chip,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
}

.meta-chip {
  color: var(--ink);
  background: var(--bg-strong);
}

.badge-default,
.badge-muted {
  color: var(--muted);
  background: rgba(0, 0, 0, 0.05);
}

.badge-good {
  color: var(--good);
  background: rgba(42, 122, 62, 0.1);
}

.badge-warn {
  color: var(--warn);
  background: rgba(138, 96, 16, 0.1);
}

.badge-danger {
  color: var(--danger);
  background: rgba(160, 48, 40, 0.1);
}

/* ── Stats & Card grids ── */

.stats-grid,
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.panel {
  margin-top: 24px;
  padding: 24px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.stat-card {
  min-height: 120px;
}

.stat-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.stat-value {
  margin: 8px 0 6px;
  font-size: 2rem;
  font-weight: 700;
}

.stat-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.6;
}

/* ── Section headings ── */

.section-heading {
  margin-bottom: 16px;
}

.section-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ── Link cards ── */

.link-card {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--paper);
  transition: box-shadow 0.15s, transform 0.15s;
}

.link-card:hover {
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.link-card span {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* ── Filters ── */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.search-field,
.select-field {
  display: grid;
  gap: 6px;
  min-width: 200px;
  flex: 1 1 200px;
}

.search-field span,
.select-field span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

input,
select,
.button {
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(122, 68, 34, 0.12);
}

.button {
  flex: 0 0 auto;
  color: #fff;
  background: var(--accent);
  border-color: transparent;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s;
}

.button:hover {
  background: var(--accent-strong);
}

/* ── Entity stack ── */

.stack {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.entity-card {
  margin-top: 0;
}

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

.entity-copy {
  margin: 10px 0;
  line-height: 1.7;
  font-size: 0.9rem;
}

.entity-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.85rem;
}

.muted,
.muted-inline {
  color: var(--muted);
}

/* ── Detail grid ── */

.detail-grid {
  display: grid;
  gap: 0;
  margin: 0;
}

.detail-row {
  display: grid;
  gap: 4px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.detail-row:first-child {
  padding-top: 0;
}

.detail-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

dt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

dd {
  margin: 0;
  line-height: 1.7;
}

/* ── Lists ── */

.compact-list,
.source-list,
.route-list {
  margin: 0;
  padding-left: 20px;
  line-height: 1.8;
}

.compact-list li + li,
.source-list li + li,
.route-list li + li {
  margin-top: 6px;
}

/* ── Two-column & list columns ── */

.two-column {
  display: grid;
  gap: 20px;
}

.list-columns {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.list-columns.dense {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.list-columns a {
  display: block;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  background: rgba(0, 0, 0, 0.03);
  transition: background 0.15s;
}

.list-columns a:hover {
  background: rgba(0, 0, 0, 0.06);
  text-decoration: none;
}

/* ── Footer ── */

.site-footer {
  padding: 0 0 48px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.6;
}

/* ── Responsive ── */

@media (min-width: 860px) {
  .hero,
  .two-column {
    grid-template-columns: 1.2fr 1fr;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100vw - 24px, 960px);
  }

  .hero,
  .panel {
    padding: 20px;
    border-radius: 10px;
  }

  .entity-head {
    align-items: flex-start;
  }

  .header-grid {
    gap: 8px;
  }

  .nav {
    margin-left: 0;
  }
}
