/* Components: header/nav, buttons, search, selects, tiles, cards, tables, badges, notices, footer */

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--white); border-bottom: var(--rule) solid var(--black); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: var(--s-5); min-height: var(--header-h); }
.brand { display: block; flex: none; line-height: 0; }
.brand img { height: 60px; width: auto; }
.nav-toggle { display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 0 16px; background: var(--black); color: var(--gold); border: 0; font-weight: 700; font-size: var(--fs-label); letter-spacing: .18em; text-transform: uppercase; }
.nav-toggle svg { width: 20px; height: 20px; }
.nav { position: absolute; left: 0; right: 0; top: 100%; background: var(--white); border-bottom: var(--rule) solid var(--black); padding: var(--s-3) var(--gutter) var(--s-6); display: none; max-height: calc(100vh - var(--header-h)); overflow-y: auto; }
.nav.is-open { display: block; }
.nav ul { display: flex; flex-direction: column; }
.nav a { display: flex; align-items: center; min-height: 56px; padding: 0 4px; text-decoration: none; font-weight: 600; font-size: 1rem; letter-spacing: .12em; text-transform: uppercase; border-bottom: 1px solid var(--border); }
.nav a[aria-current="page"] { box-shadow: inset 6px 0 0 var(--gold); padding-left: 20px; }
.nav a:hover { background: var(--ivory); }
.nav .nav__donate { margin-top: var(--s-4); border: var(--rule) solid var(--black); justify-content: center; gap: 10px; }
.nav .nav__donate::before { content: ""; width: 9px; height: 9px; background: var(--gold); transform: rotate(45deg); }
@media (min-width: 860px) {
  .nav-toggle { display: none; }
  .nav { position: static; display: block; border: 0; padding: 0; max-height: none; overflow: visible; background: transparent; }
  .nav ul { flex-direction: row; align-items: center; gap: 2px; }
  .nav a { min-height: var(--tap); padding: 0 11px; font-size: .74rem; letter-spacing: .13em; border-bottom: 3px solid transparent; }
  .nav a:hover { background: transparent; border-bottom-color: var(--black); }
  .nav a[aria-current="page"] { box-shadow: none; padding-left: 11px; border-bottom-color: var(--gold); }
  .nav .nav__donate { margin: 0 0 0 10px; padding: 0 16px; }
}

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 56px; padding: 0 28px; border: var(--rule) solid var(--black); background: var(--white); color: var(--black); font-weight: 700; font-size: .85rem; letter-spacing: .16em; text-transform: uppercase; text-decoration: none; line-height: 1.1; text-align: center; transition: background-color .15s, color .15s, border-color .15s; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn--primary { background: var(--gold); border-color: var(--gold); color: var(--black); }
.btn--primary:hover { background: var(--black); border-color: var(--black); color: var(--gold); }
.theme-dark .btn--primary:hover { background: var(--white); border-color: var(--white); color: var(--black); }
.btn--outline { background: transparent; border-color: currentColor; color: inherit; }
.btn--outline:hover { background: var(--black); color: var(--gold); border-color: var(--black); }
.theme-dark .btn--outline:hover { background: var(--gold); color: var(--black); border-color: var(--gold); }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s-3); }
.arrow-link { display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap); font-weight: 700; font-size: .82rem; letter-spacing: .16em; text-transform: uppercase; text-decoration: none; border-bottom: 3px solid var(--gold); padding-bottom: 2px; }
.arrow-link:hover { border-bottom-color: currentColor; }
.arrow-link svg { width: 18px; height: 18px; }

