/* Components (Spec 7.4–7.6). Each is shown in every state on the component reference page. */

/* ---------------------------------------------------------------- Buttons (Spec 7.4) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-control);
  border: 2px solid transparent;
  font: inherit;
  font-weight: var(--weight-semibold);
  text-decoration: none;
  cursor: pointer;
  line-height: var(--lh-16);
}
.btn-primary {
  background: var(--navy);
  color: var(--white);
}
.btn-primary:hover {
  background: #163a70;
}
.btn-secondary {
  background: var(--surface);
  color: var(--navy);
  border-color: var(--navy);
}
.btn-secondary:hover {
  background: var(--subtle);
}
.btn-tertiary {
  background: transparent;
  color: var(--navy);
  padding-left: var(--space-2);
  padding-right: var(--space-2);
}
.btn-tertiary:hover {
  background: var(--subtle);
}
.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn .icon {
  width: 20px;
  height: 20px;
}
.link-button {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

/* ---------------------------------------------------------------- Forms */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
}
.field label,
.field-label {
  font-weight: var(--weight-semibold);
}
.field .help {
  font-size: var(--text-14);
  line-height: var(--lh-14);
  color: var(--muted);
}
.input,
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="number"],
.field textarea,
.field select {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  padding: var(--space-3);
  min-height: 44px;
  width: 100%;
}
.field textarea {
  min-height: 160px;
  resize: vertical;
}
.field input:hover,
.field textarea:hover,
.field select:hover {
  border-color: var(--muted);
}
.field.has-error input,
.field.has-error textarea,
.field [aria-invalid="true"] {
  border-color: var(--error);
}
.field .error,
.form-error {
  color: var(--error);
  font-size: var(--text-14);
  line-height: var(--lh-14);
}
.checkbox {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
}
.checkbox label {
  font-weight: var(--weight-regular);
}
.checkbox input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--navy);
  flex: none;
}

/* ---------------------------------------------------------------- Badges (Spec 7.2) */
.badge {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-control);
  border: 2px solid transparent;
  font-size: var(--text-14);
  line-height: var(--lh-14);
  font-weight: var(--weight-semibold);
  white-space: nowrap;
}
.badge .score {
  font-variant-numeric: tabular-nums;
  font-size: var(--text-18);
}
.badge-strong {
  background: var(--navy);
  color: var(--white);
}
.badge-good {
  background: var(--surface);
  color: var(--blue);
  border-color: var(--blue);
}
.badge-fair {
  background: var(--surface);
  color: var(--slate);
  border-color: var(--slate);
}
.badge-tag {
  background: var(--subtle);
  color: var(--navy);
  font-weight: var(--weight-regular);
}

/* ---------------------------------------------------------------- Notices */
.notice {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: var(--space-4);
}
.notice-info {
  background: var(--subtle);
  border-color: var(--subtle);
}
.notice-success {
  background: var(--met-tint);
  border-color: var(--met-tint);
  color: var(--met);
}
.notice-warning {
  background: var(--partial-tint);
  border-color: var(--partial-tint);
  color: var(--partial);
}
.notice-error {
  border-color: var(--error);
  color: var(--error);
}
.notice .icon {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 2px;
}

/* ---------------------------------------------------------------- Cards and panels */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--space-6);
}
.card + .card {
  margin-top: var(--space-4);
}

/* ---------------------------------------------------------------- Verdict rows (Spec 7.5) */
.verdict-row {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: var(--space-3);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border);
}
.verdict-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.verdict-icon svg {
  width: 16px;
  height: 16px;
}
.verdict-met .verdict-icon {
  background: var(--met-tint);
  color: var(--met);
}
.verdict-partial .verdict-icon,
.verdict-unverified .verdict-icon {
  background: var(--partial-tint);
  color: var(--partial);
}
.verdict-missing .verdict-icon {
  background: var(--missing-tint);
  color: var(--missing);
}
.verdict-text {
  font-weight: var(--weight-semibold);
}
.evidence {
  margin-top: var(--space-2);
  padding-left: var(--space-3);
  border-left: 2px solid var(--border);
  font-size: var(--text-14);
  line-height: var(--lh-14);
  color: var(--muted);
}
.verdict-note {
  font-size: var(--text-14);
  line-height: var(--lh-14);
  margin-top: var(--space-2);
}
.verdict-partial .verdict-note,
.verdict-unverified .verdict-note {
  color: var(--partial);
}

