/* ==========================================================================
   Contact form + site UX layer.

   Additive to the stylesheet already embedded in index.html. Every rule here
   is namespaced under .jf-* so nothing the client wrote is overridden, with
   two deliberate exceptions documented inline (anchor scroll offset and
   focus-visible), both of which fix navigation bugs rather than restyle.

   Tokens are lifted from the original sheet: #FF6633 / #E85522 / #FFE6D5 /
   #333 / #666 / #e5e5e5 / 4px radius.
   ========================================================================== */

:root {
  --jf-brand: #FF6633;
  --jf-brand-dark: #E85522;
  --jf-brand-tint: #FFE6D5;
  --jf-ink: #333;
  --jf-muted: #666;
  --jf-line: #e5e5e5;
  --jf-surface: #fff;
  --jf-error: #c0392b;
  --jf-error-tint: #fdecea;
  --jf-ok: #1d5f4a;
  --jf-ok-tint: #e8f3ef;
  --jf-radius: 4px;
}

/* --------------------------------------------------------------------------
   Navigation fixes

   The header is `position: sticky`, so every in-page anchor (#about,
   #solutions, #technology, #contact) landed underneath it. scroll-margin-top
   clears the header; smooth scrolling is opt-out for reduced-motion users.
   -------------------------------------------------------------------------- */

html {
  scroll-behavior: smooth;
}

:target,
[id] {
  scroll-margin-top: 96px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* Visible keyboard focus. The original sheet defines none, which leaves the
   whole page unusable by keyboard. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--jf-brand);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Los enlaces de aviso de privacidad y términos viven en .footer-bottom, no en
   .footer-section, así que la regla de color del cliente no los alcanza y
   heredaban el azul por defecto del navegador sobre el fondo #2c2c2c: azul
   oscuro sobre gris oscuro, ilegibles. */
.footer-bottom a {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: underline;
  transition: color 0.2s;
}

.footer-bottom a:hover {
  color: #fff;
}

/* Skip link — hidden until focused. */
.jf-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--jf-brand);
  color: #fff;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  border-radius: 0 0 var(--jf-radius) 0;
}

.jf-skip:focus {
  left: 0;
}

/* --------------------------------------------------------------------------
   Form shell
   -------------------------------------------------------------------------- */

.jf-form-wrap {
  max-width: 720px;
  margin: 0 auto;
  text-align: left;
}

.jf-form {
  background: var(--jf-surface);
  border: 1px solid var(--jf-line);
  border-radius: var(--jf-radius);
  padding: 36px;
}

.jf-form[hidden],
.jf-panel[hidden] {
  display: none;
}

.jf-form-intro {
  font-size: 14px;
  color: var(--jf-muted);
  margin-bottom: 28px;
  line-height: 1.6;
}

.jf-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.jf-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.jf-field--full {
  grid-column: 1 / -1;
}

.jf-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--jf-ink);
  letter-spacing: 0.2px;
}

.jf-optional {
  font-weight: 400;
  color: var(--jf-muted);
  letter-spacing: 0;
}

.jf-req {
  color: var(--jf-brand);
  margin-left: 2px;
}

.jf-input,
.jf-select,
.jf-textarea {
  font: inherit;
  font-size: 15px;
  color: var(--jf-ink);
  background: #fff;
  border: 1px solid #d8d8d8;
  border-radius: var(--jf-radius);
  padding: 11px 13px;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.jf-input::placeholder,
.jf-textarea::placeholder {
  color: #aaa;
}

.jf-input:hover,
.jf-select:hover,
.jf-textarea:hover {
  border-color: #bbb;
}

.jf-input:focus,
.jf-select:focus,
.jf-textarea:focus {
  outline: none;
  border-color: var(--jf-brand);
  box-shadow: 0 0 0 3px rgba(255, 102, 51, 0.15);
}

.jf-textarea {
  min-height: 130px;
  resize: vertical;
  line-height: 1.6;
}

.jf-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23666' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 36px;
}

/* Invalid state — only applied after the field has been touched, via the
   .is-invalid class set by contact-form.js, never by :invalid alone (which
   would flag empty required fields before the user has typed anything). */
.jf-field.is-invalid .jf-input,
.jf-field.is-invalid .jf-select,
.jf-field.is-invalid .jf-textarea {
  border-color: var(--jf-error);
  background: var(--jf-error-tint);
}

.jf-error {
  font-size: 12.5px;
  color: var(--jf-error);
  min-height: 0;
  line-height: 1.4;
}

.jf-error:empty {
  display: none;
}

.jf-counter {
  font-size: 12px;
  color: var(--jf-muted);
  text-align: right;
}

.jf-counter.is-near {
  color: var(--jf-brand-dark);
}

/* Honeypot — off-screen rather than display:none, because some bots skip
   hidden fields but happily fill positioned ones. Removed from the tab order
   and from the accessibility tree. */
.jf-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   hCaptcha + aviso sin JavaScript
   -------------------------------------------------------------------------- */

.jf-captcha {
  margin-top: 4px;
}

/* El widget lo inyecta un tercero: se le da sitio sin imponerle estilos, que
   además el iframe ignoraría. */
