/* ==========================================================================
   Why Somerset County — Contact Us
   The enquiry form, the details card beside it and the "who to ask" cards.
   Loaded after css/styles.css and css/components/page-chrome.css.

   No comp for this page either. It takes the same accent decision as News:
   teal, because Contact is not a pillar and should not borrow a pillar's
   colour, with the bright green for the nav item so it survives the teal
   header. See css/news.css for the same two lines and the same reasoning.
   ========================================================================== */

:root {
  --ws-section-accent: var(--ws-teal);
  --ws-section-nav: var(--ws-green);
  --ws-field-border: #cdd5d8;
}

/* --------------------------------------------------------------------------
   1. Form beside the details card
   620 / 40 / 380 across the 1040. The form is the wider column because a
   two-up field row needs to stay two-up as long as possible.
   -------------------------------------------------------------------------- */
.contact-grid {
  display: grid;
  grid-template-columns: 620fr 380fr;
  column-gap: clamp(24px, 2.78vw, 40px);
  align-items: start;
}

/* --------------------------------------------------------------------------
   2. Form controls
   Bootstrap's form classes are deliberately not used: the rest of the site
   styles its own controls (the search overlay's input is the precedent) and
   mixing the two gives two different focus rings.
   -------------------------------------------------------------------------- */
.contact-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(14px, 1.53vw, 22px);
}
.field { display: flex; flex-direction: column; }
.field--full { grid-column: 1 / -1; }

.field__label {
  margin-bottom: .4em;
  font-size: .9375rem;
  font-weight: 700;
  color: var(--ws-teal-ink);
}
/* The asterisk carries no information on its own, so the requirement is also
   in the input's own `required` and announced there. This is the sighted cue. */
