/* ==========================================================================
   Victor Harbour Whale Sighting — Report a Sighting page (form.css)
   Figma: "Victor Habour - Form Page"
     desktop 3175:966 / 3314:241 (dropdown open)
     mobile  3175:1041 / 3315:447 (dropdown open)
   Mobile-first; desktop layout at >=1024px. Requires tokens.css + base.css.

   Note: form fields use the CoolGray/60-family stroke #69727D straight from
   the Figma frames (the shared --vh-border #DDE1E6 token is the lighter
   hairline used elsewhere). Placeholder/option text is Roboto per Figma.
   ========================================================================== */

.vh-form-page {
  /* local knobs (raw values verbatim from the Figma frames) */
  --vh-form-stroke: #69727D;      /* field border */
  --vh-form-label: #21272A;       /* CoolGray/90 */
  --vh-form-placeholder: #697077; /* CoolGray/60 */
  --vh-form-font-field: 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

/* --------------------------------------------------------------------------
   1. Hero
   -------------------------------------------------------------------------- */

.vh-form-hero {
  position: relative;
  height: 550px;
  overflow: hidden;
}

.vh-form-hero__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vh-form-hero__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #000 100%);
  opacity: 0.55;
}

.vh-form-hero__content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  height: 100%;
  padding-top: 250px;
  text-align: center;
  color: var(--vh-white);
}

.vh-form-hero__title {
  font-size: 40px;
  letter-spacing: -0.05em; /* matches Figma's tighter Josefin rendering */
}

.vh-form-hero__intro {
  max-width: 336px;
  font-family: var(--vh-font-display);
  font-weight: 600;
  font-size: 16px;
  line-height: 26px;
}

@media (min-width: 1024px) {
  .vh-form-hero {
    height: 620px;
  }

  .vh-form-hero__content {
    align-items: flex-start;
    gap: 40px;
    padding-top: 324px;
    text-align: left;
  }

  .vh-form-hero__title {
    font-size: 50px;
  }

  .vh-form-hero__br {
    display: none; /* the designed two-line break is mobile-only */
  }

  .vh-form-hero__intro {
    max-width: 823px;
    font-size: 20px;
    line-height: 30px;
  }
}

/* --------------------------------------------------------------------------
   2. Main two-column layout on Bone
   -------------------------------------------------------------------------- */

.vh-form-main {
  padding: 52px 0 80px;
}

@media (min-width: 1024px) {
  .vh-form-main {
    padding: 88px 0 100px;
  }
}

.vh-form-cols {
  display: flex;
  flex-direction: column;
}

/* Two columns once there's room, but keep them FLUID with a gap below the
   1332px design width (client feedback: the form was overflowing / touching
   the text on tablet-width screens). The exact Figma track widths are
   restored at >=1332px. */
@media (min-width: 1024px) {
  .vh-form-cols {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
    column-gap: 48px;
    align-items: start;
  }
}

@media (min-width: 1332px) {
  .vh-form-cols {
    grid-template-columns: 520px 630px;
    justify-content: space-between;
    column-gap: 0;
  }
}

/* --- Left rail --- */

.vh-form-rail__rule {
  height: 11px;
  margin: 0 0 32px;
  border: 0;
  background: var(--vh-black);
}

.vh-form-rail__block {
  margin-bottom: 52px;
}

.vh-form-rail__block h2 {
  margin-bottom: 32px;
  font-size: 35px;
  letter-spacing: -0.05em; /* matches Figma's tighter Josefin rendering:
                              keeps the designed single-line breaks */
}

@media (min-width: 1024px) {
  .vh-form-rail__rule {
    margin-bottom: 48px;
  }

  .vh-form-rail__block {
    margin-bottom: 64px;
  }

  .vh-form-rail__block h2 {
    margin-bottom: 40px;
    font-size: var(--vh-text-h3);
  }
}

/* --------------------------------------------------------------------------
   3. Report form
   -------------------------------------------------------------------------- */

.vh-report-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 48px;
}

@media (min-width: 1024px) {
  .vh-report-form {
    margin-top: 0;
  }
}

/* display:flex/grid would beat the UA [hidden] rule — restore it */
.vh-report-form[hidden],
.vh-upload__thumbs[hidden] {
  display: none;
}

