/* ==========================================================================
   M3RBS homepage composition: "Neighborhood Index"
   Loaded only by index.html, after base.css (shared tokens, header, footer).
   ========================================================================== */

/* ---------- Introduction + index ---------- */
.intro {
  padding-top: var(--s3);
  padding-bottom: var(--s4);
}

.intro__grid {
  display: grid;
  gap: var(--s3);
}

.masthead {
  font-family: var(--font-display);
  font-weight: 400;
  font-optical-sizing: auto;
  font-size: clamp(2.375rem, 1.55rem + 3.6vw, 4.25rem);
  line-height: 1.02;
  letter-spacing: -0.022em;
  color: var(--ink);
  text-wrap: balance;
}

.intro__lede {
  margin-top: var(--s2);
  font-size: 1.0625rem;
  line-height: 1.55;
  max-width: 34rem;
  color: var(--ink);
}

.intro__feedback {
  margin-top: var(--s1);
  font-size: 0.9375rem;
  color: var(--muted);
}

/* Phones: keep the purpose statement short and bring the index up; the
   corrections line moves below the index rather than delaying it. */
@media (max-width: 639.98px) {
  .intro { padding-top: 20px; }
  .intro__grid { gap: 0; }
  .intro__identity { display: contents; }
  .eyebrow { margin-bottom: 10px; }
  .intro__lede { margin-top: 14px; font-size: 1rem; }
  .index { margin-top: var(--s2); }
  .intro__feedback { order: 1; margin-top: var(--s2); }
}

/* The index */
.index .label { padding-bottom: var(--s1); }

.index__list {
  border-top: 1px solid var(--line-strong);
}

.index__list li { border-bottom: 1px solid var(--line); }

/* Phones: title over description, arrow on the right */
.index__link {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "title arrow"
    "desc  arrow";
  column-gap: var(--s2);
  row-gap: 3px;
  align-items: baseline;
  padding: 14px 0 15px;
  color: var(--ink);
  text-decoration: none;
}

.index__title {
  grid-area: title;
  font-size: 1.1875rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.005em;
}

.index__desc {
  grid-area: desc;
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--muted);
  text-wrap: pretty;
}

.index__arrow {
  grid-area: arrow;
  align-self: center;
  font-size: 1.125rem;
  color: var(--muted);
  transition: transform var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.index__link:hover .index__title,
.index__link:focus-visible .index__title { color: var(--accent); }
.index__link:hover .index__arrow,
.index__link:focus-visible .index__arrow { color: var(--accent); transform: translateX(4px); }
.index__link:focus-visible { outline-offset: -2px; }

/* Phones: compact rows so all six destinations fit the first screen */
@media (max-width: 639.98px) {
  .index .label { padding-bottom: 12px; }
  .index__link { padding: 11px 0 12px; }
  .index__title { font-size: 1.0625rem; }
  .index__desc { font-size: 0.875rem; line-height: 1.35; }
}

/* Tablet and up: title and description share one aligned row */
@media (min-width: 640px) {
  .intro { padding-top: var(--s4); }
  .index__link {
    grid-template-columns: minmax(11rem, 15rem) 1fr auto;
    grid-template-areas: "title desc arrow";
    column-gap: var(--s3);
    padding: 21px 0 22px;
  }
  .index__title { font-size: 1.375rem; }
}

/* Desktop: identity on the left, index on the right */
@media (min-width: 1000px) {
  .intro { padding-top: var(--s5); padding-bottom: var(--s5); }
  .intro__grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--col-gap);
    align-items: start;
  }
  .intro__identity { grid-column: 1 / span 5; padding-top: 2px; padding-right: var(--s2); }
  .masthead { max-width: 9.5ch; }
  .index { grid-column: 6 / -1; }
  .intro__lede { max-width: 24rem; margin-top: var(--s3); font-size: 1.125rem; }
  .index__link { grid-template-columns: 12.5rem 1fr auto; }
}

/* ---------- Neighborhood photograph ----------
   Full-bleed band below the directory. Phones show the whole 16:9 frame; wider
   screens crop sky and foreground scrub so the band of houses carries the image. */
.place { padding-bottom: var(--s5); }

.place__img {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 560px;
  object-fit: cover;
  object-position: 50% 55%;
  background: var(--accent-wash);
}

.place__caption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px var(--s2);
  padding-top: 10px;
  font-size: 0.875rem;
  color: var(--muted);
}
.place__name { color: var(--ink); font-weight: 500; }

@media (min-width: 640px) {
  .place__img { aspect-ratio: 2 / 1; }
}

@media (min-width: 1000px) {
  .place { padding-bottom: var(--s6); }
  .place__img { aspect-ratio: 3 / 1; }
  .place__caption { padding-top: 12px; }
}

/* ---------- Sections with a left rail ---------- */
.section { padding-block: var(--s5); border-top: 1px solid var(--line); }

.section__grid { display: grid; gap: var(--s2); }

