/* Contact and enquiry-tracking pages.
 *
 * Colours come from the --ui-* tokens in unified_theme.css. Every interactive control has
 * a visible :focus-visible ring — the previous form relied on the browser default, which
 * the reset in style.css was suppressing.
 */

.contact-shell {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 20px 72px;
}

/* ---------- Hero ---------- */

.contact-hero {
  padding: 56px 0 34px;
  max-width: 70ch;
}

.contact-eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ui-brand, #0071e3);
  background: rgba(0, 113, 227, 0.09);
  padding: 6px 13px;
  border-radius: 999px;
  margin-bottom: 18px;
}

.contact-hero h1 {
  font-size: clamp(2rem, 5vw, 2.85rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0 0 14px;
  color: var(--ui-text, #1d1d1f);
}

.contact-lede {
  font-size: clamp(1rem, 2.2vw, 1.12rem);
  line-height: 1.65;
  color: var(--ui-muted, #6e6e73);
  margin: 0;
}

/* ---------- Layout ---------- */

.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 28px;
  align-items: start;
}

.contact-main {
  min-width: 0;
}

.contact-card {
  background: var(--ui-surface, #fff);
  border: 1px solid var(--ui-line, #e7e7ed);
  border-radius: 18px;
  padding: 32px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 8px 24px rgba(0, 0, 0, 0.04);
}

/* ---------- Topic picker ---------- */

.contact-fieldset {
  border: none;
  margin: 0 0 26px;
  padding: 0;
}

.contact-legend {
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--ui-text, #1d1d1f);
  padding: 0;
  margin-bottom: 12px;
}

.fieldset-hint {
  font-size: 0.88rem;
  color: var(--ui-muted, #6e6e73);
  margin: -6px 0 16px;
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.topic-option {
  position: relative;
  display: block;
  cursor: pointer;
}

/* Visually hidden but still focusable and reachable by keyboard. */
.topic-option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.topic-body {
  display: block;
  padding: 13px 15px;
  border: 1px solid var(--ui-line, #e7e7ed);
  border-radius: 12px;
  background: var(--ui-surface-soft, #fbfbfd);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.topic-option:hover .topic-body {
  border-color: #c9c9d2;
  transform: translateY(-1px);
}

.topic-option input:checked + .topic-body {
  border-color: var(--ui-brand, #0071e3);
  background: rgba(0, 113, 227, 0.055);
  box-shadow: inset 0 0 0 1px var(--ui-brand, #0071e3);
}

/* The input is invisible, so the ring has to be drawn on its label. */
.topic-option input:focus-visible + .topic-body {
  outline: 2px solid var(--ui-brand, #0071e3);
  outline-offset: 2px;
}

.topic-title {
  display: block;
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--ui-text, #1d1d1f);
  margin-bottom: 2px;
}

.topic-hint {
  display: block;
  font-size: 0.8rem;
  color: var(--ui-muted, #6e6e73);
  line-height: 1.4;
}

/* ---------- Fields ---------- */

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field {
  margin-bottom: 18px;
  min-width: 0;
}

.field label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ui-text, #1d1d1f);
  margin-bottom: 7px;
}

.field-optional {
  font-weight: 400;
  color: var(--ui-muted, #6e6e73);
  font-size: 0.82rem;
}

.field input,
.field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  /* 16px minimum, or iOS Safari zooms the viewport on focus. */
  font-size: 16px;
  font-family: inherit;
  color: var(--ui-text, #1d1d1f);
  background: var(--ui-surface, #fff);
  border: 1px solid var(--ui-line, #e7e7ed);
  border-radius: 10px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.field textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #a1a1aa;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--ui-brand, #0071e3);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.16);
}

.field input.has-error,
.field textarea.has-error {
  border-color: var(--ui-danger, #c6291b);
  box-shadow: 0 0 0 3px rgba(198, 41, 27, 0.11);
}

.field-error {
  margin: 7px 0 0;
  font-size: 0.83rem;
  color: var(--ui-danger, #c6291b);
}

.field-foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.char-count {
  font-size: 0.79rem;
  color: var(--ui-muted, #6e6e73);
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.char-count.is-near-limit {
  color: var(--ui-warn, #9d5a00);
  font-weight: 600;
}

/* ---------- Conditional block ---------- */

.conditional-block {
  border: 1px solid var(--ui-line, #e7e7ed);
  border-radius: 13px;
  padding: 20px;
  background: var(--ui-surface-soft, #fbfbfd);
  margin-bottom: 22px;
  animation: blockReveal 260ms ease;
}

@keyframes blockReveal {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.conditional-block .contact-legend {
  padding: 0 6px;
  margin-left: -6px;
}

.check-group {
  margin-top: 16px;
}

.check-group-title {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ui-text, #1d1d1f);
  margin-bottom: 9px;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 8px;
}

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  background: var(--ui-surface, #fff);
  border: 1px solid var(--ui-line, #e7e7ed);
  border-radius: 9px;
  font-size: 0.89rem;
  color: var(--ui-text, #1d1d1f);
  cursor: pointer;
  transition: border-color 150ms ease;
}

.check:hover {
  border-color: #c9c9d2;
}

.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--ui-brand, #0071e3);
  flex-shrink: 0;
  margin: 0;
}

/* ---------- Honeypot ----------
 * Removed from the layout and the accessibility tree without display:none, which some
 * bots specifically check for. Real users never encounter it.
 */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------- Actions ---------- */

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--ui-line, #e7e7ed);
}

.btn-submit {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  /* 44px minimum height: the iOS/Android accessible tap target. */
  min-height: 46px;
  padding: 12px 28px;
  font-size: 0.97rem;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--ui-brand, #0071e3);
  border: none;
  border-radius: 11px;
  cursor: pointer;
  text-decoration: none;
  transition: background 160ms ease, transform 160ms ease;
}

.btn-submit:hover:not(:disabled) {
  background: var(--ui-brand-hover, #0062c7);
  transform: translateY(-1px);
}

.btn-submit:focus-visible {
  outline: 2px solid var(--ui-brand, #0071e3);
  outline-offset: 3px;
}

.btn-submit:disabled {
  opacity: 0.62;
  cursor: not-allowed;
  transform: none;
}

.btn-spinner {
  display: none;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.btn-submit.is-busy .btn-spinner {
  display: block;
}

.btn-submit.is-busy .btn-label {
  opacity: 0.8;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--ui-text, #1d1d1f);
  background: transparent;
  border: 1px solid var(--ui-line, #e7e7ed);
  border-radius: 11px;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}

.btn-ghost:hover {
  border-color: #c9c9d2;
  background: var(--ui-surface-soft, #fbfbfd);
}

.form-privacy {
  font-size: 0.84rem;
  color: var(--ui-muted, #6e6e73);
  margin: 0;
  flex: 1 1 220px;
}

.form-privacy a {
  color: var(--ui-brand, #0071e3);
}

.form-error {
  margin: 18px 0 0;
  padding: 13px 16px;
  background: rgba(198, 41, 27, 0.07);
  border-left: 3px solid var(--ui-danger, #c6291b);
  border-radius: 0 9px 9px 0;
  color: #9b2317;
  font-size: 0.9rem;
}

/* ---------- Success ---------- */

.success-card {
  text-align: center;
  animation: cardIn 320ms ease;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.success-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  color: #fff;
  background: var(--ui-success, #108a4a);
  border-radius: 50%;
}

.success-card h2 {
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
  color: var(--ui-text, #1d1d1f);
}

.success-copy {
  color: var(--ui-muted, #6e6e73);
  margin: 0 auto 22px;
  max-width: 46ch;
  line-height: 1.6;
}

.reference-box {
  background: var(--ui-surface-soft, #fbfbfd);
  border: 1px dashed #c9c9d2;
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 24px;
}

.reference-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ui-muted, #6e6e73);
  margin-bottom: 6px;
}

.reference-value {
  font-size: 1.55rem;
  letter-spacing: 0.06em;
  color: var(--ui-text, #1d1d1f);
  font-variant-numeric: tabular-nums;
}

.success-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

/* ---------- Sidebar ---------- */

.contact-aside {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 88px;
}

.aside-card {
  background: var(--ui-surface, #fff);
  border: 1px solid var(--ui-line, #e7e7ed);
  border-radius: 14px;
  padding: 20px;
}

.aside-card h2 {
  font-size: 0.98rem;
  margin: 0 0 9px;
  color: var(--ui-text, #1d1d1f);
}

.aside-card p {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--ui-muted, #6e6e73);
  margin: 0 0 12px;
}

.aside-card p:last-child {
  margin-bottom: 0;
}

.aside-link {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ui-brand, #0071e3);
  text-decoration: none;
}

.aside-link:hover {
  text-decoration: underline;
}

.aside-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.aside-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--ui-line, #e7e7ed);
  font-size: 0.86rem;
}

.aside-list li:last-child {
  border-bottom: none;
}

.aside-list span {
  color: var(--ui-muted, #6e6e73);
}

.aside-list strong {
  color: var(--ui-text, #1d1d1f);
  font-weight: 600;
  text-align: right;
}

.aside-contact a {
  color: var(--ui-brand, #0071e3);
  font-weight: 600;
  text-decoration: none;
  word-break: break-word;
}

.aside-note {
  font-size: 0.83rem !important;
}

.aside-note a {
  color: var(--ui-brand, #0071e3);
}

/* ---------- Responsive ---------- */

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

  /* Un-stick the sidebar once it sits below the form; sticky there would trap it. */
  .contact-aside {
    position: static;
  }
}

@media (max-width: 640px) {
  .contact-shell {
    padding: 0 14px 52px;
  }

  .contact-hero {
    padding: 32px 0 24px;
  }

  .contact-card {
    padding: 22px 18px;
    border-radius: 14px;
  }

  /* Side-by-side inputs are too cramped to type into on a phone. */
  .field-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .topic-grid {
    grid-template-columns: 1fr 1fr;
  }

  .check-grid {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-submit,
  .btn-ghost {
    width: 100%;
  }

  .form-privacy {
    text-align: center;
  }

  .success-actions {
    flex-direction: column;
  }

  .reference-value {
    font-size: 1.32rem;
  }
}

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

@media (prefers-reduced-motion: reduce) {
  .topic-body,
  .btn-submit,
  .conditional-block,
  .success-card {
    transition: none;
    animation: none;
  }

  .btn-submit:hover:not(:disabled),
  .topic-option:hover .topic-body {
    transform: none;
  }

  .btn-spinner {
    animation-duration: 1.8s;
  }
}
