/* ==========================================================
   Wargame Mission Encyclopedia — Style Sheet
   ========================================================== */

/* --- Custom Properties (Light) --- */
:root {
  --color-bg: #f5f4f0;
  --color-text: #1d1d1f;
  --color-text-muted: #6b6b70;
  --color-accent: #4a7c59;
  --color-accent-hover: #3d6a4b;
  --color-card-bg: #ffffff;
  --color-card-border: #e2e0da;
  --color-tag-bg: #eae7e0;
  --color-tag-text: #555;
  --color-header-bg: rgba(35, 48, 38, 0.95);
  --color-header-text: #f0efe9;
  --color-filter-bg: #ffffff;
  --color-input-bg: #f7f6f3;
  --color-input-border: #ddd9d0;
  --color-divider: #e2e0da;
  --color-overlay: rgba(0,0,0,0.04);
  --color-focus: #4a7c59;

  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-heading: Georgia, "Times New Roman", serif;
  --max-width: 1120px;
  --radius: 8px;
  --radius-sm: 5px;
  --radius-pill: 100px;
  --header-h: 48px;

  /* Family colors */
  --fam-control: #4a7c59;
  --fam-elimination: #a63d40;
  --fam-loot: #b08b3e;
  --fam-escort: #4a6fa5;
  --fam-sabotage: #c45d2e;
  --fam-recon: #3a8a7c;
  --fam-breakthrough: #5b7aa0;
  --fam-defense: #6b7c3e;
  --fam-progress: #7a5ea0;
  --fam-influence: #9e6b7b;
  --fam-stealth: #555d66;
}

/* --- Dark Mode --- */
[data-theme="dark"] {
  --color-bg: #1a1c20;
  --color-text: #c8c8cc;
  --color-text-muted: #7e7e88;
  --color-accent: #7bab88;
  --color-accent-hover: #94c4a0;
  --color-card-bg: #22252a;
  --color-card-border: #2c2f36;
  --color-tag-bg: #2a2d33;
  --color-tag-text: #909098;
  --color-header-bg: rgba(22, 24, 28, 0.96);
  --color-header-text: #c0c0c6;
  --color-filter-bg: #22252a;
  --color-input-bg: #282b31;
  --color-input-border: #35383f;
  --color-divider: #2c2f36;
  --color-overlay: rgba(255,255,255,0.02);
  --color-focus: #7bab88;

  /* Muted family colors — lower saturation for dark */
  --fam-control: #6d9e7a;
  --fam-elimination: #b06668;
  --fam-loot: #b89d5e;
  --fam-escort: #6d88b0;
  --fam-sabotage: #c0785a;
  --fam-recon: #5ea090;
  --fam-breakthrough: #7490ad;
  --fam-defense: #808e54;
  --fam-progress: #8e78a8;
  --fam-influence: #a87e8c;
  --fam-stealth: #727880;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* --- Language visibility (body content blocks only — JS handles the rest) --- */
.archetype-body [lang] { display: none; }
.archetype-body [lang="en"] { display: block; }

/* --- Container --- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ==========================================================
   HEADER
   ========================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-header-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  height: var(--header-h);
  display: flex;
  align-items: center;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.site-logo {
  color: var(--color-header-text);
  text-decoration: none;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.header-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--color-header-text);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s;
  line-height: 1.4;
}

.header-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.35);
}

.lang-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='rgba(255,255,255,0.5)'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.45rem center;
  padding-right: 1.3rem;
}

.lang-select option {
  background: var(--color-bg);
  color: var(--color-text);
}

.theme-toggle {
  font-size: 0.95rem;
  padding: 0.2rem 0.45rem;
  line-height: 1;
}

/* Breadcrumb in header (detail pages) */
.header-breadcrumb {
  color: rgba(240,239,233,0.55);
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.header-breadcrumb a {
  color: rgba(240,239,233,0.7);
  text-decoration: none;
}

.header-breadcrumb a:hover {
  color: rgba(240,239,233,1);
}

.header-breadcrumb .sep {
  margin: 0 0.3rem;
  opacity: 0.4;
}

/* ==========================================================
   INDEX INTRO — replaces hero
   ========================================================== */
.index-intro {
  padding: 1.25rem 0 0.25rem;
}

.index-subtitle {
  color: var(--color-text-muted);
  font-size: 0.92rem;
}

/* ==========================================================
   FILTER BAR
   ========================================================== */
.filter-bar {
  background: var(--color-filter-bg);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}

/* Family tree grid */
.family-tree {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--color-divider);
}

.family-node {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-card-border);
  border-left: 4px solid var(--color-card-border);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--color-text);
  font-family: var(--font-body);
}

