/* Toronto Homes inquiry pages. Native CSS, light + dark.
   Radius rule: containers 16px, inputs/buttons 10px, choice chips and pills fully round. */
:root {
  --bg: #E9ECEE;
  --surface: #FFFFFF;
  --surface-2: #F3F5F6;
  --ink: #17212B;
  --ink-soft: #52606D;
  --line: #D3D9DE;
  --field-line: #8E99A3;
  --accent: #C8102E;
  --accent-press: #A10D25;
  --accent-ink: #FFFFFF;
  --focus: #1D6FB8;
  --shadow: 0 1px 2px rgb(23 33 43 / 0.06), 0 12px 32px rgb(23 33 43 / 0.08);
  --r-box: 16px;
  --r-field: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F151B;
    --surface: #17202A;
    --surface-2: #1E2833;
    --ink: #E8ECEF;
    --ink-soft: #A3AEB8;
    --line: #2C3743;
    --field-line: #5A6672;
    --accent: #E3304A;
    --accent-press: #C21F38;
    --focus: #6AA9E6;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 12px 32px rgb(0 0 0 / 0.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
img { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Top bar */
.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-weight: 800;
  font-size: 17px;
  font-variation-settings: "wdth" 118;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.brand i { color: var(--accent); font-size: 22px; }

/* Layout */
.page { max-width: 1200px; margin: 0 auto; }
.listing { min-width: 0; }

/* Gallery */
.gallery-wrap { position: relative; background: #0B1015; }
.gallery {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  aspect-ratio: 4 / 3;
  max-height: 64vh;
}
.gallery::-webkit-scrollbar { display: none; }
.gallery img { width: 100%; height: 100%; object-fit: cover; scroll-snap-align: start; }
.photo-count {
  position: absolute;
  left: 12px;
  bottom: 44px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgb(15 21 27 / 0.72);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
}
.gallery-nav {
  position: absolute;
  top: calc(50% - 20px);
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.94);
  color: #17212B;
  font-size: 20px;
  cursor: pointer;
  display: none;
  place-items: center;
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.18);
}
.gallery-nav.prev { left: 14px; }
.gallery-nav.next { right: 14px; }
@media (hover: hover) and (pointer: fine) { .gallery-nav { display: grid; } }

.thumbs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 8px 16px 40px;
  background: #0B1015;
}
.thumbs::-webkit-scrollbar { display: none; }
.thumbs button {
  flex: none;
  width: 64px;
  height: 48px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  background: none;
  opacity: 0.6;
}
.thumbs button img { width: 100%; height: 100%; object-fit: cover; }
.thumbs button[aria-current="true"] { border-color: #fff; opacity: 1; }

/* Price card overlaps the bottom of the gallery */
.card {
  position: relative;
  margin: -28px 12px 0;
  background: var(--surface);
  border-radius: var(--r-box);
  box-shadow: var(--shadow);
  padding: 22px 18px;
}
.offer {
  display: inline-block;
  margin: 0 0 10px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
}
.price {
  margin: 0;
  font-size: clamp(40px, 11vw, 60px);
  line-height: 1.02;
  font-weight: 800;
  font-variation-settings: "wdth" 125;
  letter-spacing: -0.015em;
}
.price small {
  font-size: 0.38em;
  font-weight: 600;
  font-variation-settings: "wdth" 100;
  letter-spacing: 0;
  color: var(--ink-soft);
}
.address { margin: 12px 0 0; font-size: 19px; font-weight: 650; line-height: 1.3; }
.area { margin: 4px 0 0; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; }

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 20px 0 0;
}
.facts div {
  display: grid;
  grid-template-columns: 32px 1fr;
  column-gap: 10px;
  align-items: center;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 10px 12px;
}
.facts i { grid-row: span 2; font-size: 24px; color: var(--ink-soft); }
.facts dt { font-size: 13px; color: var(--ink-soft); line-height: 1.2; }
.facts dd { margin: 0; font-size: 16px; font-weight: 650; line-height: 1.3; }

.about { padding: 28px 18px 8px; }
.about h2, .inquiry h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
  font-weight: 800;
  font-variation-settings: "wdth" 112;
}
.about p { margin: 10px 0 0; max-width: 62ch; color: var(--ink); }

