/* ===========================================================================
 * Interaction polish — loaded last so it refines the page's own styles.
 *
 * Four things, in the order they matter:
 *   1. Response: the interface answers on press, not on release.
 *   2. Material: chrome is a translucent layer with content moving under it.
 *   3. Reach: menus open for keyboard and touch, not just a hovering mouse.
 *   4. Type: tracking and leading are size-specific, never one value.
 * ======================================================================== */

/* --- 1. Response ---------------------------------------------------------
   Nothing on this site responded to a press before release. Removing the
   native tap highlight is only safe because real feedback replaces it. */
.btn, .nav-cta, nav a, .dropdown a, .hamburger, button, [role="button"],
.ci, .fac-card, .footer-links a {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* The kit animates `all .22s`, which is too slow to read as a press.
   Colour keeps its own pace; the scale is near-instant. */
.btn {
  transition: background .2s ease, color .2s ease, border-color .2s ease,
              box-shadow .2s ease, transform 110ms cubic-bezier(.2,.8,.2,1);
}
.btn:active,
.nav-cta:active,
button:active:not(:disabled) {
  transform: scale(.972);
  transition-duration: 90ms;
}
/* Links in lists press too, just more subtly than a button. */
nav a:active, .dropdown a:active, .footer-links a:active {
  opacity: .62;
  transition: opacity 80ms ease-out;
}
.hamburger:active { transform: scale(.94); transition: transform 90ms ease-out; }

/* --- 2. Material ---------------------------------------------------------
   The header was an opaque white strip with a permanent hairline and a drop
   shadow. Now it is a translucent layer: content passes under it, and the
   edge only appears once there is something to separate from. */
header {
  background: rgba(255, 255, 255, .72);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  box-shadow: none;
  position: sticky;
}
header::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--bdr);
  opacity: 0;
  transition: opacity .22s ease;
  pointer-events: none;
}
body.is-scrolled header::after { opacity: 1; }
body.is-scrolled header { box-shadow: 0 4px 16px rgba(26, 75, 40, .055); }

/* Text over a translucent surface needs weight, not grey. */
header .logo-name { font-weight: 700; }

/* The mobile drawer is the same material, one step heavier. */
.mobile-nav {
  background: rgba(255, 255, 255, .88);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
}

/* --- 3. Reach ------------------------------------------------------------
   Dropdowns opened on hover only, so a keyboard could never reach them and
   touch depended on emulated hover. */
.nav-item:focus-within > .dropdown,
.nav-item:focus-within .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.nav-item:focus-within > a .chevron { transform: rotate(180deg); }

/* --- 4. Typography -------------------------------------------------------
   One -0.02em was applied to every heading regardless of size: too tight on
   a 0.9rem label, too loose on a 3.4rem display line. Leading moves
   inversely to size. */
h1 { letter-spacing: -.026em; line-height: 1.04; text-wrap: balance; }
h2 { letter-spacing: -.018em; line-height: 1.12; text-wrap: balance; }
h3 { letter-spacing: -.01em;  line-height: 1.28; }
h4, h5 { letter-spacing: -.002em; line-height: 1.35; }
p, li { text-wrap: pretty; }

/* Display type is set for the desktop size; at phone widths the same line is
   physically smaller and wants less negative tracking. */
@media (max-width: 700px) {
  h1 { letter-spacing: -.018em; }
  h2 { letter-spacing: -.012em; }
}

/* --- Accessibility preferences ------------------------------------------- */
@media (prefers-reduced-transparency: reduce) {
  header, .mobile-nav {
    background: #fff;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  body.is-scrolled header::after { opacity: 1; }
}

@media (prefers-contrast: more) {
  header, .mobile-nav { background: #fff; backdrop-filter: none; }
  header::after { opacity: 1; background: var(--td); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  /* A press scale is feedback, not travel, so it stays — but nothing eases
     for long enough to register as motion. */
  .btn, .btn:active, .nav-cta:active, button:active { transition-duration: 1ms; }
  header::after { transition: none; }
}

/* --- 5. Inline validation ------------------------------------------------
   Errors appear at the field, when the person leaves it, and read as a
   repair instruction rather than a complaint. */
.fld-err {
  font-family: 'Erode', Georgia, serif;
  font-size: .8rem;
  line-height: 1.45;
  color: var(--coral);
  margin-top: .35rem;
}
.fld-err[hidden] { display: none; }

.field.has-error input,
.field.has-error select,
.field.has-error textarea,
[aria-invalid="true"] {
  border-color: var(--coral) !important;
}
.field.has-error input:focus,
.field.has-error select:focus,
.field.has-error textarea:focus {
  box-shadow: 0 0 0 3px rgba(224, 114, 82, .14);
}

/* The consent row is a flex pair; its error message takes a line of its own. */
.consent { flex-wrap: wrap; }
.consent .fld-err { flex-basis: 100%; margin-left: 0; }

/* --- 6. Shared form card -------------------------------------------------
   Scoped to .gw-form so pages that already style their own forms (contact)
   are untouched. */
.gw-form {
  background: #fff;
  border: 1px solid var(--bdr);
  border-radius: 20px;
  padding: 2.25rem;
  box-shadow: 0 12px 32px rgba(26, 75, 40, .07);
  text-align: left;
}
.gw-form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.gw-form .field { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1rem; }
.gw-form label {
  font-family: 'Satoshi', sans-serif; font-size: .78rem; font-weight: 600; color: var(--td);
}
.gw-form .req { color: var(--coral); }
.gw-form input, .gw-form select, .gw-form textarea {
  font-family: 'Erode', Georgia, serif; font-size: .95rem; color: var(--td);
  background: #fff; border: 1.5px solid var(--bdr); border-radius: 10px;
  padding: .7rem 1rem; outline: none; width: 100%;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.gw-form textarea { resize: vertical; min-height: 110px; }
.gw-form input:focus, .gw-form select:focus, .gw-form textarea:focus {
  border-color: var(--gd); box-shadow: 0 0 0 3px rgba(31, 122, 60, .12);
}
.gw-form .consent {
  display: flex; align-items: flex-start; gap: .65rem; margin: 1.25rem 0 1.5rem;
}
.gw-form .consent input { width: auto; margin-top: .25rem; flex-shrink: 0; }
.gw-form .consent p {
  font-family: 'Erode', Georgia, serif; font-size: .85rem; line-height: 1.6; color: var(--tm);
}
.gw-form .consent a { color: var(--gd); text-decoration: underline; }
.gw-form .form-note {
  font-family: 'Erode', Georgia, serif; font-size: .8rem; color: var(--tmut); margin-top: .85rem;
}
.gw-form .form-ok { font-family: 'Erode', Georgia, serif; color: var(--gd); font-size: .95rem; margin-top: 1rem; }
.gw-form .form-err { font-family: 'Erode', Georgia, serif; color: var(--coral); font-size: .9rem; margin-top: 1rem; }

@media (max-width: 700px) {
  .gw-form { padding: 1.5rem; }
  .gw-form .form-row { grid-template-columns: 1fr; }
}
