/* Confiance Group — Contact (Figma: Contact Us · Desktop 1440) */

/* ---------- hero ---------- */

.contact-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 380px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start; /* title 200px from the top, as in the mockup */
  background: var(--bg-base);
}
.contact-hero::before,
.contact-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
}
.contact-hero::before {
  /* the mockup's crop of the square wave photo: 129.44% wide, nudged up by 27.4% of its own height */
  left: -22.3%;
  top: 0;
  width: 129.44%;
  aspect-ratio: 1;
  translate: 0 -27.41%;
  background: url("../img/contact/contact-hero.webp") 0 0 / 100% 100% no-repeat;
}
/* the light wave fades into white at the top and the bottom */
.contact-hero::after {
  inset: 0;
  background:
    linear-gradient(180deg, #ffffff 0%, rgba(255, 255, 255, 0) 51.783%),
    linear-gradient(180deg, rgba(255, 255, 255, 0) 56.197%, #ffffff 100%);
}
.contact-hero-inner { padding: 200px calc(120px + var(--edge)) 88px; }
.contact-hero-title { color: var(--text-heading); }

/* ---------- enquiry form ---------- */

.enquiry {
  padding: 80px calc(120px + var(--edge));
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), #ffffff);
}
/* left-aligned with the page content; the fields keep their own widths */
.enquiry-form {
  display: flex;
  flex-direction: column;
  gap: 40px;
}
.enquiry-head { display: flex; flex-direction: column; gap: 16px; }
.enquiry-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px 14px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 46px;
  line-height: 1.15;
  color: #000000;
}
.enquiry-sub { color: var(--text-body); }

.topic-dd { position: relative; display: inline-flex; }
.topic-trigger {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 0 0 6px;
  border-bottom: 2px solid var(--bg-accent);
  font: inherit;
  color: var(--text-link);
  white-space: nowrap;
}
.topic-chevron {
  flex: none;
  width: 24px;
  height: 15px;
  scale: 1 -1; /* artwork points up; the mockup flips it */
  transition: scale 0.2s ease;
}
.topic-trigger[aria-expanded="true"] .topic-chevron { scale: 1 1; }

.topic-listbox {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  z-index: 5;
  min-width: 340px;
  padding: 8px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 0 0 1px var(--border-subtle), 0 24px 48px rgba(8, 49, 42, 0.16);
  display: flex;
  flex-direction: column;
}
.topic-listbox[hidden] { display: none; }
.topic-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-radius: 10px;
  color: var(--bg-ink);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 17px;
  line-height: 1.3;
  text-align: left;
  white-space: nowrap;
  transition: background-color 0.12s ease;
}
.topic-option:hover { background: var(--bg-mist); }
.topic-option.is-selected { background: var(--bg-soft); }

