:root {
  --ink: #161712;
  --paper: #f3f0e5;
  --paper-deep: #e9e4d4;
  --acid: #d9ff43;
  --coral: #ff6b4a;
  --blue: #2563eb;
  --green: #1f8a58;
  --red: #cf382e;
  --amber: #c98112;
  --muted: #696b61;
  --line: rgba(22, 23, 18, 0.18);
  --shadow: 8px 8px 0 var(--ink);
  --display: "Bodoni 72", Didot, "Times New Roman", serif;
  --sans: "Avenir Next", Avenir, "Century Gothic", sans-serif;
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(
      circle at 12% 10%,
      rgba(217, 255, 67, 0.28),
      transparent 26rem
    ),
    radial-gradient(
      circle at 90% 38%,
      rgba(255, 107, 74, 0.16),
      transparent 28rem
    ),
    var(--paper);
  font-family: var(--sans);
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button,
label,
select {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

.page-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.48;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 88%);
}

.site-header,
main,
.site-footer {
  width: min(1440px, calc(100% - 64px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px 0;
  border-bottom: 1px solid var(--ink);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 2px solid var(--ink);
  background: var(--acid);
  font: 800 15px/1 var(--mono);
  transform: rotate(-3deg);
}

.brand-copy {
  display: grid;
}

.brand-copy strong {
  font-size: 17px;
  letter-spacing: -0.03em;
}

.brand-copy small,
.system-state {
  color: var(--muted);
  font: 600 11px/1.4 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.system-state {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.pulse-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(31, 138, 88, 0.45);
  animation: pulse 2s infinite;
}

main {
  padding-bottom: 110px;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.5fr);
  align-items: end;
  gap: 48px;
  min-height: 480px;
  padding: 92px 0 72px;
}

.hero .eyebrow {
  position: absolute;
  top: 88px;
  left: 0;
}

.eyebrow {
  margin: 0 0 12px;
  font: 700 11px/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 1050px;
  margin: 0;
  font: 500 clamp(54px, 7.3vw, 116px)/0.88 var(--display);
  letter-spacing: -0.065em;
}

.hero h1 em {
  color: var(--coral);
  font-weight: 500;
}

.hero-copy {
  max-width: 390px;
  margin: 0 0 8px;
  padding: 18px 0 0 20px;
  border-top: 3px solid var(--ink);
  border-left: 1px solid var(--ink);
  font-size: 15px;
}

.scanner-panel {
  margin-top: 40px;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  border: 2px solid var(--ink);
  background: rgba(243, 240, 229, 0.94);
  box-shadow: var(--shadow);
}

.panel-index {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 24px 12px;
  border-right: 2px solid var(--ink);
  background: var(--acid);
  font: 700 14px/1 var(--mono);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.panel-body {
  padding: clamp(26px, 4vw, 58px);
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 36px;
  margin-bottom: 34px;
}

.section-heading h2,
.results-header h2,
.scan-status h2,
.error-panel h2 {
  margin: 0;
  font: 600 clamp(31px, 4vw, 52px)/1 var(--display);
  letter-spacing: -0.045em;
}

.mode-description {
  max-width: 420px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.mode-switcher {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin: 0 0 32px;
  padding: 0;
  border: 1px solid var(--ink);
}

.mode-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 15px;
  min-height: 82px;
  padding: 16px 18px;
  cursor: pointer;
  border-right: 1px solid var(--ink);
  transition:
    background 160ms ease,
    color 160ms ease;
}

.mode-option:last-child {
  border-right: 0;
}

.mode-option:hover,
.mode-option.is-active {
  background: var(--ink);
  color: var(--paper);
}

.mode-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mode-option > span:last-child {
  display: grid;
}

.mode-option strong {
  font-size: 14px;
}

.mode-option small {
  opacity: 0.65;
  font: 500 11px/1.5 var(--mono);
  text-transform: uppercase;
}

.mode-number {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border: 1px solid currentColor;
  font: 700 12px/1 var(--mono);
}

.mode-option.is-active .mode-number {
  color: var(--ink);
  background: var(--acid);
  border-color: var(--acid);
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(130px, 0.3fr);
  gap: 18px;
}

.form-grid.is-broken-mode {
  grid-template-columns: 1fr;
}

.field {
  display: grid;
  gap: 8px;
}

.field > span {
  font: 700 10px/1 var(--mono);
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.field input,
.result-filters input,
.result-filters select {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 0;
  outline: 0;
  background: transparent;
  font: 500 14px/1.2 var(--mono);
  transition:
    box-shadow 140ms ease,
    background 140ms ease;
}

.field input:focus,
.result-filters input:focus,
.result-filters select:focus {
  background: #fffef8;
  box-shadow: 4px 4px 0 var(--acid);
}

.form-actions {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-top: 28px;
}

.check-options {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 24px;
}

.check-field {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
}

.check-field input {
  position: absolute;
  opacity: 0;
}

.fake-check {
  position: relative;
  width: 18px;
  height: 18px;
  border: 1px solid var(--ink);
  background: transparent;
}

.check-field input:checked + .fake-check {
  background: var(--acid);
}

.check-field input:checked + .fake-check::after {
  position: absolute;
  top: 1px;
  left: 5px;
  width: 5px;
  height: 10px;
  border: solid var(--ink);
  border-width: 0 2px 2px 0;
  content: "";
  transform: rotate(45deg);
}

.scan-button {
  display: inline-flex;
  align-items: stretch;
  min-width: 230px;
  padding: 0;
  cursor: pointer;
  color: var(--paper);
  border: 0;
  background: var(--ink);
  box-shadow: 5px 5px 0 var(--coral);
  font-weight: 700;
}

.scan-button:hover {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 var(--coral);
}

.scan-button:disabled {
  cursor: wait;
  opacity: 0.6;
  transform: none;
}

.button-label {
  flex: 1;
  padding: 17px 20px;
}

.button-arrow {
  display: grid;
  width: 56px;
  place-items: center;
  color: var(--ink);
  border-left: 1px solid var(--paper);
  background: var(--acid);
  font-size: 24px;
}

.scan-status,
.error-panel {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 30px;
  margin-top: 46px;
  padding: 30px 34px;
  border: 2px solid var(--ink);
}

.scan-status {
  color: var(--paper);
  background: var(--ink);
}

.scan-status .eyebrow {
  color: var(--acid);
}

.scan-status h2,
.error-panel h2 {
  font-size: clamp(27px, 3vw, 40px);
}

.scan-status p:last-child,
.error-panel p {
  margin: 8px 0 0;
  color: rgba(243, 240, 229, 0.68);
}

.scanner-orbit {
  position: relative;
  width: 68px;
  height: 68px;
  border: 1px solid rgba(243, 240, 229, 0.35);
  border-radius: 50%;
  animation: spin 3s linear infinite;
}

.scanner-orbit span {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--acid);
}

.scanner-orbit span:nth-child(1) {
  top: -5px;
  left: 29px;
}
.scanner-orbit span:nth-child(2) {
  right: 2px;
  bottom: 7px;
  background: var(--coral);
}
.scanner-orbit span:nth-child(3) {
  bottom: 7px;
  left: 2px;
  background: var(--paper);
}

.elapsed-time {
  font: 700 26px/1 var(--mono);
}

.error-panel {
  grid-template-columns: auto 1fr;
  background: var(--coral);
}

.error-panel p {
  color: var(--ink);
}

.error-code {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border: 2px solid var(--ink);
  background: var(--paper);
  font: 800 14px/1 var(--mono);
}

.results {
  margin-top: 78px;
}

.results-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  padding-bottom: 22px;
  border-bottom: 2px solid var(--ink);
}

.result-url {
  display: inline-block;
  max-width: min(720px, 80vw);
  margin-top: 12px;
  overflow: hidden;
  color: var(--blue);
  font: 500 13px/1.4 var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.meta-badge,
.scope-badge,
.status-badge,
.heading-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 6px 9px;
  border: 1px solid var(--ink);
  background: var(--paper);
  font: 700 10px/1 var(--mono);
  letter-spacing: 0.04em;
  /* text-transform: uppercase; */
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 1px;
  margin: 28px 0 42px;
  border: 1px solid var(--ink);
  background: var(--ink);
}

.summary-card {
  min-height: 128px;
  padding: 18px;
  background: var(--paper);
}

.summary-card.is-accent {
  background: var(--acid);
}

.summary-card.is-danger {
  background: var(--coral);
}

.summary-card small {
  display: block;
  min-height: 28px;
  color: var(--muted);
  font: 700 10px/1.3 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.summary-card strong {
  display: block;
  margin-top: 12px;
  font: 600 28px/1 var(--display);
}

.result-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 16px;
}

.view-switcher {
  display: flex;
  border: 1px solid var(--ink);
}

.view-button {
  padding: 12px 16px;
  cursor: pointer;
  border: 0;
  border-right: 1px solid var(--ink);
  background: transparent;
  font: 700 11px/1 var(--mono);
  /* text-transform: uppercase; */
}

.view-button:last-child {
  border-right: 0;
}

.view-button.is-active {
  color: var(--paper);
  background: var(--ink);
}

.result-filters {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) repeat(3, 120px);
  gap: 8px;
  width: min(780px, 100%);
}

.result-filters input,
.result-filters select {
  min-height: 43px;
  background: rgba(243, 240, 229, 0.88);
  font-size: 12px;
}

.result-count {
  min-height: 24px;
  margin-bottom: 8px;
  color: var(--muted);
  font: 600 11px/1 var(--mono);
  text-transform: uppercase;
}

.table-shell {
  overflow-x: auto;
  border: 1px solid var(--ink);
  background: rgba(243, 240, 229, 0.9);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th,
.data-table td {
  padding: 14px 12px;
  vertical-align: top;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.data-table th:last-child,
.data-table td:last-child {
  border-right: 0;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--ink);
  color: var(--paper);
  font: 700 10px/1.2 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.url-cell {
  min-width: 270px;
  max-width: 480px;
}

.url-cell a,
.source-list a,
.entry-list a {
  color: var(--blue);
  font-family: var(--mono);
  overflow-wrap: anywhere;
}

.url-cell small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-family: var(--mono);
}

.scope-badge.internal {
  background: #dff1e4;
  color: #125738;
}
.scope-badge.external {
  background: #dfe9ff;
  color: #194da6;
}
.status-badge.ok {
  background: #dff1e4;
  color: #125738;
}
.status-badge.redirect {
  background: #fff0c9;
  color: #744a09;
}
.status-badge.broken,
.status-badge.error {
  background: #ffd8cf;
  color: #8b2118;
}
.status-badge.not_checked {
  background: #e4e1d8;
  color: #55574f;
}

.http-warning {
  display: table;
  margin-top: 7px;
  padding: 3px 7px;
  color: #8b2118;
  border: 1px solid currentColor;
  background: #ffd8cf;
  font: 700 10px/1.2 var(--mono);
  text-transform: uppercase;
}

.source-list {
  display: grid;
  min-width: 230px;
  gap: 7px;
}

.source-list a {
  display: block;
  max-width: 310px;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-mini {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

.source-mini span {
  padding: 3px 5px;
  border: 1px solid var(--line);
  font: 700 9px/1 var(--mono);
}

.source-mini .missing-h1 {
  color: var(--red);
  border-color: var(--red);
}

details.occurrence-details summary,
.page-card summary,
.file-card summary {
  cursor: pointer;
  font: 700 10px/1.3 var(--mono);
  /* text-transform: uppercase; */
}

.occurrence-list,
.heading-list,
.warning-list,
.entry-list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.occurrence-list li,
.heading-list li,
.warning-list li,
.entry-list li {
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.page-list,
.file-list {
  display: grid;
  gap: 14px;
}

.page-card,
.file-card,
.report-panel {
  border: 1px solid var(--ink);
  background: rgba(243, 240, 229, 0.92);
}

.page-card > summary,
.file-card > summary {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  padding: 18px;
  list-style: none;
}

.page-card > summary::-webkit-details-marker,
.file-card > summary::-webkit-details-marker {
  display: none;
}

.page-card[open] > summary,
.file-card[open] > summary {
  border-bottom: 1px solid var(--ink);
  background: var(--paper-deep);
}

.page-title {
  min-width: 0;
}

.page-title strong,
.page-title a {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-title a {
  margin-top: 5px;
  color: var(--blue);
  font: 500 11px/1.3 var(--mono);
}

.heading-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.heading-chip.is-zero {
  color: #96988f;
  border-color: var(--line);
}

.page-body,
.file-body,
.report-panel {
  padding: 20px;
}

.page-facts,
.file-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 1px;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  background: var(--line);
}

.fact {
  padding: 12px;
  background: var(--paper);
}

.fact small,
.fact strong {
  display: block;
}

.fact small {
  color: var(--muted);
  font: 700 9px/1.2 var(--mono);
  text-transform: uppercase;
}

.fact strong {
  margin-top: 6px;
  font-size: 14px;
}

.heading-list li {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
}

.heading-tag {
  color: var(--coral);
  font: 800 11px/1.5 var(--mono);
  text-transform: uppercase;
}

.empty-state {
  padding: 56px 24px;
  border: 1px dashed var(--ink);
  text-align: center;
}

.empty-state strong {
  display: block;
  font: 600 32px/1 var(--display);
}

.empty-state p {
  margin: 10px 0 0;
  color: var(--muted);
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.report-panel h3,
.file-body h3 {
  margin: 0 0 14px;
  font: 600 25px/1 var(--display);
}

.report-panel.full-width {
  grid-column: 1 / -1;
}

.warning-list li {
  color: #7a2b20;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 0 36px;
  border-top: 1px solid var(--ink);
  color: var(--muted);
  font: 600 10px/1.4 var(--mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.is-hidden {
  display: none !important;
}

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

.reveal {
  opacity: 0;
  transform: translateY(24px);
  animation: reveal 700ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.reveal-delay-1 {
  animation-delay: 120ms;
}

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

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 8px rgba(31, 138, 88, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(31, 138, 88, 0);
  }
}

@media (max-width: 1050px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-top: 110px;
  }

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

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

  .result-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .result-filters {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .site-header,
  main,
  .site-footer {
    width: min(100% - 28px, 1440px);
  }

  .site-header {
    padding: 16px 0;
  }

  .brand-copy small,
  .system-state {
    display: none;
  }

  .hero {
    gap: 28px;
    padding: 94px 0 48px;
  }

  .hero .eyebrow {
    top: 58px;
  }

  .hero h1 {
    font-size: clamp(48px, 15vw, 72px);
  }

  .scanner-panel {
    grid-template-columns: 1fr;
    box-shadow: 5px 5px 0 var(--ink);
  }

  .panel-index {
    align-items: center;
    justify-content: flex-start;
    min-height: 38px;
    padding: 10px 16px;
    border-right: 0;
    border-bottom: 2px solid var(--ink);
    writing-mode: horizontal-tb;
    transform: none;
  }

  .panel-body {
    padding: 24px 18px 28px;
  }

  .section-heading,
  .results-header,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .mode-switcher,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .mode-option {
    min-height: 68px;
    border-right: 0;
    border-bottom: 1px solid var(--ink);
  }

  .mode-option:last-child {
    border-bottom: 0;
  }

  .scan-button {
    width: 100%;
  }

  .scan-status {
    grid-template-columns: auto 1fr;
    padding: 22px 18px;
  }

  .elapsed-time {
    grid-column: 2;
    font-size: 17px;
  }

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

  .result-meta {
    justify-content: flex-start;
  }

  .result-filters {
    grid-template-columns: 1fr 1fr;
  }

  .result-filters label:first-child {
    grid-column: 1 / -1;
  }

  .page-card > summary,
  .file-card > summary {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .page-facts,
  .file-facts,
  .report-grid {
    grid-template-columns: 1fr 1fr;
  }

  .report-panel.full-width {
    grid-column: auto;
  }

  .site-footer {
    flex-direction: column;
  }
}

@media (max-width: 430px) {
  .summary-grid,
  .page-facts,
  .file-facts,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .view-switcher {
    width: 100%;
  }

  .view-button {
    flex: 1;
  }
}

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