/* ---------- Search (Perplexity-style: one big field, filters beneath) ---------- */
.search { max-width: 1040px; }
.search__label, .field__label { display: block; font-weight: 700; font-size: var(--fs-label); letter-spacing: .18em; text-transform: uppercase; margin-bottom: 8px; }
.search__field { position: relative; }
.search__box { display: flex; align-items: stretch; background: var(--white); color: var(--black); border: 3px solid var(--black); }
.search__box:focus-within { outline: 4px solid var(--gold); outline-offset: 0; }
.search__icon { display: none; align-items: center; padding-left: 20px; color: var(--black); }
.search__icon svg { width: 26px; height: 26px; }
.search__box input[type="search"] { flex: 1; min-width: 0; border: 0; background: transparent; padding: 22px 18px; font-size: clamp(1.35rem, 4vw, 2rem); font-weight: 500; line-height: 1.1; outline: 0; -webkit-appearance: none; appearance: none; border-radius: 0; }
.search__box input::placeholder { color: #6B6B6B; font-weight: 400; }
.search__box .btn { border-width: 0 0 0 3px; border-color: var(--black); border-style: solid; min-height: 0; padding-inline: clamp(18px, 4vw, 40px); }
.search__row { display: grid; gap: var(--s-4); margin-top: var(--s-5); grid-template-columns: 1fr; }
@media (min-width: 720px) { .search__row { grid-template-columns: 1.1fr 1fr 1fr 1fr; } .search__icon { display: flex; } }
.field input[type="text"], .select { width: 100%; min-height: var(--tap); border: var(--rule) solid var(--black); background: var(--white); color: var(--black); padding: 0 14px; font-weight: 500; font-size: 1rem; border-radius: 0; }
.select { -webkit-appearance: none; appearance: none; padding-right: 44px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M4 7l6 6 6-6' fill='none' stroke='%23050505' stroke-width='2.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; background-size: 18px; }
.field input[type="text"]:focus-visible, .select:focus-visible { outline: 4px solid var(--gold); outline-offset: 0; }
.search__hint { margin-top: var(--s-5); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; font-size: var(--fs-small); color: var(--fg-muted); }
.chip { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border: var(--rule) solid var(--black); background: var(--white); color: var(--black); font-weight: 600; font-size: .9rem; text-decoration: none; }
.chip:hover { background: var(--black); color: var(--gold); }
button.chip { font-family: inherit; }

/* Suggestions dropdown */
.suggest { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; background: var(--white); color: var(--black); border: 3px solid var(--black); border-top: 0; max-height: 340px; overflow-y: auto; }
.suggest[hidden] { display: none; }
.suggest li { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; padding: 14px 20px; min-height: var(--tap); cursor: pointer; border-top: 1px solid var(--border); font-size: 1.15rem; font-weight: 600; }
.suggest li:first-child { border-top: 0; }
.suggest li small { font-weight: 400; color: var(--muted); font-size: .85rem; white-space: nowrap; }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--black); color: var(--gold); }
.suggest li[aria-selected="true"] small, .suggest li:hover small { color: var(--on-dark-muted); }

