/* ============================================================
   SITE FOOTER BUNDLE
   ------------------------------------------------------------
   Everything the shared footer component needs, in one file:
     · .field / .field-input   reusable form-field pattern
     · .form-submit            submit button
     · .site-contact-*         the footer contact block itself
     · .toast-*                transient status messages

   Linked by EVERY page, including case studies that otherwise
   carry their own inline <style>. Markup lives in
   js/site-footer.js. Edit styling here and it updates sitewide.
   ============================================================ */

/* ══════════════════════════════════════════════════════════
   FORM FIELD — reusable pattern
   ──────────────────────────────────────────────────────────
   One markup shape for every input on the site. Copy this block,
   change the id/name/type. The id must match the label's `for`
   AND the error's `aria-describedby`, or the field loses its
   accessible name and error announcement.

     <div class="field">
       <label class="field-label" for="ID">Label <span class="field-req">*</span></label>
       <input class="field-input" id="ID" name="NAME" type="text"
              required autocomplete="..." aria-describedby="ID-err">
       <p class="field-error" id="ID-err" role="alert" hidden></p>
     </div>

   Modifiers:
     .field--half   → sits in a 2-up row (see .field-row)
     .field-input--area → for <textarea>
   ══════════════════════════════════════════════════════════ */
.field { margin-bottom: 1.25rem; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1rem;
}
@media (max-width: 600px) {
  .field-row { grid-template-columns: 1fr; }
}

.field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-bottom: 0.4rem;
  color: inherit;
}
.field-req {
  color: var(--accent-coral);
  margin-left: 0.15rem;
}

.field-input {
  width: 100%;
  font-family: var(--sans);
  font-size: 0.95rem;
  line-height: 1.5;
  padding: 0.7rem 0.9rem;
  color: var(--ink);
  background: var(--white);
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-sm, 8px);
  transition: border-color var(--ease-default, 0.3s ease), box-shadow var(--ease-default, 0.3s ease);
  /* Stops iOS Safari zooming the viewport on focus at <16px font size. */
  -webkit-appearance: none;
  appearance: none;
}
.field-input::placeholder { color: var(--warm-gray); opacity: 0.7; }
.field-input:hover { border-color: rgba(0, 0, 0, 0.28); }
.field-input:focus {
  outline: none;                      /* replaced by the ring below */
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(26, 158, 143, 0.18);
}
/* Keyboard users additionally get the global focus-visible outline. */
.field-input:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}
.field-input--area {
  min-height: 150px;
  resize: vertical;
}

/* Invalid state is driven by JS adding .is-invalid — never by :invalid
   alone, which would flag empty required fields before the user types. */
.field-input.is-invalid {
  border-color: var(--accent-coral);
  box-shadow: 0 0 0 3px rgba(232, 97, 77, 0.15);
}
.field-error {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--accent-coral);
}
.field-error[hidden] { display: none; }

/* Honeypot — visually gone, still in the DOM for bots to fill.
   Kept out of the tab order and the a11y tree via tabindex/aria in markup. */
