/* =========================================================================
   Josh Comeau's Custom CSS Reset
   https://www.joshwcomeau.com/css/custom-css-reset/
   (the framework-only #root/#__next rule is omitted — this is a plain site)
   ========================================================================= */
*, *::before, *::after { box-sizing: border-box; }
*:not(dialog) { margin: 0; }

@media (prefers-reduced-motion: no-preference) {
  html { interpolate-size: allow-keywords; }
}

body { line-height: 1.5; -webkit-font-smoothing: antialiased; }
img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }
p { text-wrap: pretty; }
h1, h2, h3, h4, h5, h6 { text-wrap: balance; }

/* =========================================================================
   Design tokens — "Shade": heat at the top, cool shaded ground below.
   ========================================================================= */
:root {
  color-scheme: light dark;

  --ink: #12262b;
  --text: #12262b;
  --text-muted: #4f6b72;
  --shade: #e6eff0;        /* cool page ground */
  --surface: #ffffff;
  --surface-2: #eef5f6;
  --border: #d2e0e2;

  --relief: #0b8aa0;       /* cool teal — the action colour */
  --relief-deep: #076170;
  --sun: #f6a723;          /* warmth, used sparingly */
  --sun-hot: #e8542a;

  /* Facet hues — a small semantic system for the tag chips. */
  --c-housing: #5c7d8c;
  --c-cost: #1f9e79;
  --c-effort: #d5811f;
  --c-area: #3f7bb6;

  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(18, 38, 43, 0.05), 0 10px 24px rgba(18, 38, 43, 0.06);
  --shadow-lift: 0 2px 4px rgba(18, 38, 43, 0.06), 0 16px 34px rgba(18, 38, 43, 0.11);
  --maxw: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e7f1f2;
    --text: #e7f1f2;
    --text-muted: #9fb8bc;
    --shade: #0c1a1e;
    --surface: #13272c;
    --surface-2: #18323a;
    --border: #274248;

    --relief: #38b8cd;
    --relief-deep: #86dbe6;
    --sun: #f7b23f;
    --sun-hot: #ff7a4d;

    --c-housing: #86a6b3;
    --c-cost: #46c79b;
    --c-effort: #eaa64a;
    --c-area: #6ea6d8;

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 26px rgba(0, 0, 0, 0.4);
    --shadow-lift: 0 2px 6px rgba(0, 0, 0, 0.45), 0 18px 38px rgba(0, 0, 0, 0.5);
  }
}

/* =========================================================================
   Base
   ========================================================================= */
body {
  background: var(--shade);
  color: var(--text);
  font-family: var(--font-body);
}

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2.25rem);
}

/* Monospace "instrument readout" — the page's signature type treatment. */
.eyebrow,
.readout,
.badge,
.filters__group legend,
.results__count,
.card__more-toggle,
.filters__reset {
  font-family: var(--font-mono);
}

/* =========================================================================
   Hero — heat lives here: a sun glow over a cool sky.
   ========================================================================= */
.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(130% 120% at 92% -30%,
      color-mix(in srgb, var(--sun) 22%, transparent) 0%,
      transparent 46%),
    var(--surface);
  border-bottom: 1px solid var(--border);
}

.hero__inner {
  position: relative;
  z-index: 1;
  padding-block: clamp(2.5rem, 7vw, 4.75rem);
}

.hero__sun {
  position: absolute;
  top: -120px;
  right: -80px;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  /* A defined disc: bright core easing to a warmer rim. */
  background:
    radial-gradient(circle at 44% 40%,
      color-mix(in srgb, var(--sun) 70%, white) 0%,
      var(--sun) 46%,
      color-mix(in srgb, var(--sun) 78%, var(--sun-hot)) 100%);
  /* Glow radiating around the crisp edge, in layers. */
  box-shadow:
    0 0 55px 8px color-mix(in srgb, var(--sun) 55%, transparent),
    0 0 130px 34px color-mix(in srgb, var(--sun) 32%, transparent),
    0 0 230px 76px color-mix(in srgb, var(--sun) 17%, transparent);
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  .hero__sun { animation: sun-breathe 9s ease-in-out infinite; }
}
@keyframes sun-breathe {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50%      { transform: scale(1.05); opacity: 1; }
}

.eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--relief-deep);
}

