/* Credence Compass — plain CSS, no framework. System fonts, so nothing to download. */

:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --ink: #151b26;
  --muted: #566070;
  --line: #dde2ea;
  --brand: #153e75;
  --brand-dark: #0f2d57;
  --gold: #c8961e;
  --focus: #1f6feb;
  --radius: 12px;

  /* Rating colors. Bullet text is always black on these, per the blueprint. */
  --green-bg: #c9f0cf;
  --green-edge: #2e9e4a;
  --yellow-bg: #ffeeaa;
  --yellow-edge: #d9a800;
  --red-bg: #ffcccc;
  --red-edge: #d33a3a;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }

a { color: var(--brand); }
a:hover { color: var(--brand-dark); }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); letter-spacing: -.01em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }

.muted { color: var(--muted); }
.fine-print { color: var(--muted); font-size: .85rem; }
.eyebrow { margin: 0; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); font-weight: 700; }

/* Accessibility helpers */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 8px; top: -60px; background: var(--brand); color: #fff;
  padding: .5rem .75rem; border-radius: 0 0 8px 8px; z-index: 10;
}
.skip-link:focus { top: 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* Header */
.site-header { background: var(--brand); color: #fff; }
.site-header-inner {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center;
  gap: .5rem 1.25rem; min-height: 56px; padding-top: .45rem; padding-bottom: .45rem;
}
.header-search { grid-column: 2; max-width: 460px; width: 100%; justify-self: center; }
.site-header-inner > nav { grid-column: 3; justify-self: end; } /* stays right even when the header search is hidden */
.site-header a { color: #fff; text-decoration: none; }
.site-header nav a { padding: .35rem .6rem; border-radius: 6px; font-size: .95rem; }
.site-header nav a:hover { background: rgba(255,255,255,.14); }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.1rem; }
.brand-icon { width: 30px; height: 30px; color: var(--gold); }

.company-header { padding: 1.75rem 0 1rem; }
.company-header h1 { margin-top: .15rem; overflow-wrap: anywhere; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem 1rem;
  margin: 0 0 1.25rem;
  box-shadow: 0 1px 2px rgba(20, 30, 50, .04);
}

/* Buttons */
.button {
  font: inherit; font-weight: 600; cursor: pointer;
  background: var(--surface); color: var(--brand);
  border: 1.5px solid var(--brand); border-radius: 8px;
  padding: .5rem .95rem; min-height: 40px;
}
.button:hover:not(:disabled) { background: #eaf0fa; }
.button.primary { background: var(--brand); color: #fff; }
.button.primary:hover:not(:disabled) { background: var(--brand-dark); }
.button.small { padding: .2rem .6rem; min-height: 32px; font-size: .9rem; }
.button:disabled { opacity: .55; cursor: not-allowed; }

.notice {
  background: #fff8e1; border: 1px solid #f0d98a; border-radius: 8px;
  padding: .6rem .8rem; margin: .5rem 0;
}

/* AI Summary */
.bullets { list-style: none; padding: 0; margin: .75rem 0; }
.bullet {
  color: #000; padding: .6rem .8rem; margin: .4rem 0;
  border-radius: 8px; border-left: 6px solid transparent;
}
.bullet-icon { margin-right: .5rem; }
.bullet-green { background: var(--green-bg); border-left-color: var(--green-edge); }
.bullet-yellow { background: var(--yellow-bg); border-left-color: var(--yellow-edge); }
.bullet-red { background: var(--red-bg); border-left-color: var(--red-edge); }

/* Skeleton loaders */
.skeleton {
  background: linear-gradient(90deg, #e9edf3 25%, #f6f8fb 50%, #e9edf3 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: 6px;
}
.skeleton-line { height: 14px; margin: .55rem 0; }
.skeleton-line.short { width: 60%; }
.skeleton-bullet { height: 40px; margin: .5rem 0; border-radius: 8px; }
.skeleton-cell { height: 14px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Compass Check */
.compass-layout { display: grid; grid-template-columns: 260px 1fr; gap: 1.5rem; align-items: start; }
.dial-column { display: flex; flex-direction: column; align-items: center; gap: .9rem; }
.dial { width: 240px; max-width: 100%; height: auto; }
.dial-ring { fill: #fff; stroke: var(--brand); stroke-width: 4; }
.dial-inner { fill: #f6f8fc; stroke: var(--line); stroke-width: 1.5; }
.dial-mark { fill: #a7b2c4; transition: fill .3s, r .3s; }
.dial-mark.active { fill: var(--gold); r: 6; stroke: var(--brand); stroke-width: 1.5; }
.needle { transform-origin: 100px 100px; }
.needle-head { fill: var(--brand); }
.needle-tail { fill: #b8c1cf; }
.dial-hub { fill: var(--gold); stroke: var(--brand); stroke-width: 2; }

.result-label { margin: 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.result-row { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; }
.tier-name { font-size: 1.7rem; line-height: 1.2; letter-spacing: -.01em; }
#why-text { font-size: 1.02rem; }

.metrics { width: 100%; border-collapse: collapse; margin: .75rem 0; font-size: .95rem; }
.metrics th, .metrics td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.metrics thead th { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.metrics tbody th { font-weight: 600; }

.pill { display: inline-block; padding: .05rem .55rem; border-radius: 999px; font-size: .85rem; font-weight: 600; color: #000; white-space: nowrap; }
.pill-green { background: var(--green-bg); }
.pill-yellow { background: var(--yellow-bg); }
.pill-red { background: var(--red-bg); }

/* Filters */
.filters {
  display: grid; grid-template-columns: 1.4fr 2fr 1fr 1fr auto; gap: .75rem; align-items: end;
  margin: 1rem 0 .5rem;
}
.filters label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; font-weight: 600; color: var(--muted); min-width: 0; }
.filters select, .filters input {
  font: inherit; color: var(--ink); background: #fff; min-height: 40px; min-width: 0; width: 100%;
  border: 1.5px solid #b9c3d3; border-radius: 8px; padding: .4rem .5rem;
}
.list-count { margin: .75rem 0 .4rem; color: var(--muted); font-size: .95rem; min-height: 1.5em; }

/* Complaint table */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.complaints { width: 100%; border-collapse: collapse; font-size: .9rem; }
.complaints th, .complaints td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.complaints thead th { background: #f0f3f8; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); white-space: nowrap; }
.complaints tbody tr:nth-child(even) { background: #fafbfd; }
.complaints tbody tr:last-child td { border-bottom: 0; }
[aria-busy="true"] .complaints tbody { opacity: .85; }
.list-actions { display: flex; gap: .75rem; margin: .9rem 0 .25rem; }

/* Home page */
.landing { max-width: 760px; margin: 0 auto; padding: 3rem 0 1.5rem; }
.landing h1 { font-size: clamp(1.85rem, 5.2vw, 2.8rem); margin: .35rem 0 .75rem; }
.lead { font-size: 1.12rem; color: var(--muted); margin-bottom: 1.5rem; }
.examples { margin: 1rem 0 0; color: var(--muted); font-size: .92rem; display: flex; flex-wrap: wrap; gap: .35rem .9rem; align-items: baseline; }
.how { list-style: none; padding: 0; margin: 2.5rem 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.how li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; font-size: .93rem; color: var(--muted); }
.how strong { display: block; color: var(--ink); margin-bottom: .25rem; }

/* Company search box (home page: large; header: compact) */
.search { position: relative; }
.search-label { display: block; font-weight: 700; margin-bottom: .4rem; }
.search-row { display: flex; gap: .5rem; }
.search input[type="search"] {
  flex: 1; min-width: 0; font: inherit; color: var(--ink); background: #fff;
  border: 1.5px solid #b9c3d3; border-radius: 10px; padding: .45rem .75rem; min-height: 40px;
}
.search input[type="search"]::placeholder { color: #7a8494; }
.search-large input[type="search"] { font-size: 1.15rem; min-height: 54px; padding: .7rem 1rem; border-width: 2px; }
.search-large .search-button { min-height: 54px; padding: 0 1.4rem; font-size: 1.05rem; }
.search-compact input[type="search"] { border-color: transparent; }
.site-header .search-compact .search-button { background: var(--gold); border-color: var(--gold); color: #1d1604; min-height: 40px; }
.site-header .search-compact .search-button:hover { background: #dfab2e; }

.search-panel {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30;
  background: #fff; color: var(--ink); text-align: left;
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(20, 30, 50, .18);
  max-height: min(430px, 70vh); overflow-y: auto; padding: .35rem 0;
}
.search-message { margin: 0; padding: .55rem .95rem; color: var(--muted); font-size: .93rem; }
.search-tip { display: block; margin-top: .25rem; font-size: .88rem; }
.search-group-label { padding: .5rem .95rem .2rem; font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.search-option { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .55rem .95rem; cursor: pointer; }
.search-option[aria-selected="true"] { background: #e6eefb; box-shadow: inset 3px 0 0 var(--brand); }
.search-option-name { overflow-wrap: anywhere; }
.search-option.suggestion .search-option-name { font-weight: 600; }
.search-option-count { color: var(--muted); font-size: .85rem; white-space: nowrap; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: #fff; padding: 1.25rem 0 2rem; margin-top: 1rem; }
.site-footer p { margin-bottom: .5rem; }

/* About page */
.prose { max-width: 720px; }
.prose h2 { margin-top: 2rem; font-size: 1.35rem; }
.prose h3 { margin-top: 1.25rem; }
.prose ul { padding-left: 1.25rem; }
.prose li { margin: .3rem 0; }
.prose table { border-collapse: collapse; width: 100%; margin: .75rem 0 1.25rem; font-size: .95rem; }
.prose th, .prose td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose thead th { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.callout { background: #eef4fd; border-left: 5px solid var(--brand); border-radius: 6px; padding: .75rem 1rem; margin: 1rem 0; }

/* Phones: stack the compass layout, filters, and turn table rows into cards */
@media (max-width: 760px) {
  .site-header-inner { grid-template-columns: 1fr auto; }
  .site-header-inner > nav { grid-column: 2; grid-row: 1; }
  .header-search { grid-column: 1 / -1; grid-row: 2; max-width: none; }
  .how { grid-template-columns: 1fr; }
  .landing { padding-top: 2rem; }
  .search-option { flex-direction: column; gap: .1rem; }
  .compass-layout { grid-template-columns: 1fr; }
  .dial { width: 200px; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters label:nth-child(1), .filters label:nth-child(2), .filters button { grid-column: 1 / -1; }

  .complaints thead { position: absolute; left: -9999px; }
  .complaints, .complaints tbody, .complaints tr, .complaints td { display: block; width: 100%; }
  .complaints tr { padding: .5rem .25rem; border-bottom: 1px solid var(--line); }
  .complaints td { border: 0; padding: .2rem .7rem; }
  .complaints td::before { content: attr(data-label) ": "; font-weight: 600; color: var(--muted); }
  .complaints tr.skeleton-row td::before { content: none; }
  .table-scroll { border: 0; }
}

/* Respect people who ask their system for less motion */
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
  .dial-mark { transition: none; }
}
