:root {
  --bg: #f6f5f1;
  --ink: #1a1a18;
  --muted: #5c5a52;
  --line: #d9d6cc;
  --card: #ffffff;
  --accent: #2c4a3e;
  --accent-soft: #e8efe9;
  --warn: #6b4e16;
  --warn-bg: #f7f0de;
  --good: #1f5c3a;
  --bad: #7a2e2e;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(26, 26, 24, 0.06), 0 8px 24px rgba(26, 26, 24, 0.04);
  --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sticky-w: 11.5rem;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  font-size: 16px;
}

a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }

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

.wrap {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

.topbar {
  border-bottom: 1px solid var(--line);
  background: var(--card);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  text-decoration: none;
  color: inherit;
}
.brand strong {
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.brand span {
  color: var(--muted);
  font-size: 0.85rem;
}
.nav {
  display: flex;
  gap: 1rem;
  font-size: 0.9rem;
}
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover { color: var(--ink); }

.hero {
  padding: 2.5rem 0 1.5rem;
}
.hero h1 {
  margin: 0 0 0.6rem;
  font-size: clamp(1.6rem, 3.5vw, 2.25rem);
  letter-spacing: -0.03em;
  line-height: 1.2;
  max-width: 18ch;
}
.lede {
  margin: 0;
  max-width: 52ch;
  color: var(--muted);
  font-size: 1.05rem;
}
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--muted);
}
.pill.fresh {
  background: var(--accent-soft);
  border-color: #c5d6c9;
  color: var(--accent);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  margin: 0.5rem 0 0.75rem;
  padding: 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 140px; }
.field label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.field select, .field input {
  font: inherit;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
.field input { min-width: 180px; }
.check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  color: var(--muted);
  padding-bottom: 0.45rem;
}
.check input { accent-color: var(--accent); }

.table-hint {
  margin: 0 0 0.55rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.table-shell {
  position: relative;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}
.table-shell.can-scroll .table-fade {
  opacity: 1;
}
.table-shell.scrolled-end .table-fade {
  opacity: 0;
}
.table-fade {
  position: sticky;
  left: 0;
  float: right;
  width: 2.5rem;
  height: 0;
  margin-right: -2.5rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 5;
}
.table-fade::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 2.5rem;
  height: 100%;
  min-height: 12rem;
  background: linear-gradient(to left, var(--card), transparent);
  pointer-events: none;
}

/* Fix fade height: overlay on shell instead */
.table-shell > .table-fade {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 2.75rem;
  height: auto;
  float: none;
  margin: 0;
  background: linear-gradient(to left, rgba(255,255,255,0.95), transparent);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  z-index: 4;
}
.table-shell.can-scroll:not(.scrolled-end) > .table-fade {
  opacity: 1;
}
.table-fade::after { display: none; }

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 0;
  font-size: 0.92rem;
  table-layout: fixed;
}
th, td {
  padding: 0.85rem 0.85rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}
th {
  background: #faf9f5;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
  user-select: none;
}
th[data-sort] { cursor: pointer; }
th[data-sort]:hover { color: var(--ink); }
th .sort-ind { opacity: 0.45; margin-left: 0.25rem; }
th.active .sort-ind { opacity: 1; color: var(--accent); }
.th-more { text-transform: uppercase; }

.col-provider { width: 18%; }
.col-rent { width: 18%; }
.col-scan { width: 24%; }
.col-street { width: 12%; }
.col-llc { width: 16%; }
.col-more { width: 12%; text-align: right; }

/* Sticky provider on mid widths when table can scroll */
@media (min-width: 721px) and (max-width: 980px) {
  table { table-layout: auto; min-width: 720px; }
  .col-provider,
  th.col-provider {
    position: sticky;
    left: 0;
    z-index: 3;
    background: var(--card);
    box-shadow: 4px 0 8px -6px rgba(26, 26, 24, 0.35);
    min-width: var(--sticky-w);
    width: var(--sticky-w);
  }
  th.col-provider {
    background: #faf9f5;
    z-index: 6;
  }
  .col-rent, .col-scan { min-width: 11rem; }
  .col-street, .col-llc { min-width: 7.5rem; }
  .col-more { min-width: 5.5rem; }
}