/* ---------------------------------------------------------------- Match card (Spec 7.5) */
.match-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--space-6);
}
.match-card[aria-current="true"],
.match-card.is-selected {
  background: var(--subtle);
  border: 2px solid var(--navy);
  padding: calc(var(--space-6) - 1px);
}
.match-card-head {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  align-items: flex-start;
}
.match-card-title {
  font-size: var(--text-18);
  line-height: var(--lh-18);
  font-weight: var(--weight-semibold);
  margin: 0;
}
.match-card-company {
  margin: var(--space-1) 0 0;
}
.facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  font-size: var(--text-14);
  line-height: var(--lh-14);
  color: var(--muted);
  margin: var(--space-3) 0;
  font-variant-numeric: tabular-nums;
}
.facts span {
  display: inline-flex;
  gap: var(--space-1);
  align-items: center;
}
.facts .icon {
  width: 16px;
  height: 16px;
}
.reasons {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-4);
}
.reasons li {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  padding: 2px 0;
}
.reasons .verdict-icon {
  width: 22px;
  height: 22px;
}
.checking {
  display: inline-flex;
  gap: var(--space-2);
  align-items: center;
  font-size: var(--text-14);
  color: var(--muted);
}
.card-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------- Score breakdown (Spec 7.5) */
.breakdown-row {
  padding: var(--space-2) 0;
}
.breakdown-row .row-head {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-14);
  line-height: var(--lh-14);
  font-variant-numeric: tabular-nums;
}
.bar-track {
  height: 8px;
  border-radius: 4px;
  background: var(--subtle);
  margin-top: var(--space-1);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: var(--blue);
  border-radius: 4px;
}
.bar-track.not-counted {
  background: var(--missing-tint);
}
.breakdown-total {
  display: flex;
  justify-content: space-between;
  font-weight: var(--weight-semibold);
  padding-top: var(--space-3);
  margin-top: var(--space-2);
  border-top: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- Chips (Spec 7.5) */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 36px;
  padding: var(--space-1) var(--space-3);
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--navy);
  font: inherit;
  cursor: pointer;
}
.chip[aria-pressed="true"] {
  background: var(--subtle);
  border: 2px solid var(--navy);
  font-weight: var(--weight-semibold);
}

/* ---------------------------------------------------------------- Empty state */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-4);
  color: var(--muted);
}
.empty-state .icon {
  width: 20px;
  height: 20px;
  margin: 0 auto var(--space-3);
}

/* ---------------------------------------------------------------- Header (Spec 7.5) */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 64px;
}
.brand img {
  height: 36px;
  width: auto;
}
.brand .mark {
  display: none;
}
@media (max-width: 359px) {
  .brand .logo {
    display: none;
  }
  .brand .mark {
    display: block;
    height: 32px;
  }
}
.nav {
  display: flex;
  gap: var(--space-6);
  align-items: center;
}
@media (max-width: 639px) {
  .nav-public {
    gap: var(--space-4);
  }
}
.nav a:not(.btn) {
  color: var(--navy);
  text-decoration: none;
  padding: 20px 0 17px;
  border-bottom: 3px solid transparent;
}
.nav a[aria-current="page"] {
  border-bottom-color: var(--navy);
  font-weight: var(--weight-semibold);
}
.nav-signed-in {
  flex: 1;
  margin-left: var(--space-8);
}
@media (max-width: 639px) {
  .nav-signed-in,
  .nav-public .nav-secondary {
    display: none;
  }
}

/* ---------------------------------------------------------------- Account menu (Spec 7.5) */
.menu {
  position: relative;
}
.menu-button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--subtle);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--navy);
}
.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + var(--space-2));
  min-width: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-overlay);
  padding: var(--space-2) 0;
  z-index: 50;
}
.menu-panel[hidden] {
  display: none;
}
.menu-panel .signed-in-as {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  word-break: break-all;
}
.menu-panel a,
.menu-panel button {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  color: var(--navy);
  text-decoration: none;
  background: none;
  border: 0;
  font: inherit;
  cursor: pointer;
}
.menu-panel a:hover,
.menu-panel button:hover {
  background: var(--subtle);
}
.menu-panel .menu-separator {
  border-top: 1px solid var(--border);
  margin-top: var(--space-2);
  padding-top: var(--space-2);
}

