@import url("https://fonts.googleapis.com/css2?family=Gabarito:wght@400;500;700;800;900&family=Literata:opsz,wght@7..72,500;7..72,650;7..72,750&display=swap");

:root {
  color-scheme: light;
  --bg: oklch(1 0 0);
  --ink: oklch(0.145 0 0);
  --muted: oklch(0.39 0.012 165);
  --faint: oklch(0.91 0.006 165);
  --surface: oklch(0.975 0.004 165);
  --primary: oklch(0.32 0.09 160);
  --primary-strong: oklch(0.24 0.08 160);
  --accent: oklch(0.47 0.17 28);
  --amber: oklch(0.83 0.11 78);
  --amber-strong: oklch(0.77 0.13 74);
  --green-soft: oklch(0.94 0.035 160);
  --red-soft: oklch(0.94 0.035 28);
  --amber-soft: oklch(0.94 0.045 82);
  --shadow: 0 8px 8px oklch(0 0 0 / 0.06);
  --max: 1160px;
  --step-1: clamp(0.88rem, 0.84rem + 0.18vw, 1rem);
  --step-2: clamp(1rem, 0.95rem + 0.25vw, 1.16rem);
  --step-3: clamp(1.28rem, 1.1rem + 0.9vw, 1.84rem);
  --step-4: clamp(2.1rem, 1.3rem + 4vw, 4.6rem);
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 40px;
  --space-6: clamp(48px, 7vw, 88px);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, oklch(0.97 0.006 160) 0 1px, transparent 1px) 0 0 / 72px 72px,
    var(--bg);
  color: var(--ink);
  font-family: "Gabarito", ui-sans-serif, system-ui, sans-serif;
  font-weight: 400;
}

body::selection {
  background: var(--primary);
  color: var(--bg);
}

button,
input {
  font: inherit;
}

.shell {
  width: min(var(--max), calc(100% - 40px));
  margin: 0 auto;
  padding: var(--space-4) 0 var(--space-6);
}

.masthead {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  align-items: center;
  border-block: 1px solid var(--ink);
  padding: 11px 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.wordmark {
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: var(--space-5);
  align-items: end;
  padding: var(--space-6) 0 var(--space-5);
}

.hero-copy {
  max-width: 820px;
}

.eyebrow {
  max-width: 54ch;
  margin: 0 0 var(--space-3);
  color: var(--primary);
  font-weight: 900;
  font-size: var(--step-1);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

h1 {
  max-width: 10ch;
  margin-bottom: var(--space-4);
  font-family: "Literata", Georgia, serif;
  font-size: var(--step-4);
  font-weight: 750;
  line-height: 0.9;
  letter-spacing: -0.035em;
}

.lede {
  max-width: 68ch;
  margin-bottom: 0;
  color: var(--muted);
  font-size: var(--step-2);
  line-height: 1.58;
  text-wrap: pretty;
}

.case-note {
  border: 1px solid var(--ink);
  background: var(--primary);
  color: var(--bg);
  padding: var(--space-4);
}

.case-note strong {
  display: block;
  margin-bottom: var(--space-2);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.case-note p {
  margin-bottom: 0;
  font-family: "Literata", Georgia, serif;
  font-size: 1.12rem;
  line-height: 1.45;
}

.search-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, auto);
  column-gap: var(--space-4);
  row-gap: var(--space-3);
  align-items: end;
  border: 2px solid var(--ink);
  background: var(--surface);
  padding: var(--space-4);
  box-shadow: var(--shadow);
}

.search-main label,
.jurisdiction-filter legend {
  display: block;
  margin-bottom: var(--space-2);
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 900;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-2);
}

input[type="search"] {
  width: 100%;
  min-width: 0;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: var(--bg);
  color: var(--ink);
  padding: 14px 15px;
}

input[type="search"]::placeholder {
  color: oklch(0.45 0.012 165);
  opacity: 1;
}

input[type="search"]:focus-visible,
button:focus-visible,
.source-row a:focus-visible,
.jurisdiction-filter input:focus-visible {
  outline: 3px solid oklch(0.78 0.11 160);
  outline-offset: 3px;
}

button {
  border: 2px solid var(--ink);
  border-radius: 0;
  background: var(--amber);
  color: var(--ink);
  padding: 0 18px;
  font-weight: 800;
  letter-spacing: 0;
  cursor: pointer;
}

button:hover {
  background: var(--amber-strong);
  border-color: var(--ink);
}

.jurisdiction-filter {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  align-items: center;
  margin: 0;
  border: 0;
  padding: 0;
}

.jurisdiction-filter legend {
  width: 100%;
}

.jurisdiction-filter label {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  border: 1px solid var(--ink);
  background: var(--bg);
  padding: 8px 10px;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

.jurisdiction-filter label:has(input:checked) {
  background: var(--amber);
  color: var(--ink);
}

.jurisdiction-filter input {
  margin: 0;
  accent-color: var(--primary);
}

.hint {
  grid-column: 1 / -1;
  max-width: 76ch;
  margin: 0;
  color: var(--muted);
  font-size: var(--step-1);
  line-height: 1.5;
}

.scanner {
  display: grid;
  grid-template-columns: minmax(180px, 320px) 1fr;
  gap: var(--space-3);
  align-items: center;
  margin: var(--space-3) 0 0;
  border: 2px solid var(--ink);
  background: var(--bg);
  padding: var(--space-3);
}

.scanner video {
  width: 100%;
  max-height: 180px;
  aspect-ratio: 16 / 10;
  background: var(--ink);
  object-fit: cover;
}

.scanner p {
  margin: 0 0 var(--space-2);
  color: var(--muted);
}

.scanner-copy {
  min-width: 0;
}

.scanner.is-scanning p::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 8px;
  border-radius: 999px;
  background: var(--accent);
  vertical-align: 1px;
}