@media (min-width: 981px) {
  .col-provider { width: 16%; }
  .col-rent { width: 18%; }
  .col-scan { width: 26%; }
  .col-street { width: 12%; }
  .col-llc { width: 16%; }
  .col-more { width: 12%; }
}

tr.cmp-row:last-of-type td,
tr.detail-row:last-child td { border-bottom: none; }
tr.cmp-row.is-open td { border-bottom-color: transparent; }
tr.cmp-row.hidden,
tr.detail-row.hidden-by-filter { display: none; }

.provider {
  font-weight: 600;
  letter-spacing: -0.01em;
}
.provider a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.provider a:hover { border-bottom-color: var(--accent); color: var(--accent); }
.sub {
  display: block;
  margin-top: 0.25rem;
  font-weight: 400;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}
.num {
  font-family: var(--mono);
  font-size: 0.88rem;
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
}
.tag {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}
.tag.yes { background: #e5f3ea; color: var(--good); }
.tag.maybe { background: var(--warn-bg); color: var(--warn); }
.tag.no { background: #f6e8e8; color: var(--bad); }

.cta {
  display: inline-block;
  margin-top: 0.55rem;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  background: var(--accent);
  color: #fff !important;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
}
.cta:hover { filter: brightness(1.05); }
.cta.todo {
  background: #eceae3;
  color: var(--muted) !important;
  border: 1px dashed #b8b4a8;
}

.detail-toggle {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid #c5d6c9;
  border-radius: 8px;
  padding: 0.4rem 0.65rem;
  cursor: pointer;
  white-space: nowrap;
}
.detail-toggle:hover { filter: brightness(0.98); }
.detail-toggle[aria-expanded="true"] {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.detail-toggle::after {
  content: " ▾";
  font-size: 0.7em;
}
.detail-toggle[aria-expanded="true"]::after { content: " ▴"; }

.detail-row td {
  background: #faf9f5;
  padding: 0 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
}
.detail-row[hidden] { display: none; }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1.25rem;
  padding: 0.85rem 0.15rem 0.15rem;
  border-top: 1px dashed var(--line);
}
.detail-block h3 {
  margin: 0 0 0.3rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
}
.detail-block p {
  margin: 0;
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.45;
  max-width: none;
}
.detail-note {
  grid-column: 1 / -1;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
}

.section {
  padding: 2.25rem 0 0.5rem;
}
.section h2 {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}
.section p, .section li {
  color: var(--muted);
  max-width: 68ch;
}
.unverifiable {
  margin-top: 1rem;
  color: var(--muted);
  max-width: 68ch;
}
.score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
  margin-top: 1rem;
}
.score-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
}
.score-card h3 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
}
.score-card p {
  margin: 0;
  font-size: 0.88rem;
}

.callout {
  margin-top: 1.25rem;
  padding: 1rem 1.1rem;
  background: var(--warn-bg);
  border: 1px solid #e6d7a8;
  border-radius: var(--radius);
  color: var(--warn);
  font-size: 0.9rem;
}
.callout strong { color: var(--ink); }

.sources {
  margin-top: 1rem;
  font-size: 0.85rem;
}
.sources ul { padding-left: 1.1rem; margin: 0.4rem 0 0; }
.sources li { margin: 0.25rem 0; }

footer {
  margin-top: 3rem;
  padding: 1.5rem 0 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
}
.footer-brand { color: var(--ink); font-weight: 600; }
.thesis { font-style: italic; }