.jf-captcha .h-captcha {
  min-height: 78px;
}

.jf-noscript {
  background: var(--jf-brand-tint);
  border: 1px solid var(--jf-brand);
  border-radius: var(--jf-radius);
  color: var(--jf-brand-dark);
  font-size: 13.5px;
  line-height: 1.6;
  padding: 14px 16px;
  margin-bottom: 24px;
}

.jf-noscript a {
  color: inherit;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Consent + submit
   -------------------------------------------------------------------------- */

.jf-consent {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
}

.jf-consent input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-top: 3px;
  accent-color: var(--jf-brand);
  flex-shrink: 0;
}

.jf-consent label {
  font-size: 13px;
  color: var(--jf-muted);
  line-height: 1.55;
}

.jf-consent a {
  color: var(--jf-brand);
  text-decoration: underline;
}

.jf-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* Reuses the client's .cta-button for brand consistency; this only adds the
   states .cta-button never had. */
.jf-submit[disabled] {
  opacity: 0.65;
  cursor: not-allowed;
}

.jf-spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 8px;
  vertical-align: -2px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: jf-spin 0.7s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .jf-spinner {
    animation-duration: 2s;
  }
}

.jf-note {
  font-size: 12.5px;
  color: var(--jf-muted);
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Result panels
   -------------------------------------------------------------------------- */

.jf-panel {
  border-radius: var(--jf-radius);
  padding: 32px 36px;
  border: 1px solid;
}

.jf-panel h3 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 10px;
}

.jf-panel p {
  font-size: 14.5px;
  line-height: 1.65;
  margin-bottom: 8px;
}

.jf-panel p:last-child {
  margin-bottom: 0;
}

.jf-panel a {
  color: inherit;
  font-weight: 600;
}

.jf-panel--ok {
  background: var(--jf-ok-tint);
  border-color: #b9d9cd;
  color: var(--jf-ok);
}

.jf-panel--error {
  background: var(--jf-error-tint);
  border-color: #f0b8b2;
  color: var(--jf-error);
}

.jf-panel-icon {
  font-size: 30px;
  line-height: 1;
  margin-bottom: 12px;
  display: block;
}

/* Alert shown above the form when the submit is rejected client-side. */
.jf-alert {
  background: var(--jf-error-tint);
  border: 1px solid #f0b8b2;
  border-radius: var(--jf-radius);
  color: var(--jf-error);
  font-size: 13.5px;
  padding: 12px 16px;
  margin-bottom: 24px;
  line-height: 1.5;
}

.jf-alert[hidden] {
  display: none;
}

/* --------------------------------------------------------------------------
   Direct-contact fallback under the form
   -------------------------------------------------------------------------- */

.jf-direct {
  margin-top: 24px;
  font-size: 13.5px;
  color: var(--jf-muted);
  text-align: center;
  line-height: 1.7;
}

.jf-direct a {
  color: var(--jf-brand);
  text-decoration: none;
  font-weight: 500;
}

.jf-direct a:hover {
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Standalone pages (thanks / 404 / privacy) reuse the landing's chrome
   -------------------------------------------------------------------------- */

.jf-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 80px 20px 100px;
}

.jf-page h1 {
  font-size: 34px;
  font-weight: 400;
  color: var(--jf-ink);
  margin-bottom: 20px;
  line-height: 1.25;
}

.jf-page h2 {
  font-size: 19px;
  font-weight: 600;
  color: var(--jf-ink);
  margin: 36px 0 12px;
}

.jf-page p,
.jf-page li {
  font-size: 15px;
  color: var(--jf-muted);
  line-height: 1.75;
  margin-bottom: 14px;
}

.jf-page ul {
  padding-left: 22px;
  margin-bottom: 14px;
}

.jf-page a {
  color: var(--jf-brand);
}

.jf-page .cta-button {
  margin-top: 16px;
}

/* `.jf-page a` (0-1-1) le gana a `.cta-button` (0-1-0), así que el texto del
   botón salía naranja sobre un botón naranja: un rectángulo vacío en las tres
   páginas sueltas. Se necesita 0-2-1 para revertirlo. */
.jf-page a.cta-button,
.jf-page a.cta-button:hover {
  color: #fff;
  text-decoration: none;
}

.jf-page-meta {
  font-size: 13px;
  color: #999;
  border-top: 1px solid var(--jf-line);
  padding-top: 20px;
  margin-top: 44px;
}

.jf-badge {
  display: inline-block;
  background: var(--jf-brand-tint);
  color: var(--jf-brand-dark);
  border: 1px solid var(--jf-brand);
  border-radius: var(--jf-radius);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 5px 10px;
  margin-bottom: 20px;
}

/* --------------------------------------------------------------------------
   Mobile
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
  .jf-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .jf-form {
    padding: 24px 20px;
  }

  .jf-panel {
    padding: 26px 22px;
  }

  .jf-actions .cta-button {
    width: 100%;
    text-align: center;
  }

  .jf-page {
    padding: 48px 20px 70px;
  }

  .jf-page h1 {
    font-size: 27px;
  }

  [id] {
    scroll-margin-top: 72px;
  }
}