.field-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Field pattern on a dark section (the contact block) */
.bg-ink .field-label { color: rgba(255, 255, 255, 0.85); }
.bg-ink .field-input {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--white);
}
.bg-ink .field-input::placeholder { color: rgba(255, 255, 255, 0.4); }
.bg-ink .field-input:hover { border-color: rgba(255, 255, 255, 0.35); }
.bg-ink .field-input:focus {
  border-color: var(--teal);
  background: rgba(255, 255, 255, 0.1);
}
.bg-ink .field-input.is-invalid { border-color: #ff9d8c; }
.bg-ink .field-error { color: #ff9d8c; }

/* ── Form submit button ──────────────────────────────────── */
.form-submit {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.8rem 2rem;
  border-radius: var(--radius-pill, 100px);
  border: 1px solid var(--teal);
  background: var(--teal);
  color: var(--white);
  cursor: pointer;
  transition: background var(--ease-default, 0.3s ease), border-color var(--ease-default, 0.3s ease),
              opacity var(--ease-default, 0.3s ease);
}
.form-submit:hover:not(:disabled) {
  background: var(--teal-deep);
  border-color: var(--teal-deep);
}
.form-submit:disabled { opacity: 0.55; cursor: progress; }

/* ══════════════════════════════════════════════════════════
   SITE FOOTER — the contact form, on every page
   ──────────────────────────────────────────────────────────
   Injected by js/site-footer.js. Edit the markup there, the
   styling here. Never copy either into an individual page.
   ══════════════════════════════════════════════════════════ */
.site-contact {
  padding: var(--section-pad, 6rem 3rem);
  background: var(--ink);
}
.site-contact-inner {
  /* Wider than --inner-max (960px): this block holds a two-column
     form, not a column of prose, so it needs the room. */
  max-width: 1100px;
  margin: 0 auto;
}

.site-contact-intro { text-align: center; margin-bottom: 3rem; }
.site-contact-intro .section-label { color: rgba(255, 255, 255, 0.4); }

.site-contact-heading {
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 2.75rem);
  color: var(--white);
  line-height: 1.15;
  margin-bottom: 1rem;
}
.site-contact-text {
  font-size: 1.05rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.6);
}

.site-contact-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 3.5rem;
  align-items: start;
  text-align: left;
}
@media (max-width: 860px) {
  .site-contact-layout { grid-template-columns: 1fr; gap: 2.5rem; }
}

.site-contact-form { min-width: 0; }

.site-contact-fallback {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
}
.site-contact-fallback a {
  color: rgba(255, 255, 255, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.25);
}
.site-contact-fallback a:hover { color: var(--white); border-color: var(--white); }

.site-contact-aside { padding-top: 0.25rem; }
.site-contact-aside-title {
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--white);
  margin-bottom: 0.9rem;
}
.site-contact-aside-nav { margin-top: 1.75rem; }
.site-contact-aside-list { margin-bottom: 0; }
.site-contact-aside-list li { margin-bottom: 0.6rem; }
.site-contact-aside-list a {
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.75);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 0.1rem;
  transition: color var(--ease-default, 0.3s ease), border-color var(--ease-default, 0.3s ease);
}
.site-contact-aside-list a:hover { color: var(--white); border-color: var(--teal); }
.site-contact-aside-note {
  margin-top: 1.75rem;
  font-size: 0.82rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.45);
}

@media (max-width: 768px) {
  .site-contact { padding: var(--section-pad-mobile, 4rem 1.5rem); }
}

/* ══════════════════════════════════════════════════════════
   TOAST — transient status message
   Lives in a persistent aria-live region so screen readers
   announce it without moving focus. Auto-dismisses; also
   dismissible with Escape or the close button.
   ══════════════════════════════════════════════════════════ */
.toast-region {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: var(--z-modal, 200);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  /* Region itself must never intercept clicks when empty. */
  pointer-events: none;
}
@media (max-width: 600px) {
  .toast-region { left: 1rem; right: 1rem; bottom: 1rem; }
}

.toast {
  /* Was --ink on --ink — the toast usually floats over the dark contact
     section, so a same-color background nearly disappeared into it. A
     light background reads as its own surface regardless of what's
     behind it. */
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  max-width: 380px;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md, 12px);
  background: var(--teal-light);
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.5;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  border-left: 4px solid var(--teal-deep);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.28s ease, transform 0.28s ease;
}
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast--success { border-left-color: var(--teal-deep); }
.toast--error   { border-left-color: var(--accent-coral); }

.toast-icon { flex-shrink: 0; font-size: 1rem; line-height: 1.4; }
.toast-body { flex: 1; }
.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: rgba(26, 26, 46, 0.45);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0 0 0.25rem;
  transition: color var(--ease-default, 0.3s ease);
}
.toast-close:hover { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .toast { transition: opacity 0.01ms; transform: none; }
}