.hero__title {
  margin-top: 0.5rem;
  font-size: clamp(2.5rem, 8vw, 4.25rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 0.95;
}

.hero__lede {
  margin-top: 0.9rem;
  max-width: 44ch;
  font-size: clamp(1.02rem, 2.2vw, 1.18rem);
  color: var(--text-muted);
}

.readout {
  margin-top: 1.4rem;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}
.readout__num {
  color: var(--sun-hot);
  font-weight: 700;
}

/* =========================================================================
   Layout
   ========================================================================= */
.layout {
  display: grid;
  gap: clamp(1.5rem, 4vw, 3rem);
  padding-block: clamp(1.75rem, 4vw, 2.75rem);
}

@media (min-width: 860px) {
  .layout {
    grid-template-columns: 264px 1fr;
    align-items: start;
  }
}

/* =========================================================================
   Sidebar / filters — one clean panel with hairline dividers.
   ========================================================================= */
@media (min-width: 860px) {
  .sidebar { position: sticky; top: 1.5rem; }
}

/* Filter disclosure — on mobile the whole thing is ONE continuous panel that
   expands/collapses as a unit; on desktop it's a plain heading above the panel. */
.filters-disclosure {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.filters-disclosure__toggle {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  padding: 0.95rem 1.15rem;
}
/* Hairline under the header only while expanded, so the block reads as one. */
.filters-disclosure[open] .filters-disclosure__toggle {
  border-bottom: 1px solid var(--border);
}
.filters-disclosure__toggle::-webkit-details-marker { display: none; }
.filters-disclosure__toggle::after {
  content: "";
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid var(--relief);
  border-bottom: 2px solid var(--relief);
  transform: rotate(45deg); /* points down when collapsed */
  transition: transform 0.15s ease;
}
.filters-disclosure[open] .filters-disclosure__toggle::after {
  transform: rotate(-135deg); /* points up when expanded */
}
@media (prefers-reduced-motion: reduce) {
  .filters-disclosure__toggle::after { transition: none; }
}

.sidebar__hint {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 0.9rem 1.15rem;
}

/* Mobile default (no card chrome — the disclosure container is the card).
   The desktop override in the media query below re-adds card padding, so this
   must stay ABOVE it in source order or it would clobber the desktop padding. */
.filters {
  padding: 0 1.15rem 1.15rem;
}

@media (min-width: 860px) {
  /* Desktop: no container card, no disclosure affordance — a static heading
     sitting above a separate filters panel. */
  .filters-disclosure {
    background: none;
    border: 0;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
  }
  .filters-disclosure__toggle {
    cursor: default;
    pointer-events: none;
    padding: 0;
    font-size: 1.15rem;
  }
  .filters-disclosure[open] .filters-disclosure__toggle { border-bottom: 0; }
  .filters-disclosure__toggle::after { display: none; }

  .sidebar__hint {
    padding: 0;
    margin-top: 0.35rem;
    margin-bottom: 1rem;
  }
  .filters {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.9rem 1.15rem 1.15rem; /* top padding gives HOUSING room from the edge */
  }
  /* On desktop the hint sits above a separate card, so the first group drops
     its divider (the card's top padding provides the breathing room instead). */
  .filters__group:first-of-type {
    border-top: 0;
  }
}

/* Small top padding keeps each label tight to its own checkboxes; larger bottom
   padding sets a clear gap before the next section's divider. */
.filters__group {
  border: 0; /* clear the fieldset's default all-sides border */
  border-top: 1px solid var(--border);
  padding: 0.45rem 0 1.1rem;
}

.filters__group legend {
  padding: 0;
  line-height: 1;
  margin-bottom: 0.1rem;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

.filters__option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-block: 0.28rem;
  cursor: pointer;
}
.filters__option input {
  accent-color: var(--relief);
  width: 1.05rem;
  height: 1.05rem;
}

.filters__reset {
  margin-top: 1.15rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 1.05rem;
  cursor: pointer;
}
.filters__reset:hover {
  border-color: var(--relief);
  color: var(--relief-deep);
}

/* =========================================================================
   Results + cards
   ========================================================================= */
.results__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 1.15rem;
}
.results__bar h2 { font-size: 1.4rem; }

.results__count {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.grid {
  display: grid;
  gap: 1.1rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
}

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.3rem 1.3rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
  border-color: color-mix(in srgb, var(--relief) 40%, var(--border));
}

.card__title {
  font-size: 1.14rem;
  line-height: 1.28;
  letter-spacing: -0.01em;
}
.card__summary { color: var(--text); }

/* Collapsible detail (native <details>) */
.card__more { margin-top: -0.15rem; }

.card__more-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  width: fit-content;
  cursor: pointer;
  color: var(--relief-deep);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  list-style: none;
}
.card__more-toggle::-webkit-details-marker { display: none; }
.card__more-toggle::before {
  content: "";
  width: 0.42rem;
  height: 0.42rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}
.card__more[open] .card__more-toggle::before { transform: rotate(45deg); }
@media (prefers-reduced-motion: reduce) {
  .card__more-toggle::before { transition: none; }
}

.card__detail {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-top: 0.55rem;
}

/* Tag chips — soft tint + colour dot, one hue per facet. */
.card__tags {
  list-style: none;
  padding: 0;
  margin-top: auto;
  padding-top: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.3rem 0.55rem;
  border-radius: 7px;
  background: color-mix(in srgb, var(--badge) 14%, var(--surface));
  color: color-mix(in srgb, var(--badge) 62%, var(--ink));
}
.badge::before {
  content: "";
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--badge);
}
.badge--housing { --badge: var(--c-housing); }
.badge--cost    { --badge: var(--c-cost); }
.badge--effort  { --badge: var(--c-effort); }
.badge--area    { --badge: var(--c-area); }

.results__empty {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
}

.is-hidden { display: none; }

/* =========================================================================
   Footer
   ========================================================================= */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  padding-block: 1.75rem;
  margin-top: 2.5rem;
  font-size: 0.9rem;
}
.site-footer p + p { margin-top: 0.6rem; }
.site-footer__sources { font-size: 0.85rem; }
.site-footer a { color: var(--relief); }

/* =========================================================================
   Focus + motion
   ========================================================================= */
:where(a, button, input, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--relief);
  outline-offset: 2px;
  border-radius: 4px;
}