/* Inquiry form */
.inquiry {
  margin: 24px 0 0;
  background: var(--surface);
  padding: 28px 18px 32px;
  border-top: 1px solid var(--line);
}
.inquiry .lede { margin: 8px 0 24px; color: var(--ink-soft); }
form { display: grid; gap: 28px; }
.group { display: grid; gap: 16px; border: 0; margin: 0; padding: 0; min-width: 0; }
.group > legend {
  padding: 0;
  margin-bottom: 4px;
  font-size: 17px;
  font-weight: 750;
}
.row { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, fieldset.choice > legend { font-size: 15px; font-weight: 600; padding: 0; }
.hint { font-weight: 400; color: var(--ink-soft); }
input[type="text"], input[type="email"], input[type="tel"], input[type="date"], select, textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--field-line);
  border-radius: var(--r-field);
  padding: 12px 14px;
  min-height: 50px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea { min-height: 104px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--ink-soft); opacity: 1; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent);
}
fieldset.choice { border: 0; margin: 0; padding: 0; min-width: 0; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.choices label {
  position: relative;
  font-weight: 550;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  border: 1px solid var(--field-line);
  border-radius: 999px;
  padding: 0 18px;
  cursor: pointer;
  background: var(--surface);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.choices input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choices label:has(input:checked) { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.choices label:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }

.consent {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 14px;
  color: var(--ink-soft);
  cursor: pointer;
}
.consent input { margin: 2px 0 0; width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

button[type="submit"] {
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  color: var(--accent-ink);
  background: var(--accent);
  border: 0;
  border-radius: var(--r-field);
  min-height: 56px;
  padding: 0 24px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.15s ease, transform 0.1s ease;
}
button[type="submit"]:hover { background: var(--accent-press); }
button[type="submit"]:active { transform: scale(0.98); }
button[type="submit"][disabled] { opacity: 0.65; cursor: progress; }
.error { color: var(--accent); font-size: 14px; font-weight: 600; margin: -12px 0 0; }

.done { display: grid; gap: 10px; justify-items: start; padding: 8px 0; }
.done i { font-size: 44px; color: #1F8A5B; }
.done p { margin: 0; color: var(--ink-soft); max-width: 46ch; }

/* Message pages (not found, unavailable) */
.notice { max-width: 560px; margin: 0 auto; padding: 56px 16px; }
.notice .card { margin: 0; }
.notice p { color: var(--ink-soft); margin: 8px 0 0; }

@media (min-width: 640px) {
  .row.two { grid-template-columns: 1fr 1fr; }
  .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .card { margin: -36px 24px 0; padding: 28px; }
  .about { padding: 32px 28px 8px; }
  .inquiry { padding: 32px 28px 36px; }
}

@media (min-width: 1000px) {
  .page {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 430px;
    gap: 32px;
    padding: 28px 24px 48px;
    align-items: start;
  }
  .gallery-wrap { border-radius: var(--r-box) var(--r-box) 0 0; overflow: hidden; }
  .thumbs { border-radius: 0 0 var(--r-box) var(--r-box); }
  .gallery { aspect-ratio: 3 / 2; max-height: none; }
  .about { padding: 32px 4px 0; }
  .inquiry {
    margin: 0;
    position: sticky;
    top: 24px;
    border: 0;
    border-radius: var(--r-box);
    box-shadow: var(--shadow);
    max-height: calc(100dvh - 48px);
    overflow-y: auto;
  }
}

/* One entrance moment: the price card settles in on load */
@media (prefers-reduced-motion: no-preference) {
  .gallery { scroll-behavior: smooth; }
  .card { animation: settle 0.6s cubic-bezier(0.16, 1, 0.3, 1) both; }
  @keyframes settle { from { opacity: 0; transform: translateY(16px); } }
}

/* Keep the top bar aligned with the page content on wide screens */
@media (min-width: 1000px) {
  .topbar { padding: 0 max(24px, calc((100% - 1200px) / 2 + 24px)); }
}

/* Full listing details */
.about h2 + p, .about h2 + .details, .about h2 + .amenities, .about .desc p { margin-top: 12px; }
.about h2:not(:first-child) { margin-top: 32px; }
.tour {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--field-line);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}
.tour i { font-size: 22px; color: var(--accent); }
.tour:hover { background: var(--surface-2); }
.details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
  margin: 0;
  max-width: 720px;
}
.details dt { font-size: 13px; color: var(--ink-soft); }
.details dd { margin: 2px 0 0; font-weight: 600; }
.amenities { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.amenities li {
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 14px;
}
@media (min-width: 640px) { .details { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- Phone and tablet only (desktop at 1000px+ is untouched) ---------- */
.mobile-cta, .more { display: none; }

@media (max-width: 999px) {
  /* Room for the pinned button so it never covers the last field */
  body { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .inquiry { scroll-margin-top: 12px; }

  /* Pinned "Book a showing" button */
  .mobile-cta {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 56px;
    border-radius: var(--r-field);
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 17px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 8px 24px rgb(23 33 43 / 0.25);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
  }
  .mobile-cta:active { transform: scale(0.98); }
  .mobile-cta.is-hidden { transform: translateY(140%); opacity: 0; pointer-events: none; }

  /* Long description collapses to 6 lines with a Read more toggle */
  .desc.is-clamped p {
    display: -webkit-box;
    -webkit-line-clamp: 6;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .more {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin-top: 4px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink);
    font: inherit;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
  }
  .more[hidden] { display: none; }

  /* Arrows are for mouse users; phones swipe */
  .gallery-nav { display: none; }
  .photo-count { bottom: 12px; }
  .thumbs { padding-bottom: 40px; }
}

@media (max-width: 639px) {
  .card { padding: 20px 16px; }
  .price { font-size: clamp(38px, 12vw, 52px); }
  .address { font-size: 18px; }
  .facts { gap: 6px; margin-top: 18px; }
  .facts div { grid-template-columns: 26px 1fr; padding: 10px; column-gap: 8px; }
  .facts i { font-size: 21px; }
  .facts dd { font-size: 15px; }
  /* A lone last tile spans the full row instead of leaving a gap */
  .facts div:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .about { padding: 28px 16px 4px; }
  .about h2:not(:first-child) { margin-top: 28px; }
  .details { gap: 14px 16px; }
  .inquiry { padding: 28px 16px 28px; }
  form { gap: 24px; }
  .group { gap: 14px; }
}

/* Desktop keeps the original two-column layout: listing + details on the left, form pinned on the right.
   On phones the DOM order puts the form right after the price card. */
@media (min-width: 1000px) {
  .page { grid-template-areas: "listing inquiry" "more inquiry"; grid-template-rows: auto 1fr; row-gap: 0; }
  .listing { grid-area: listing; }
  .listing-more { grid-area: more; min-width: 0; }
  .inquiry { grid-area: inquiry; align-self: start; }
}
