/* TifinaghDB — tifinagh.tussna.org
   Warm sand, ink, terracotta. No webfont dependency: the sign artwork, when it
   exists, is inline SVG from the registry, never a font. */

:root {
  --sand: #f7f2e8;
  --sand-deep: #efe6d5;
  --ink: #221c17;
  --ink-soft: #5c5248;
  --line: #ded2bd;
  --terracotta: #a8452a;
  --terracotta-dark: #7d3019;
  --teal: #2f5d62;
  --gold: #b98a2f;
  --radius: 6px;
  --measure: 62rem;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--sand);
  color: var(--ink);
  font: 16px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--terracotta-dark); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--terracotta); }

.site-header {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 1rem 2rem;
  max-width: var(--measure); margin: 0 auto; padding: 1.4rem 1.25rem 0.9rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-weight: 700; font-size: 1.15rem; letter-spacing: 0.01em;
  color: var(--ink); text-decoration: none;
}
.brand-mark {
  width: 0.85rem; height: 0.85rem; display: inline-block;
  background: var(--terracotta); transform: rotate(45deg);
}
.brand small { font-weight: 400; color: var(--ink-soft); font-size: 0.8rem; }

.site-nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; margin-left: auto; }
.site-nav a {
  color: var(--ink-soft); text-decoration: none; padding: 0.15rem 0;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--ink); border-bottom-color: var(--terracotta); }

.container { max-width: var(--measure); margin: 0 auto; padding: 2rem 1.25rem 3rem; }

h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.3rem); line-height: 1.2; margin: 0 0 0.6rem; }
h2 { font-size: 1.25rem; margin: 2.2rem 0 0.6rem; }
h3 { font-size: 1.05rem; margin: 1.6rem 0 0.4rem; }

.lede { font-size: 1.1rem; color: var(--ink-soft); max-width: 48rem; margin: 0 0 1rem; }
.note { color: var(--ink-soft); font-size: 0.9rem; }

.hero { padding: 1rem 0 0.5rem; }
.hero .tagline { color: var(--ink-soft); font-size: 0.9rem; letter-spacing: 0.08em; text-transform: uppercase; }

.stats {
  list-style: none; display: grid; gap: 0.75rem; padding: 0; margin: 1.75rem 0 0;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
}
.stats li {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.85rem 1rem;
}
.stats .number { display: block; font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.stats .label { display: block; font-size: 0.82rem; color: var(--ink-soft); margin-top: 0.15rem; }

.filters {
  display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center;
  margin: 1.25rem 0 1rem; padding: 0.9rem 1rem;
  background: var(--sand-deep); border: 1px solid var(--line); border-radius: var(--radius);
}
.filters input[type="search"] {
  flex: 1 1 18rem; padding: 0.5rem 0.7rem; font: inherit;
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink);
}
.filters select {
  padding: 0.5rem 0.7rem; font: inherit; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink);
}

table { width: 100%; border-collapse: collapse; margin: 0.5rem 0 1rem; background: #fff; }
table.data, table.signs { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--sand-deep); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fdfaf4; }
code, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.9em; }

.badge {
  display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px;
  font-size: 0.78rem; font-weight: 600; border: 1px solid transparent;
}
.badge-attested { background: #e3efe4; color: #245a2b; border-color: #bcd8bf; }
.badge-probable { background: #f3ecd8; color: #7a5a12; border-color: #e2d3a8; }
.badge-disputed { background: #f7e3dc; color: #8a3218; border-color: #e6c3b5; }
.badge-unknown  { background: #ecebe8; color: #5b564e; border-color: #d8d4cc; }

.detail { display: grid; grid-template-columns: 11rem 1fr; gap: 0.35rem 1rem; margin: 1.25rem 0; }
.detail dt { color: var(--ink-soft); font-size: 0.9rem; }
.detail dd { margin: 0; }

/* Glyphs: inline SVG from the sprite, never a font (PLAN.md §7.3). */
.glyph { display: inline-block; line-height: 0; color: var(--ink); }
.glyph svg { width: 1.5em; height: 1.5em; vertical-align: -0.3em; }
td.glyph-cell { width: 2.6rem; }
.glyph-hero { color: var(--ink); margin: 0.5rem 0 0.25rem; }
.glyph-hero svg { width: 5.5rem; height: 5.5rem; }

.empty { padding: 1.5rem; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--ink-soft); }

.site-footer {
  border-top: 1px solid var(--line); margin-top: 2rem;
  padding: 1.5rem 1.25rem 2.5rem; max-width: var(--measure); margin-left: auto; margin-right: auto;
  color: var(--ink-soft); font-size: 0.85rem;
}
.site-footer p { margin: 0.2rem 0; }

.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.htmx-indicator { opacity: 0; transition: opacity 150ms ease; font-size: 0.85rem; color: var(--ink-soft); }

@media (max-width: 640px) {
  .site-nav { margin-left: 0; }
  .detail { grid-template-columns: 1fr; }
  .detail dt { margin-top: 0.5rem; }
}
