/* ============================================================
   rupertcollingwood.com, Housing Thesis editorial
   Inspired by WhichAgency: electric orange, black, white,
   bold modern typography, tick-mark identity.
   ============================================================ */

@import url('https://api.fontshare.com/v2/css?f[]=satoshi@900,700,500,400&f[]=clash-display@600,700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;0,6..72,600;1,6..72,400&display=swap');

:root {
  --ink: #0a0a0a;
  --ink-90: #1a1a1a;
  --muted: #5b5b5b;
  --muted-soft: #8a8a8a;
  --paper: #ffffff;
  --paper-warm: #faf8f5;
  --rule: #e6e6e6;
  --rule-strong: #111111;
  --accent: #ff4d00;
  --accent-soft: #ffe2d5;
  --accent-deep: #cc3d00;

  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --sans: 'Satoshi', 'Inter', system-ui, -apple-system, sans-serif;
  --display: 'Clash Display', 'Satoshi', system-ui, sans-serif;

  --measure: 68ch;
  --gutter: clamp(1.25rem, 3vw, 2.5rem);

  --t-xs: 0.75rem;
  --t-sm: 0.875rem;
  --t-base: 1.0625rem;
  --t-md: 1.1875rem;
  --t-lg: 1.4rem;
  --t-xl: 1.75rem;
  --t-2xl: 2.4rem;
  --t-3xl: 3.4rem;
  --t-hero: clamp(2.8rem, 7vw, 5.4rem);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: var(--t-base);
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: color .15s, text-decoration-color .15s;
}
a:hover { color: var(--accent); }

::selection { background: var(--accent); color: #fff; }

/* ---------- Top navigation ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem var(--gutter);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.nav__brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--ink);
}
.nav__brand svg { width: 28px; height: 28px; }
.nav__meta {
  font-family: var(--sans);
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.nav__cta {
  display: none;
  padding: .55rem 1rem;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  font-size: var(--t-sm);
  font-weight: 500;
  border: 1px solid var(--ink);
}
.nav__cta:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (min-width: 720px) { .nav__cta { display: inline-block; } }

/* ---------- Hero ---------- */
.hero {
  padding: clamp(3rem, 8vw, 6rem) var(--gutter) clamp(3rem, 6vw, 5rem);
  border-bottom: 1px solid var(--rule);
  position: relative;
  overflow: hidden;
}
.hero__inner { max-width: 1240px; margin: 0 auto; }
.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 1.5rem;
}
.hero__eyebrow::before {
  content: '';
  width: 22px;
  height: 2px;
  background: var(--accent);
  display: inline-block;
}
.hero__title {
  font-family: var(--display);
  font-weight: 700;
  font-size: var(--t-hero);
  line-height: 0.98;
  letter-spacing: -0.025em;
  margin: 0 0 1.5rem;
  color: var(--ink);
}
.hero__title em {
  font-style: italic;
  font-family: var(--serif);
  font-weight: 500;
  color: var(--accent);
}
.hero__deck {
  max-width: 60ch;
  font-family: var(--serif);
  font-size: clamp(1.1rem, 1.6vw, 1.45rem);
  line-height: 1.55;
  color: var(--ink-90);
  margin: 0 0 2.5rem;
}
.hero__meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.5rem 2rem;
  border-top: 1px solid var(--rule-strong);
  padding-top: 1.5rem;
  max-width: 900px;
}
.hero__meta-item span {
  display: block;
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: .3rem;
}
.hero__meta-item strong {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink);
}

/* ---------- Page layout: TOC + article ---------- */
.layout {
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4rem) var(--gutter);
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
}
@media (min-width: 1024px) {
  .layout { grid-template-columns: 240px 1fr; gap: 4rem; }
}

.toc {
  font-family: var(--sans);
  font-size: var(--t-sm);
}
@media (min-width: 1024px) {
  .toc {
    position: sticky;
    top: 92px;
    align-self: start;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
  }
}
.toc__title {
  font-family: var(--sans);
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--rule);
}
.toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: tocitem;
}
.toc li {
  counter-increment: tocitem;
  margin-bottom: .65rem;
  padding-left: 2.2rem;
  position: relative;
  line-height: 1.4;
}
.toc li::before {
  content: counter(tocitem, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0.05rem;
  font-family: var(--sans);
  font-feature-settings: "tnum";
  font-size: var(--t-xs);
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.05em;
}
.toc a {
  text-decoration: none;
  color: var(--ink-90);
  font-weight: 500;
}
.toc a:hover { color: var(--accent); }
.toc a.is-active { color: var(--accent); }

/* ---------- Article ---------- */
.article { width: 100%; max-width: var(--measure); min-width: 0; }
.article > * { max-width: 100%; min-width: 0; }

.chapter {
  padding-top: clamp(2.5rem, 5vw, 4rem);
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
  border-top: 1px solid var(--rule-strong);
  max-width: 100%;
}
.chapter:first-of-type { border-top: none; padding-top: 0; }
.chapter__num {
  display: block;
  font-family: var(--sans);
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: .8rem;
}
.chapter__title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.9rem, 3.5vw, 2.6rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 1.5rem;
  max-width: 22ch;
  color: var(--ink);
}
.chapter__lede {
  font-family: var(--serif);
  font-size: clamp(1.15rem, 1.4vw, 1.3rem);
  line-height: 1.55;
  color: var(--ink-90);
  margin: 0 0 2rem;
  max-width: var(--measure);
}