.family-node:hover {
  background: var(--color-overlay);
  border-color: var(--color-text-muted);
}

.family-node.active {
  background: var(--color-overlay);
  box-shadow: 0 0 0 2px var(--color-card-border);
}

.family-node__name {
  font-size: 0.82rem;
  font-weight: 700;
  font-family: var(--font-heading);
  line-height: 1.2;
}

.family-node__count {
  font-size: 0.68rem;
  color: var(--color-text-muted);
}

.family-node__count strong {
  color: var(--color-text);
  font-weight: 700;
}

.family-node__desc {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* "All" card spans full width */
.family-node--all {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  gap: 1rem;
  padding: 0.4rem 0.65rem;
  border-left-color: var(--color-accent);
}

.family-node--all .family-node__desc {
  -webkit-line-clamp: 1;
}

/* Left border + active tint per family */
.family-node[data-family="control"]      { border-left-color: var(--fam-control); }
.family-node[data-family="elimination"]  { border-left-color: var(--fam-elimination); }
.family-node[data-family="loot"]         { border-left-color: var(--fam-loot); }
.family-node[data-family="escort"]       { border-left-color: var(--fam-escort); }
.family-node[data-family="sabotage"]     { border-left-color: var(--fam-sabotage); }
.family-node[data-family="recon"]        { border-left-color: var(--fam-recon); }
.family-node[data-family="breakthrough"] { border-left-color: var(--fam-breakthrough); }
.family-node[data-family="defense"]      { border-left-color: var(--fam-defense); }
.family-node[data-family="progress"]     { border-left-color: var(--fam-progress); }
.family-node[data-family="influence"]    { border-left-color: var(--fam-influence); }
.family-node[data-family="stealth"]      { border-left-color: var(--fam-stealth); }

.family-node[data-family="all"].active           { background: color-mix(in srgb, var(--color-accent) 10%, transparent); }
.family-node[data-family="control"].active       { background: color-mix(in srgb, var(--fam-control) 10%, transparent); }
.family-node[data-family="elimination"].active   { background: color-mix(in srgb, var(--fam-elimination) 10%, transparent); }
.family-node[data-family="loot"].active          { background: color-mix(in srgb, var(--fam-loot) 10%, transparent); }
.family-node[data-family="escort"].active        { background: color-mix(in srgb, var(--fam-escort) 10%, transparent); }
.family-node[data-family="sabotage"].active      { background: color-mix(in srgb, var(--fam-sabotage) 10%, transparent); }
.family-node[data-family="recon"].active         { background: color-mix(in srgb, var(--fam-recon) 10%, transparent); }
.family-node[data-family="breakthrough"].active  { background: color-mix(in srgb, var(--fam-breakthrough) 10%, transparent); }
.family-node[data-family="defense"].active       { background: color-mix(in srgb, var(--fam-defense) 10%, transparent); }
.family-node[data-family="progress"].active      { background: color-mix(in srgb, var(--fam-progress) 10%, transparent); }
.family-node[data-family="influence"].active     { background: color-mix(in srgb, var(--fam-influence) 10%, transparent); }
.family-node[data-family="stealth"].active       { background: color-mix(in srgb, var(--fam-stealth) 10%, transparent); }

/* Secondary filters row */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.filter-group label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-group select,
.filter-group input {
  padding: 0.38rem 0.55rem;
  border: 1px solid var(--color-input-border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  background: var(--color-input-bg);
  color: var(--color-text);
  transition: border-color 0.15s;
}

.filter-group select:focus,
.filter-group input:focus {
  outline: none;
  border-color: var(--color-focus);
  box-shadow: 0 0 0 2px rgba(74,124,89,0.15);
}

.search-group {
  flex: 1;
  min-width: 160px;
}

.search-group input {
  width: 100%;
}

.result-count {
  margin-left: auto;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.result-count strong {
  color: var(--color-text);
  font-weight: 700;
}

/* Active filter chips */
.active-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.55rem;
  min-height: 0;
}

.active-chips:empty {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  background: var(--color-tag-bg);
  color: var(--color-text);
  font-size: 0.72rem;
  font-weight: 500;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}

.chip:hover {
  background: var(--color-card-border);
}

.chip .chip-x {
  font-size: 0.85em;
  opacity: 0.5;
  line-height: 1;
}

.clear-all-link {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  cursor: pointer;
  background: none;
  border: none;
  text-decoration: underline;
  padding: 0.15rem 0;
}

.clear-all-link:hover {
  color: var(--color-text);
}

/* No results */
.no-results {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-text-muted);
  display: none;
}

.no-results.visible {
  display: block;
}

.no-results p {
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.no-results button {
  background: var(--color-accent);
  color: #fff;
  border: none;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  cursor: pointer;
  font-weight: 600;
}

.no-results button:hover {
  background: var(--color-accent-hover);
}

/* ==========================================================
   CARD GRID
   ========================================================== */
.archetype-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 3rem;
}

/* --- Card --- */
.archetype-card {
  display: flex;
  flex-direction: column;
  padding: 0.85rem 0.95rem 0.75rem 1rem;
  border: 1px solid var(--color-card-border);
  border-left: 4px solid var(--color-card-border);
  border-radius: var(--radius);
  background: var(--color-card-bg);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.archetype-card:hover {
  box-shadow: 0 3px 12px rgba(0,0,0,0.07);
  transform: translateY(-1px);
  color: inherit;
}

[data-theme="dark"] .archetype-card {
  border-color: transparent;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 0 0 1px rgba(255,255,255,0.04);
}

[data-theme="dark"] .archetype-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.06);
}