#stop-scan {
  min-height: 42px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--ink);
  border-top-width: 2px;
  margin-top: var(--space-5);
}

.summary-grid article {
  min-height: 180px;
  border-right: 1px solid var(--ink);
  background: var(--bg);
  padding: var(--space-3);
}

.summary-grid article:last-child {
  border-right: 0;
}

.scope-code {
  display: block;
  margin-bottom: var(--space-5);
  color: var(--accent);
  font-family: "Literata", Georgia, serif;
  font-size: 1.6rem;
  font-weight: 750;
}

.summary-grid strong,
.summary-grid span {
  display: block;
}

.summary-grid strong {
  margin-bottom: var(--space-2);
  font-size: 1.06rem;
}

.summary-grid span:not(.scope-code),
.notes-grid p {
  color: var(--muted);
  font-size: var(--step-1);
  line-height: 1.5;
}

.results,
.build-notes {
  margin-top: var(--space-6);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  align-items: end;
  border-bottom: 2px solid var(--ink);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
}

.section-heading h2,
.build-notes h2 {
  margin-bottom: 0;
  font-family: "Literata", Georgia, serif;
  font-size: var(--step-3);
  line-height: 1.05;
}

.section-heading p {
  margin-bottom: 2px;
  color: var(--muted);
}

.cards {
  display: grid;
  gap: var(--space-3);
}

.card {
  display: grid;
  grid-template-columns: minmax(220px, 0.78fr) minmax(0, 1.22fr);
  gap: var(--space-4);
  align-items: start;
  border: 1px solid var(--ink);
  background: var(--bg);
  padding: var(--space-4);
}

.card header {
  display: grid;
  gap: var(--space-2);
}

.brand {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.card h3 {
  margin-bottom: 0;
  font-family: "Literata", Georgia, serif;
  font-size: clamp(1.35rem, 1.04rem + 1.2vw, 2rem);
  line-height: 1.05;
}

.jurisdiction,
.risk {
  width: fit-content;
  border: 1px solid var(--ink);
  padding: 6px 9px;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.25;
}

.jurisdiction {
  background: var(--surface);
  color: var(--ink);
}

.risk.high {
  background: var(--amber);
  color: var(--ink);
}

.risk.medium {
  background: var(--amber);
  color: var(--ink);
}

.risk.watch {
  background: var(--amber);
  color: var(--ink);
}

.record-body {
  display: grid;
  gap: var(--space-3);
}

.card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: var(--step-2);
  font-weight: 500;
  line-height: 1.52;
}

.evidence-list {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.evidence-list li {
  display: grid;
  grid-template-columns: 7px 1fr;
  gap: var(--space-2);
  color: var(--ink);
  font-size: var(--step-1);
  font-weight: 500;
  line-height: 1.45;
}

.evidence-list li::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-top: 0.48em;
  background: var(--primary);
}

.source-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.source-row a {
  border: 1px solid var(--ink);
  background: var(--bg);
  color: var(--primary-strong);
  padding: 7px 10px;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 800;
}

.source-row a:hover {
  background: var(--amber);
  color: var(--ink);
}

.empty {
  border: 1px solid var(--ink);
  padding: var(--space-5);
  text-align: center;
}

.empty p {
  margin-bottom: 0;
  color: var(--muted);
}

.build-notes h2 {
  margin-bottom: var(--space-3);
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}

.notes-grid > div {
  border: 1px solid var(--ink);
  background: var(--surface);
  padding: var(--space-3);
}

.notes-grid h3 {
  margin-bottom: var(--space-2);
  font-size: 1.05rem;
}

@media (prefers-reduced-motion: no-preference) {
  button,
  .source-row a,
  .card {
    transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease;
  }

  .card:hover {
    transform: translateY(-2px);
  }

  .scanner:not([hidden]) {
    animation: reveal-panel 180ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .scanner.is-scanning p::before {
    animation: scan-pulse 1200ms cubic-bezier(0.22, 1, 0.36, 1) infinite;
  }

  .cards.is-updating .card {
    animation: result-in 220ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

@keyframes result-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes reveal-panel {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scan-pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.82);
  }

  50% {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 880px) {
  .hero,
  .search-panel,
  .scanner,
  .card,
  .notes-grid {
    grid-template-columns: 1fr;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-grid article:nth-child(2) {
    border-right: 0;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 24px, var(--max));
  }

  .masthead,
  .section-heading {
    display: block;
  }

  .masthead span {
    display: block;
    margin-top: 4px;
  }

  .search-row,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  button {
    min-height: 48px;
  }

  .summary-grid article,
  .summary-grid article:nth-child(2) {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--ink);
  }

  .summary-grid article:last-child {
    border-bottom: 0;
  }

  .scope-code {
    margin-bottom: var(--space-3);
  }
}
