* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, sans-serif;
  max-width: 48rem;
  margin: 2rem auto;
  padding: 0 1rem;
  color: #1a1a1a;
}

h1 {
  margin-bottom: 1.5rem;
}

h2, h3 {
  margin-top: 1.5rem;
}

form {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

label {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  font-weight: bold;
  gap: 0.25rem;
}

input {
  font-size: 1rem;
  padding: 0.4rem;
}

button {
  font-size: 1rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
}

.admin-panel {
  border: 1px solid #ddd;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.raw-form {
  margin-bottom: 0.75rem;
}

pre {
  background: #f2f2f2;
  padding: 1rem;
  overflow-x: auto;
  white-space: pre-wrap;
  border-radius: 0.35rem;
  max-height: 24rem;
  overflow-y: auto;
}

.error {
  color: #b00020;
  font-weight: bold;
}

/* ---- Public pages (index.html, coverage/how-it-works/contact.html) ---- */

body.public-page {
  max-width: none;
  margin: 0;
  padding: 0;
  color: #1f2937;
  background: #f4f5f7;
}

:focus-visible {
  outline: 2px solid #d99a2b;
  outline-offset: 2px;
}

.site-shell {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.site-header {
  background: #0f1b2d;
  padding: 0.9rem 1.5rem;
}

.site-nav {
  max-width: 72rem;
  margin: 0 auto;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.nav-link {
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.9rem;
  padding-bottom: 2px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.nav-link-active {
  color: #fff;
  border-bottom: 2px solid #d99a2b;
}

.site-footer {
  max-width: 72rem;
  margin: 2.5rem auto 0;
  padding: 1.5rem;
  font-size: 0.85rem;
  color: #6b7280;
  border-top: 1px solid #e5e7eb;
}

.footer-brand {
  font-weight: 700;
  color: #111827;
}

.footer-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0.5rem 0;
}

.footer-links a {
  color: #0f1b2d;
}

.footer-disclaimer {
  margin-top: 0.75rem;
  max-width: 48rem;
}

.stub-page {
  max-width: 72rem;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.coverage-page {
  max-width: 56rem;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.coverage-page h1 {
  color: #111827;
}

#coverage-status {
  color: #374151;
}

#coverage-status.error {
  color: #b00020;
  font-weight: bold;
}

.coverage-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

.coverage-table th,
.coverage-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}

.coverage-table thead th {
  color: #6b7280;
  font-weight: 600;
}

.coverage-table tbody th {
  color: #111827;
  font-weight: 600;
}

.coverage-table td {
  text-align: right;
}

.coverage-table tfoot th,
.coverage-table tfoot td {
  border-top: 2px solid #d1d5db;
  border-bottom: none;
  font-weight: 700;
}

.hero {
  max-width: 40rem;
  margin: 0 auto;
  padding: 3rem 1.5rem 2rem;
  text-align: center;
}

.hero h1 {
  font-size: 2.1rem;
  color: #111827;
  margin: 0 0 0.6rem;
}

.hero-subtitle {
  color: #4b5563;
  margin: 0 0 1.5rem;
}

.search-form {
  justify-content: center;
}

.search-form input {
  flex: 1;
  min-width: 16rem;
  background: #fff;
  color: #111827;
  border: 1px solid #d1d5db;
  border-radius: 6px;
}

.search-form button {
  background: #d99a2b;
  border: 1px solid #d99a2b;
  color: #1a1200;
  border-radius: 6px;
  min-height: 44px;
}

.example-chips {
  margin-top: 0.9rem;
  font-size: 0.85rem;
  color: #6b7280;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
}

.example-chip {
  background: none;
  border: none;
  color: #0f1b2d;
  text-decoration: underline;
  font-size: 0.85rem;
  padding: 0.3rem 0.4rem;
  min-height: 44px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

#search-status {
  text-align: center;
  min-height: 1.2rem;
  margin: 0.5rem 0;
  color: #374151;
}

#search-status.error {
  color: #b00020;
  font-weight: bold;
}

.info-cards {
  max-width: 56rem;
  margin: 1rem auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.info-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 1rem;
}

.info-card h2 {
  font-size: 1rem;
  margin: 0 0 0.4rem;
  color: #111827;
}

.info-card p {
  font-size: 0.85rem;
  color: #6b7280;
  margin: 0;
}

.tier-explainer {
  max-width: 56rem;
  margin: 1.5rem auto 3rem;
  padding: 0 1.5rem;
}

.tier-explainer ul {
  padding-left: 1.2rem;
}

@media (max-width: 640px) {
  .info-cards {
    grid-template-columns: 1fr;
  }

  .search-form {
    flex-direction: column;
    align-items: stretch;
  }
}

.results-summary {
  color: #374151;
  font-size: 0.9rem;
}

.result-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 0.5rem 0 2rem;
}