.article h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 2.5rem 0 .8rem;
  max-width: 100%;
}
.article h4 {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1.3;
  margin: 1.8rem 0 .5rem;
}
.article p {
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.7;
  margin: 0 0 1.2rem;
  max-width: 100%;
  color: var(--ink-90);
}
.article p strong { color: var(--ink); font-weight: 600; }
.article ul, .article ol {
  font-family: var(--serif);
  font-size: 1.1rem;
  line-height: 1.65;
  max-width: 100%;
  padding-left: 1.4rem;
  margin: 0 0 1.5rem;
  color: var(--ink-90);
}
.article li { margin-bottom: .4rem; }
.article ul li::marker { color: var(--accent); }

.article blockquote, .pull {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 2.5rem 0;
  padding: 1.5rem 0 1.5rem 1.5rem;
  border-left: 4px solid var(--accent);
  max-width: 100%;
}
.pull cite {
  display: block;
  margin-top: 1rem;
  font-family: var(--sans);
  font-style: normal;
  font-size: var(--t-sm);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  color: var(--muted);
}

/* ---------- Stat strip ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0;
  margin: 2.5rem 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  max-width: 100%;
}
.stat {
  padding: 1.5rem 1.25rem;
  border-right: 1px solid var(--rule);
}
.stat:last-child { border-right: none; }
.stat__value {
  display: block;
  font-family: var(--display);
  font-weight: 700;
  font-size: 2.2rem;
  line-height: 1;
  letter-spacing: -0.025em;
  color: var(--ink);
  font-feature-settings: "tnum";
}
.stat__value .accent { color: var(--accent); }
.stat__label {
  display: block;
  margin-top: .5rem;
  font-family: var(--sans);
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.4;
}

/* ---------- Chart figure ---------- */
.figure {
  margin: 2.5rem 0;
  max-width: 100%;
}
.figure__inner {
  border: 1px solid var(--rule);
  padding: 1rem 1rem 0.5rem;
  background: var(--paper);
}
.figure img {
  width: 100%;
  height: auto;
}
.figure figcaption {
  font-family: var(--sans);
  font-size: var(--t-sm);
  color: var(--muted);
  margin-top: .75rem;
  padding: 0 .25rem;
}
.figure figcaption strong { color: var(--ink); font-weight: 600; }

/* ---------- Data table ---------- */
.table-wrap {
  margin: 2rem 0;
  overflow-x: auto;
  max-width: 100%;
  border: 1px solid var(--rule);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: var(--t-sm);
}
thead {
  background: var(--ink);
  color: #fff;
}
th {
  text-align: left;
  font-weight: 600;
  padding: .75rem 1rem;
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
td {
  padding: .75rem 1rem;
  border-top: 1px solid var(--rule);
  vertical-align: top;
  color: var(--ink-90);
  font-feature-settings: "tnum";
}
tbody tr:nth-child(even) { background: var(--paper-warm); }

/* ---------- Inline callout ---------- */
.callout {
  margin: 2rem 0;
  padding: 1.25rem 1.5rem;
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  max-width: 100%;
}
.callout p {
  font-family: var(--sans);
  font-size: 1rem;
  margin: 0;
  color: var(--ink);
}
.callout strong { color: var(--accent-deep); }

/* ---------- Section dividers ---------- */
.rule {
  height: 1px;
  background: var(--ink);
  margin: 3rem 0;
  max-width: 100%;
}

/* ---------- Closing / sources ---------- */
.closing {
  padding: clamp(3rem, 6vw, 5rem) var(--gutter);
  background: var(--ink);
  color: #fff;
  margin-top: 4rem;
}
.closing__inner { max-width: 1240px; margin: 0 auto; }
.closing__eyebrow {
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 1rem;
}
.closing h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 1.5rem;
  max-width: 20ch;
}
.closing p {
  font-family: var(--serif);
  font-size: 1.2rem;
  line-height: 1.6;
  max-width: 60ch;
  color: #d8d8d8;
  margin: 0 0 1rem;
}
.closing a { color: #fff; text-decoration-color: var(--accent); }
.closing a:hover { color: var(--accent); }

.footer {
  padding: 2rem var(--gutter);
  background: #050505;
  color: #888;
  font-size: var(--t-sm);
  font-family: var(--sans);
}
.footer__inner {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
}
.footer a { color: #ccc; text-decoration: none; }
.footer a:hover { color: var(--accent); }

/* ---------- Author byline ---------- */
.byline {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin: 2.5rem 0;
}
.byline__mark {
  width: 48px;
  height: 48px;
  background: var(--ink);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.byline__name { font-family: var(--sans); }
.byline__name strong {
  display: block;
  font-weight: 700;
  color: var(--ink);
  font-size: 1.05rem;
}
.byline__name span {
  display: block;
  font-size: var(--t-sm);
  color: var(--muted);
}

/* ---------- Misc ---------- */
.lead-letter {
  padding-left: 1.15rem;
  border-left: 8px solid var(--accent);
}

@media (max-width: 720px) {
  .stat { padding: 1.1rem 1rem; }
  .stat__value { font-size: 1.8rem; }
  .toc { display: none; }
  .article p, .article ul, .article ol { font-size: 1.05rem; }
}