@media (min-width: 1000px) {
  .section { padding-block: var(--s6); }
  .section__grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--col-gap);
    row-gap: 0;
    align-items: start;
  }
  .section__rail { grid-column: 1 / span 2; }
}

/* About: a geographic lead, the original prose, the name question set apart, and the map */
.about__text p + p { margin-top: var(--s1); }
.about__text p { max-width: 36rem; font-size: 1.0625rem; line-height: 1.65; }

.about__lead {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.625rem, 1.2rem + 1.6vw, 2.25rem) !important;
  line-height: 1.2 !important;
  letter-spacing: -0.01em;
  margin-bottom: var(--s2);
  max-width: 22ch !important;
  text-wrap: balance;
}

.about__name {
  margin-top: var(--s3);
  padding-top: var(--s1);
  border-top: 1px solid var(--line);
  max-width: 36rem;
}
.about__name h3 {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 6px;
}
.about__name p { font-size: 1rem !important; color: var(--muted); }

.about__map { margin-top: var(--s2); max-width: 420px; }
.about__map img { width: 100%; border: 1px solid var(--line); background: var(--surface); }
.about__map figcaption { margin-top: var(--s0); font-size: 0.875rem; color: var(--muted); }

@media (min-width: 640px) and (max-width: 999.98px) {
  .about .section__grid { grid-template-columns: minmax(0, 1fr) 15rem; column-gap: var(--s3); }
  .about .section__rail { grid-column: 1 / -1; }
  .about__map { margin-top: 0; }
}

@media (min-width: 1000px) {
  .about__text { grid-column: 3 / span 6; }
  .about__map { grid-column: 9 / -1; margin-top: 0; max-width: none; }
}

/* ---------- Photos: justified rows ----------
   Each <li> carries --ar (width / height). flex-grow is proportional to --ar, so every
   photo in a row ends up the same height, rows run flush to both edges, and no photo
   is cropped. --row-h sets the target row height per breakpoint. */
.photos__note { margin-top: var(--s0); font-size: 0.9375rem; color: var(--muted); max-width: 30rem; }

.gallery {
  --row-h: 80px;
  --g: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: var(--g);
  margin-top: var(--s1);
}
.gallery li {
  flex-grow: var(--ar);
  flex-shrink: 1;
  flex-basis: calc(var(--ar) * var(--row-h));
  min-width: 0;
}
.gallery a { display: block; }
.gallery img {
  width: 100%;
  height: auto;
  background: var(--accent-wash);
  transition: opacity var(--t-fast) var(--ease);
}
.gallery a:hover img { opacity: 0.88; }
.gallery a:focus-visible { outline-offset: 2px; }

@media (min-width: 360px) { .gallery { --row-h: 96px; } }
@media (min-width: 640px) { .gallery { --row-h: 150px; --g: 10px; } }

@media (min-width: 1000px) {
  .photos__head {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--col-gap);
    align-items: baseline;
  }
  .photos__head .label { grid-column: 1 / span 2; }
  .photos__note { grid-column: 3 / span 6; margin-top: 0; }
  .gallery { grid-column: 1 / -1; margin-top: var(--s3); --row-h: 180px; --g: 12px; }
}
@media (min-width: 1200px) { .gallery { --row-h: 215px; } }

/* Contact */
.contact__intro p { margin-top: var(--s0); font-size: 1rem; max-width: 22rem; }

.contact__form {
  width: 100%;
  max-width: 640px;
}

.field-row { display: grid; gap: var(--s1); align-items: start; }
.field + .field,
.field-row + .field { margin-top: var(--s1); }
.field-row > .field + .field { margin-top: 0; }

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9375rem;
  font-weight: 500;
}

.field input,
.field textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #b9c1b6;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: 400 1rem/1.4 var(--font-sans);
  transition: border-color var(--t-fast) var(--ease);
}
.field textarea { resize: vertical; min-height: 140px; }
.field input:hover,
.field textarea:hover { border-color: var(--muted); }
.field input:focus,
.field textarea:focus { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 0; }

.form-message {
  margin-top: var(--s1);
  font-size: 0.9375rem;
}
.form-message:empty { display: none; }
.form-message.success {
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  background: var(--accent-wash);
  color: var(--ink);
}
.form-message.error {
  padding: 10px 12px;
  border-left: 3px solid #a3352b;
  background: #f8ecea;
  color: #6e2219;
}

.cf-turnstile { margin-top: var(--s2); }
.cf-turnstile:empty { margin-top: 0; }

.form-actions { margin-top: var(--s2); }

#submit-button {
  min-height: 46px;
  padding: 0 var(--s2);
  border: 0;
  border-radius: var(--radius);
  background: var(--accent-deep);
  color: #fff;
  font: 600 1rem/1 var(--font-sans);
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease);
}
#submit-button:hover { background: #183f24; }
#submit-button:disabled { opacity: 0.6; cursor: progress; }

@media (min-width: 640px) {
  .field-row { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1000px) {
  .contact .section__rail { grid-column: 1 / span 4; }
  .contact__intro p { margin-top: var(--s1); }
  .contact__form { grid-column: 6 / span 7; }
}