.result-card {
  display: block;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 0.9rem 1rem;
  cursor: pointer;
  position: relative;
  min-height: 44px;
}

.result-card:hover {
  background: #f9fafb;
}

.result-label-meta {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #6b7280;
  text-transform: uppercase;
}

.result-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #111827;
  margin-top: 2px;
}

.result-title mark {
  background: #fde68a;
  padding: 0 2px;
}

.result-alt {
  font-size: 0.82rem;
  color: #6b7280;
  margin-top: 4px;
}

.result-description {
  font-size: 0.85rem;
  color: #374151;
  margin-top: 4px;
}

.result-chevron {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #d99a2b;
  font-size: 1.2rem;
}

.no-results,
.error-state {
  max-width: 40rem;
  margin: 1.5rem auto;
  padding: 0 1.5rem;
}

.no-results-heading,
.error-message {
  font-weight: 700;
  color: #111827;
}

@media (max-width: 640px) {
  .result-list {
    gap: 0.5rem;
  }
}

.detail-view {
  max-width: 44rem;
  margin: 0 auto 3rem;
  padding: 0 1.5rem;
}

.back-link {
  background: none;
  border: none;
  color: #0f1b2d;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.4rem 0;
  margin-bottom: 0.8rem;
  min-height: 44px;
}

.detail-meta {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #6b7280;
  text-transform: uppercase;
}

.detail-heading {
  font-size: 1.6rem;
  color: #111827;
  margin: 2px 0 4px;
}

.detail-description {
  font-size: 0.95rem;
  color: #374151;
  margin: 0 0 0.6rem;
}

.detail-alt {
  font-size: 0.85rem;
  color: #6b7280;
  margin-bottom: 1.2rem;
}

.section-heading {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #374151;
  text-transform: uppercase;
  margin: 1.2rem 0 0.6rem;
}

.replacement-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.6rem;
}

.replacement-card.tier-modification {
  border: 2px solid #fecaca;
}

.tier-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
}

.tier-pill.tier-exact {
  background: #dcfce7;
  color: #166534;
}

.tier-pill.tier-direct {
  background: #fef9c3;
  color: #854d0e;
}

.tier-pill.tier-modification {
  background: #fee2e2;
  color: #991b1b;
}

.replacement-part {
  font-size: 1.05rem;
  font-weight: 600;
  color: #111827;
  margin-top: 6px;
}

.replacement-caveats {
  font-size: 0.85rem;
  color: #4b5563;
  margin-top: 2px;
}

.copy-link-button {
  margin-top: 1.2rem;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  min-height: 44px;
}

.discontinued-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 1.2rem;
}

.chain-branch {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.chain-node {
  display: block;
  text-align: left;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  min-height: 44px;
  font-size: 0.95rem;
  color: #111827;
}

.chain-node-current {
  border: 2px solid #16a34a;
  background: #f0fdf4;
  font-weight: 600;
}

.chain-node-tag {
  color: #9ca3af;
  font-size: 0.8rem;
  margin-left: 6px;
}

.chain-node-current .chain-node-tag {
  color: #166534;
}

.chain-node-unverified {
  border: 2px solid #9ca3af;
  background: #f3f4f6;
  font-weight: 600;
}

.chain-node-unverified .chain-node-tag {
  color: #6b7280;
}

.chain-node-attributes {
  font-size: 0.78rem;
  color: #4b5563;
  margin-top: 3px;
}

.chain-arrow {
  color: #d99a2b;
  padding: 2px 0 2px 20px;
  font-size: 0.85rem;
}

.chain-children {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.discontinued-loading {
  color: #6b7280;
  font-size: 0.85rem;
  margin-top: 1rem;
}
