/* SleeperLot — "measurement bench".
 *
 * The design direction comes from the product's own thesis rather than from a website
 * genre: this is an instrument that reports ranges and refuses to guess, so the page is
 * built out of the vocabulary of measurement — ruled edges with tick marks, a bone-paper
 * ground, ink, and one instrument blue used only where a number is being asserted.
 *
 * The signature element is the interval bar (.iv): every price claim is drawn as a band
 * with the observed value plotted on it, so a range reads as a picture instead of a pair
 * of numbers. It is the one loud thing; everything around it stays quiet.
 *
 * Data colours were validated with the dataviz palette checker against the paper surface
 * (#F5F4EE): band blue, miss red and gain green clear the lightness, chroma,
 * normal-vision and 3:1 contrast gates. Green vs red sits in the CVD warn band, which is
 * why every good/bad mark on this site also carries a word or a sign — never colour alone.
 */

:root {
  color-scheme: light;

  /* Ground */
  --paper: #f5f4ee;
  --card: #fbfaf6;
  --sunk: #eceae1;

  /* Ink */
  --ink: #14181b;
  --ink-2: #4b5157;
  --muted: #656b70;

  /* Rules */
  --rule: #d8d8d0;
  --rule-strong: #b6b6ac;

  /* Data */
  --signal: #1b45c4; /* the assertion: a number we stand behind */
  --signal-wash: #dfe4f8;
  --gain: #0f7a4a;
  --miss: #c33a2e;
  --miss-wash: #f3ddda;
  --silence: #8e9188; /* declined — deliberately mute */

  --display: "Archivo", "Archivo Expanded", ui-sans-serif, system-ui, sans-serif;
  --body: "Public Sans", ui-sans-serif, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --page: 1180px;
  --prose: 66ch;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink-2);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; display: flex; flex-direction: column; }

h1, h2, h3 {
  font-family: var(--display);
  font-stretch: 112%;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.1;
  margin: 0;
}

a { color: var(--signal); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

/* The recurring device: a hairline carrying measurement ticks. Used instead of a plain
   border wherever a section ends, so the page reads as ruled stock. */
.ticked {
  border-top: 1px solid var(--rule);
  background-image: repeating-linear-gradient(
    to right, var(--rule) 0 1px, transparent 1px 9px);
  background-repeat: no-repeat;
  background-size: 100% 4px;
  background-position: 0 0;
}

/* ---------- Header ---------- */

.site-header {
  display: flex;
  align-items: baseline;
  gap: 2rem;
  flex-wrap: wrap;
  max-width: var(--page);
  width: 100%;
  margin: 0 auto;
  padding: 1.4rem 1.5rem 1rem;
}

.site-header .brand {
  font-family: var(--display);
  font-stretch: 125%;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
}

.site-header nav {
  display: flex;
  gap: 1.35rem;
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.site-header nav a {
  color: var(--muted);
  text-decoration: none;
  padding-bottom: 0.15rem;
  border-bottom: 2px solid transparent;
}
.site-header nav a:hover { color: var(--ink); }
.site-header nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--signal);
}

.header-rule {
  max-width: var(--page);
  width: 100%;
  margin: 0 auto 2rem;
  padding: 0 1.5rem;
}
.header-rule > div { height: 4px; }

/* ---------- Shell ---------- */