.vh-field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 20px;
}

.vh-field__label {
  display: block;
  margin-bottom: 8px;
  font-family: var(--vh-font-display);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.1;
  color: var(--vh-form-label);
}

.vh-field__box {
  position: relative;
}

.vh-field__icon {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  pointer-events: none;
}

.vh-input,
.vh-textarea,
.vh-select__btn,
.vh-select-native {
  display: block;
  width: 100%;
  padding: 8px 16px;
  background: var(--vh-gray-10);
  border: 1px solid var(--vh-form-stroke);
  border-radius: var(--vh-radius);
  font-family: var(--vh-form-font-field);
  font-size: 16px;
  line-height: 1.4;
  color: var(--vh-form-label);
}

.vh-field__box .vh-input {
  padding-right: 52px;
}

.vh-input::placeholder,
.vh-textarea::placeholder {
  color: var(--vh-form-placeholder);
  text-transform: uppercase;
  opacity: 1;
}

.vh-textarea {
  resize: none;
}

/* Native <select> compass dropdowns (Direction from Shore / travelling direction).
   Styled to match the field inputs, with a CSS chevron in place of the OS arrow. */
.vh-select-native {
  text-transform: uppercase;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 44px;
  background-image: url('../../img/icons/icon-chevron-down.svg');
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 12px 10px;
  touch-action: manipulation;
}

/* Muted colour while the placeholder (empty) option is selected, mirroring the
   other fields' placeholder styling. */
.vh-select-native:has(option[value=""]:checked) {
  color: var(--vh-form-placeholder);
}

.vh-textarea--description {
  height: 156px;
}

.vh-textarea--other {
  height: 85px;
}

/* --- Custom species dropdown (button + listbox) --- */

.vh-select {
  position: relative;
}

.vh-select__btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation; /* no double-tap zoom delay on iOS */
}

.vh-select__value.is-placeholder {
  color: var(--vh-form-placeholder);
}

.vh-select__value {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.vh-select__chevron {
  flex: 0 0 auto;
  transition: transform 0.15s ease;
}

.vh-select__btn[aria-expanded='true'] {
  border-bottom-color: transparent;
}

.vh-select__btn[aria-expanded='true'] .vh-select__chevron {
  transform: rotate(180deg);
}

.vh-select__list {
  position: absolute;
  z-index: 20;
  top: 100%;
  left: 0;
  right: 0;
  margin: -1px 0 0;
  padding: 0 16px 10px;
  list-style: none;
  background: var(--vh-gray-10);
  border: 1px solid var(--vh-form-stroke);
  border-top: 0;
  border-radius: 0 0 var(--vh-radius) var(--vh-radius);
}

/* The listbox indicates focus via the underlined active option (the
   affordance the Figma open state designs), not a container outline */
.vh-select__list:focus-visible {
  outline: none;
}

.vh-select__option {
  font-family: var(--vh-form-font-field);
  font-size: 16px;
  line-height: 38px;
  text-transform: uppercase;
  color: var(--vh-black);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  touch-action: manipulation;
}

/* Figma dropdown-open frames underline the highlighted option */
.vh-select__option.is-active,
.vh-select__option:hover {
  text-decoration: underline;
}

/* --- Photos upload panel --- */

.vh-upload__panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 56px 16px;
  background: var(--vh-gray-10);
  border: 1px solid var(--vh-form-stroke);
  border-radius: 4px; /* per frame: upload panel is 4px, not the 2px inputs */
}

.vh-upload__remove {
  padding: 0;
  border: 0;
  background: none;
  font-family: var(--vh-form-font-field);
  font-size: 16px;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--vh-black);
  cursor: pointer;
}

/* Extrapolated: selected-photo thumbnails (no designed state) */
.vh-upload__thumbs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.vh-upload__thumb {
  position: relative;
  line-height: 0;
}

.vh-upload__thumb img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border: 1px solid var(--vh-form-stroke);
  border-radius: var(--vh-radius);
}

/* Per-photo remove control (extrapolated — no designed state) */
.vh-upload__thumb-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--vh-black);
  color: var(--vh-white);
  font-family: var(--vh-font-body);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.vh-upload__thumb-remove:hover {
  background: #262626;
}

