/* ==========================================================================
   /contact — ติดต่อมูลนิธิ. Form base styles come from Contact.css (shared with
   /donate); everything here is scoped to .contact-page.
   Layout: photo hero → info card + form card (overlapping the hero's foot) →
   full-width map band. Gold-line flowers (element/floral-corner.webp, a top-left
   cluster with a transparent background) are flipped into whichever corner needs one.
   ========================================================================== */

.contact-page {
  --contact-card-bg: rgba(255, 252, 246, 0.94);
  --contact-line: #efdfc0;
  overflow-x: clip;
}

/* Short gold accent rule under headings. */
.contact-rule {
  display: block;
  width: 40px;
  height: 2px;
  border-radius: 2px;
  background: var(--gold-warm);
}

/* ----- Hero ----- */
/* Pulled up under the transparent header so the photo reaches the top of the page. */
.contact-hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-height: clamp(290px, 23vw, 340px);
  margin-top: calc(-1 * var(--header-h, 88px));
  padding: var(--header-h, 88px) 0 44px;
}

.contact-hero::before {
  content: "";
  position: absolute;
  z-index: 1;
  /* starts under the header so it never sits behind the logo */
  top: calc(var(--header-h, 88px) - 12px);
  left: 0;
  width: clamp(110px, 10vw, 160px);
  aspect-ratio: 340 / 250;
  background: url("/element/floral-corner.webp") left top / contain no-repeat;
  opacity: 0.9;
  pointer-events: none;
}

/* Top sits just under the nav row so the doctor's head clears the menu. */
.contact-hero__art {
  position: absolute;
  z-index: 0;
  inset: calc(var(--header-h, 88px) - 24px) 0 0 auto;
  width: min(48%, 840px);
  pointer-events: none;
  -webkit-mask-image:
    linear-gradient(90deg, transparent 0, #000 34%),
    linear-gradient(180deg, transparent 0, #000 12%, #000 86%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(90deg, transparent 0, #000 34%),
    linear-gradient(180deg, transparent 0, #000 12%, #000 86%, transparent 100%);
  mask-composite: intersect;
}

.contact-hero__art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: right 27%;
}

.contact-hero__inner {
  position: relative;
  z-index: 2;
}

.contact-hero__copy {
  display: grid;
  justify-items: start;
  gap: 12px;
  max-width: 520px;
}

.contact-hero__title {
  font-family: var(--font-heading);
  font-size: clamp(34px, 3.3vw, 48px);
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink-navy);
}

.contact-hero__desc {
  font-size: clamp(16px, 1.25vw, 18px);
  line-height: 1.55;
  color: var(--brown-ink);
}

/* ----- Info + form cards ----- */
.contact-page__body {
  position: relative;
  z-index: 3;
  margin-top: -20px;
  padding-bottom: clamp(28px, 3vw, 40px);
}

.contact-page__grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  align-items: stretch;
  gap: clamp(16px, 2vw, 24px);
}

.contact-info,
.contact-page .contact-form-card {
  position: relative;
  isolation: isolate;
  height: 100%;
  margin-top: 0;
  padding: clamp(20px, 2.2vw, 30px);
  border: 1px solid var(--contact-line);
  border-radius: 22px;
  background: var(--contact-card-bg);
  box-shadow: 0 18px 40px rgba(140, 90, 30, 0.08), 0 2px 6px rgba(140, 90, 30, 0.04);
}

/* Flowers in each card's bottom-right corner. */
.contact-info::after,
.contact-page .contact-form-card::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: 0;
  bottom: 0;
  width: clamp(110px, 10vw, 160px);
  aspect-ratio: 340 / 250;
  background: url("/element/floral-corner.webp") left top / contain no-repeat;
  /* top-left before the flip = the card's rounded bottom-right corner after it */
  border-top-left-radius: 22px;
  transform: rotate(180deg);
  opacity: 0.85;
  pointer-events: none;
}

.contact-info__name {
  font-family: var(--font-heading);
  font-size: clamp(18px, 1.5vw, 21px);
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink-navy);
}

.contact-info > .contact-rule {
  margin: 10px 0 2px;
}

.contact-info__row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: start;
  gap: 16px;
  padding-block: 12px;
}

