/* ==========================================================================
   TaxSales.ca — "Modern Land Registry"
   Archival paper + ink + spruce green. Serif display (Spectral), civic UI
   sans (Public Sans), mono ledger figures (IBM Plex Mono).
   ========================================================================== */

:root {
  /* paper + ink */
  --paper: #f7f4ec;
  --paper-deep: #efeadd;
  --card: #fdfcf8;
  --ink: #1d2521;
  --ink-soft: #5b635c;
  --ink-faint: #8a918a;
  --line: #d9d3c4;
  --line-strong: #b9b29e;

  /* institutional spruce */
  --brand: #11402f;
  --brand-deep: #0b2e21;
  --brand-bright: #1d7a4f;
  --brand-wash: #e3ece4;

  /* stamps & signals */
  --stamp-red: #a23b2a;
  --stamp-red-wash: #f6e7e2;
  --brass: #8a6d2f;
  --brass-wash: #f3ecd9;
  --ok: #1d6b43;
  --ok-wash: #e2efe4;

  --radius: 4px;
  --shadow: 0 1px 0 rgba(29, 37, 33, 0.06), 0 6px 18px -8px rgba(29, 37, 33, 0.18);
  --shadow-lift: 0 2px 0 rgba(29, 37, 33, 0.05), 0 14px 28px -10px rgba(29, 37, 33, 0.28);
  --max: 1120px;

  --serif: "Spectral", Georgia, "Times New Roman", serif;
  --sans: "Public Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", "Courier New", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--paper);
  /* faint archival grain */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.035'/%3E%3C/svg%3E");
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
.container { max-width: var(--max); margin: 0 auto; padding: 0 22px; }
h1, h2, h3, .brand { font-family: var(--serif); letter-spacing: -0.01em; }
.num, .amount { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   Header — institutional spruce bar
   -------------------------------------------------------------------------- */
.site-header {
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-deep) 100%);
  border-bottom: 3px double var(--brass);
  position: sticky; top: 0; z-index: 1000;
}
.site-header .container { display: flex; align-items: center; gap: 26px; height: 64px; }
.brand {
  color: var(--paper); font-weight: 600; font-size: 1.35rem;
  display: flex; align-items: center; gap: 10px;
}
.brand .seal {
  width: 26px; height: 26px; border-radius: 50%;
  border: 1.5px solid var(--brass); display: grid; place-items: center;
  font-size: 13px; color: var(--brass); font-family: var(--serif);
}
.brand:hover { text-decoration: none; color: #fff; }
.brand .tld { color: var(--brass); font-style: italic; }
.nav { display: flex; gap: 22px; margin-left: auto; align-items: center; }
.nav a {
  color: #cfdacd; font-size: 0.82rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.09em;
}
.nav a:hover { color: #fff; text-decoration: none; border-bottom: 2px solid var(--brass); }

/* --------------------------------------------------------------------------
   Buttons — unambiguous contrast
   -------------------------------------------------------------------------- */
.btn {
  display: inline-block; cursor: pointer; border: 1.5px solid var(--brand-deep);
  background: var(--brand); color: #fdfcf8;
  padding: 10px 18px; border-radius: var(--radius);
  font-family: var(--sans); font-weight: 700; font-size: 0.8rem;
  text-transform: uppercase; letter-spacing: 0.08em;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  box-shadow: 0 2px 0 var(--brand-deep);
}
.btn:hover { background: var(--brand-bright); text-decoration: none; transform: translateY(-1px); box-shadow: 0 3px 0 var(--brand-deep); }
.btn:active { transform: translateY(1px); box-shadow: 0 0 0 var(--brand-deep); }
.btn.secondary {
  background: transparent; color: var(--brand); border-color: var(--brand);
  box-shadow: 0 2px 0 var(--line-strong);
}
.btn.secondary:hover { background: var(--brand-wash); color: var(--brand-deep); }
.nav .btn {
  background: var(--paper); color: var(--brand-deep); border-color: var(--brass);
  box-shadow: 0 2px 0 var(--brass);
}
.nav .btn:hover { background: #fff; color: var(--brand); }

/* --------------------------------------------------------------------------
   Hero — title page of the registry
   -------------------------------------------------------------------------- */
.hero {
  background:
    radial-gradient(1100px 420px at 85% -10%, rgba(138, 109, 47, 0.10), transparent 60%),
    linear-gradient(180deg, var(--paper-deep), var(--paper));
  border-bottom: 1px solid var(--line);
  padding: 58px 0 44px;
}
.hero h1 {
  font-size: clamp(1.9rem, 4vw, 2.9rem); font-weight: 600; line-height: 1.18;
  margin: 0 0 14px; max-width: 21ch;
  animation: rise 0.5s ease both;
}
.hero h1 em { font-style: italic; color: var(--brand); }
.hero .rule {
  width: 84px; border: 0; border-top: 3px double var(--brass);
  margin: 0 0 16px;
}
.hero p.lead {
  font-size: 1.06rem; color: var(--ink-soft); margin: 0 0 18px; max-width: 56ch;
  animation: rise 0.5s 0.08s ease both;
}
.hero .sub { animation: rise 0.5s 0.16s ease both; color: var(--ink-soft); font-size: 0.92rem; }
.stat-chip {
  display: inline-block; font-family: var(--mono); font-size: 0.8rem;
  border: 1px solid var(--line-strong); background: var(--card);
  padding: 4px 12px; border-radius: 2px; margin-right: 8px;
}
.stat-chip strong { color: var(--brand); }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */
main { padding: 34px 0 64px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.section-title { font-size: 1.45rem; font-weight: 600; margin: 0 0 16px; }

/* --------------------------------------------------------------------------
   Cards — ledger entries
   -------------------------------------------------------------------------- */
.card {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); box-shadow: var(--shadow); padding: 18px;
}
.listing-card {
  display: block; color: inherit; position: relative; overflow: hidden;
  border-left: 3px solid var(--brand);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
  animation: rise 0.4s ease both;
}
.grid .listing-card:nth-child(2n) { animation-delay: 0.05s; }
.grid .listing-card:nth-child(3n) { animation-delay: 0.1s; }
.listing-card:hover {
  text-decoration: none; transform: translateY(-3px);
  box-shadow: var(--shadow-lift); border-color: var(--line-strong);
  border-left-color: var(--brass);
}
.lc-media {
  position: relative; height: 158px; overflow: hidden;
  margin: -18px -18px 14px; border-bottom: 1px solid var(--line);
  background: var(--paper-deep);
}
.lc-media img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  filter: sepia(0.08) saturate(0.96);
  transition: transform 0.35s ease;
}
.listing-card:hover .lc-media img { transform: scale(1.04); }
.lc-credit {
  position: absolute; right: 6px; bottom: 6px;
  font-size: 0.62rem; font-family: var(--sans); letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.92); background: rgba(29, 37, 33, 0.55);
  padding: 1px 7px; border-radius: 2px;
}
.lc-media-empty {
  display: grid; place-items: center;
  background:
    repeating-linear-gradient(-45deg, transparent 0 14px, rgba(138, 109, 47, 0.07) 14px 15px),
    var(--paper-deep);
}
.lc-media-empty span { font-family: var(--serif); font-size: 2.4rem; color: var(--line-strong); }

.listing-card .lc-muni {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--brand); margin-bottom: 3px;
}
.listing-card h3 {
  margin: 0; font-size: 1.16rem; font-weight: 600; line-height: 1.3; color: var(--ink);
}
.listing-card:hover h3 { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--brass); }
.listing-card .lc-amount {
  margin-top: 12px; padding-top: 12px; border-top: 1px dotted var(--line-strong);
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
}
.listing-card .lc-amount .label {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-soft);
}
.amount { font-weight: 600; font-size: 1.12rem; color: var(--brand-deep); }
.listing-card .meta {
  margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  font-size: 0.85rem; color: var(--ink-soft);
}