/* ---------------------------------------------------------------- Footer (Spec 7.5) */
.site-footer {
  background: var(--page-dark);
  color: var(--on-dark);
  padding: var(--space-12) 0 var(--space-6);
}
.site-footer a {
  color: var(--on-dark);
  text-decoration: none;
}
.site-footer a:hover {
  text-decoration: underline;
}
.footer-grid {
  display: grid;
  gap: var(--space-8);
}
@media (min-width: 640px) {
  .footer-grid {
    grid-template-columns: 2fr repeat(3, 1fr);
  }
}
.footer-tagline {
  color: var(--muted-on-dark);
  margin-top: var(--space-3);
}
.footer-group h2 {
  color: var(--muted-on-dark);
  font-size: var(--text-12);
  line-height: var(--lh-12);
  letter-spacing: var(--label-tracking);
  text-transform: uppercase;
  margin-bottom: var(--space-3);
}
.footer-group ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.footer-group li + li {
  margin-top: var(--space-2);
}
.footer-bottom {
  border-top: 1px solid rgba(157, 178, 204, 0.25);
  margin-top: var(--space-8);
  padding-top: var(--space-4);
  color: var(--muted-on-dark);
  font-size: var(--text-14);
}
.has-tabbar .site-footer {
  padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom) + var(--space-6));
}

/* ---------------------------------------------------------------- Phone tab bar (Spec 7.5) */
.tabbar {
  display: none;
}
@media (max-width: 639px) {
  .tabbar {
    display: grid;

    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 40;
  }
  .tabbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: var(--space-2) 0;
    color: var(--muted);
    text-decoration: none;
    font-size: var(--text-14);
  }
  .tabbar a[aria-current="page"] {
    color: var(--navy);
    font-weight: var(--weight-semibold);
  }
}

/* ---------------------------------------------------------------- Admin layout (Spec 6.1) */
.admin-header {
  background: var(--page-dark);
  color: var(--on-dark);
}
.admin-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
}
.admin-header a {
  color: var(--on-dark);
}
.admin-label {
  margin-left: var(--space-3);
  padding: 2px var(--space-2);
  border-radius: var(--radius-control);
  background: var(--blue-bright);
  color: var(--page-dark);
  font-size: var(--text-12);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--label-tracking);
  text-transform: uppercase;
}
.admin-shell {
  display: grid;
  gap: var(--space-6);
}
@media (min-width: 1024px) {
  .admin-shell {
    grid-template-columns: 220px 1fr;
  }
}
.admin-sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.admin-sidebar a {
  display: block;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-control);
  color: var(--navy);
  text-decoration: none;
}
.admin-sidebar a[aria-current="page"] {
  background: var(--subtle);
  font-weight: var(--weight-semibold);
}
.admin-sidebar .soon {
  color: var(--muted);
  padding: var(--space-2) var(--space-3);
  display: block;
}

/* ---------------------------------------------------------------- Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
}
.table th {
  text-align: left;
  font-size: var(--text-12);
  line-height: var(--lh-12);
  letter-spacing: var(--label-tracking);
  text-transform: uppercase;
  color: var(--muted);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table tr:last-child td {
  border-bottom: 0;
}
.table-wrap {
  overflow-x: auto;
}

/* ---------------------------------------------------------------- Swatches (component page) */
.swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-4);
}
.swatch {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--surface);
}
.swatch-color {
  height: 64px;
}
.swatch-meta {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-14);
  line-height: var(--lh-14);
}

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

.footer-credits {
  margin: var(--space-2) 0 0;
  font-size: var(--text-14);
  line-height: var(--lh-14);
}
/* WCAG 1.4.1: links inside running text are underlined, not distinguished by color alone. */
.footer-credits a {
  text-decoration: underline;
  text-underline-offset: 2px;
}