.contact-info__row + .contact-info__row {
  border-top: 1px solid var(--contact-line);
}

.contact-info__row:last-child {
  padding-bottom: 0;
}

.contact-info__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--paper-shade);
  color: var(--gold-heritage);
}

/* Solid pin with a paper-coloured dot, as in the design. */
.contact-info__icon--solid svg {
  fill: currentColor;
}

.contact-info__icon--solid svg circle {
  fill: var(--paper-shade);
  stroke: var(--paper-shade);
}

.contact-info__title {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  color: var(--ink-navy);
}

.contact-info__label,
.contact-info__text {
  margin-top: 2px;
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--brown-ink);
}

.contact-info__phone {
  display: inline-block;
  margin-top: 2px;
  font-family: var(--font-heading);
  font-size: clamp(19px, 1.6vw, 22px);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink-navy);
  transition: color var(--motion-base) var(--ease-out-quart);
}

.contact-info__phone:hover {
  color: var(--gold-text);
}

/* Both numbers side by side. */
.contact-info__phones {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, max-content));
  gap: 6px clamp(20px, 3vw, 40px);
  margin-top: 2px;
}

.contact-page .contact-info .social-links {
  justify-content: flex-start;
  margin-top: 6px;
}

.contact-page .contact-info .social-btn {
  width: 40px;
  height: 40px;
  border-color: var(--gold-warm);
  color: var(--gold-heritage);
  background: rgba(255, 255, 255, 0.6);
}

/* Outline gold pill (ดูแผนที่ / เปิดแผนที่ใน Google Maps). */
.contact-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  margin-top: 8px;
  padding: 0 14px 0 18px;
  border: 1.5px solid var(--gold-warm);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.55);
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--gold-text);
  transition: background-color var(--motion-base) var(--ease-out-quart),
    color var(--motion-base) var(--ease-out-quart);
}

.contact-pill:hover {
  background: var(--paper-shade);
  color: var(--ink-navy);
}

.contact-pill--lg {
  min-height: 46px;
  margin-top: 16px;
  padding-inline: 22px 18px;
  font-size: 16px;
}

.contact-info__phone:focus-visible,
.contact-pill:focus-visible {
  outline: 2px solid var(--gold-text);
  outline-offset: 4px;
}

/* ----- Form ----- */
.contact-page .contact-form-card__title {
  font-size: clamp(21px, 1.8vw, 25px);
  color: var(--ink-navy);
}

.contact-page .contact-form-card__desc {
  margin-top: 2px;
  font-size: 15.5px;
  color: var(--brown-ink);
}

.contact-page .contact-form-card > .contact-rule {
  margin-top: 10px;
}

.contact-page .contact-form {
  gap: 12px;
  margin-top: 14px;
}

.contact-page .contact-form__row {
  gap: 14px;
}

.contact-page .contact-form__field {
  gap: 4px;
}

/* No gap reserved for the status line until there is one. */
.contact-page [data-contact-form-message]:empty {
  display: none;
}

.contact-page .contact-form__field label {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-navy);
}

.contact-form__req {
  color: #d23a2a;
}

.contact-page .contact-form__field input,
.contact-page .contact-form__field textarea,
.contact-page .contact-form__field select {
  width: 100%;
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: #fffdf9;
  font-family: inherit;
  font-size: 16px;
  color: var(--ink-navy);
  transition: border-color var(--motion-base) var(--ease-out-quart);
}

.contact-page .contact-form__field ::placeholder {
  color: #a39684;
  opacity: 1;
}

.contact-page .contact-form__field input:focus-visible,
.contact-page .contact-form__field textarea:focus-visible,
.contact-page .contact-form__field select:focus-visible {
  outline: 2px solid var(--gold-warm);
  outline-offset: 1px;
  border-color: var(--gold-warm);
}

.contact-form__select {
  position: relative;
}