main {
  flex: 1;
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

/* The prose column sits at the page's left edge, under the wordmark, rather than centred
   in the viewport — the header is the page's baseline and text that drifts away from it
   reads as a different document. */
main.prose > * { max-width: var(--prose); }

.site-footer {
  max-width: var(--page);
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 2.5rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.74rem;
  line-height: 1.7;
  letter-spacing: 0.02em;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.6rem;
}

.page-title { font-size: clamp(1.9rem, 4vw, 2.6rem); margin-bottom: 0.4rem; }

.page-sub {
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 72ch;
  margin: 0 0 2rem;
}

/* ---------- Landing ---------- */

.hero { padding: 1rem 0 2.5rem; }

.hero h1 {
  font-size: clamp(2.1rem, 4.4vw, 3.3rem);
  max-width: 20ch;
  margin-bottom: 1.5rem;
}

.hero .lede {
  font-size: 1.08rem;
  max-width: 56ch;
  color: var(--ink-2);
  margin: 0 0 2rem;
}

.cta-row { display: flex; gap: 0.75rem; flex-wrap: wrap; }

.cta {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.75rem 1.15rem;
  background: var(--signal);
  color: #fff;
  border: 1px solid var(--signal);
}
.cta:hover { background: var(--ink); border-color: var(--ink); color: #fff; }

.cta.secondary { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
.cta.secondary:hover { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Readouts: the day bar and the calibration bar ---------- */

.readouts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2.5rem;
  padding: 2rem 0 1rem;
}

.readout .head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.readout .head .k {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.readout .head .v {
  font-family: var(--display);
  font-stretch: 112%;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--ink);
}

/* Proportion bar. Segments are separated by a 2px gap in the paper colour rather than
   by a stroke — white does the separating, per the dataviz mark spec. */
.prop {
  display: flex;
  gap: 2px;
  height: 26px;
  background: var(--paper);
}
.prop .seg { height: 100%; min-width: 2px; }
.prop .seg.silence { background: var(--silence); }
.prop .seg.signal { background: var(--signal); }
.prop .seg.miss { background: var(--miss); }
.prop .seg.priced { background: var(--signal-wash); border: 1px solid var(--signal); box-sizing: border-box; }

.prop-legend {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 0.6rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}
.prop-legend .key { display: flex; align-items: center; gap: 0.45rem; }
.prop-legend .swatch { width: 10px; height: 10px; flex: none; }
.prop-legend .swatch.silence { background: var(--silence); }
.prop-legend .swatch.signal { background: var(--signal); }
.prop-legend .swatch.miss { background: var(--miss); }
.prop-legend .swatch.priced { background: var(--signal-wash); border: 1px solid var(--signal); box-sizing: border-box; }
.prop-legend strong { color: var(--ink); font-weight: 600; }

/* The 80% target on the calibration bar: a tick, so "81.2%" is read against the thing it
   is supposed to hit rather than in isolation. */
.target-rail {
  position: relative;
  height: 14px;
  margin-bottom: 2px;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
}
.target-rail .tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}
.target-rail .tick::after {
  content: "";
  display: block;
  width: 1px;
  height: 6px;
  margin: 2px auto 0;
  background: var(--rule-strong);
}

.readout .note {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 46ch;
}

.stat-note {
  font-size: 0.82rem;
  color: var(--muted);
  max-width: 72ch;
  margin: 1.5rem 0 0;
}
.stat-note code { font-family: var(--mono); font-size: 0.85em; }

/* ---------- Explainer ---------- */

.explainer { max-width: var(--prose); padding-top: 3rem; }
.explainer h2 { font-size: 1.3rem; margin: 2.5rem 0 0.6rem; }
.explainer h2:first-child { margin-top: 0; }
.explainer p { margin: 0 0 1rem; }

/* ---------- Prose / method ---------- */

.prose h2 {
  font-size: 1.25rem;
  margin: 2.75rem 0 0.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}
.prose p { margin: 0 0 1rem; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose em { color: var(--ink-2); }
.prose ul { margin: 0 0 1.25rem; padding-left: 1.1rem; }
.prose li { margin-bottom: 0.6rem; }
.prose code {
  font-family: var(--mono);
  font-size: 0.85em;
  color: var(--ink);
  background: var(--sunk);
  padding: 0.05rem 0.3rem;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0 1.5rem;
  font-size: 0.92rem;
}
.prose th, .prose td {
  text-align: left;
  padding: 0.55rem 0.8rem 0.55rem 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
.prose th {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom-color: var(--rule-strong);
}
.prose td:first-child { white-space: nowrap; }

.ladder td:first-child {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--ink);
  width: 3rem;
}
.ladder tr.ok td:first-child {
  box-shadow: inset 3px 0 0 var(--signal);
  padding-left: 0.8rem;
}
.ladder tr.no td { color: var(--muted); }
.ladder tr.no td:first-child {
  box-shadow: inset 3px 0 0 var(--rule-strong);
  padding-left: 0.8rem;
  color: var(--muted);
}

.callout {
  border-left: 3px solid var(--signal);
  background: var(--card);
  padding: 1rem 1.1rem;
  margin: 0 0 1.25rem;
}
.callout strong { color: var(--ink); }

/* ---------- The interval bar: the signature mark ---------- */

/* Capped rather than full-bleed: past about this width the observation tick and its
   caption stop reading as one object. */
.iv, .iv-scale, .iv-caption { max-width: 540px; }

.iv {
  --iv-h: 26px;
  position: relative;
  height: var(--iv-h);
  margin: 0.55rem 0 0.3rem;
}

/* The domain line. Hairline, solid, recessive — it is the ruler, not the data. */
.iv .axis {
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  height: 1px;
  background: var(--rule);
}

/* The claimed range. A wash, not a saturated block. */
.iv .band {
  position: absolute;
  top: calc(50% - 7px);
  height: 14px;
  background: var(--signal-wash);
  border-left: 2px solid var(--signal);
  border-right: 2px solid var(--signal);
}
.iv.is-miss .band { background: var(--miss-wash); border-color: var(--miss); }

/* The observed value. A 2px rule with a dot, ringed in the surface colour so it stays
   legible where it sits on top of the band. */
.iv .obs {
  position: absolute;
  top: calc(50% - 11px);
  width: 2px;
  height: 22px;
  background: var(--ink);
  transform: translateX(-1px);
}
.iv .obs::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 0 2px var(--paper);
  transform: translate(-50%, -50%);
}
.iv.is-miss .obs, .iv.is-miss .obs::after { background: var(--miss); }
.iv.is-gain .obs, .iv.is-gain .obs::after { background: var(--gain); }

.iv-scale {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
}

.iv-caption {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.35rem;
}
.iv-caption strong { color: var(--ink); font-weight: 500; }

/* ---------- Filters ---------- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: end;
  padding: 0 0 1rem;
  border-bottom: 1px solid var(--rule-strong);
  margin: 2.5rem 0 1.5rem;
}

.filter-bar .field { display: flex; flex-direction: column; gap: 0.3rem; }

.filter-bar label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.filter-bar select,
.filter-bar button {
  font-family: var(--body);
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--rule-strong);
  padding: 0.45rem 0.6rem;
}
.filter-bar button { cursor: pointer; }
.filter-bar button:hover { border-color: var(--ink); }

.filter-count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  align-self: center;
}

/* ---------- Cards ---------- */

.feed { list-style: none; margin: 0; padding: 0; }

.card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) minmax(150px, auto);
  gap: 1.25rem;
  padding: 1.4rem 0;
  border-top: 1px solid var(--rule);
  align-items: start;
}
.card:last-child { border-bottom: 1px solid var(--rule); }