/* Card hide/show for filtering */
.archetype-card.card-hidden {
  opacity: 0;
  transform: scale(0.96);
  pointer-events: none;
  position: absolute;
  visibility: hidden;
}

/* Family border colors */
.archetype-card[data-family="control"] { border-left-color: var(--fam-control); }
.archetype-card[data-family="elimination"] { border-left-color: var(--fam-elimination); }
.archetype-card[data-family="loot"] { border-left-color: var(--fam-loot); }
.archetype-card[data-family="escort"] { border-left-color: var(--fam-escort); }
.archetype-card[data-family="sabotage"] { border-left-color: var(--fam-sabotage); }
.archetype-card[data-family="recon"] { border-left-color: var(--fam-recon); }
.archetype-card[data-family="breakthrough"] { border-left-color: var(--fam-breakthrough); }
.archetype-card[data-family="defense"] { border-left-color: var(--fam-defense); }
.archetype-card[data-family="progress"] { border-left-color: var(--fam-progress); }
.archetype-card[data-family="influence"] { border-left-color: var(--fam-influence); }
.archetype-card[data-family="stealth"] { border-left-color: var(--fam-stealth); }

/* Card family badge */
.card-family {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.18rem 0.45rem 0.15rem;
  border-radius: var(--radius-pill);
  margin-bottom: 0.35rem;
  width: fit-content;
  line-height: 1;
  color: #fff;
}