/* --------------------------------------------------------------------------
   Stamps & chips — rubber-stamp statuses
   -------------------------------------------------------------------------- */
.badge {
  display: inline-block; font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 2px;
  border: 1.5px solid currentColor; background: transparent; color: var(--ink-soft);
}
.badge.active { color: var(--ok); background: var(--ok-wash); }
.badge.cancelled, .badge.deadline_passed { color: var(--stamp-red); background: var(--stamp-red-wash); }
.badge.needs_review, .badge.results_pending { color: var(--brass); background: var(--brass-wash); }
.badge.approx { color: var(--brass); background: var(--brass-wash); border-style: dashed; }
.badge.stale { color: var(--stamp-red); background: var(--stamp-red-wash); }

/* --------------------------------------------------------------------------
   Filters / forms
   -------------------------------------------------------------------------- */
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; align-items: end; }
.filters label, .form-row label {
  display: block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-soft); margin-bottom: 5px;
}
.filters input, .filters select, .form-row input, .form-row select, input[type="email"] {
  width: 100%; padding: 9px 11px; font-size: 0.95rem; font-family: var(--sans);
  color: var(--ink); background: #fff;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.filters input:focus, .filters select:focus, .form-row input:focus, input[type="email"]:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-wash);
}
.form-row { margin-bottom: 16px; }