.contact-page .contact-form__select select {
  padding-right: 48px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

/* Placeholder colour while nothing is chosen. */
.contact-page .contact-form__select select:invalid {
  color: #a39684;
}

.contact-form__select option {
  color: var(--ink-navy);
}

.contact-form__select svg {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  color: var(--ink-navy);
  pointer-events: none;
}

.contact-page .contact-form__field textarea {
  min-height: 96px;
}

.contact-form__count {
  margin-top: -2px;
  font-size: 13px;
  text-align: right;
  color: #8f8170;
}

.contact-page .contact-form__message {
  font-size: 16px;
}

.contact-page .contact-form__submit {
  justify-content: center;
  gap: 12px;
  width: min(100%, 340px);
  min-height: 48px;
  margin-top: 0;
  padding-inline: 28px;
  border-radius: var(--radius-pill);
  font-size: 17px;
}

.contact-form__privacy {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--brown-ink);
}

.contact-form__privacy svg {
  flex: none;
  color: var(--ink-navy);
}

/* ----- Map band ----- */
.contact-map {
  position: relative;
  isolation: isolate;
  min-height: clamp(260px, 20vw, 320px);
  display: flex;
  align-items: center;
  border-top: 1px solid var(--contact-line);
  background: linear-gradient(180deg, rgba(248, 236, 218, 0.55), rgba(255, 250, 241, 0));
}

/* Flowers on the band's bottom-left edge. */
.contact-map::before {
  content: "";
  position: absolute;
  z-index: 2;
  left: 0;
  bottom: 0;
  width: clamp(100px, 9vw, 150px);
  aspect-ratio: 340 / 250;
  background: url("/element/floral-corner.webp") left top / contain no-repeat;
  transform: scaleY(-1);
  opacity: 0.85;
  pointer-events: none;
}

.contact-map__inner {
  position: relative;
  z-index: 3;
  padding-block: 28px;
  pointer-events: none;
}

.contact-map__copy {
  max-width: 470px;
  pointer-events: auto;
}

.contact-map__title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-heading);
  font-size: clamp(22px, 2vw, 28px);
  font-weight: 700;
  color: var(--ink-navy);
}

.contact-map__pin {
  display: grid;
  flex: none;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--gold-heritage);
  color: #fff;
}

.contact-map__text {
  margin-top: 12px;
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--brown-ink);
}

/* The map fills the band's right side and fades into the paper on its left. */
.contact-map__frame {
  position: absolute;
  z-index: 1;
  inset: 0 0 0 auto;
  width: min(62%, 1180px);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 22%);
  mask-image: linear-gradient(90deg, transparent 0, #000 22%);
}

.contact-map__frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  filter: sepia(0.22) saturate(0.9) brightness(1.02);
}

/* ----- Responsive ----- */
@media (max-width: 900px) {
  .contact-hero {
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
    padding-bottom: 48px;
  }

  .contact-hero__art {
    position: relative;
    inset: auto;
    order: -1;
    width: 100%;
    height: clamp(190px, 44vw, 300px);
    margin-bottom: -40px;
    -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 22%, #000 70%, transparent 100%);
    mask-image: linear-gradient(180deg, transparent 0, #000 22%, #000 70%, transparent 100%);
  }

  .contact-hero::before {
    top: var(--header-h, 72px);
    width: 110px;
  }

  .contact-page__grid {
    grid-template-columns: 1fr;
  }

  .contact-map {
    flex-direction: column;
    align-items: stretch;
  }

  .contact-map__inner {
    padding-bottom: 24px;
  }

  .contact-map__frame {
    position: relative;
    inset: auto;
    width: 100%;
    height: 260px;
    -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 16%);
    mask-image: linear-gradient(180deg, transparent 0, #000 16%);
  }

  .contact-map::before {
    display: none;
  }
}

@media (max-width: 560px) {
  .contact-hero__desc br {
    display: none;
  }

  .contact-info,
  .contact-page .contact-form-card {
    padding: 20px 16px;
  }

  .contact-info__row {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 12px;
  }

  .contact-info__icon {
    width: 40px;
    height: 40px;
  }

  .contact-page .contact-form__submit {
    width: 100%;
  }

  .contact-form__privacy {
    align-items: flex-start;
  }

  .contact-form__privacy svg {
    margin-top: 3px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .contact-info__phone,
  .contact-pill,
  .contact-page .contact-form__field input,
  .contact-page .contact-form__field textarea,
  .contact-page .contact-form__field select {
    transition: none;
  }
}
