/* ============================================================
   Your Malden Shul — index.css
   Built from spec/ on 2026-05-01.
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  --navy: #1a2a44;
  --navy-dark: #121e33;
  --gold: #c9a449;
  --gold-hover: #b3902e;
  --cream: #f7f5f0;
  --cream-dark: #ece7db;
  --ink: #1a1a1a;
  --muted: #5a5a5a;
  --white: #ffffff;

  /* Gray-box placeholders — deliberately unglamorous, labeled,
     meant to create pressure to be replaced. See spec/open-issues.md #1. */
  --placeholder-bg: #d9d9d9;
  --placeholder-bg-dark: #2a2a2a;
  --placeholder-border: #7a7a7a;
  --placeholder-ink: #333;
  --placeholder-ink-dark: #ddd;

  --font-serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;

  --max-w: 1200px;
  --gutter: clamp(1rem, 4vw, 2.5rem);

  --radius: 4px;
  --tap: 48px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--white);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.5em;
  color: var(--ink);
}

p {
  margin: 0 0 1em;
}

a {
  color: inherit;
}

/* ---------- Layout helpers ---------- */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

section {
  padding-block: clamp(3rem, 7vw, 6rem);
}

section[id] {
  scroll-margin-top: 1rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0.75rem 1.75rem;
  border: 2px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.05s ease;
}

.btn--primary {
  background: var(--gold);
  color: var(--navy);
}

.btn--primary:hover,
.btn--primary:focus-visible {
  background: var(--gold-hover);
}

.btn--primary:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: 3px solid var(--cream);
  outline-offset: 2px;
}

/* ============================================================
   PLACEHOLDER COMPONENT
   A visible gray box standing in for every image on the page.
   Labels indicate slot purpose and target dimensions. This is
   intentional: the site should never ship with placeholders
   silently in place. grep for "placeholder" to find them all.
   ============================================================ */
.placeholder {
  position: relative;
  width: 100%;
  background: var(--placeholder-bg);
  border: 1px dashed var(--placeholder-border);
  color: var(--placeholder-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  overflow: hidden;
}

.placeholder::before {
  content: attr(data-label);
  white-space: pre-line;
  line-height: 1.4;
  max-width: 90%;
}

.placeholder--dark {
  background: var(--placeholder-bg-dark);
  color: var(--placeholder-ink-dark);
  border-color: #555;
}

.placeholder--16x9 {
  aspect-ratio: 16 / 9;
}
.placeholder--4x3 {
  aspect-ratio: 4 / 3;
}
.placeholder--3x2 {
  aspect-ratio: 3 / 2;
}
.placeholder--1x1 {
  aspect-ratio: 1 / 1;
}

.placeholder--icon {
  width: 72px;
  height: 72px;
  aspect-ratio: 1 / 1;
  font-size: 0.625rem;
  padding: 0.5rem;
  border-radius: 4px;
}

/* ---------- Icon tile ----------
   White rounded card wrapping one of the nine icons (traced from the
   source JPEGs to navy SVG via potrace — see tools/ or commit history).
   The tile itself provides visual consistency; SVG transparency means
   no blend-mode hacks are needed. */
.icon-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 88px;
  background: var(--white);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  overflow: hidden;
}

.icon-tile img {
  width: 70%;
  height: 70%;
  object-fit: contain;
}

.icon-tile--sm {
  width: 64px;
  height: 64px;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  color: var(--white);
  padding: 0;
}

.hero__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero__bg .placeholder {
  height: 100%;
  border: none;
  aspect-ratio: auto;
}

.hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(26, 42, 68, 0.55) 0%,
    rgba(26, 42, 68, 0.75) 100%
  );
  z-index: 1;
}

.hero__content {
  position: relative;
  z-index: 2;
  width: 100%;
  padding-block: 5rem;
}

.hero__headline {
  color: var(--white);
  font-size: clamp(2rem, 5.5vw, 3.75rem);
  max-width: 18ch;
  margin-bottom: 0.75rem;
}

.hero__tagline {
  font-size: clamp(1.05rem, 1.8vw, 1.35rem);
  max-width: 42ch;
  margin-bottom: 2rem;
  line-height: 1.5;
  opacity: 0.95;
}

