:root {
  --ivory: #f7f4ef;
  --paper: #eee6da;
  --charcoal: #1d1d1b;
  --charcoal-soft: #292824;
  --rust: #ad5b3f;
  --rust-dark: #88442f;
  --taupe: #c9b89e;
  --line: #c8bdad;
  --ink: #2a2926;
  --white: #fff;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--ivory); color: var(--ink); font-family: var(--sans); line-height: 1.55; }
a { color: inherit; }
button, input { font: inherit; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 1000; background: white; padding: .75rem 1rem; }
.skip-link:focus { top: 1rem; }

.site-header { height: 78px; padding: 0 clamp(1.2rem, 4vw, 4.5rem); display: flex; align-items: center; justify-content: space-between; background: rgba(247,244,239,.96); border-bottom: 1px solid rgba(42,41,38,.12); position: sticky; top: 0; z-index: 50; backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: .8rem; text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; background: var(--charcoal); color: var(--ivory); font-family: var(--serif); }
.brand strong { display: block; font-family: var(--serif); font-size: 1rem; font-weight: 500; }
.brand small { display: block; text-transform: uppercase; letter-spacing: .18em; font-size: .58rem; margin-top: .1rem; }
nav { display: flex; gap: 1.6rem; }
nav a { text-decoration: none; font-size: .78rem; text-transform: uppercase; letter-spacing: .09em; }
nav a:hover, nav a:focus-visible { color: var(--rust); }

.hero { min-height: calc(100vh - 78px); position: relative; display: grid; align-items: center; color: white; overflow: hidden; }
.hero-image, .hero-shade { position: absolute; inset: 0; }
.hero-image { background-image: url('assets/etobicoke-house.png'); background-size: cover; background-position: center 52%; transform: scale(1.01); }
.hero-shade { background: linear-gradient(90deg, rgba(20,20,18,.87) 0%, rgba(20,20,18,.66) 47%, rgba(20,20,18,.18) 76%, rgba(20,20,18,.05) 100%); }
.hero-content { position: relative; z-index: 2; width: min(760px, 88%); margin-left: clamp(1.5rem, 8vw, 8rem); padding: 6rem 0; }
.eyebrow { margin: 0 0 1rem; text-transform: uppercase; letter-spacing: .24em; font-size: .7rem; font-weight: 700; color: var(--taupe); }
.eyebrow.dark { color: var(--rust-dark); }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.05; margin: 0; }
h1 { font-size: clamp(3.2rem, 7vw, 6.7rem); max-width: 12ch; letter-spacing: -.035em; }
h1 em { color: #d87b59; font-weight: 400; }
.hero-copy { font-size: clamp(1rem, 1.6vw, 1.25rem); max-width: 620px; margin: 2rem 0; color: rgba(255,255,255,.88); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.hero-note { margin-top: 1.3rem; font-size: .78rem; color: rgba(255,255,255,.65); }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 50px; padding: .8rem 1.25rem; border: 1px solid transparent; text-decoration: none; text-transform: uppercase; letter-spacing: .08em; font-size: .73rem; font-weight: 700; cursor: pointer; transition: .2s ease; }
.button-primary { background: var(--rust); color: white; }
.button-primary:hover, .button-primary:focus-visible { background: var(--rust-dark); transform: translateY(-1px); }
.button-ghost { border-color: rgba(255,255,255,.6); color: white; background: rgba(0,0,0,.12); }
.button-ghost:hover, .button-ghost:focus-visible { background: white; color: var(--charcoal); }
.button-ghost-dark { border-color: var(--charcoal); background: transparent; color: var(--charcoal); }
.button-light { background: var(--ivory); color: var(--charcoal); }

.section-pad { padding: clamp(4.5rem, 8vw, 8.5rem) clamp(1.3rem, 7vw, 7rem); }
.intro { background: var(--paper); }
.intro-grid { display: grid; grid-template-columns: minmax(280px, .9fr) minmax(320px, 1.25fr); gap: clamp(3rem, 8vw, 9rem); max-width: 1250px; }
.intro h2, .section-heading h2 { font-size: clamp(2.5rem, 5vw, 5rem); }
.intro p { font-size: 1.05rem; max-width: 680px; }

.compare { background: var(--charcoal); color: var(--ivory); }
.section-heading { max-width: 900px; margin-bottom: 4rem; }
.section-heading > p:last-child { max-width: 650px; color: rgba(247,244,239,.72); font-size: 1rem; }
.matcher { max-width: 1220px; }
fieldset { border: 0; border-top: 1px solid rgba(247,244,239,.22); padding: 2.3rem 0 2.8rem; margin: 0; }
legend { font-family: var(--serif); font-size: clamp(1.5rem, 2.5vw, 2.2rem); padding: 0 1rem 0 0; }
legend span { color: var(--rust); font-family: var(--sans); font-size: .7rem; letter-spacing: .12em; vertical-align: middle; margin-right: 1rem; }
.field-note { color: rgba(247,244,239,.6); font-size: .78rem; margin: .8rem 0 1.1rem; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .75rem; margin-top: 1.4rem; }
.choice-grid.four { grid-template-columns: repeat(4, minmax(0,1fr)); }
.choice-grid label { position: relative; cursor: pointer; }
.choice-grid input { position: absolute; opacity: 0; pointer-events: none; }
.choice-grid label span { display: block; height: 100%; border: 1px solid rgba(247,244,239,.22); padding: 1.1rem; transition: .18s ease; }
.choice-grid label:hover span { border-color: var(--taupe); }
.choice-grid input:focus-visible + span { outline: 2px solid white; outline-offset: 3px; }
.choice-grid input:checked + span { background: var(--rust); border-color: var(--rust); color: white; }
.choice-grid b { display: block; font-family: var(--serif); font-size: 1.05rem; font-weight: 400; }
.choice-grid small { display: block; font-size: .72rem; color: rgba(247,244,239,.62); margin-top: .35rem; line-height: 1.4; }
.choice-grid input:checked + span small { color: rgba(255,255,255,.78); }
.form-actions { display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap; padding-top: 1.6rem; }
.text-button { border: 0; background: none; color: var(--ivory); text-decoration: underline; cursor: pointer; }
.form-error { flex-basis: 100%; color: #f2a98f; }

.results { background: var(--ivory); color: var(--ink); margin: 5rem -3vw -3vw; padding: clamp(2rem, 5vw, 5rem); }
.results-heading { max-width: 820px; }
.results-heading h2 { font-size: clamp(2.3rem, 4vw, 4rem); }
.result-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 1rem; margin-top: 2.5rem; }
.result-card { border-top: 4px solid var(--rust); background: white; padding: 1.5rem; box-shadow: 0 14px 40px rgba(37,31,25,.08); }
.result-card .rank { color: var(--rust); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; }
.result-card h3 { font-size: 1.8rem; margin: .45rem 0 .8rem; }
.result-card p { font-size: .87rem; }
.result-card button { border: 0; background: none; color: var(--rust-dark); text-decoration: underline; padding: .4rem 0; cursor: pointer; }
.results-actions { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 2rem; }

.neighbourhoods { background: var(--ivory); }
.dark-heading > p:last-child { color: #625d56; }
.neighbourhood-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); border-top: 1px solid var(--line); }
.neighbourhood-card { display: grid; grid-template-columns: 72px 1fr; gap: 1rem; padding: 2rem .6rem; border-bottom: 1px solid var(--line); }
.neighbourhood-card:nth-child(odd) { border-right: 1px solid var(--line); padding-right: 2rem; }
.neighbourhood-card:nth-child(even) { padding-left: 2rem; }
.card-number { font-family: var(--serif); font-size: 2.2rem; color: var(--rust); }
.neighbourhood-card h3 { font-size: clamp(1.7rem, 2.5vw, 2.5rem); }
.neighbourhood-card p { font-size: .9rem; color: #5d5851; }
.tag-list { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0; }
.tag { border: 1px solid var(--line); padding: .25rem .5rem; font-size: .64rem; text-transform: uppercase; letter-spacing: .06em; }
.card-link { border: 0; background: none; color: var(--rust-dark); padding: 0; text-decoration: underline; cursor: pointer; }

.cta { background: var(--rust); color: white; text-align: center; }
.cta .eyebrow { color: #f2d5c8; }
.cta h2 { font-size: clamp(2.4rem, 5vw, 5rem); max-width: 1040px; margin: 0 auto; }
.cta p:not(.eyebrow) { max-width: 700px; margin: 1.6rem auto 2rem; }

footer { background: var(--charcoal); color: var(--ivory); padding: 3rem clamp(1.3rem, 7vw, 7rem); display: flex; justify-content: space-between; gap: 2rem; }
footer > div:first-child { display: flex; gap: 3rem; }
footer p { font-size: .78rem; }
footer a { color: inherit; }
.footer-right { text-align: right; max-width: 510px; }
.footer-right > a { display: inline-block; margin-left: 1rem; }
.footer-right p { color: rgba(247,244,239,.55); }

dialog { width: min(760px, calc(100% - 2rem)); max-height: calc(100vh - 2rem); border: 0; padding: 0; color: var(--ink); background: var(--ivory); box-shadow: 0 22px 90px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(20,20,18,.76); backdrop-filter: blur(3px); }
.dialog-close { position: sticky; float: right; top: 1rem; margin: 1rem; z-index: 2; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; background: var(--ivory); cursor: pointer; font-size: 1.5rem; }
.dialog-inner { padding: clamp(2rem, 6vw, 5rem); }
.dialog-inner h2 { font-size: clamp(2.5rem, 6vw, 4.5rem); max-width: 10ch; }
.dialog-summary { font-size: 1.08rem; max-width: 600px; margin: 1.3rem 0 2rem; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.detail-block { border-top: 1px solid var(--line); padding-top: 1rem; }
.detail-block h3 { font-family: var(--sans); font-size: .7rem; text-transform: uppercase; letter-spacing: .15em; color: var(--rust-dark); }
.detail-block p { font-size: .9rem; }
.caution { background: var(--paper); padding: 1rem; margin-top: 1.2rem; font-size: .8rem; }
.source-links { font-size: .76rem; margin-top: 1.5rem; word-break: break-word; }

@media (max-width: 900px) {
  nav a:not(:last-child) { display: none; }
  .hero-shade { background: linear-gradient(90deg, rgba(20,20,18,.84), rgba(20,20,18,.4)); }
  .intro-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .choice-grid.four { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .result-grid { grid-template-columns: 1fr; }
}

@media (max-width: 650px) {
  .site-header { height: 68px; padding: 0 1rem; }
  .brand strong { font-size: .86rem; }
  .brand small { display: none; }
  nav { gap: .6rem; }
  nav a { font-size: .65rem; }
  .hero { min-height: calc(100svh - 68px); }
  .hero-content { margin-left: 1.2rem; width: calc(100% - 2.4rem); padding: 4rem 0; }
  h1 { font-size: clamp(2.7rem, 13vw, 4.3rem); }
  .hero-image { background-position: 58% center; }
  .hero-shade { background: linear-gradient(90deg, rgba(20,20,18,.88), rgba(20,20,18,.5)); }
  .section-pad { padding: 4.2rem 1.2rem; }
  .choice-grid, .choice-grid.four { grid-template-columns: 1fr; }
  .neighbourhood-grid { grid-template-columns: 1fr; }
  .neighbourhood-card { grid-template-columns: 52px 1fr; }
  .neighbourhood-card:nth-child(odd) { border-right: 0; padding-right: .6rem; }
  .neighbourhood-card:nth-child(even) { padding-left: .6rem; }
  .results { margin: 4rem 0 0; padding: 2rem 1rem; }
  footer, footer > div:first-child { flex-direction: column; }
  .footer-right { text-align: left; }
  .footer-right > a { margin: 0 1rem 0 0; }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
