/* unwarrantablecondos.com — "lapsed ledger" design.
   Paper + ink + rubber-stamp vermilion. Mobile-first; no external fonts. */
:root {
  --paper: #f3ede2;
  --paper-2: #ebe3d4;
  --card: #fbf8f2;
  --ink: #1c2330;
  --ink-2: #4a5263;
  --ink-3: #6b7180;
  --rule: #d6cbb7;
  --stamp: #b8401f;
  --stamp-soft: #f6dcd2;
  --sage: #3f6b4f;
  --sage-soft: #dde9df;
  --amber: #8a5a00;
  --amber-soft: #f4e6c4;
  --focus: #1f5fbf;
  --shadow: 0 1px 0 rgba(28,35,48,.06), 0 6px 18px -10px rgba(28,35,48,.35);
  --radius: 10px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, ui-serif, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --card-min: 280px;
  --maxw: 1180px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12161d;
    --paper-2: #181d26;
    --card: #1c222c;
    --ink: #ece5d8;
    --ink-2: #c3bcae;
    --ink-3: #9a9486;
    --rule: #2f3744;
    --stamp: #ff8a66;
    --stamp-soft: #3a211b;
    --sage: #8fc4a0;
    --sage-soft: #1e2e24;
    --amber: #f0c060;
    --amber-soft: #332910;
    --focus: #7fb0ff;
    --shadow: 0 1px 0 rgba(0,0,0,.3), 0 8px 22px -12px rgba(0,0,0,.8);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 17px/1.55 var(--sans); overflow-wrap: anywhere;
}
img, svg { max-width: 100%; }
a { color: inherit; text-decoration-color: var(--stamp); text-underline-offset: 3px; }
a:hover { color: var(--stamp); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--ink); color: var(--paper); padding: 12px 16px; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.15; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 7vw, 3.6rem); margin: .2em 0 .35em; }
h2 { font-size: clamp(1.45rem, 4.5vw, 2.1rem); margin: 1.6em 0 .5em; }
h3 { font-size: 1.2rem; margin: 1.2em 0 .4em; }
p { margin: 0 0 1em; }
.lede { font-size: 1.15rem; color: var(--ink-2); max-width: 46em; }
.muted { color: var(--ink-3); }
.small { font-size: .88rem; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------- header / nav ---------------- */
.site-header { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--rule); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--serif); font-weight: 700; font-size: 1.1rem; min-height: 44px; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand b { color: var(--stamp); font-weight: 700; }
.nav-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 44px; min-height: 44px; padding: 0 12px; border: 1px solid var(--rule); background: var(--card); color: var(--ink); border-radius: 8px; font: 600 16px var(--sans); cursor: pointer; }
.nav-toggle .bars, .nav-toggle .bars::before, .nav-toggle .bars::after { display: block; width: 18px; height: 2px; background: currentColor; position: relative; content: ""; transition: transform .2s; }
.nav-toggle .bars::before { position: absolute; top: -6px; }
.nav-toggle .bars::after { position: absolute; top: 6px; }
.nav-toggle[aria-expanded="true"] .bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .bars::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bars::after { transform: translateY(-6px) rotate(-45deg); }
.site-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--paper); border-bottom: 1px solid var(--rule); box-shadow: var(--shadow); }
.site-nav.open { display: block; }
.site-nav ul { list-style: none; margin: 0; padding: 8px 16px 16px; }
.site-nav a { display: flex; align-items: center; min-height: 48px; padding: 0 8px; text-decoration: none; font-weight: 600; border-bottom: 1px solid var(--rule); }
.site-nav a[aria-current="page"] { color: var(--stamp); }
@media (min-width: 820px) {
  .nav-toggle { display: none; }
  .site-nav { display: block; position: static; background: none; border: 0; box-shadow: none; }
  .site-nav ul { display: flex; gap: 4px; padding: 0; }
  .site-nav a { border: 0; min-height: 44px; padding: 0 12px; border-radius: 8px; }
  .site-nav a:hover { background: var(--paper-2); }
  .site-nav a[aria-current="page"] { background: var(--stamp-soft); }
}

/* ---------------- stamps / badges ---------------- */
.stamp { display: inline-flex; align-items: center; gap: 6px; font: 700 .72rem/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--stamp); border: 2px solid currentColor; border-radius: 4px; padding: 5px 7px 4px; transform: rotate(-2deg); background: var(--stamp-soft); white-space: nowrap; }
.badge { display: inline-flex; align-items: center; font: 600 .78rem/1 var(--sans); padding: 5px 8px; border-radius: 99px; background: var(--paper-2); color: var(--ink-2); white-space: nowrap; }
.badge.warn { background: var(--amber-soft); color: var(--amber); }
.badge.good { background: var(--sage-soft); color: var(--sage); }
.badge.cut { background: var(--stamp-soft); color: var(--stamp); }