.enquiry-body { display: flex; flex-direction: column; gap: 32px; }
.enquiry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 400px));
  gap: 20px 40px;
}
.field { display: flex; flex-direction: column; gap: 8px; }
/* "optional" after a label: lighter, italic, regular weight */
.field-optional { font-style: italic; font-weight: 400; opacity: 0.55; }
.enquiry-grid.has-odd > .field:last-child { grid-column: 1 / -1; }
.field-label {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 17px;
  line-height: 1.6;
  color: #000000;
}
.field input,
.enquiry-groups input,
.enquiry-groups textarea {
  font: inherit;
  font-size: 17px;
  color: var(--bg-ink);
  background: #ffffff;
  border: 1.5px solid #cccccc; /* not focused; focus turns it accent green */
  transition: border-color 0.2s ease;
}
.field input,
.enquiry-groups input {
  height: 52px;
  padding: 0 20px;
  border-radius: 999px;
}
.field input::placeholder,
.enquiry-groups input::placeholder { color: #000000; opacity: 0.2; }
.enquiry-groups textarea::placeholder { color: var(--bg-ink); opacity: 0.5; }
.field input:focus,
.enquiry-groups input:focus,
.enquiry-groups textarea:focus { outline: none; border-color: var(--bg-accent); }

.enquiry-groups { display: flex; flex-direction: column; gap: 32px; }
.field-group { display: flex; flex-direction: column; gap: 8px; }
/* free-text fields stay at the mockup's 840px; chip rows can use the full width */
.enquiry-groups input,
.enquiry-groups textarea { width: 100%; max-width: 840px; }
.enquiry-groups textarea {
  min-height: 140px;
  padding: 16px 20px;
  border-radius: 16px;
  line-height: 1.5;
  resize: vertical;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.enquiry .chip {
  height: 46px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--divider);
  background: #ffffff;
  color: var(--text-link);
  font-size: 17px;
  line-height: 1.3;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.enquiry .chip:hover { border-color: var(--text-link); }
.enquiry .chip[aria-pressed="true"] { background: var(--bg-deep); border-color: var(--bg-deep); color: #ffffff; }

.consent { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.consent-box {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border-radius: 6px;
  border: 1.5px solid var(--divider);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.consent-box::after {
  content: "";
  width: 10px;
  height: 5px;
  border-left: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  transform: translateY(-1px) rotate(-45deg);
  opacity: 0;
}
.consent-checkbox:checked + .consent-box { background: var(--bg-deep); border-color: var(--bg-deep); }
.consent-checkbox:checked + .consent-box::after { opacity: 1; }
.consent-checkbox:focus-visible + .consent-box { outline: 2px solid var(--bg-accent); outline-offset: 3px; }
.consent-copy { color: var(--bg-ink); }
.consent-copy a { color: var(--text-link); text-decoration: underline; text-underline-offset: 3px; }

.enquiry-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 16px 24px; }
.enquiry-actions .btn { width: auto; }
.enquiry-turnstile:empty { display: none; }
.enquiry-turnstile { margin-bottom: 20px; min-height: 65px; }
.form-status { color: var(--text-heading); }
.form-status.is-error { color: var(--bg-ink); font-weight: 600; }

/* ---------- regional offices ---------- */

.offices { background: var(--bg-mist); }
.offices-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  padding: 88px calc(120px + var(--edge));
}
.offices-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 25px;
  text-align: center;
}
.offices-head h2 { color: var(--text-heading); }
.offices-head p { width: 560px; max-width: 100%; color: var(--text-body); }

.office-tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.office-tab {
  height: 46px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--text-muted);
  color: var(--text-link);
  font-size: 17px;
  line-height: 1.3;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.office-tab:hover { border-color: var(--text-link); }
.office-tab.is-active { background: var(--bg-ink); border-color: var(--bg-deep); color: #ffffff; }

.office-grid { display: flex; width: 100%; }
.office-photo {
  position: relative;
  flex: 1 0 0;
  min-width: 1px;
  overflow: hidden;
  border-radius: 16px 0 0 16px;
  background: var(--bg-ink);
}
/* the mockup's crop of the wide skyline photo */
.office-photo img {
  position: absolute;
  left: -188.48%;
  top: -35.82%;
  width: 361.79%;
  height: 203.89%;
  max-width: none;
  transition: opacity 0.35s ease;
}
.office-photo img.is-swapping { opacity: 0; }

.office-card {
  flex: 1 0 0;
  min-width: 1px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 40px;
  border-radius: 0 16px 16px 0;
  background: #ffffff;
  color: #08312a;
}
.office-card-head { display: flex; flex-direction: column; gap: 8px; }
.office-card-city { color: var(--text-heading); }
.office-card-entity { font-size: 17px; line-height: 1.3; color: #000000; }
.office-card dl {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
}
.office-card dl > div { display: flex; flex-direction: column; gap: 4px; }
.office-card dt {
  font-size: 14px; /* caption style */
  font-weight: 400;
  line-height: 1.3;
  color: #6c6c6c;
}
.office-card dd { font-size: 17px; line-height: 1.3; }
.office-card dd a { color: var(--text-link); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- smaller screens ---------- */

@media (max-width: 1024px) {
  .contact-hero { min-height: 360px; }
  .contact-hero-inner { padding: 160px var(--gutter) 56px; }
  .enquiry { padding: 32px var(--gutter) 72px; }
  .enquiry-heading { font-size: 36px; }
  .offices-inner { padding: 72px var(--gutter); }
  .office-grid { flex-direction: column; }
  .office-photo { flex: none; height: 320px; border-radius: 16px 16px 0 0; }
  .office-photo img { left: -60%; top: -20%; width: 220%; height: 140%; }
  .office-card { border-radius: 0 0 16px 16px; }
}

@media (max-width: 640px) {
  .enquiry-grid { grid-template-columns: 1fr; }
  .enquiry-heading { flex-direction: column; gap: 8px; font-size: 32px; }
  .enquiry-actions { flex-direction: column; align-items: flex-start; }
  .office-card { padding: 28px; }
  .offices-head h2 { white-space: normal; }
}

/* ---------- dark mode ---------- */

@media (prefers-color-scheme: dark) {
  .contact-hero::after {
    background:
      linear-gradient(180deg, var(--bg-base) 0%, rgba(15, 30, 27, 0) 51.783%),
      linear-gradient(180deg, rgba(15, 30, 27, 0) 56.197%, var(--bg-base) 100%);
  }
  .contact-hero::before { opacity: 0.35; }
  .enquiry { background: var(--bg-base); }
  .enquiry-heading { color: var(--text-body); }
  .field-label { color: var(--text-body); }
  .field input, .enquiry-groups input, .enquiry-groups textarea { border-color: var(--divider); }
  .field input:focus, .enquiry-groups input:focus, .enquiry-groups textarea:focus { border-color: var(--bg-accent); }
  .field input, .enquiry-groups input, .enquiry-groups textarea, .enquiry .chip, .consent-box { background: var(--bg-mist); color: var(--text-body); }
  .field input::placeholder, .enquiry-groups input::placeholder { color: var(--text-body); opacity: 0.35; }
  .topic-chevron { filter: brightness(2.2); }
  .topic-listbox { background: var(--bg-mist); }
  .topic-option { color: var(--text-body); }
  .consent-copy { color: var(--text-body); }
  .office-card { background: var(--bg-mist); color: var(--text-body); }
  .office-card-entity { color: var(--text-body); }
}

/* office photos: one per city, filling the panel (Kuala Lumpur keeps its towers crop via object-position) */
.office-photo img { left: 0; top: 0; width: 100%; height: 100%; object-fit: cover; object-position: 66% 50%; }
@media (max-width: 1024px) { .office-photo img { left: 0; top: 0; width: 100%; height: 100%; } }

/* dark mode: hero uses the mission photo instead of the faded photo + dark gradient */
@media (prefers-color-scheme: dark) {
  .contact-hero::before { background: url("../img/contact/contact-hero.webp") center / cover no-repeat; opacity: 1; }
  .contact-hero::after { background: none; }
}

/* ---------- dark mode: Contact Us (Figma 341:21067) ---------- */
@media (prefers-color-scheme: dark) {
  body.page-light-hero { background: var(--bg-mist); }

  /* hero: green light photo fading into var(--bg-mist) top and bottom */
  body .contact-hero { background: var(--bg-mist); }
  body .contact-hero::before { background: url("../img/contact/contact-hero.webp") center / cover no-repeat; opacity: 1; }
  body .contact-hero::after {
    background:
      linear-gradient(180deg, rgb(9, 23, 20) 0%, rgba(9, 23, 20, 0) 51.783%),
      linear-gradient(180deg, rgba(9, 23, 20, 0) 56.197%, rgb(9, 23, 20) 100%);
  }
  body .contact-hero-title { color: #ffffff; }

  /* enquiry form */
  body .enquiry { background: var(--bg-mist); }
  body .enquiry-heading { color: #ffffff; }
  body .topic-trigger { color: #13ab8d; border-bottom-color: #13ab8d; }
  body .field-label, body .enquiry .field-label { color: #ffffff; }
  body .field input, body .enquiry-groups input, body .enquiry-groups textarea {
    background: #ffffff; border-color: #cccccc; color: #000000;
  }
  body .field input::placeholder, body .enquiry-groups input::placeholder { color: #000000; opacity: 0.3; }
  body .enquiry-groups textarea::placeholder { color: #08312a; opacity: 0.5; }
  body .enquiry .chip { background: transparent; border-color: #ffffff; color: #ffffff; }
  body .enquiry .chip[aria-pressed="true"] { background: #ffffff; border-color: #ffffff; color: #000000; }
  body .consent-box { background: #ffffff; border-color: #ffffff; }
  body .consent-copy { color: #ffffff; }
  body .consent-copy a { color: #13ab8d; }

  /* regional offices */
  body .offices { background: #000000; }
  body .offices-head h2 { color: #13ab8d !important; }
  body .offices-head p { color: #ffffff; }
  body .office-tab { background: transparent; border-color: #ffffff; color: #ffffff; }
  body .office-tab.is-active { background: #ffffff; border-color: #ffffff; color: #000000; }
  body .office-card { background: var(--bg-mist); color: #ffffff; }
  body .office-card-city { color: #ffffff; }
  body .office-card-entity { color: #ffffff; }
  body .office-card dl { border-top-color: rgba(194, 213, 209, 0.25); }
  body .office-card dt { color: #b0b0b0; }
  body .office-card dd, body .office-card dd a { color: #ffffff; }
}

/* office photo: no outline in either mode (the dark fill behind it also showed as a thin edge) */
body .office-photo { border: 0; outline: 0; box-shadow: none; background: transparent; }

/* dark mode: topic dropdown — selected option on solid green with white text, hover a soft lift */
@media (prefers-color-scheme: dark) {
  body .topic-listbox { background: #172b27; box-shadow: 0 0 0 1px rgba(194, 213, 209, 0.25), 0 24px 48px rgba(0, 0, 0, 0.5); }
  body .topic-option, body .topic-option * { color: #ffffff; }
  body .topic-option:hover { background: rgba(255, 255, 255, 0.08); }
  body .topic-option.is-selected, body .topic-option[aria-selected="true"] { background: #13ab8d; }
  body .topic-option.is-selected *, body .topic-option[aria-selected="true"] * { color: #ffffff; }
}

/* offices intro: fits narrow screens */
.offices-head { max-width: 100%; }
@media (max-width: 768px) { .offices-head p { width: auto; } }

/* form errors / success */
body .field.is-invalid input { border-color: var(--error); box-shadow: 0 0 0 1px var(--error); }
body .field.is-invalid .field-label { color: var(--error); }
body .consent.is-invalid .consent-box { border-color: var(--error); box-shadow: 0 0 0 1px var(--error); }
body .form-status.is-error { color: var(--error); font-weight: 600; }
body .form-status.is-success { color: var(--text-heading); font-weight: 600; }
@media (prefers-color-scheme: dark) { body .form-status.is-success { color: #8fe0c6; } }

/* ---------- contact mobile (≤640px) ---------- */
.office-select-wrap { display: none; }
@media (max-width: 640px) {
  body .contact-hero { min-height: 200px; padding-top: 112px; padding-bottom: 32px; justify-content: flex-end; }

  /* enquiry pills: slimmer */
  body .enquiry .chip { height: auto; min-height: 0; padding: 6px 14px; line-height: 1.3; }

  /* offices: dropdown instead of city pills, centred, Kuala Lumpur (Malaysia) first */
  body .office-tabs { display: none; }
  body .office-select-wrap { display: flex; justify-content: center; width: 100%; }
  body .office-select {
    -webkit-appearance: none; appearance: none;
    min-width: 220px; padding: 10px 44px 10px 20px; border-radius: 999px;
    border: 1.5px solid var(--text-link); background: #ffffff url("../img/shared/topic-chevron.svg") right 16px center / 16px 16px no-repeat;
    color: var(--text-link); font: inherit; font-size: 16px; text-align: center; text-align-last: center; cursor: pointer;
  }
  @media (prefers-color-scheme: dark) {
    body .office-select { background-color: transparent; border-color: #ffffff; color: #ffffff; }
    body .office-select option { color: #000000; }
  }
}
@media (max-width: 640px) {
  body .contact-hero { padding: 0; justify-content: flex-end; }
  body .contact-hero .contact-hero-inner { padding: 112px var(--gutter) 40px; }
  /* chevron (the shared one points up, so it's rotated here) */
  body .office-select { background-image: none; }
  body .office-select-wrap { position: relative; width: max-content; margin-inline: auto; }
  body .office-select-wrap::after {
    content: ""; position: absolute; right: 18px; top: 50%; width: 12px; height: 8px; margin-top: -4px; pointer-events: none;
    background: url("../img/shared/topic-chevron.svg") center / contain no-repeat; rotate: 180deg;
  }
  @media (prefers-color-scheme: dark) { body .office-select-wrap::after { filter: brightness(0) invert(1); } }
}
@media (max-width: 640px) { body .office-select-wrap .office-select { padding-top: 7px; padding-bottom: 7px; font-size: 13px; } body .enquiry .chip { padding: 6px 14px; } }

/* ---------- phones: office dropdown, same pill + menu card as Client stories ---------- */
.office-dd { display: none; }
@media (max-width: 640px) {
  body .office-select-wrap { display: none !important; }
  body .office-dd { display: block; position: relative; width: max-content; margin-inline: auto; z-index: 6; }
  body .office-dd-btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px;
    border: 1.5px solid var(--text-link); border-radius: 999px; background: var(--bg-base);
    color: var(--text-link); font-size: 13px; line-height: 1.3; white-space: nowrap;
  }
  body .office-dd-btn img { width: 16px; height: 16px; transition: rotate 0.2s ease; }
  body .office-dd-btn[aria-expanded="true"] img { rotate: 180deg; }
  body .office-dd-list {
    position: absolute; top: calc(100% + 8px); left: 50%; translate: -50% 0; z-index: 6;
    width: max-content; min-width: 100%; max-width: calc(100vw - 2 * var(--gutter));
    padding: 8px; background: #ffffff; border-radius: 16px;
    box-shadow: 0 0 0 1px var(--border-subtle), 0 24px 48px rgba(8, 49, 42, 0.16);
    display: flex; flex-direction: column;
  }
  body .office-dd-list[hidden] { display: none; }
  body .office-dd-option { padding: 8px 16px; border-radius: 10px; color: var(--bg-ink); font-size: 13px; line-height: 1.3; text-align: left; white-space: nowrap; }
  body .office-dd-option:hover, body .office-dd-option:focus-visible { background: var(--bg-mist); outline: none; }
  body .office-dd-option[aria-selected="true"] { background: var(--bg-soft); }
  @media (prefers-color-scheme: dark) {
    body .office-dd-btn { background: transparent; border-color: #ffffff; color: #ffffff; }
    body .office-dd-btn img { filter: brightness(0) invert(1); }
    body .office-dd-option { color: var(--text-body); }
  }
}
@media (max-width: 640px) { html body .offices-inner { gap: 20px; } }

/* office card: Google Maps link opens in a new tab */
.office-map-link { align-self: flex-start; margin-top: 0; }

/* careers (linked from About "Join our team") */
.careers-contact { padding: 100px calc(var(--gutter) + var(--edge)); }
.careers-contact-inner { width: min(1204px, 100%); margin: 0 auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 48px; }
.careers-contact-text { display: flex; flex-direction: column; align-items: flex-start; gap: 20px; max-width: 640px; }
.careers-contact-text h2 { color: var(--text-heading); }
.careers-contact-inner .btn { flex: none; }
@media (max-width: 1024px) { .careers-contact { padding: 80px var(--gutter); } }
@media (max-width: 640px) {
  .careers-contact { padding: 64px var(--gutter); }
  .careers-contact-inner { flex-direction: column; align-items: flex-start; gap: 24px; }
}

/* mobile form fields per the Contact Us — Mobile mockup (Figma 237:2) */
@media (max-width: 640px) {
  html body .enquiry-form input:not([type=checkbox]):not([type=radio]) { height: 40px; min-height: 0; font-size: 13px; line-height: normal; padding: 0 20px; border-width: 1px; }
  html body .enquiry-form textarea { min-height: 140px; height: 140px; font-size: 13px; line-height: 25.5px; padding: 8px 10px; border-width: 1px; }
  html body .enquiry-form .chip { border-width: 1px; }
}

/* selected enquiry chips: accent green (matches the selected topic option) */
html body .enquiry .chip[aria-pressed="true"] { background: var(--bg-accent); border-color: var(--bg-accent); color: #ffffff; }
