/* =========================================================
   HIDDEN KEY CORE — ENTRANCE FORM FOUNDATION
   Owns: colour/type variables, panel shell, field styling,
   labels, checkboxes, validation, legal text, key submit.
   Motion owns only state-dependent presentation.
   ========================================================= */

.hk-entry {
  --hke-black: #070505;
  --hke-panel: #150b0d;
  --hke-panel-2: #1d1012;
  --hke-maroon: #3d0f16;
  --hke-gold: #c99c43;
  --hke-gold-bright: #f2c66f;
  --hke-gold-pale: #ffe1a0;
  --hke-ivory: #f5ecdf;
  --hke-ivory-muted: #cfc1b2;
  --hke-line: rgba(220, 165, 73, .42);
  --hke-line-soft: rgba(220, 165, 73, .18);
  --hke-error: #ffb4a8;
  --hke-serif: "Cormorant Garamond", "Bodoni 72", Didot, Georgia, serif;
  --hke-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --hke-radius: 26px;
}

/* ---------- Panel shell ---------- */
.hk-entry-panel {
  position: relative;
  width: min(520px, 100%);
  max-height: min(88vh, 900px);
  max-height: min(88svh, 900px);
  max-height: min(88dvh, 900px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
  padding: clamp(24px, 2.4vw, 40px) clamp(20px, 2.2vw, 38px);
  border-radius: var(--hke-radius);
  background:
    radial-gradient(circle at 110% -12%, rgba(154, 38, 44, .26), transparent 46%),
    linear-gradient(180deg, rgba(32, 14, 18, .97), rgba(11, 6, 7, .98));
  box-shadow:
    inset 0 0 0 1px var(--hke-line),
    inset 0 0 0 5px rgba(7, 5, 5, .85),
    inset 0 0 0 6px rgba(201, 156, 67, .28),
    0 44px 110px rgba(0, 0, 0, .62);
  color: var(--hke-ivory);
  font-family: var(--hke-sans);
}

/* Internal scroll region — short laptops and phones never clip fields. */
.hk-entry-panel__scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: smooth;
  scroll-padding-block: 14px 92px;
  touch-action: pan-y;
}
.hk-entry-panel__scroll::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.hk-entry-panel__title {
  margin: 0 0 8px;
  color: var(--hke-gold-bright);
  font-family: var(--hke-serif);
  font-size: clamp(26px, 2.5vw, 38px);
  font-weight: 400;
  line-height: 1.05;
  text-align: center;
}

.hk-entry-panel__intro {
  margin: 0 0 clamp(16px, 1.6vw, 24px);
  color: var(--hke-ivory-muted);
  font-size: clamp(13px, 1vw, 14.5px);
  line-height: 1.55;
  text-align: center;
}

.hk-entry-panel__secure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 14px 0 0;
  color: #a99d94;
  font-size: 11.5px;
  text-align: center;
}
.hk-entry-panel__secure svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  stroke: var(--hke-gold-bright);
  fill: none;
  stroke-width: 1.7;
}

/* ---------- Gravity Forms reset inside the entrance ---------- */
.hk-entry .gform_wrapper { margin: 0; }
.hk-entry .gform_wrapper form { margin: 0; }
.hk-entry .gform_heading { display: none; }
.hk-entry .gform_wrapper .gform_fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(12px, 1.2vw, 16px);
}
.hk-entry .gform_wrapper .gfield { margin: 0; padding: 0; }