/* --------------------------------------------------------------------------
   Map — framed plate
   -------------------------------------------------------------------------- */
#map {
  height: 520px; width: 100%; border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  outline: 3px double var(--line-strong); outline-offset: 4px;
  background: var(--paper-deep);
  box-shadow: var(--shadow);
}
.leaflet-popup-content-wrapper {
  background: var(--card); color: var(--ink); border-radius: var(--radius);
  border: 1px solid var(--line-strong); box-shadow: var(--shadow-lift);
  font-family: var(--sans);
}
.leaflet-popup-tip { background: var(--card); }
.leaflet-container { font-family: var(--sans); }
.pin {
  width: 22px; height: 22px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  display: block;
}
.pin::after {
  content: ""; width: 7px; height: 7px; margin: 5px;
  background: #fff; border-radius: 50%; display: block;
}
.pin.exact { background: var(--brand-bright); }
.pin.approx { background: #c98a2b; }
.approx-note { color: var(--brass); font-size: 0.85rem; margin-top: 8px; }

/* --------------------------------------------------------------------------
   Detail page — the folio
   -------------------------------------------------------------------------- */
.detail-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; }
.field-table { width: 100%; border-collapse: collapse; }
.field-table th, .field-table td {
  text-align: left; padding: 11px 0; border-bottom: 1px dotted var(--line-strong);
  vertical-align: top; font-size: 0.96rem;
}
.field-table th {
  width: 210px; color: var(--ink-soft); font-weight: 700; font-size: 0.74rem;
  text-transform: uppercase; letter-spacing: 0.08em; padding-right: 14px;
}
.quote { color: var(--ink-faint); font-size: 0.82rem; font-style: italic; margin-top: 4px; font-family: var(--serif); }
.risk-list { list-style: none; padding: 0; margin: 0; }
.risk-list li {
  padding: 9px 13px; border: 1px solid var(--brass); border-left: 3px solid var(--brass);
  background: var(--brass-wash); border-radius: 2px; margin-bottom: 8px; font-size: 0.9rem;
}
figure img { filter: sepia(0.04); }

/* --------------------------------------------------------------------------
   Disclaimer, messages, pagination, footer
   -------------------------------------------------------------------------- */
.disclaimer {
  background: var(--paper-deep); border: 1px solid var(--line);
  border-left: 3px solid var(--brass);
  border-radius: 2px; padding: 14px 18px; color: var(--ink-soft); font-size: 0.85rem;
  font-family: var(--serif); font-style: italic;
}
.messages { list-style: none; padding: 0; margin: 0 0 18px; }
.messages li { padding: 11px 15px; border-radius: 2px; margin-bottom: 8px; font-weight: 600; font-size: 0.92rem; }
.messages .success { background: var(--ok-wash); border: 1.5px solid var(--ok); color: var(--ok); }
.messages .error { background: var(--stamp-red-wash); border: 1.5px solid var(--stamp-red); color: var(--stamp-red); }

.site-footer {
  background: var(--brand-deep); color: #b9c8b9;
  border-top: 3px double var(--brass);
  padding: 36px 0; margin-top: 56px; font-size: 0.88rem;
}
.site-footer a { color: #d9e3d6; }
.site-footer strong { color: var(--paper); font-family: var(--serif); font-size: 1.05rem; }
.footer-grid { display: flex; gap: 48px; flex-wrap: wrap; justify-content: space-between; }

/* honeypot — humans never see it */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 760px) {
  .grid, .detail-grid { grid-template-columns: 1fr; }
  .site-header .container { flex-wrap: wrap; height: auto; min-height: 64px; padding-top: 9px; padding-bottom: 9px; }
  .nav { gap: 14px; }
  .nav a { font-size: 0.72rem; }
  .nav .btn { padding: 7px 12px; }
  #map { height: 380px; }
  .hero { padding: 40px 0 32px; }
}