/* ---------- Tiles (Five Tribes navigation) ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-3); }
.tiles > :last-child:nth-child(odd) { grid-column: 1 / -1; }
@media (min-width: 900px) { .tiles { grid-template-columns: repeat(5, 1fr); } .tiles > :last-child:nth-child(odd) { grid-column: auto; } }
.tile { display: flex; flex-direction: column; justify-content: space-between; gap: var(--s-5); min-height: 132px; padding: 18px; border: var(--rule) solid var(--black); background: var(--white); color: var(--black); text-decoration: none; transition: background-color .15s, color .15s; }
.tile strong { font-weight: 700; font-size: 1.02rem; line-height: 1.2; }
.tile span { font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.tile svg { width: 18px; height: 18px; }
.tile:hover { background: var(--black); color: var(--gold); }

/* ---------- Cards (Notion-style consistent cards) ---------- */
.grid-2 { display: grid; gap: var(--s-5); grid-template-columns: 1fr; }
@media (min-width: 860px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } }
.grid-3 { display: grid; gap: var(--s-5); grid-template-columns: 1fr; }
@media (min-width: 860px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.card { position: relative; display: flex; flex-direction: column; gap: var(--s-4); padding: calc(var(--s-6) + 8px) var(--s-6) var(--s-6); background: var(--white); color: var(--black); border: var(--rule) solid var(--black); }
.card::before { content: ""; position: absolute; left: -2px; right: -2px; top: -2px; height: 10px; background: var(--gold); }
.card__num { font-family: var(--font-display); font-size: 3.25rem; line-height: 1; }
.card p { color: var(--muted); }
.card .arrow-link { margin-top: auto; align-self: flex-start; }
.card--link { text-decoration: none; transition: background-color .15s; }
.card--link:hover { background: var(--ivory); }

/* ---------- Data table (Notion-style database view) ---------- */
.table-wrap { overflow-x: auto; border: var(--rule) solid var(--black); background: var(--white); color: var(--black); }
.data-table { width: 100%; border-collapse: collapse; min-width: 680px; font-size: .95rem; }
.data-table caption { text-align: left; padding: 14px 16px; font-weight: 700; font-size: var(--fs-label); letter-spacing: .18em; text-transform: uppercase; border-bottom: var(--rule) solid var(--black); background: var(--ivory); }
.data-table th, .data-table td { text-align: left; padding: 14px 16px; vertical-align: top; border-bottom: 1px solid var(--border); }
.data-table thead th { background: var(--black); color: var(--gold); font-size: var(--fs-label); letter-spacing: .16em; text-transform: uppercase; font-weight: 700; border-bottom: 0; }
.data-table tbody th { font-weight: 700; }
.data-table tbody tr:last-child > * { border-bottom: 0; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table tfoot td, .data-table tfoot th { background: var(--ivory); font-weight: 700; border-top: var(--rule) solid var(--black); border-bottom: 0; }

/* ---------- Status badges (used by record cards) ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border: var(--rule) solid var(--black); font-weight: 700; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; line-height: 1.5; white-space: nowrap; }
.badge--verified { background: var(--black); color: var(--gold); }
.badge--check { background: var(--white); color: var(--black); }
.badge--ocr { background: var(--parchment); color: var(--black); border-style: dashed; }

/* ---------- Notice (accuracy and disclaimer boxes) ---------- */
.notice { padding: var(--s-4) var(--s-5); border: 1px solid var(--black); border-left: 10px solid var(--gold); background: var(--ivory); color: var(--black); font-size: var(--fs-small); line-height: 1.55; }
.notice strong { font-weight: 700; }
.notice--dark { background: #121212; color: #fff; border-color: var(--line-dark); border-left-color: var(--gold); }
.tag { display: inline-block; padding: 2px 8px; border: var(--rule) solid currentColor; font-weight: 700; font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; vertical-align: middle; }

/* ---------- Placeholder (clearly marked, never faked) ---------- */
.placeholder { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 280px; padding: var(--s-6); border: 2px dashed var(--gold); color: var(--gold); font-weight: 700; font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; line-height: 1.7; }

/* ---------- Footer ---------- */
.site-footer { background: var(--black); color: var(--white); border-top: 8px solid var(--gold); }
.site-footer a { text-decoration-color: var(--gold); text-underline-offset: 4px; }
.site-footer a:hover { color: var(--gold); }
.footer__grid { display: grid; gap: var(--s-7); grid-template-columns: 1fr; padding-block: var(--s-9) var(--s-7); }
@media (min-width: 900px) { .footer__grid { grid-template-columns: 1.2fr 1fr 1.3fr 1.1fr; gap: var(--s-6); } }
.footer__logo { display: inline-block; background: var(--white); padding: 14px; line-height: 0; }
.footer__logo img { width: 132px; height: auto; }
.footer__h { font-weight: 700; font-size: var(--fs-label); letter-spacing: .22em; text-transform: uppercase; color: var(--gold); margin-bottom: var(--s-4); }
.footer__list li + li { margin-top: 2px; }
.footer__list a { display: inline-flex; align-items: center; min-height: 40px; text-decoration: none; font-size: .98rem; }
.footer__list a:hover { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 4px; text-decoration-thickness: 2px; }
.footer__fine { border-top: 1px solid var(--line-dark); padding-block: var(--s-6) var(--s-8); display: grid; gap: var(--s-4); color: var(--on-dark-muted); font-size: .875rem; line-height: 1.6; max-width: 90ch; }
.footer__fine a { color: var(--white); font-weight: 600; text-decoration: underline; text-decoration-color: var(--gold); }