.archetype-card[data-family="control"] .card-family { background: var(--fam-control); }
.archetype-card[data-family="elimination"] .card-family { background: var(--fam-elimination); }
.archetype-card[data-family="loot"] .card-family { background: var(--fam-loot); }
.archetype-card[data-family="escort"] .card-family { background: var(--fam-escort); }
.archetype-card[data-family="sabotage"] .card-family { background: var(--fam-sabotage); }
.archetype-card[data-family="recon"] .card-family { background: var(--fam-recon); }
.archetype-card[data-family="breakthrough"] .card-family { background: var(--fam-breakthrough); }
.archetype-card[data-family="defense"] .card-family { background: var(--fam-defense); }
.archetype-card[data-family="progress"] .card-family { background: var(--fam-progress); }
.archetype-card[data-family="influence"] .card-family { background: var(--fam-influence); }
.archetype-card[data-family="stealth"] .card-family { background: var(--fam-stealth); }

.card-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 0.2rem;
  color: var(--color-text);
  line-height: 1.3;
}

.card-summary {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  flex-grow: 1;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.45;
}

.card-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: auto;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  flex: 1;
}

.card-match {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--color-tag-bg);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

/* --- Tags --- */
.tag {
  display: inline-block;
  font-size: 0.65rem;
  padding: 1px 7px;
  background: var(--color-tag-bg);
  color: var(--color-tag-text);
  border-radius: var(--radius-sm);
  font-weight: 500;
}

/* ==========================================================
   DETAIL PAGE
   ========================================================== */
.archetype-detail {
  padding: 1.5rem 0 3rem;
}

.detail-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  align-items: start;
}

.detail-main {
  min-width: 0;
}

.detail-card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.detail-sidebar {
  position: sticky;
  top: calc(var(--header-h) + 16px);
}

/* Detail header */
.detail-header {
  margin-bottom: 1.25rem;
  padding-bottom: 1.15rem;
  border-bottom: 1px solid var(--color-divider);
}

.detail-family-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.55rem 0.22rem;
  border-radius: var(--radius-pill);
  color: #fff;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.detail-header h1 {
  font-family: var(--font-heading);
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
  line-height: 1.2;
}

.detail-header .summary {
  font-size: 1rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* Meta panel / sidebar */
.meta-panel {
  background: var(--color-card-bg);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius);
  padding: 1rem;
}

.meta-panel dl {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.meta-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-divider);
}

.meta-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.meta-item:first-child {
  padding-top: 0;
}

.meta-item dt {
  font-weight: 700;
  font-size: 0.65rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.1rem;
}

.meta-item dd {
  font-size: 0.85rem;
  line-height: 1.4;
}

.meta-sep {
  color: var(--color-text-muted);
  margin: 0 0.15rem;
  opacity: 0.6;
}

.meta-item .tag {
  margin-top: 0.1rem;
  margin-right: 0.15rem;
}

/* Archetype body */
.archetype-body {
  line-height: 1.75;
}

.archetype-body strong {
  font-family: var(--font-heading);
  font-size: 1.02rem;
  display: block;
  margin-top: 1.5rem;
  margin-bottom: 0.3rem;
  padding-left: 0.7rem;
  border-left: 3px solid var(--color-accent);
  color: var(--color-text);
}

.archetype-body p {
  margin-bottom: 0.5rem;
}

.archetype-body ul {
  padding-left: 1.5rem;
  margin-bottom: 0.75rem;
}

.archetype-body li {
  margin-bottom: 0.2rem;
}

/* Related archetypes */
.related-section {
  margin-top: 2.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--color-divider);
}

.related-section h2 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  margin-bottom: 0.85rem;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.65rem;
}

/* ==========================================================
   FOOTER
   ========================================================== */
.site-footer {
  border-top: 1px solid var(--color-divider);
  padding: 1.25rem 0;
  margin-top: 2rem;
}

.footer-families {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
}