.card.board-card { grid-template-columns: minmax(0, 1fr) minmax(150px, auto); }

.card .thumb,
.card .thumb-fallback {
  width: 56px;
  height: 56px;
  object-fit: cover;
  background: var(--sunk);
  border: 1px solid var(--rule);
}
.card .thumb-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--muted);
  text-align: center;
}

.card .body { min-width: 0; }

.card .title-row { margin-bottom: 0.5rem; }
.card .title-row a,
.card .title-row .untitled {
  font-family: var(--display);
  font-stretch: 100%;
  font-weight: 600;
  font-size: 1.02rem;
  line-height: 1.3;
  color: var(--ink);
  text-decoration: none;
}
.card .title-row a:hover { color: var(--signal); text-decoration: underline; }

.badges { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.4rem; }

.badge {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.1rem 0;
}
.badge + .badge { padding-left: 0.5rem; border-left: 1px solid var(--rule); }

.badge-outcome-hit { color: var(--signal); font-weight: 600; }
.badge-outcome-miss { color: var(--miss); font-weight: 600; }
.badge-outcome-priced { color: var(--ink); font-weight: 600; }
.badge-outcome-no_estimate { color: var(--muted); font-weight: 600; }
.badge-conf-high, .badge-conf-medium { color: var(--ink-2); }
.badge-conf-low, .badge-conf-none { color: var(--muted); }

.price-lines {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--ink-2);
  margin-top: 0.5rem;
}
.price-lines .row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.price-lines .k { color: var(--muted); min-width: 9rem; }
.price-lines .v { color: var(--ink); }
.price-lines .n { color: var(--muted); }

.attention {
  display: flex;
  gap: 1.1rem;
  flex-wrap: wrap;
  margin-top: 0.6rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}