.hero__ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

@media (max-width: 640px) {
  .hero__ctas {
    flex-direction: column;
    align-items: stretch;
  }
  .hero__ctas .btn {
    width: 100%;
  }
}

/* ============================================================
   PILLARS
   ============================================================ */
.pillars {
  background: var(--cream);
}

.pillars__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
}

.pillar {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.pillar__icon {
  margin: 0 auto;
}

.pillar__label {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
  color: var(--navy);
}

.pillar__text {
  font-size: 0.975rem;
  color: var(--muted);
  margin: 0;
  max-width: 28ch;
}

@media (max-width: 1023px) and (min-width: 768px) {
  .pillars__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 767px) {
  .pillars__grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  /* Keep the centered vertical stack (icon → label → description),
     just one pillar per row. Matthew pushed back on the row layout:
     at ~360px wide the description column is too narrow and wraps
     every 1–2 words. */
  .pillar {
    max-width: 420px;
    margin-inline: auto;
  }
  .pillar__text {
    max-width: none;
  }
}

/* ============================================================
   COMMUNITY
   ============================================================ */
.community {
  background: var(--white);
}

.community__inner {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}

.community__photos {
  display: grid;
  gap: 1rem;
}

.community__heading {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  color: var(--navy);
  margin-bottom: 1.25rem;
}

.community__body p {
  color: var(--ink);
  line-height: 1.65;
  font-size: 1.02rem;
}

@media (max-width: 900px) {
  .community__inner {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   INFRASTRUCTURE
   ============================================================ */
.infrastructure {
  background: var(--cream);
}

.infrastructure__heading {
  text-align: center;
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  color: var(--navy);
  margin-bottom: 3rem;
  max-width: 22ch;
  margin-inline: auto;
}

.infra-list {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.infra-item {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: var(--white);
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* Staircase offset per spec (desktop only) */
@media (min-width: 900px) {
  .infra-item:nth-child(1) {
    margin-left: 0;
  }
  .infra-item:nth-child(2) {
    margin-left: 6%;
  }
  .infra-item:nth-child(3) {
    margin-left: 12%;
  }
  .infra-item:nth-child(4) {
    margin-left: 18%;
  }
  .infra-item:nth-child(5) {
    margin-left: 24%;
  }
}

.infra-item__text {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  color: var(--navy);
  font-weight: 500;
}

@media (max-width: 640px) {
  .infra-item {
    padding: 1rem;
    gap: 1rem;
  }
  .infra-item__text {
    font-size: 1rem;
  }
}

/* ============================================================
   HOUSING
   ============================================================ */
.housing {
  background: var(--navy);
  color: var(--white);
  padding: 0;
}

.housing__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
  min-height: 420px;
}

.housing__text {
  padding: clamp(3rem, 6vw, 5rem) var(--gutter);
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 640px;
  margin-inline: auto;
}

.housing__heading {
  color: var(--white);
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  margin-bottom: 1rem;
}

.housing__body {
  font-size: 1.05rem;
  line-height: 1.6;
  opacity: 0.9;
  margin-bottom: 2rem;
}

.housing__photo {
  position: relative;
}

.housing__photo .placeholder {
  height: 100%;
  min-height: 320px;
  border: none;
  aspect-ratio: auto;
}

@media (max-width: 900px) {
  .housing__inner {
    grid-template-columns: 1fr;
  }
  .housing__photo .placeholder {
    min-height: 260px;
  }
}

/* ============================================================
   TESTIMONIALS
   ============================================================ */
.testimonials {
  background: var(--cream);
}

.testimonials__heading {
  text-align: center;
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  color: var(--navy);
  margin-bottom: 2.5rem;
}

.testimonials__viewport {
  position: relative;
}

.testimonials__scroller {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--gutter);
  padding-block: 1rem;
  padding-inline: var(--gutter);
  margin-inline: calc(var(--gutter) * -1);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

/* Subtle right-edge fade to hint at more content. */
.testimonials__viewport::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 3rem;
  pointer-events: none;
  background: linear-gradient(
    to right,
    rgba(247, 245, 240, 0) 0%,
    var(--cream) 100%
  );
  opacity: 0;
  transition: opacity 0.2s ease;
}

.testimonials__viewport[data-can-scroll-right="true"]::after {
  opacity: 1;
}

/* Prev/next chevron buttons for obvious scrollability. */
.testimonials__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: var(--white);
  color: var(--navy);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.1s ease, background-color 0.15s ease;
  padding: 0;
}

.testimonials__nav:hover {
  background: var(--cream-dark);
}

.testimonials__nav:active {
  transform: translateY(-50%) scale(0.95);
}

.testimonials__nav:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.testimonials__nav svg {
  width: 20px;
  height: 20px;
}

.testimonials__nav--prev {
  left: 0.5rem;
}

.testimonials__nav--next {
  right: 0.5rem;
}

.testimonials__nav[disabled] {
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 640px) {
  .testimonials__nav {
    width: 40px;
    height: 40px;
  }
  .testimonials__nav--prev {
    left: 0.25rem;
  }
  .testimonials__nav--next {
    right: 0.25rem;
  }
}

.testimonial-card {
  flex: 0 0 min(560px, 85%);
  scroll-snap-align: center;
  background: var(--white);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  margin: 0;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  min-height: 220px;
}

.testimonial-card p {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(1.15rem, 2vw, 1.5rem);
  line-height: 1.45;
  color: var(--navy);
  margin: 0;
}

@media (min-width: 1100px) {
  .testimonial-card {
    flex-basis: 620px;
  }
}

/* ============================================================
   TRANSIT
   ============================================================ */
.transit {
  background: var(--cream);
}

.transit__inner {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}

.transit__heading {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  color: var(--navy);
  margin-bottom: 1rem;
}

.transit__body p {
  color: var(--ink);
  line-height: 1.6;
}

@media (max-width: 900px) {
  .transit__inner {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   FORM
   ============================================================ */
.form-section {
  background: var(--navy);
  color: var(--white);
}

.form-section__header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 2.5rem;
}

.form-section__heading {
  color: var(--white);
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  margin-bottom: 0.75rem;
}

.form-section__sub {
  font-size: 1.05rem;
  opacity: 0.9;
  line-height: 1.5;
}

.form-card {
  background: var(--white);
  color: var(--ink);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  max-width: 600px;
  margin: 0 auto;
  box-shadow: var(--shadow-md);
}

.form__group {
  margin-bottom: 1.25rem;
}

.form__label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
  color: var(--navy);
}

.form__label .req {
  color: #c0392b;
  margin-left: 0.15em;
}

.form__input,
.form__select {
  width: 100%;
  min-height: var(--tap);
  padding: 0.65rem 0.85rem;
  border: 1px solid #c8c8c8;
  border-radius: var(--radius);
  background: var(--white);
  font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form__input:focus,
.form__select:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(26, 42, 68, 0.15);
}

.form__input[aria-invalid="true"],
.form__select[aria-invalid="true"] {
  border-color: #c0392b;
}

.form__error {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.85rem;
  color: #c0392b;
  min-height: 1.1em;
}

/* Intent cards */
.intent-fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 1.5rem;
}

.intent-fieldset legend {
  font-weight: 600;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  color: var(--navy);
}

.intent-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.intent-option {
  position: relative;
}

.intent-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}

.intent-option__label {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 64px;
  padding: 0.75rem 1rem;
  border: 2px solid #d5d5d5;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--navy);
  background: var(--white);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.intent-option input[type="radio"]:checked + .intent-option__label {
  border-color: var(--navy);
  background: #f1f4fa;
}

.intent-option input[type="radio"]:focus-visible + .intent-option__label {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

@media (max-width: 480px) {
  .intent-options {
    grid-template-columns: 1fr;
  }
}

.form__submit {
  width: 100%;
  margin-top: 0.5rem;
}

.form__status {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.95rem;
  min-height: 1.2em;
}

.form__status--error {
  color: #c0392b;
}

/* Confirmation state */
.form-confirmation {
  text-align: center;
  padding: 1rem 0;
}

.form-confirmation__heading {
  color: var(--navy);
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.form-confirmation__body {
  color: var(--muted);
  margin: 0;
}

.is-hidden {
  display: none !important;
}

/* ---------- Accessibility ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}