.footer-families a {
  font-size: 0.72rem;
  padding: 0.18rem 0.55rem;
  border-radius: var(--radius-pill);
  background: var(--color-tag-bg);
  color: var(--color-text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.footer-families a:hover {
  background: var(--color-accent);
  color: #fff;
}

.footer-links {
  text-align: center;
  font-size: 0.78rem;
  margin-bottom: 0.25rem;
}

.footer-link {
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-link:hover {
  color: var(--color-accent);
}

.footer-sep {
  color: var(--color-text-muted);
  margin: 0 0.35rem;
}

.footer-text {
  text-align: center;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

/* ==========================================================
   DARK MODE — refined overrides
   ========================================================== */
[data-theme="dark"] .filter-bar {
  border-color: transparent;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 0 0 1px rgba(255,255,255,0.04);
}

[data-theme="dark"] .meta-panel {
  border-color: transparent;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 0 0 1px rgba(255,255,255,0.04);
}

[data-theme="dark"] .detail-card {
  border-color: transparent;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 0 0 1px rgba(255,255,255,0.04);
}

[data-theme="dark"] .family-node {
  border-color: rgba(255,255,255,0.08);
}

[data-theme="dark"] .family-node:hover {
  border-color: rgba(255,255,255,0.15);
}

[data-theme="dark"] .filter-group select,
[data-theme="dark"] .filter-group input {
  border-color: rgba(255,255,255,0.08);
}

[data-theme="dark"] .family-tree {
  border-bottom-color: rgba(255,255,255,0.06);
}

[data-theme="dark"] .meta-item {
  border-bottom-color: rgba(255,255,255,0.06);
}

[data-theme="dark"] .detail-header {
  border-bottom-color: rgba(255,255,255,0.06);
}

[data-theme="dark"] .site-footer {
  border-top-color: rgba(255,255,255,0.06);
}

[data-theme="dark"] .related-section {
  border-top-color: rgba(255,255,255,0.06);
}

[data-theme="dark"] .card-family {
  opacity: 0.85;
}

[data-theme="dark"] .tag {
  background: rgba(255,255,255,0.07);
  color: var(--color-text-muted);
}

[data-theme="dark"] .chip {
  background: rgba(255,255,255,0.07);
}

[data-theme="dark"] .footer-families a {
  background: rgba(255,255,255,0.06);
}

[data-theme="dark"] .no-results button {
  opacity: 0.9;
}

/* ==========================================================
   ANIMATIONS — respect prefers-reduced-motion
   ========================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* ==========================================================
   RESPONSIVE
   ========================================================== */

/* Tablet */
@media (max-width: 1024px) {
  .family-tree {
    grid-template-columns: repeat(2, 1fr);
  }

  .archetype-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .detail-layout {
    grid-template-columns: 1fr;
  }

  .detail-sidebar {
    position: static;
    order: -1;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }

  .index-intro {
    padding: 0.75rem 0 0.15rem;
  }

  .family-tree {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .family-node {
    padding: 0.4rem 0.55rem;
  }

  .family-node__desc {
    -webkit-line-clamp: 1;
  }

  .filter-bar {
    padding: 0.75rem;
    margin-bottom: 0.75rem;
  }

  .filter-row {
    flex-direction: column;
    align-items: stretch;
  }

  .search-group {
    min-width: unset;
  }

  .result-count {
    margin-left: 0;
  }

  .archetype-grid {
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }

  .detail-header h1 {
    font-size: 1.4rem;
  }

  .meta-panel dl {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
  }

  .meta-item {
    padding: 0.4rem 0.2rem;
  }

  .meta-item:nth-child(odd) {
    border-right: 1px solid var(--color-divider);
    padding-right: 0.5rem;
  }

  .meta-item:nth-child(even) {
    padding-left: 0.5rem;
  }

  .related-grid {
    grid-template-columns: 1fr;
  }

  .site-logo {
    font-size: 0.88rem;
  }
}

@media (max-width: 480px) {
  .header-breadcrumb {
    display: none;
  }
}
