/* =========================================================
   Phone styles: contact (contact.html and 404.html)
   Loaded after css/style.css, only at max-width 768px (the link carries the
   media query), so everything here wins over the desktop and old narrow rules
   by order. Written for phones first: carousels, sheets, thumb reach, not
   desktop layouts stacked into a column.

   1. Hero      a shorter photo, the heading anchored low-left over a
                bottom-weighted scrim
   2. Form      the form comes first, as a raised card that overlaps the
                photo; clear labels, live focus, inline errors, full-width send
   3. Map       a rounded print below the form that settles as it scrolls in
   4. 404       a centred screen: oversized numeral over slow rings
   Field and button basics (48px, 16px type, focus ring) live in base.css.
   ========================================================= */


/* ---------- 1. Hero ---------- */
.contact-hero {
  min-height: 0;
  text-align: left;
}

.contact-hero .header-placeholder {
  height: clamp(400px, 60svh, 560px);
  min-height: 0;
}

@supports not (height: 1svh) {
  .contact-hero .header-placeholder {
    height: clamp(400px, 60vh, 560px);
  }
}

/* Room at the bottom for the form card that rises over the photo */
.contact-hero .header-placeholder__overlay {
  align-items: flex-start;
  justify-content: flex-end;
  text-align: left;
  padding: 0 var(--gutter, 20px) 72px;
}

.contact-hero .header-placeholder__overlay::before {
  background: linear-gradient(180deg,
    rgba(4, 25, 23, 0.18) 0%,
    rgba(4, 25, 23, 0.28) 40%,
    rgba(4, 25, 23, 0.78) 100%);
}

.contact-hero .header-placeholder__overlay h1 {
  --fs-scale: 1.05;
  max-width: 11em;
  margin-bottom: 10px;
}

.contact-hero .header-placeholder__overlay p {
  max-width: 22em;
  margin: 0;
}


/* ---------- 2. Form card ---------- */
.contact-body {
  position: relative;
  z-index: 3;
  min-height: 0;
  padding: 0 var(--gutter, 20px) calc(var(--section-pad-y, 64px) + var(--safe-bottom, 0px));
}

.contact-body__inner {
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 28px;
}

.contact-form-col {
  order: -1;
  flex: none;
  margin-top: -44px;
  padding: 30px 20px 24px;
  border-radius: 20px;
  background: var(--ivory-card);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset,
    0 0 0 1px rgba(26, 65, 70, 0.06),
    0 26px 50px -22px rgba(4, 25, 23, 0.4);
}

.contact-form-col h2 {
  margin-bottom: 8px;
}

.contact-form-col__sub {
  margin-bottom: 26px;
}

.contact-form {
  gap: 18px;
}

.form-field {
  gap: 7px;
}

.form-field label {
  color: var(--petrol);
  letter-spacing: 1px;
  transition: color 0.4s ease;
}

.form-field:focus-within label {
  color: var(--teal-deep);
}

.form-field input,
.form-field textarea,
.form-field select {
  border-width: 1.5px;
  border-radius: 12px;
  padding: 13px 15px;
  background: #ffffff;
}

/* Long options end in an ellipsis before the chevron */
.form-field select {
  padding-right: 44px;
  text-overflow: ellipsis;
}

.form-field input::placeholder,
.form-field textarea::placeholder {
  color: #8a9a98;
}

.form-field select:has(option[value=""]:checked) {
  color: #8a9a98;
}

/* The script grows it with what is typed, so no resize grip */
.form-field textarea {
  min-height: 132px;
  resize: none;
  overflow: hidden;
}

/* Errors: shown once a field has been left (or a send was tried) */
.form-field.is-m-invalid label {
  color: #b3261e;
}

.form-field.is-m-invalid input,
.form-field.is-m-invalid textarea {
  border-color: #b3261e;
  box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.1);
}

.m-field-error {
  display: grid;
  grid-template-rows: 0fr;
  color: #b3261e;
  opacity: 0;
  transition: grid-template-rows 0.5s var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
    opacity 0.4s ease;
}

.m-field-error > span {
  overflow: hidden;
  font-size: calc(var(--fs-small, 14px) * var(--fs-scale, 1));
  line-height: 1.4;
}

.form-field.is-m-invalid .m-field-error {
  grid-template-rows: 1fr;
  opacity: 1;
}

.contact-form .btn {
  margin-top: 6px;
  border-radius: 999px;
}

.contact-form .btn::before {
  border-radius: 999px;
}

.contact-form .form-status {
  text-align: center;
  font-size: calc(var(--fs-small, 14px) * var(--fs-scale, 1));
  line-height: 1.5;
}


/* ---------- 3. Map ---------- */
.contact-map {
  flex: none;
  min-height: 320px;
  aspect-ratio: 4 / 3;
  border-radius: 18px;
  box-shadow: 0 18px 40px -24px rgba(4, 25, 23, 0.35);
}

/* The script eases the photo from slightly enlarged to rest as it arrives */
.contact-map iframe {
  height: 100%;
}

.contact-map__open {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.contact-map img {
  transform: scale(var(--m-map-zoom, 1));
  transform-origin: 50% 40%;
}

@media (min-width: 600px) {
  .contact-form-col {
    padding: 40px 36px 32px;
  }

  .contact-map {
    aspect-ratio: 16 / 9;
  }
}


/* ---------- 4. 404 ---------- */
.not-found {
  position: relative;
  overflow: hidden;
  padding: 56px var(--gutter, 20px) 64px;
  isolation: isolate;
}

/* Concentric rings, the brand's wave mark at rest, breathing very slowly */
.not-found::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 34%;
  width: 560px;
  height: 560px;
  margin: -280px 0 0 -280px;
  border-radius: 50%;
  background: repeating-radial-gradient(circle at center,
    transparent 0 54px,
    rgba(52, 182, 175, 0.16) 54px 55px);
  -webkit-mask-image: radial-gradient(circle at center, #000 0, #000 30%, transparent 70%);
  mask-image: radial-gradient(circle at center, #000 0, #000 30%, transparent 70%);
  animation: m-rings 9s var(--ease-inout, cubic-bezier(0.65, 0, 0.35, 1)) infinite alternate;
}

@keyframes m-rings {
  from { transform: scale(0.96); opacity: 0.75; }
  to { transform: scale(1.04); opacity: 1; }
}

.not-found__code {
  color: var(--petrol);
  font-size: calc(var(--fs-numeral, 48px) * 2.2);
  line-height: 1;
  letter-spacing: -3px;
  margin-bottom: 18px;
}

/* The zero in brand orange */
.not-found__zero {
  color: var(--highlight, #039999);
}

.not-found h1 {
  max-width: 12em;
  margin-bottom: 12px;
}

.not-found > p:not(.not-found__code) {
  max-width: 22em;
  margin-bottom: 32px;
}

.not-found__links .btn {
  width: 100%;
}

@media (prefers-reduced-motion: reduce) {
  .m-field-error,
  .form-field label {
    transition: none;
  }

  .not-found::before {
    animation: none;
  }
}


/* S15 phone scale (<= 599px only): hero title on the H1 tier */
@media (max-width: 599px) {
  .contact-hero .header-placeholder__overlay h1 {
    --fs-scale: 1;
  }
}