.vh-upload__thumb-remove:focus-visible {
  outline: 2px solid var(--vh-black);
  outline-offset: 2px;
}

/* --- Requirements block --- */

.vh-requirements {
  max-width: 480px;
}

.vh-requirements__title {
  margin-bottom: 12px;
  font-family: var(--vh-font-display);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.1;
  text-transform: uppercase;
  text-decoration: underline; /* underlined on the mobile frame only */
}

@media (min-width: 1024px) {
  .vh-requirements__title {
    text-decoration: none;
  }
}

.vh-requirements__cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.vh-requirements__cols p {
  font-family: var(--vh-font-display);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.4;
}

.vh-requirements__note {
  margin-top: 12px;
  font-family: var(--vh-font-body);
  font-size: 13px;
  line-height: 1.5;
  color: var(--vh-form-placeholder);
}

/* --- Share-name checkbox --- */

.vh-consent {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
  font-family: var(--vh-font-display);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.4;
}

.vh-checkbox {
  appearance: none;
  -webkit-appearance: none;
  display: grid;
  place-content: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  margin: 0;
  background: var(--vh-gray-10);
  border: 1px solid var(--vh-form-stroke);
  border-radius: var(--vh-radius);
  cursor: pointer;
}

.vh-checkbox:checked::before {
  content: '';
  width: 14px;
  height: 12px;
  background: url('../../img/icons/icon-check-dark.svg') center / contain no-repeat;
}

.vh-report-form__actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
}

.vh-report-form__submit {
  align-self: flex-start;
}

/* Loading wheel beside Submit while the report is being sent */
.vh-report-form__spinner {
  display: none;
  width: 26px;
  height: 26px;
  border: 3px solid rgba(0, 0, 0, 0.15);
  border-top-color: var(--vh-black);
  border-radius: 50%;
  animation: vh-spin 0.8s linear infinite;
}

.is-submitting .vh-report-form__spinner {
  display: inline-block;
}

.is-submitting .vh-report-form__submit {
  cursor: progress;
}

@keyframes vh-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .vh-report-form__spinner {
    animation-duration: 2.4s;
  }
}

/* --- Honeypot (WP rejects submissions where this is filled) --- */