.attention .pill strong { color: var(--ink); font-weight: 600; }
.attention .pill.zero-bids strong { color: var(--gain); }
.attention .pill.countdown { color: var(--ink); font-variant-numeric: tabular-nums; }

.headline { text-align: right; }
.headline .savings {
  font-family: var(--display);
  font-stretch: 112%;
  font-weight: 700;
  font-size: 1.45rem;
  line-height: 1.1;
  color: var(--ink);
}
.headline .savings.positive { color: var(--gain); }
.headline .savings.negative { color: var(--miss); }
.headline .savings.unknown { color: var(--muted); }

.headline .savings-label,
.headline .savings-sub {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.2rem;
}

.no-estimate-note {
  margin: 0.6rem 0 0;
  font-size: 0.84rem;
  color: var(--muted);
  max-width: 56ch;
}

/* ---------- Totals, empty states, funnel ---------- */

.totals-footer {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
  padding-top: 1rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}
.totals-footer strong { color: var(--ink); font-weight: 600; }

.price-lines .row.closed-at .v {
  font-weight: 700;
  color: var(--ink);
}

.empty-state {
  padding: 3rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
  max-width: 62ch;
}
.empty-state strong {
  display: block;
  font-family: var(--display);
  font-stretch: 112%;
  font-size: 1.3rem;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.stale-banner {
  border-left: 3px solid var(--miss);
  background: var(--miss-wash);
  color: var(--ink);
  padding: 0.8rem 1rem;
  margin: 0 0 1.5rem;
  font-size: 0.88rem;
}

.funnel { margin: 2.5rem 0; }
.funnel h2 {
  font-family: var(--mono);
  font-stretch: normal;
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.75rem;
}
.funnel-table { border-collapse: collapse; font-size: 0.85rem; }
.funnel-table td {
  padding: 0.3rem 1rem 0.3rem 0;
  border-bottom: 1px solid var(--rule);
  color: var(--ink-2);
}
.funnel-table td.count {
  font-family: var(--mono);
  color: var(--ink);
  text-align: right;
  min-width: 4rem;
}
.funnel-note { font-size: 0.8rem; color: var(--muted); margin-top: 0.75rem; max-width: 60ch; }

.method-note {
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 68ch;
  margin: 1.5rem 0 0;
}

/* ---------- Waitlist ---------- */

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

.waitlist {
  margin-top: 3.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--rule-strong);
  max-width: var(--prose);
}
.waitlist h2 { font-size: 1.2rem; margin-bottom: 0.6rem; }
.waitlist p { margin: 0 0 1.25rem; }

.waitlist form { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.waitlist input[type="email"] {
  flex: 1 1 18rem;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--rule-strong);
  padding: 0.7rem 0.75rem;
}
.waitlist input[type="email"]::placeholder { color: var(--muted); }
.waitlist button {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--signal);
  color: #fff;
  border: 1px solid var(--signal);
  padding: 0.7rem 1.15rem;
  cursor: pointer;
}
.waitlist button:hover:not(:disabled) { background: var(--ink); border-color: var(--ink); }
.waitlist button:disabled { opacity: 0.55; cursor: default; }

.waitlist-status {
  margin: 0.85rem 0 0;
  font-size: 0.86rem;
  min-height: 1.2em;
  color: var(--muted);
}
.waitlist-status.ok { color: var(--gain); }
.waitlist-status.error { color: var(--miss); }

/* ---------- Responsive ---------- */

@media (max-width: 720px) {
  .card { grid-template-columns: 48px minmax(0, 1fr); }
  .card.board-card { grid-template-columns: minmax(0, 1fr); }
  .card .thumb, .card .thumb-fallback { width: 48px; height: 48px; }
  .headline {
    grid-column: 1 / -1;
    text-align: left;
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
  }
  .headline .savings-label, .headline .savings-sub { margin-top: 0; }
  .site-header nav { margin-left: 0; width: 100%; gap: 1rem; }
  .filter-count { margin-left: 0; }
}

@media (prefers-reduced-motion: no-preference) {
  .card { transition: background-color 120ms ease; }
  .card:hover { background: var(--card); }
}

.site-footer .footer-links { display: block; margin-top: 0.5rem; }
.site-footer .footer-links a { color: var(--muted); text-decoration: underline; text-underline-offset: 0.2em; }
.site-footer .footer-links a:hover { color: var(--ink); }