.field__req { color: #b3281e; margin-left: .2em; }

.field__input,
.field__select,
.field__textarea {
  width: 100%;
  padding: .62em .85em;
  border: 2px solid var(--ws-field-border);
  border-radius: 10px;
  background: #fff;
  font-family: var(--ws-font-body);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ws-ink);
  transition: border-color .2s var(--ws-ease), box-shadow .2s var(--ws-ease);
}
.field__textarea { min-height: 170px; resize: vertical; }
.field__select {
  appearance: none;
  /* The caret is drawn rather than left to the platform, so the control keeps
     the same height and radius as the text inputs on every OS. */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%23004f5a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right .9em center;
  background-size: 12px 8px;
  padding-right: 2.4em;
}
.field__input:focus,
.field__select:focus,
.field__textarea:focus {
  outline: none;
  border-color: var(--ws-green);
  box-shadow: 0 0 0 3px rgba(122, 193, 67, .28);
}
.field.is-invalid .field__input,
.field.is-invalid .field__select,
.field.is-invalid .field__textarea { border-color: #b3281e; }

.field__error {
  margin: .35em 0 0;
  font-size: .875rem;
  font-weight: 700;
  color: #b3281e;
}
.field__error:empty { display: none; }

.field--check {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: flex-start;
  gap: .6em;
}
.field--check input {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: .18em;
  accent-color: var(--ws-green-mid);
}
.field--check label { font-size: .9375rem; line-height: 1.45; }

.contact-form__actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: clamp(12px, 1.25vw, 18px);
}
.contact-form__note { margin: 0; font-size: .875rem; color: #6c7478; }

/* The form has no back end. Rather than letting a submit navigate away and
   look broken, main.js validates, blocks the submit and writes here. */
.form-status {
  grid-column: 1 / -1;
  margin: 0;
  padding: clamp(12px, 1.25vw, 18px);
  border-radius: 10px;
  background: var(--ws-band-green);
  font-weight: 700;
  color: #2c4a1a;
}
.form-status:empty { display: none; }
.form-status--error { background: #fbe3e1; color: #8c1f17; }

/* --------------------------------------------------------------------------
   3. Details card — teal panel to the right of the form
   -------------------------------------------------------------------------- */
.contact-card {
  border-radius: 14px;
  background: var(--ws-teal);
  padding: clamp(22px, 2.36vw, 34px);
  color: #fff;
  box-shadow: 0 6px 18px rgba(0, 79, 90, .22);
}
.contact-card__title {
  margin: 0 0 clamp(14px, 1.53vw, 22px);
  font-family: var(--ws-font-display);
  font-weight: 400;
  font-size: clamp(1.375rem, 1.944vw, 1.75rem);
  line-height: 1.1;
}
.contact-card__list { list-style: none; margin: 0; padding: 0; }
.contact-card__list li {
  display: flex;
  gap: .8em;
  padding: clamp(10px, 1.11vw, 16px) 0;
  font-size: 1rem;
  line-height: 1.5;
}
.contact-card__list li + li { border-top: 1px solid rgba(255, 255, 255, .22); }
.contact-card__list i {
  flex: 0 0 1.25em;
  margin-top: .22em;
  color: var(--ws-green);
  text-align: center;
}
.contact-card__list a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.contact-card__list a:hover { color: var(--ws-green); }
.contact-card__label { display: block; font-weight: 700; }

.contact-card__social {
  display: flex;
  gap: 10px;
  margin: clamp(16px, 1.81vw, 26px) 0 0;
  padding: 0;
  list-style: none;
}
.contact-card__social a {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  color: #fff;
  text-decoration: none;
  transition: background .25s var(--ws-ease), transform .25s var(--ws-ease);
}
.contact-card__social a:hover { background: var(--ws-green-mid); transform: translateY(-2px); }

/* --------------------------------------------------------------------------
   4. "Who to ask" cards — three across the 1040
   -------------------------------------------------------------------------- */
.contact-people {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(18px, 2.08vw, 30px);
  margin: 0;
  padding: 0;
}
.contact-person {
  height: 100%;
  padding: clamp(18px, 1.94vw, 28px);
  border-radius: 14px;
  border-top: 5px solid var(--ws-green);
  background: #fff;
  box-shadow: 0 6px 18px rgba(0, 79, 90, .14);
}
.contact-person h3 {
  margin: 0 0 .35em;
  font-family: var(--ws-font-body);
  font-weight: 700;
  font-size: clamp(1.0625rem, 1.389vw, 1.25rem);
  line-height: 1.25;
  color: var(--ws-teal-ink);
}
.contact-person p { margin: 0 0 .6em; font-size: 1rem; line-height: 1.5; }
.contact-person a { font-weight: 700; color: var(--ws-teal-ink); text-decoration: underline; text-underline-offset: 3px; }
.contact-person a:hover { color: var(--ws-green-mid); }

/* --------------------------------------------------------------------------
   5. Visit us — photo beside the address block
   -------------------------------------------------------------------------- */
.visit-row {
  display: grid;
  grid-template-columns: 496fr 496fr;
  column-gap: clamp(24px, 3.33vw, 48px);
  align-items: center;
}
.visit-row figure { margin: 0; }
.visit-row img { border-radius: 14px; box-shadow: 0 6px 18px rgba(0, 79, 90, .14); }

/* --------------------------------------------------------------------------
   6. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
  .contact-grid { grid-template-columns: minmax(0, 1fr); row-gap: clamp(24px, 4vw, 40px); }
  .contact-people { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 767.98px) {
  .contact-form { grid-template-columns: minmax(0, 1fr); }
  .contact-people { grid-template-columns: minmax(0, 1fr); }
  .visit-row { grid-template-columns: minmax(0, 1fr); row-gap: clamp(16px, 4vw, 24px); }
  /* Photo above the copy, matching .media-row--text-first on the other pages */
  .visit-row figure { order: -1; }
}

/* --------------------------------------------------------------------------
   Contact Form 7
   CF7 renders the same field markup (set in the form's template in wp-admin)
   but wraps each control in a span, adds its own error tips and a response
   box. These map its pieces onto the styles above.
   -------------------------------------------------------------------------- */
.wpcf7 .hidden-fields-container { display: none; }
.wpcf7 .contact-form > p:empty { display: none; }
.wpcf7-form-control-wrap { display: block; }
.wpcf7-not-valid.field__input,
.wpcf7-not-valid.field__select,
.wpcf7-not-valid.field__textarea { border-color: #b3281e; }
.wpcf7-not-valid-tip {
  display: block;
  margin: .35em 0 0;
  font-size: .875rem;
  font-weight: 700;
  color: #b3281e;
}
.wpcf7 .wpcf7-response-output {
  grid-column: 1 / -1;
  margin: 0;
  padding: clamp(12px, 1.25vw, 18px);
  border: 0;
  border-radius: 10px;
  background: var(--ws-band-green);
  font-weight: 700;
  color: #2c4a1a;
}
.wpcf7 form.invalid .wpcf7-response-output,
.wpcf7 form.unaccepted .wpcf7-response-output,
.wpcf7 form.failed .wpcf7-response-output,
.wpcf7 form.spam .wpcf7-response-output {
  border: 0;
  background: #fbe3e1;
  color: #8c1f17;
}
.wpcf7 form.sent .wpcf7-response-output { border: 0; }
.wpcf7 form.init .wpcf7-response-output { display: none; }
.contact-form__actions .wpcf7-spinner { margin: 0; }