.vh-hp {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   4. Validation states — extrapolated (mandated by brief, not designed)
   -------------------------------------------------------------------------- */

.vh-field.is-invalid .vh-input,
.vh-field.is-invalid .vh-textarea,
.vh-field.is-invalid .vh-select__btn,
.vh-field.is-invalid .vh-select-native,
.vh-field.is-invalid .vh-upload__panel {
  border-color: var(--vh-error);
}

.vh-field.is-valid .vh-input,
.vh-field.is-valid .vh-textarea,
.vh-field.is-valid .vh-select__btn,
.vh-field.is-valid .vh-select-native,
.vh-field.is-valid .vh-upload__panel {
  border-color: var(--vh-valid);
}

.vh-field__msg {
  margin-top: 6px;
  font-family: var(--vh-font-body);
  font-size: 13px;
  line-height: 1.5;
  color: var(--vh-error);
}

.vh-field__msg[hidden] {
  display: none;
}

/* Observer Location: explicit "Use my current location" + the place the
   shared position resolved to, so a wrong fix is visible before submitting. */
.vh-field__action {
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: none;
  font-family: var(--vh-font-body);
  font-size: 14px;
  line-height: 1.5;
  color: var(--vh-black);
  text-decoration: underline;
  cursor: pointer;
}

.vh-field__action:disabled {
  cursor: progress;
  opacity: 0.6;
}

.vh-field__note {
  margin-top: 6px;
  font-family: var(--vh-font-body);
  font-size: 13px;
  line-height: 1.5;
  color: var(--vh-form-label);
}

.vh-field__note[hidden] {
  display: none;
}

.vh-loc-map {
  height: 460px;
  margin-top: 4px;
  border: 1px solid var(--vh-form-label);
  border-radius: 4px;
  overflow: hidden;
}

/* "Show your location" button on the map, styled like Google's own controls
   and sitting above the + / − buttons. */
.vh-loc-map .vh-loc-locate {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0 10px 8px 0;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: #fff;
  color: #666;
  box-shadow: rgba(0, 0, 0, 0.3) 0 1px 4px -1px;
  cursor: pointer;
}

.vh-loc-map .vh-loc-locate:hover,
.vh-loc-map .vh-loc-locate:focus-visible {
  background: #fff;
  color: #1a73e8;
}

.vh-loc-map .vh-loc-locate.is-locating {
  color: #1a73e8;
  cursor: progress;
  animation: vh-locating 0.9s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .vh-loc-map .vh-loc-locate.is-locating { animation: none; }
}

/* Inside a two-column row the search box takes one column beside the other
   field (e.g. Area / Region); the note and map underneath span the whole row. */
.vh-field-row > .vh-loc-note,
.vh-field-row > .vh-loc-map {
  grid-column: 1 / -1;
}

/* "click here to allow location sharing" inside the denied warning */
/* Scoped under the message so the theme's link styles don't win. */
.vh-field__msg .vh-loc-retry,
.vh-field__msg .vh-loc-retry:hover,
.vh-field__msg .vh-loc-retry:focus {
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: none;
  text-decoration: underline;
  cursor: pointer;
}

[data-vh-fieldwrap="observer_location"] > .vh-field__box[hidden],
[data-vh-fieldwrap="observer_location"] > .vh-field__msg[hidden] {
  display: none;
}

.vh-field-row > .vh-loc-note {
  margin-top: -8px;
}

.vh-field__action[hidden],
.vh-loc-map[hidden] {
  display: none;
}

/* --------------------------------------------------------------------------
   5. Success confirmation — extrapolated (mock AJAX result, not designed)
   -------------------------------------------------------------------------- */

.vh-form-success {
  margin-top: 48px;
}

/* Testing feedback: after a report the page should read just "Sighting
   Received". The left-hand intro text is page content (Elementor), so it is
   hidden by class: the designed .vh-form-rail, or any element given the
   vh-hide-on-success class in Elementor (Advanced > CSS Classes). */
.vh-sighting-submitted .vh-form-rail,
.vh-sighting-submitted .vh-hide-on-success {
  display: none !important;
}

/* Elementor layout: the columns beside the one holding the form (the intro
   text) are hidden and the form's column takes the full row. Only direct
   siblings, so rows elsewhere on the page are untouched. */
.vh-sighting-submitted :is(.e-con, .e-con-inner):has(> .e-con > .elementor-widget-shortcode #vh-form-success) > .e-con:not(:has(> .elementor-widget-shortcode #vh-form-success)) {
  display: none !important;
}

.vh-sighting-submitted :is(.e-con, .e-con-inner):has(> .e-con > .elementor-widget-shortcode #vh-form-success) > .e-con:has(> .elementor-widget-shortcode #vh-form-success) {
  --width: 100%;
  width: 100%;
  max-width: 100%;
}

.vh-form-success[hidden] {
  display: none;
}

.vh-form-success__title {
  margin-bottom: 24px;
  font-size: 35px;
  letter-spacing: -0.05em;
}

.vh-form-success__copy {
  max-width: 520px;
}

.vh-form-success__nav {
  margin-top: 40px;
}

.vh-form-success__nav .vh-cta__band {
  width: 100%;
  margin: 0;
  padding: 0;
  background: transparent;
}

.vh-form-success__nav .vh-btn--xl {
  border: 0;
}

@media (min-width: 1024px) {
  .vh-form-success__nav .vh-cta__band {
    padding: 0;
  }
}

@media (min-width: 1024px) {
  .vh-form-success {
    margin-top: 0;
  }

  .vh-form-success__title {
    font-size: var(--vh-text-h3);
  }
}

/* --------------------------------------------------------------------------
   6. Aerial photo below the columns
   -------------------------------------------------------------------------- */

.vh-form-aerial {
  max-width: 1064px;
  margin: 80px auto 0;
}

.vh-form-aerial img {
  width: 100%;
  aspect-ratio: 480 / 344;
  object-fit: cover;
  object-position: 50% 42%;
  border-radius: var(--vh-radius);
  box-shadow: 0 4px 16px 5px rgba(12, 12, 13, 0.15);
}

@media (min-width: 1024px) {
  .vh-form-aerial {
    margin-top: 100px;
  }

  .vh-form-aerial img {
    aspect-ratio: 1064 / 484;
    border-radius: var(--vh-radius-panel);
  }
}