/* Labels stay real and visible. */
.hk-entry .gform_wrapper .gfield_label {
  display: block;
  margin: 0 0 7px;
  color: var(--hke-gold-pale);
  font-family: var(--hke-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.hk-entry .gform_wrapper .gfield_required { color: var(--hke-gold-bright); }

/* Fields */
.hk-entry .gform_wrapper input[type="text"],
.hk-entry .gform_wrapper input[type="email"],
.hk-entry .gform_wrapper input[type="tel"],
.hk-entry .gform_wrapper input[type="url"],
.hk-entry .gform_wrapper input[type="number"],
.hk-entry .gform_wrapper select,
.hk-entry .gform_wrapper textarea {
  width: 100%;
  /* 44px minimum touch target. */
  min-height: 48px;
  padding: 12px 16px;
  border: 1px solid var(--hke-line);
  border-radius: 11px;
  outline: 0;
  color: var(--hke-ivory);
  background: rgba(8, 5, 5, .62);
  font-family: var(--hke-sans);
  font-size: 15px; /* >=16px avoids iOS zoom; see mobile block below. */
  line-height: 1.3;
  appearance: none;
  transition: border-color .22s ease, box-shadow .22s ease, background .22s ease;
}
.hk-entry .gform_wrapper input::placeholder,
.hk-entry .gform_wrapper textarea::placeholder { color: #9a8e85; }

/* Focus ring is deliberately stronger than the resting border. */
.hk-entry .gform_wrapper input:focus,
.hk-entry .gform_wrapper select:focus,
.hk-entry .gform_wrapper textarea:focus {
  border-color: var(--hke-gold-bright);
  background: rgba(12, 7, 7, .82);
  box-shadow: 0 0 0 3px rgba(226, 167, 68, .22), 0 0 26px rgba(226, 167, 68, .12);
}

.hk-entry .gform_wrapper .ginput_container { margin: 0; }
.hk-entry .gform_wrapper .gfield_description {
  padding: 6px 0 0;
  color: var(--hke-ivory-muted);
  font-size: 12px;
}

/* ---------- Checkboxes / consent ---------- */
.hk-entry .gform_wrapper .gfield_checkbox li,
.hk-entry .gform_wrapper .gfield_checkbox .gchoice,
.hk-entry .gform_wrapper .gfield_consent .gchoice {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin: 0;
}
.hk-entry .gform_wrapper input[type="checkbox"] {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  border: 1px solid var(--hke-line);
  border-radius: 6px;
  background: rgba(8, 5, 5, .62);
  cursor: pointer;
  appearance: none;
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.hk-entry .gform_wrapper input[type="checkbox"]:hover { border-color: rgba(242, 198, 111, .8); }
.hk-entry .gform_wrapper input[type="checkbox"]:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(226, 167, 68, .3);
}
.hk-entry .gform_wrapper input[type="checkbox"]:checked {
  border-color: var(--hke-gold-bright);
  background:
    linear-gradient(135deg, #f1c66d, #b97d30) padding-box;
}
.hk-entry .gform_wrapper input[type="checkbox"]:checked::after {
  content: "";
  display: block;
  width: 6px;
  height: 11px;
  margin: 2px auto 0;
  border: solid #1a0d05;
  border-width: 0 2.4px 2.4px 0;
  transform: rotate(43deg);
}
.hk-entry .gform_wrapper .gfield_checkbox label,
.hk-entry .gform_wrapper .gfield_consent label {
  color: var(--hke-ivory-muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: normal;
  text-transform: none;
}
.hk-entry .gform_wrapper .gfield_consent .gfield_label,
.hk-entry .gform_wrapper .gfield_checkbox .gfield_label { display: none; }

.hk-entry .gform_wrapper a {
  color: var(--hke-gold-bright);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.hk-entry .gform_wrapper a:focus-visible {
  outline: 2px solid var(--hke-gold-bright);
  outline-offset: 2px;
}

/* ---------- Validation ---------- */
.hk-entry .gform_wrapper .gform_validation_errors,
.hk-entry .gform_wrapper .validation_error {
  margin: 0 0 14px;
  padding: 11px 14px;
  border: 1px solid rgba(255, 140, 120, .5);
  border-radius: 11px;
  background: rgba(92, 20, 20, .34);
  color: var(--hke-error);
  font-size: 13px;
  line-height: 1.45;
}
.hk-entry .gform_wrapper .gform_validation_errors h2 {
  margin: 0;
  color: var(--hke-error);
  font-family: var(--hke-sans);
  font-size: 13px;
  font-weight: 600;
}
.hk-entry .gform_wrapper .gfield_error input,
.hk-entry .gform_wrapper .gfield_error select,
.hk-entry .gform_wrapper .gfield_error textarea {
  border-color: rgba(255, 140, 120, .85);
  background: rgba(60, 14, 14, .38);
}
.hk-entry .gform_wrapper .gfield_validation_message,
.hk-entry .gform_wrapper .validation_message {
  margin: 6px 0 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--hke-error);
  font-size: 12.5px;
}
.hk-entry .gform_wrapper .gfield_error { background: none; }

/* Honeypot must never be visible. */
.hk-entry .gform_wrapper .gform_validation_container,
.hk-entry .gform_wrapper .gfield--type-honeypot { display: none !important; }

/* ---------- Key-shaped submit ---------- */
.hk-entry .gform_footer,
.hk-entry .gform_wrapper .gform_footer {
  display: flex;
  justify-content: center;
  margin: clamp(16px, 1.8vw, 24px) 0 0;
  padding: 0;
}

.hk-entry .hkm-key-submit,
.hk-entry .gform_wrapper .gform_button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 14px 30px;
  overflow: hidden;
  border: 1px solid rgba(245, 194, 99, .7);
  border-radius: 999px;
  cursor: pointer;
  color: #150c04;
  background: linear-gradient(110deg, #9e6727 0%, #f1c66d 42%, #b97d30 72%, #f3d28e 100%);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .5);
  font-family: var(--hke-serif);
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
  transition: filter .3s ease, box-shadow .3s ease, transform .3s cubic-bezier(.2, .7, .2, 1);
}
.hk-entry .hkm-key-submit:hover,
.hk-entry .gform_wrapper .gform_button:hover {
  filter: brightness(1.07);
  box-shadow: 0 18px 42px rgba(0, 0, 0, .46), 0 0 34px rgba(237, 187, 91, .3);
}
.hk-entry .hkm-key-submit:focus-visible,
.hk-entry .gform_wrapper .gform_button:focus-visible {
  outline: 3px solid var(--hke-gold-pale);
  outline-offset: 3px;
}
.hk-entry .hkm-key-submit[disabled],
.hk-entry .gform_wrapper .gform_button[disabled] {
  cursor: progress;
  filter: saturate(.65) brightness(.9);
}
.hk-entry .hkm-key-submit__icon {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

/* Gravity Forms' own spinner is replaced by the key choreography. */
.hk-entry .gform_wrapper .gform_ajax_spinner { display: none !important; }

/* ---------- Mobile ---------- */
@media (max-width: 1024px) {
  .hk-entry-panel {
    width: min(560px, 100%);
    max-height: none;
    border-radius: 22px;
  }
  /* 16px prevents iOS focus-zoom. Slightly taller controls are easier to hit
     above the software keyboard and play better with autofill overlays. */
  .hk-entry .gform_wrapper input[type="text"],
  .hk-entry .gform_wrapper input[type="email"],
  .hk-entry .gform_wrapper input[type="tel"],
  .hk-entry .gform_wrapper input[type="url"],
  .hk-entry .gform_wrapper input[type="number"],
  .hk-entry .gform_wrapper select,
  .hk-entry .gform_wrapper textarea {
    min-height: 52px;
    padding: 13px 14px;
    font-size: 16px;
  }

  .hk-entry .gform_wrapper .gform_footer,
  .hk-entry .gform_footer {
    position: sticky;
    bottom: -1px;
    z-index: 4;
    margin-top: 14px;
    padding: 12px 0 max(2px, env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(17, 8, 10, 0), rgba(17, 8, 10, .96) 30%, rgba(17, 8, 10, .99));
  }

  .hk-entry .gform_wrapper .gform_button,
  .hk-entry .hkm-key-submit {
    min-height: 54px;
  }
}

@media (max-width: 600px) {
  .hk-entry-panel { padding: 16px 14px 16px; }
  .hk-entry-panel__title { font-size: 24px; }
  .hk-entry-panel__intro { margin-bottom: 14px; font-size: 13px; line-height: 1.42; }
  .hk-entry-panel__secure { margin-top: 10px; font-size: 10.5px; }

  .hk-entry .gform_wrapper .gform_fields { gap: 10px; }
  .hk-entry .gform_wrapper .gfield_label { margin-bottom: 5px; font-size: 10.5px; }

  /* Gravity Forms' Name field can remain two-column even on a narrow iPhone.
     Force complex inputs to a single readable column inside the entrance. */
  .hk-entry .gform_wrapper .ginput_complex,
  .hk-entry .gform_wrapper .ginput_container_name,
  .hk-entry .gform_wrapper .ginput_complex.ginput_container {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 9px !important;
  }
  .hk-entry .gform_wrapper .ginput_complex > span,
  .hk-entry .gform_wrapper .ginput_container_name > span {
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .hk-entry .gform_wrapper .gfield_checkbox label,
  .hk-entry .gform_wrapper .gfield_consent label {
    font-size: 12.5px;
    line-height: 1.42;
  }
  .hk-entry .gform_wrapper .gfield_description { font-size: 11.5px; line-height: 1.4; }
}

@media (max-width: 1024px) {
  .hk-entry.is-keyboard-open .hk-entry-panel { padding: 10px 12px 8px; }
  .hk-entry.is-keyboard-open .gform_wrapper .gform_fields { gap: 8px; }
  .hk-entry.is-keyboard-open .gform_wrapper .gfield_label { margin-bottom: 4px; }
  .hk-entry.is-keyboard-open .gform_wrapper input[type="text"],
  .hk-entry.is-keyboard-open .gform_wrapper input[type="email"],
  .hk-entry.is-keyboard-open .gform_wrapper input[type="tel"],
  .hk-entry.is-keyboard-open .gform_wrapper input[type="url"],
  .hk-entry.is-keyboard-open .gform_wrapper input[type="number"],
  .hk-entry.is-keyboard-open .gform_wrapper select,
  .hk-entry.is-keyboard-open .gform_wrapper textarea {
    min-height: 48px;
    padding-block: 11px;
  }
}

/* =========================================================
   CHECKBOX / AUTOFILL HARDENING
   Gravity Forms and some themes ship their own checkbox rules,
   and Safari needs the -webkit- prefix, so the custom control
   was falling back to the native OS checkbox. These rules are
   scoped to the entrance and stated at higher specificity.
   ========================================================= */
.hk-entry .gform_wrapper .gfield input[type="checkbox"],
.hk-entry .gform_wrapper .gfield_consent input[type="checkbox"],
.hk-entry .gform_wrapper .gchoice input[type="checkbox"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  margin: 1px 10px 0 0;
  padding: 0;
  border: 1px solid var(--hke-line);
  border-radius: 6px;
  background-color: rgba(8, 5, 5, .62);
  background-image: none;
  box-shadow: none;
  cursor: pointer;
  transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease;
}

.hk-entry .gform_wrapper .gfield input[type="checkbox"]:checked,
.hk-entry .gform_wrapper .gfield_consent input[type="checkbox"]:checked,
.hk-entry .gform_wrapper .gchoice input[type="checkbox"]:checked {
  border-color: var(--hke-gold-bright);
  background-color: #e8b954;
  background-image: linear-gradient(135deg, #f3d28e, #b97d30);
}

.hk-entry .gform_wrapper .gfield input[type="checkbox"]::before,
.hk-entry .gform_wrapper .gchoice input[type="checkbox"]::before {
  content: none;
}

.hk-entry .gform_wrapper .gfield input[type="checkbox"]:checked::after,
.hk-entry .gform_wrapper .gfield_consent input[type="checkbox"]:checked::after,
.hk-entry .gform_wrapper .gchoice input[type="checkbox"]:checked::after {
  content: "";
  display: block;
  width: 6px;
  height: 11px;
  margin: 2px auto 0;
  border: solid #1a0d05;
  border-width: 0 2.4px 2.4px 0;
  transform: rotate(43deg);
}

/* Chrome's autofill wash would otherwise repaint fields pale blue/yellow. */
.hk-entry .gform_wrapper input:-webkit-autofill,
.hk-entry .gform_wrapper input:-webkit-autofill:hover,
.hk-entry .gform_wrapper input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--hke-ivory);
  -webkit-box-shadow: 0 0 0 1000px #140b0c inset;
  caret-color: var(--hke-ivory);
  transition: background-color 9999s ease-in-out 0s;
}