/* ---------------- hero ---------------- */
.hero { padding: 28px 0 8px; border-bottom: 1px solid var(--rule); background:
  repeating-linear-gradient(0deg, transparent 0 31px, color-mix(in srgb, var(--rule) 45%, transparent) 31px 32px); }
.hero .kicker { font: 700 .8rem var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--stamp); }
.hero h1 em { font-style: italic; color: var(--stamp); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 26px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 8px; border: 2px solid var(--ink); background: var(--ink); color: var(--paper); font: 700 16px var(--sans); text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--stamp); border-color: var(--stamp); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { color: #fff; }
.btn.small { min-height: 44px; padding: 0 14px; font-size: 15px; }

/* ---------------- tiles ---------------- */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 18px 0; }
@media (min-width: 720px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; } }
.tile { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); min-width: 0; }
.tile .v { font: 700 clamp(1.35rem, 5vw, 2rem)/1.1 var(--mono); font-variant-numeric: tabular-nums; }
.tile .k { font-size: .85rem; color: var(--ink-2); margin-top: 6px; }
.tile .s { font-size: .78rem; color: var(--ink-3); margin-top: 4px; }
.tile.accent { border-color: var(--stamp); }
.tile.accent .v { color: var(--stamp); }
.skeleton { color: transparent !important; background: linear-gradient(90deg, var(--paper-2), var(--rule), var(--paper-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------------- prose sections ---------------- */
.prose { max-width: 44em; }
.cols { display: grid; gap: 14px; }
@media (min-width: 760px) { .cols { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.panel { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px; }
.panel h3 { margin-top: 0; }
.callout { border-left: 4px solid var(--stamp); background: var(--stamp-soft); padding: 14px 16px; border-radius: 0 8px 8px 0; margin: 18px 0; }
.callout.neutral { border-color: var(--amber); background: var(--amber-soft); }
ol.steps, ul.ticks { padding-left: 1.2em; }
ol.steps li, ul.ticks li { margin: .45em 0; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
dl.kv dt { color: var(--ink-3); font-size: .9rem; }
dl.kv dd { margin: 0; }

/* ---------------- listings layout ---------------- */
.page-head { padding: 22px 0 6px; }
.page-head h1 { font-size: clamp(1.8rem, 6vw, 2.8rem); }
.proxy-note { font-size: .9rem; }
.toolbar { position: sticky; top: 61px; z-index: 30; background: var(--paper); border-bottom: 1px solid var(--rule); padding: 10px 0; }
.toolbar .wrap { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.toolbar .search { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label, .field .lbl { font: 600 .8rem var(--sans); color: var(--ink-2); letter-spacing: .02em; }
input, select, button { font: inherit; }
input[type="search"], input[type="number"], select {
  width: 100%; min-height: 44px; font-size: 16px; padding: 8px 12px; border: 1px solid var(--rule); border-radius: 8px;
  background: var(--card); color: var(--ink);
}
input[type="range"] { width: 100%; min-height: 44px; accent-color: var(--stamp); }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 16px; }
.check input { width: 22px; height: 22px; accent-color: var(--stamp); }
.toolbar .controls { grid-column: 1 / -1; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: end; }
.toolbar .density { display: none; }
.filter-btn { min-height: 44px; }
.filter-btn .count { background: var(--stamp); color: #fff; border-radius: 99px; padding: 1px 7px; font-size: .78rem; }
.filter-btn .count:empty { display: none; }
@media (min-width: 560px) {
  .toolbar .controls { grid-template-columns: auto minmax(0, 1fr) minmax(0, 200px); }
  .toolbar .density { display: flex; }
}
.layout { display: grid; gap: 20px; padding: 18px 0 40px; }
.results-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 12px; }

/* filter drawer: off-canvas on mobile, sticky sidebar on desktop */
.filters { position: fixed; inset: 0 0 0 auto; width: min(92vw, 380px); background: var(--paper); z-index: 60; transform: translateX(105%); transition: transform .25s ease; display: flex; flex-direction: column; box-shadow: -10px 0 30px rgba(0,0,0,.25); visibility: hidden; }
.filters.open { transform: none; visibility: visible; }
.filters header { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--rule); }
.filters header h2 { margin: 0; font-size: 1.3rem; }
.filters .body { padding: 16px; overflow-y: auto; display: grid; gap: 14px; flex: 1; }
.filters footer { padding: 12px 16px; border-top: 1px solid var(--rule); display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.icon-btn { min-width: 44px; min-height: 44px; border: 1px solid var(--rule); border-radius: 8px; background: var(--card); color: var(--ink); cursor: pointer; font-size: 22px; line-height: 1; }
.scrim { position: fixed; inset: 0; background: rgba(10,12,16,.45); z-index: 55; }
.scrim[hidden] { display: none; }
.range2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (min-width: 980px) {
  .layout { grid-template-columns: 270px minmax(0, 1fr); align-items: start; }
  .filters { position: sticky; top: 140px; inset: auto; width: auto; transform: none; visibility: visible; box-shadow: none; background: transparent; border: 1px solid var(--rule); border-radius: var(--radius); max-height: calc(100vh - 160px); z-index: 1; }
  .filters .close, .filters .apply, .filter-btn { display: none; }
  .filters footer { grid-template-columns: 1fr; }
  .scrim { display: none !important; }
  .toolbar .controls { grid-template-columns: minmax(0, 1fr) minmax(0, 220px); }
}

/* ---------------- grid + cards ---------------- */
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(var(--card-min), 100%), 1fr)); }
@media (max-width: 480px) { .grid { grid-template-columns: minmax(0, 1fr); } }
.card { position: relative; display: flex; flex-direction: column; gap: 10px; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card:hover { border-color: var(--ink-3); }
.card .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.card .price { font: 700 1.5rem/1.1 var(--mono); font-variant-numeric: tabular-nums; }
.card .was { font-size: .85rem; color: var(--ink-3); }
.card .was s { color: var(--ink-3); }
.card h3 { margin: 0; font-size: 1.12rem; }
.card h3 a { text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card h3 a:focus-visible { outline: none; }
.card:has(h3 a:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.card .where { color: var(--ink-2); font-size: .92rem; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 0; padding: 10px 0; border-top: 1px dashed var(--rule); border-bottom: 1px dashed var(--rule); }
.facts div { min-width: 0; }
.facts dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.facts dd { margin: 0; font: 600 .95rem var(--mono); font-variant-numeric: tabular-nums; }
.card .hud { font-size: .85rem; color: var(--ink-2); }
.card .badges { display: flex; flex-wrap: wrap; gap: 6px; }

.empty, .loading, .error { text-align: center; padding: 48px 16px; border: 2px dashed var(--rule); border-radius: var(--radius); color: var(--ink-2); }
.error { border-color: var(--stamp); color: var(--stamp); }
.spinner { width: 36px; height: 36px; border: 3px solid var(--rule); border-top-color: var(--stamp); border-radius: 50%; margin: 0 auto 12px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- detail drawer / page ---------------- */
dialog.detail { width: min(100vw, 640px); max-width: 100vw; max-height: 100dvh; height: 100dvh; margin: 0 0 0 auto; padding: 0; border: 0; background: var(--paper); color: var(--ink); }
dialog.detail::backdrop { background: rgba(10,12,16,.5); }
dialog.detail .dhead { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 16px; background: var(--paper); border-bottom: 1px solid var(--rule); z-index: 1; }
dialog.detail .dbody { padding: 16px; }
.detail-block { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.detail-block h3 { margin-top: 0; font-size: 1.05rem; }
.big-price { font: 700 2rem/1.1 var(--mono); }
.agent { padding: 8px 0; border-bottom: 1px dashed var(--rule); }
.agent:last-child { border: 0; }
.linkrow { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }

/* ---------------- tables (stack on mobile) ---------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.data th, table.data td { padding: 10px 8px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
table.data th { font: 700 .78rem var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
table.data th button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; min-height: 44px; }
@media (min-width: 641px) { .sort-mobile { display: none; } }
table.data th button:focus-visible { outline: 3px solid var(--focus); }
table.data td.n, table.data th.n { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  table.stack thead { display: none; }
  .sort-mobile { display: flex; margin-bottom: 10px; }
  table.stack tr { display: block; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card); margin-bottom: 10px; padding: 6px 12px; }
  table.stack td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 6px 0; text-align: right !important; }
  table.stack td::before { content: attr(data-label); font: 600 .8rem var(--sans); color: var(--ink-3); text-align: left; }
  table.stack td.lead { font-weight: 700; font-size: 1.05rem; }
  table.stack td.lead::before { content: none; }
}
.spark { width: 120px; height: 32px; vertical-align: middle; }
.spark path { fill: none; stroke: var(--stamp); stroke-width: 2; }
.up { color: var(--sage); }
.down { color: var(--stamp); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border: 1px solid var(--rule); border-radius: 99px; background: var(--card); text-decoration: none; font-weight: 600; }
.chip-link span { color: var(--ink-3); margin-left: 6px; font-family: var(--mono); }

/* ---------------- footer ---------------- */
.site-footer { margin-top: 40px; border-top: 1px solid var(--rule); background: var(--paper-2); padding: 26px 0 40px; font-size: .9rem; color: var(--ink-2); }
.site-footer .disclaimer { border: 2px solid var(--stamp); border-radius: 8px; padding: 12px 14px; color: var(--ink); background: var(--card); }
.site-footer nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 0; margin: 14px 0; }
.site-footer nav a { display: inline-flex; min-height: 44px; align-items: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .stamp { transform: none; }
}
@media print { .site-header, .toolbar, .filters, .site-footer nav { display: none; } }
