@font-face {
  font-family: "Atkinson";
  src: url("./fonts/atkinson-400.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson";
  src: url("./fonts/atkinson-700.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Plex Mono";
  src: url("./fonts/ibm-plex-mono-500.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}

:root {
  --bg: oklch(1 0 0);
  --surface: oklch(0.965 0 0);
  --ink: oklch(0.17 0.035 310);
  --muted: oklch(0.47 0.025 310);
  --line: oklch(0.78 0.012 310);
  --primary: oklch(0.489 0.19 28.3);
  --primary-dark: oklch(0.405 0.17 28.3);
  --accent: oklch(0.885 0.185 95);
  --focus: oklch(0.63 0.18 250);
  --shadow: 0 1.25rem 3rem oklch(0.17 0.035 310 / 0.15);
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4.5rem;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: "Atkinson", ui-sans-serif, system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

button, input, textarea { font: inherit; }

button, summary, a { -webkit-tap-highlight-color: transparent; }

:focus-visible {
  outline: 0.2rem solid var(--focus);
  outline-offset: 0.2rem;
}

[hidden] { display: none !important; }

.site-header,
.hero,
.search-results,
.diagnosis,
.site-footer {
  width: min(100% - 2rem, 74rem);
  margin-inline: auto;
}

.site-header {
  display: flex;
  min-height: 5.5rem;
  align-items: center;
}

.wordmark {
  position: relative;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.2rem;
  line-height: 1;
  text-decoration: none;
}

.wordmark span {
  position: absolute;
  left: 30%;
  right: -0.25rem;
  bottom: -0.55rem;
  height: 0.22rem;
  background: var(--primary);
  transform: rotate(-2deg);
}

.hero {
  padding-block: clamp(2.5rem, 8vw, 6.5rem) var(--space-3xl);
  text-align: center;
}

.eyebrow,
.mono-label,
label,
.trust-line,
.result-meta,
.docket-footer {
  font-family: "Plex Mono", ui-monospace, monospace;
}

.eyebrow,
.mono-label {
  margin: 0 0 var(--space-md);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.hero .eyebrow { color: var(--primary); }

h1, h2, h3, p { text-wrap: pretty; }

h1 {
  max-width: 17ch;
  margin: 0 auto;
  font-size: clamp(2.7rem, 7vw, 5.8rem);
  line-height: 0.97;
  letter-spacing: -0.045em;
}

.hero-line {
  margin: var(--space-lg) auto var(--space-xl);
  color: var(--muted);
  font-size: 1.2rem;
}

.search-form {
  display: grid;
  max-width: 65rem;
  margin: 0 auto;
  gap: var(--space-md);
  text-align: left;
}

.field { display: grid; gap: var(--space-xs); }

label {
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input {
  width: 100%;
  min-height: 3.5rem;
  border: 0.12rem solid var(--ink);
  border-radius: 0;
  padding: 0.8rem 1rem;
  color: var(--ink);
  background: var(--bg);
  appearance: none;
}

input::placeholder { color: oklch(0.63 0.015 310); }

input[aria-invalid="true"] { border-color: var(--primary); }

textarea {
  width: 100%;
  border: 0.12rem solid var(--ink);
  border-radius: 0;
  padding: 0.8rem 1rem;
  color: var(--ink);
  background: var(--bg);
  resize: vertical;
}

.button {
  min-height: 3.5rem;
  border: 0.12rem solid var(--ink);
  border-radius: 0;
  padding: 0.75rem 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  color: var(--ink);
  background: var(--accent);
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0.28rem 0.28rem 0 var(--ink);
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.button:hover { transform: translate(-0.1rem, -0.1rem); box-shadow: 0.38rem 0.38rem 0 var(--ink); }
.button:active { transform: translate(0.18rem, 0.18rem); box-shadow: 0.1rem 0.1rem 0 var(--ink); }
.button:disabled { cursor: wait; opacity: 0.65; transform: none; box-shadow: none; }

.button-search { align-self: end; }

.form-message {
  min-height: 1.5rem;
  margin: var(--space-sm) auto 0;
  color: var(--primary-dark);
  font-weight: 700;
}

.trust-line {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-sm);
  margin: var(--space-sm) 0 0;
  color: var(--muted);
  font-size: 0.74rem;
}

.trust-line span { width: 1.5rem; height: 0.1rem; background: currentColor; }

.search-results,
.diagnosis { padding-block: var(--space-3xl); }

.search-results { border-top: 0.12rem solid var(--ink); }

.section-heading { margin-bottom: var(--space-xl); }

.section-heading h2 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1;
  letter-spacing: -0.035em;
}

.result-list { border-top: 0.12rem solid var(--ink); }

.result-button {
  width: 100%;
  min-height: 5.5rem;
  border: 0;
  border-bottom: 0.08rem solid var(--line);
  padding: var(--space-md) 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-md);
  align-items: center;
  color: var(--ink);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.result-button:hover { background: var(--surface); }
.result-name { display: block; font-size: 1.25rem; font-weight: 700; }
.result-address { display: block; color: var(--muted); }
.result-meta { font-size: 0.74rem; text-align: right; text-transform: uppercase; }
.result-rating { display: block; font-family: "Atkinson", sans-serif; font-size: 2rem; font-weight: 700; }

.empty-result {
  padding: var(--space-xl) 0;
  font-size: 1.15rem;
}

.back-button {
  min-height: 2.75rem;
  border: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.25rem;
  cursor: pointer;
}

.docket {
  position: relative;
  max-width: 48rem;
  margin: var(--space-xl) auto 0;
  padding: clamp(1.5rem, 5vw, 3.5rem);
  background-color: var(--bg);
  background-image: repeating-linear-gradient(0deg, transparent 0 1.95rem, oklch(0.9 0 0) 2rem);
  border-inline: 0.08rem solid var(--line);
  box-shadow: var(--shadow);
  clip-path: polygon(0 1%, 1.5% 0, 3% 1%, 4.5% 0, 6% 1%, 7.5% 0, 9% 1%, 10.5% 0, 12% 1%, 13.5% 0, 15% 1%, 16.5% 0, 18% 1%, 19.5% 0, 21% 1%, 22.5% 0, 24% 1%, 25.5% 0, 27% 1%, 28.5% 0, 30% 1%, 31.5% 0, 33% 1%, 34.5% 0, 36% 1%, 37.5% 0, 39% 1%, 40.5% 0, 42% 1%, 43.5% 0, 45% 1%, 46.5% 0, 48% 1%, 49.5% 0, 51% 1%, 52.5% 0, 54% 1%, 55.5% 0, 57% 1%, 58.5% 0, 60% 1%, 61.5% 0, 63% 1%, 64.5% 0, 66% 1%, 67.5% 0, 69% 1%, 70.5% 0, 72% 1%, 73.5% 0, 75% 1%, 76.5% 0, 78% 1%, 79.5% 0, 81% 1%, 82.5% 0, 84% 1%, 85.5% 0, 87% 1%, 88.5% 0, 90% 1%, 91.5% 0, 93% 1%, 94.5% 0, 96% 1%, 97.5% 0, 99% 1%, 100% 0, 100% 99%, 98.5% 100%, 97% 99%, 95.5% 100%, 94% 99%, 92.5% 100%, 91% 99%, 89.5% 100%, 88% 99%, 86.5% 100%, 85% 99%, 83.5% 100%, 82% 99%, 80.5% 100%, 79% 99%, 77.5% 100%, 76% 99%, 74.5% 100%, 73% 99%, 71.5% 100%, 70% 99%, 68.5% 100%, 67% 99%, 65.5% 100%, 64% 99%, 62.5% 100%, 61% 99%, 59.5% 100%, 58% 99%, 56.5% 100%, 55% 99%, 53.5% 100%, 52% 99%, 50.5% 100%, 49% 99%, 47.5% 100%, 46% 99%, 44.5% 100%, 43% 99%, 41.5% 100%, 40% 99%, 38.5% 100%, 37% 99%, 35.5% 100%, 34% 99%, 32.5% 100%, 31% 99%, 29.5% 100%, 28% 99%, 26.5% 100%, 25% 99%, 23.5% 100%, 22% 99%, 20.5% 100%, 19% 99%, 17.5% 100%, 16% 99%, 14.5% 100%, 13% 99%, 11.5% 100%, 10% 99%, 8.5% 100%, 7% 99%, 5.5% 100%, 4% 99%, 2.5% 100%, 1% 99%, 0 100%);
}

.docket-top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-lg);
  align-items: start;
  padding-bottom: var(--space-lg);
  border-bottom: 0.14rem solid var(--ink);
}

.docket h2 {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 3rem);
  line-height: 1;
  letter-spacing: -0.035em;
}

.business-address { margin: var(--space-sm) 0 0; color: var(--muted); }

.rating-stamp {
  width: 6rem;
  aspect-ratio: 1;
  border: 0.22rem solid var(--primary);
  border-radius: 50%;
  display: grid;
  place-content: center;
  color: var(--primary);
  text-align: center;
  transform: rotate(4deg);
}

.rating-stamp span { font-family: "Plex Mono", monospace; font-size: 0.66rem; text-transform: uppercase; }
.rating-stamp strong { font-size: 2.5rem; line-height: 0.9; font-variant-numeric: tabular-nums; }

.weak-area { padding-block: var(--space-xl); }

.weak-area h3 {
  position: relative;
  display: inline;
  margin: 0;
  font-size: clamp(2rem, 7vw, 4rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.weak-area h3::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: -0.05em;
  right: -0.08em;
  bottom: 0.02em;
  height: 0.18em;
  background: var(--primary);
  transform: rotate(-1deg);
}

.weak-area > p:not(.mono-label) { max-width: 37rem; margin: var(--space-lg) 0; font-size: 1.15rem; }

.button-primary { color: var(--bg); background: var(--primary); border-color: var(--primary-dark); box-shadow: 0.28rem 0.28rem 0 var(--ink); }
.button-primary:hover { background: var(--primary-dark); }

.action-panel {
  margin-block: 0 var(--space-xl);
  padding: var(--space-lg);
  border: 0.12rem solid var(--ink);
  background: var(--accent);
}

.plan-intro h4,
.personal-plan h4 {
  max-width: 18ch;
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  line-height: 1;
  letter-spacing: -0.035em;
}

.plan-intro > p:last-child,
.personal-plan > p:not(.mono-label) {
  max-width: 42rem;
  margin: var(--space-sm) 0 var(--space-lg);
}

.question-list { border-top: 0.12rem solid var(--ink); }

.question-progress {
  margin: 0 0 var(--space-sm);
  font-family: "Plex Mono", monospace;
  font-size: 0.76rem;
  font-weight: 500;
  text-transform: uppercase;
}

.plan-question {
  min-width: 0;
  margin: 0;
  padding: var(--space-lg) 0;
  border: 0;
  border-bottom: 0.08rem solid var(--ink);
}

.plan-question legend {
  width: 100%;
  padding: 0;
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.35;
}

.plan-question legend span {
  margin-right: var(--space-sm);
  color: var(--primary-dark);
  font-family: "Plex Mono", monospace;
  font-size: 0.78rem;
}

.answer-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-xs);
  margin-top: var(--space-md);
}

.answer-option {
  position: relative;
  min-height: 2.75rem;
  display: grid;
  place-items: center;
  border: 0.1rem solid var(--ink);
  background: var(--bg);
  cursor: pointer;
  font-family: "Atkinson", sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.answer-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.answer-option:has(input:checked) {
  color: var(--bg);
  background: var(--ink);
}

.answer-option:has(input:focus-visible) {
  outline: 0.2rem solid var(--focus);
  outline-offset: 0.15rem;
}

.plan-error {
  min-height: 1.5rem;
  margin: var(--space-sm) 0;
  color: var(--primary-dark);
  font-weight: 700;
}

.question-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.question-back { flex: 0 0 auto; }
.plan-submit { min-width: 12rem; margin-left: auto; background: var(--ink); color: var(--bg); }

.personal-plan { padding-top: var(--space-xs); }

.priority-list {
  list-style: none;
  margin: var(--space-xl) 0 0;
  padding: 0;
  counter-reset: priority;
  border-top: 0.12rem solid var(--ink);
}

.priority-list li {
  counter-increment: priority;
  position: relative;
  padding: var(--space-lg) 0 var(--space-lg) 2.8rem;
  border-bottom: 0.08rem solid var(--ink);
}

.priority-list li::before {
  content: counter(priority, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 1.65rem;
  color: var(--primary-dark);
  font-family: "Plex Mono", monospace;
  font-weight: 600;
}

.priority-list h5 {
  margin: 0 0 var(--space-xs);
  font-size: 1.2rem;
  line-height: 1.2;
}

.priority-list p { margin: 0; }

.evidence-line {
  margin-top: var(--space-sm) !important;
  font-size: 0.92rem;
}

.official-tools {
  display: grid;
  gap: var(--space-sm);
  padding-block: var(--space-lg);
  border-bottom: 0.08rem solid var(--ink);
}

.official-tools .mono-label { margin-bottom: 0; }
.official-tools a,
.council-links a,
.reset-plan {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  font-weight: 700;
  text-underline-offset: 0.2rem;
}

.feedback-card {
  margin-top: var(--space-2xl);
  border: 0.14rem solid var(--ink);
  padding: clamp(1.25rem, 4vw, 2rem);
  background: var(--accent);
  box-shadow: 0.4rem 0.4rem 0 var(--ink);
}

.feedback-card h4 {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.feedback-card > p:not(.mono-label) { margin: var(--space-sm) 0 var(--space-xl); }

.feedback-question {
  margin: 0;
  border: 0;
  border-top: 0.1rem solid var(--ink);
  padding: var(--space-lg) 0;
}

.feedback-question legend {
  width: 100%;
  padding: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
}

.feedback-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-xs);
  margin-top: var(--space-sm);
}

.feedback-options--three { grid-template-columns: repeat(3, 1fr); }

.feedback-options label {
  position: relative;
  min-height: 2.75rem;
  display: grid;
  place-items: center;
  border: 0.1rem solid var(--ink);
  background: var(--bg);
  cursor: pointer;
  font-family: "Atkinson", sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0;
  text-align: center;
  text-transform: none;
}

.feedback-options input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.feedback-options label:has(input:checked) { color: var(--bg); background: var(--ink); }
.feedback-options label:has(input:focus-visible) { outline: 0.2rem solid var(--focus); outline-offset: 0.15rem; }
.feedback-text { padding-top: var(--space-sm); }
.feedback-privacy { margin: var(--space-md) 0 !important; font-size: 0.78rem; }
.feedback-submit { width: 100%; background: var(--ink); color: var(--bg); box-shadow: none; }
.feedback-thanks { border-top: 0.1rem solid var(--ink); padding-top: var(--space-lg); }
.feedback-thanks strong { font-size: 1.25rem; }
.feedback-thanks p { margin-bottom: 0; }

.council-links { display: flex; flex-wrap: wrap; gap: var(--space-sm) var(--space-lg); margin-top: var(--space-md); padding-top: var(--space-md); border-top: 0.1rem solid var(--ink); }

.reset-plan {
  border: 0;
  padding-inline: 0;
  background: transparent;
  text-decoration: underline;
  cursor: pointer;
}

.score-details { border-top: 0.1rem solid var(--ink); padding-block: var(--space-lg); }
.score-details summary { min-height: 2.75rem; display: flex; align-items: center; cursor: pointer; font-weight: 700; text-decoration: underline; text-underline-offset: 0.25rem; }
.score-explainer { margin: 0 0 var(--space-sm); color: var(--muted); }
.score-list { margin: 0; }
.score-row { display: grid; grid-template-columns: 1fr auto; gap: var(--space-md); padding-block: var(--space-sm); border-top: 0.08rem solid var(--line); }
.score-row dt, .score-row dd { margin: 0; }
.score-row dd { font-family: "Plex Mono", monospace; font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.score-row.is-weak { color: var(--primary-dark); font-weight: 700; }

.docket-footer {
  display: grid;
  gap: var(--space-sm);
  padding-top: var(--space-lg);
  border-top: 0.14rem solid var(--ink);
  color: var(--muted);
  font-size: 0.72rem;
}

.site-footer {
  display: grid;
  gap: var(--space-md);
  padding-block: var(--space-2xl);
  border-top: 0.08rem solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}

.site-footer p { margin: 0; max-width: 65ch; }

@media (min-width: 48rem) {
  .search-form { grid-template-columns: 1fr 1fr 0.72fr; align-items: end; }
  .site-footer { grid-template-columns: 1fr 1fr; }
  .docket-footer { grid-template-columns: auto 1fr; justify-content: space-between; }
  .docket-footer span:last-child { text-align: right; }
}

@media (max-width: 35rem) {
  .hero { padding-top: var(--space-xl); }
  h1 { font-size: 2.8rem; }
  .docket { margin-inline: -0.5rem; padding: 1.5rem 1.25rem 2rem; }
  .docket-top { grid-template-columns: 1fr; }
  .rating-stamp { width: 5rem; }
  .weak-area h3 { font-size: 2.4rem; }
  .result-meta { text-align: left; }
  .result-button { grid-template-columns: 1fr; }
  .action-panel { margin-inline: -0.25rem; padding: 1.25rem; }
  .feedback-options,
  .feedback-options--three { grid-template-columns: 1fr; }
}

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