/* —— Mobile / narrow: card stack, no horizontal clip —— */
@media (max-width: 720px) {
  .nav { display: none; }
  .brand span { display: none; }
  .hero { padding-top: 1.75rem; }
  .controls { padding: 0.85rem; }
  .field, .field input { min-width: 100%; width: 100%; }
  .controls .check { width: 100%; padding-bottom: 0; }
  .table-hint { display: none !important; }

  .table-shell {
    overflow: visible;
    border: none;
    background: transparent;
    box-shadow: none;
  }
  .table-shell > .table-fade { display: none; }

  table,
  thead,
  tbody,
  tr.cmp-row,
  tr.detail-row,
  th,
  td {
    display: block;
    width: 100% !important;
    min-width: 0 !important;
  }
  thead { display: none; }
  table { min-width: 0; table-layout: auto; border-collapse: collapse; }

  tr.cmp-row {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.85rem 1rem 0.35rem;
    margin-bottom: 0;
  }
  tr.cmp-row.is-open {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom-color: transparent;
    margin-bottom: 0;
  }
  tr.cmp-row:not(.is-open) { margin-bottom: 0.85rem; }
  tr.cmp-row.hidden { display: none; }

  tr.cmp-row td {
    border: none;
    padding: 0.45rem 0;
  }
  tr.cmp-row td.col-provider {
    padding-top: 0;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: 0.35rem;
  }
  tr.cmp-row td.col-provider::before { display: none; }

  tr.cmp-row td:not(.col-provider):not(.col-more) {
    display: grid;
    grid-template-columns: 7.5rem minmax(0, 1fr);
    gap: 0.5rem 0.75rem;
    align-items: start;
  }
  tr.cmp-row td:not(.col-provider):not(.col-more)::before {
    content: attr(data-label);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    font-weight: 600;
    padding-top: 0.15rem;
  }

  tr.cmp-row td.col-more {
    padding: 0.65rem 0 0.85rem;
    text-align: left;
  }
  .detail-toggle { width: 100%; text-align: center; }

  tr.detail-row td {
    background: #faf9f5;
    border: 1px solid var(--line);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    margin-bottom: 0.85rem;
    padding: 0 1rem 1rem;
  }
  tr.detail-row[hidden] { display: none; }
  tr.detail-row.hidden-by-filter { display: none; }

  .detail-grid {
    grid-template-columns: 1fr;
    padding-top: 0.75rem;
  }
}

@media (min-width: 721px) {
  .detail-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .detail-note { grid-column: 1 / -1; }
}

/* —— Guide pages (e.g. Delaware LLC) —— */
.crumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 1.25rem 0 0;
}
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--accent); }
.crumb .sep { opacity: 0.5; }

.guide-hero h1 { max-width: 22ch; }
.guide-lede { max-width: 60ch; }

.split-callouts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.85rem;
  margin: 1.25rem 0 0;
}
.split-callouts .callout { margin: 0; }
.callout.ok {
  background: var(--accent-soft);
  border-color: #c5d6c9;
  color: var(--accent);
}
.callout.ok strong { color: var(--ink); }
.callout.danger {
  background: #f6e8e8;
  border-color: #e2bcbc;
  color: var(--bad);
}
.callout.danger strong { color: var(--ink); }

.guide-section { padding: 2rem 0 0.25rem; }
.guide-section h2 {
  margin: 0 0 0.65rem;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}
.guide-section > p {
  margin: 0 0 1rem;
  color: var(--muted);
  max-width: 68ch;
}

.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.75rem;
}
.steps li {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  max-width: none;
  color: var(--ink);
  font-size: 0.95rem;
}
.steps strong { display: block; margin-bottom: 0.2rem; letter-spacing: -0.01em; }
.steps span { color: var(--muted); font-size: 0.9rem; }

.pick-list {
  display: grid;
  gap: 0.85rem;
}
.pick-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.15rem;
}
.pick-card header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.65rem;
}
.pick-card h3 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.pick-card .price {
  font-family: var(--mono);
  font-size: 0.88rem;
  color: var(--accent);
  font-weight: 500;
}
.pick-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}
.pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem 1.1rem;
  margin: 0.5rem 0 0.85rem;
}
.pick-grid h4 {
  margin: 0 0 0.25rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.pick-grid p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink);
  max-width: none;
}
.pick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.35rem;
}
.pick-actions .cta { margin-top: 0; }

.unknown {
  border-left: 3px solid #e6d7a8;
  padding: 0.75rem 0.9rem;
  background: var(--warn-bg);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--warn);
  font-size: 0.9rem;
  margin: 0.85rem 0 0;
}
.unknown strong { color: var(--ink); }

.checklist {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--muted);
}
.checklist li { margin: 0.4rem 0; max-width: 68ch; }

.related {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.75rem;
}
.related a {
  display: inline-block;
  padding: 0.55rem 0.85rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  color: var(--ink);
  font-size: 0.9rem;
}
.related a:hover { border-color: var(--accent); color: var(--accent); }

.nav-pill {
  display: none;
}
@media (min-width: 641px) {
  .nav .nav-pill {
    display: inline;
    color: var(--accent);
    font-weight: 500;
  }
}
