/* The enquiry form (enquiry.js) and the header Contact button (index.html).
 *
 * z-index 55: above the header (20), the feedback button (25), the plan viewer
 * (30) and the comparison (compare.css, 50), under the feedback dialog (60) so a
 * buyer who finds a bug while filling it in can still report it.
 * This file carries its own phone rules; responsive.css is not edited for it. */

/* ---------------------------------------------------------- header button */
#contactBtn {
  flex: none; display: inline-flex; align-items: center; gap: 7px;
  margin-left: 8px; min-height: 40px; padding: 0 16px;
  border: 1px solid var(--line, rgba(0,0,0,.16)); border-radius: 999px;
  background: #fff; color: var(--ink, #000); font-weight: 650; cursor: pointer;
}
#contactBtn:hover { border-color: #000; }
#contactBtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#contactBtn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
/* The phone header is ONE 60px row: the menu button, then this. Icon only, so
 * the row still fits with the buyer-link logo in front (measured in
 * tests/buyer-actions-smoke.mjs). The accessible name stays "Contact". */
@media (max-width: 720px) and (min-height: 501px) {
  #contactBtn { width: 44px; min-height: 44px; padding: 0; justify-content: center; margin-left: 0; }
  #contactBtn .label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
/* A phone on its side keeps the one-row header of 52px. */
@media (max-height: 500px) { #contactBtn { min-height: 34px; padding: 0 12px; } }

/* ------------------------------------------------------------- the dialog */
.enquiry {
  position: fixed; inset: 0; z-index: 55; display: grid; place-items: center;
  padding: 20px; background: rgba(0,0,0,.45); backdrop-filter: blur(3px);
}
.enquiry[hidden] { display: none; }
.enq-form {
  width: min(560px, 100%); max-height: min(92vh, 860px); overflow: auto;
  padding: 24px; border-radius: 18px; background: #fff; color: var(--ink, #000);
  box-shadow: 0 24px 70px rgba(0,0,0,.35); display: grid; gap: 14px;
}
.enq-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.enq-head h2 { margin: 0; font-size: 22px; line-height: 1.2; }
.enq-close {
  flex: none; width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: var(--warm-paper,#f1f1f1); font-size: 24px; line-height: 1; cursor: pointer;
}
.enq-lead, .enq-notice, .enq-hint { margin: 0; font-size: 14px; line-height: 1.45; color: #444; }
.enq-hint, .enq-notice { font-size: 12.5px; color: var(--warm-muted,#666); }
.enq-label { display: block; margin-bottom: 5px; font-size: 12.5px; font-weight: 650; letter-spacing: .02em; }
.enq-field { display: block; }
.enq-field input, .enq-field textarea, .enq-add select {
  width: 100%; padding: 11px 12px; border: 1px solid rgba(0,0,0,.25); border-radius: 10px;
  background: #fff; color: inherit; font: inherit; font-size: 16px; /* 16px: iOS does not zoom */
}
.enq-field textarea { resize: vertical; min-height: 110px; }
.enq-field input[aria-invalid="true"] { border-color: #b00020; box-shadow: 0 0 0 2px rgba(176,0,32,.18); }
.enq-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.enq-pref { margin: 0; padding: 0; border: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.enq-pref legend { padding: 0; }
.enq-pref label, .enq-check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.enq-pref input, .enq-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.enq-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.enq-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 12px;
  border-radius: 999px; background: var(--warm-paper,#f1f1f1); font-size: 14px; font-weight: 650;
}
.enq-chip button { width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; font-size: 18px; cursor: pointer; }
.enq-chip button:hover { background: #ddd; }
.enq-none { font-size: 13px; color: var(--warm-muted,#777); }
.enq-add select { padding: 9px 10px; font-size: 14px; }
/* The honeypot: off screen, not display:none, because a simple script skips
 * hidden fields and a person never reaches it (tabindex -1, aria-hidden). */
.enq-trap { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.enq-status { min-height: 1.3em; margin: 0; font-size: 14px; line-height: 1.4; }
.enq-status[data-kind="error"] { color: #b00020; font-weight: 600; }
.enq-actions { display: flex; justify-content: flex-end; gap: 10px; }
.enq-primary, .enq-secondary {
  min-height: 46px; padding: 0 22px; border-radius: 999px; font-weight: 700; cursor: pointer;
  border: 1px solid transparent;
}
.enq-primary { background: var(--accent); color: #fff; }
.enq-primary:hover { background: var(--accent-strong); }
.enq-primary[disabled] { opacity: .6; cursor: progress; }
.enq-secondary { background: #fff; border-color: rgba(0,0,0,.25); color: inherit; }
.enq-done p { margin: 0; font-size: 15px; line-height: 1.5; }
.enquiry button:focus-visible, .enquiry input:focus-visible, .enquiry textarea:focus-visible, .enquiry select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
html.enquiry-open { overflow: hidden; }

/* A phone: a full-height sheet, the actions pinned at the bottom. */
@media (max-width: 720px) {
  .enquiry { padding: 0; place-items: stretch; background: #fff; backdrop-filter: none; }
  .enq-form {
    width: 100%; max-height: none; height: 100%; border-radius: 0; box-shadow: none;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); align-content: start;
  }
  .enq-row { grid-template-columns: 1fr; }
  .enq-actions {
    position: sticky; bottom: calc(-16px - env(safe-area-inset-bottom)); margin: 0 -16px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: #fff;
    border-top: 1px solid rgba(0,0,0,.1);
  }
  .enq-actions > * { flex: 1; }
  .enq-done { height: auto; }
}

/* ------------------------------------------------ calls to action in panel */
/* Overview: the enquiry button beside "See the N apartments". On a phone the
 * pair is the sheet's bottom bar, exactly as the lone .primary was (the rules in
 * responsive.css select `.primary:last-child`, which a wrapper no longer is). */
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.cta-row > button { flex: 1 1 160px; margin: 0; }
.cta-row .cta-ghost {
  padding: 15px; border: 1px solid #000; border-radius: 12px; background: #fff; color: var(--warm-ink,#000);
  font-weight: 700; cursor: pointer;
}
.cta-row .cta-ghost:hover { background: var(--warm-ink,#000); color: #fff; }
@media (max-width: 720px) and (min-height: 501px) {
  #panel .tab-body > .cta-row:last-child {
    position: sticky; bottom: calc(-18px - env(safe-area-inset-bottom)); z-index: 6;
    width: calc(100% + 40px); margin: 14px -20px 0; flex-wrap: nowrap;
    padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.97);
    border-radius: 0 0 21px 21px; box-shadow: 0 -8px 18px rgba(255,255,255,.9);
  }
  #panel .tab-body > .cta-row:last-child > button { flex: 1 1 0; padding: 13px 8px; font-size: 14px; }
}

.contact-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.contact-actions .cta-ghost, .contact-actions a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px;
  border: 1px solid #000; border-radius: 999px; background: #fff; color: var(--warm-ink,#000);
  font-weight: 650; text-decoration: none; cursor: pointer;
}
.contact-actions .cta-ghost:hover, .contact-actions a:hover { background: var(--warm-ink,#000); color: #fff; }
.contact-actions .cta-solid { background: var(--accent); border-color: var(--accent); color: #fff; }
.contact-actions .cta-solid:hover { background: var(--accent-strong); border-color: var(--accent-strong); }

/* A sold apartment: up to three similar homes that can still be bought. */
.similar { margin-top: 14px; }
.similar h3 { margin: 0 0 8px; font-size: 15px; }
.similar .cta-ghost { margin-top: 10px; width: 100%; padding: 14px; border: 1px solid #000; border-radius: 12px; background: #fff; font-weight: 700; cursor: pointer; }
.similar .cta-ghost:hover { background: var(--warm-ink,#000); color: #fff; }

/* The Availability list with nothing in it. */
.no-results { margin: 10px 0; padding: 16px; border: 1px dashed rgba(0,0,0,.3); border-radius: 12px; }
.no-results p { margin: 0 0 10px; }
.no-results .cta-ghost { width: 100%; padding: 14px; border: 1px solid #000; border-radius: 12px; background: #fff; font-weight: 700; cursor: pointer; }
.no-results .cta-ghost:hover { background: var(--warm-ink,#000); color: #fff; }
