:root {
  --primary: #004C97;
  --primary-dark: #003b75;
  --primary-deep: #022e63;
  --primary-soft: #f4f8ff;
  --primary-light: #eaf3ff;
  --border: #d8e5f5;
  --text: #1f2937;
  --muted: #6b7280;
  --white: #ffffff;
  --bg: #f7fbff;
  --success-bg: #e9f6ee;
  --success-text: #0f5132;
  --error-bg: #fdecec;
  --error-text: #b42318;
  --warning-bg: #fff4e5;
  --warning-border: #f5c27a;
  --warning-text: #7a4b00;
  --shadow-soft: 0 10px 28px rgba(0, 76, 151, 0.08);
  --shadow-banner: 0 18px 42px rgba(0, 52, 110, 0.16);
  --shadow-floating: 0 24px 48px rgba(0, 42, 90, 0.14);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(0, 76, 151, 0.05), transparent 30%),
    linear-gradient(180deg, var(--bg) 0%, #ffffff 100%);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition:
    color 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

a:hover {
  color: var(--primary-dark);
}

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

/* =========================
   HEADER
========================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(216, 229, 245, 0.9);
  box-shadow: 0 6px 18px rgba(0, 40, 90, 0.04);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 0;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1 1 auto;
}

.brand-logo {
  width: 82px;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 10px rgba(0, 76, 151, 0.12));
}

.brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-tagline {
  margin: 0;
  color: #4f647c;
  font-size: 1rem;
  line-height: 1.35;
  max-width: 320px;
  text-align: left;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}

.header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%);
  color: var(--white);
  font-weight: 800;
  text-align: center;
  box-shadow: 0 10px 20px rgba(0, 76, 151, 0.16);
  border: 1px solid transparent;
  white-space: nowrap;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.header-btn:hover {
  color: var(--white);
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(0, 76, 151, 0.2);
}

/* =========================
   BANNER
========================= */
.banner-section {
  padding: 24px 0 100px;
}

.banner-card {
  max-width: 980px;
  margin: 0 auto;
}

.promo-banner {
  width: 100%;
  object-fit: cover;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-banner);
}

/* =========================
   FORM
========================= */
.form-section {
  position: relative;
  z-index: 3;
  margin-top: -70px;
  padding: 0 0 44px;
}

.form-wrapper {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(216, 229, 245, 0.9);
  border-radius: 24px;
  padding: 30px;
  box-shadow: var(--shadow-floating);
}

.section-text {
  color: var(--muted);
  line-height: 1.65;
  margin: 0 auto 26px;
  max-width: 760px;
  text-align: center;
}

.intro-block {
  max-width: 860px;
  margin: 0 auto 22px;
  padding: 18px 20px;
  background: linear-gradient(180deg, #f8fbff 0%, #f2f7ff 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  text-align: center;
}

.intro-block h2 {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.2;
}

.intro-block .section-text {
  margin: 0;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

/* =========================
   FORM CERRADO
========================= */
.form-closed-message {
  display: none;
  margin-bottom: 20px;
  padding: 18px 20px;
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-radius: 14px;
  color: var(--warning-text);
  text-align: center;
}

.form-closed-message h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  color: #9a5b00;
}

.form-closed-message p {
  margin: 0;
  line-height: 1.6;
}

/* =========================
   GRID DEL FORMULARIO
========================= */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 20px;
  margin-bottom: 22px;
}

.field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

label {
  margin-bottom: 8px;
  font-weight: 700;
  color: var(--text);
}

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="date"] {
  width: 100%;
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  color: var(--text);
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input::placeholder {
  color: #9ca3af;
}

input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 76, 151, 0.10);
}

input.invalid {
  border-color: #dc2626;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.08);
}

/* =========================
   LEGAL COMPACTO
========================= */
.legal-compact {
  margin-bottom: 16px;
  padding: 14px 16px;
  background: linear-gradient(180deg, #fbfdff 0%, #f5f9ff 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.legal-compact p {
  margin: 0;
  color: #4b5563;
  line-height: 1.6;
  font-size: 0.95rem;
}

.legal-compact a {
  font-weight: 700;
  text-decoration: underline;
}

/* =========================
   CHECKS / MENSAJES
========================= */
.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
}

.check-row input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.check-row label {
  margin: 0;
  line-height: 1.55;
  font-weight: 500;
}

.check-row a {
  font-weight: 700;
  text-decoration: underline;
}

/* =========================
   CAPTCHA
========================= */
.captcha-wrap {
  margin: 18px 0 12px;
  display: flex;
  justify-content: center;
}

.captcha-note {
  margin: 0 0 16px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
}

.captcha-note a {
  font-weight: 700;
  text-decoration: underline;
}

.form-errors,
.form-result {
  display: none;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  line-height: 1.5;
  overflow-wrap: break-word;
}

.form-errors {
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid #f5c2c7;
}

.form-errors ul {
  margin: 0;
  padding-left: 20px;
}

.form-result {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid #badbcc;
}

.submit-wrap {
  margin-top: 8px;
}

.submit-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%);
  color: var(--white);
  border: none;
  border-radius: 14px;
  padding: 15px 20px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(0, 76, 151, 0.14);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(0, 76, 151, 0.18);
}

.submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
  text-align: center;
}

/* =========================
   MODALES
========================= */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 9999;
}

.modal.is-open {
  display: block;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
}

.modal-dialog {
  position: relative;
  width: min(920px, calc(100% - 32px));
  max-height: 86vh;
  margin: 7vh auto;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid #e5e7eb;
  background: var(--primary-soft);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--primary);
}

.modal-close {
  border: none;
  background: transparent;
  color: var(--primary);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  color: var(--text);
  line-height: 1.65;
}

.modal-body h3 {
  margin-top: 18px;
  margin-bottom: 8px;
  color: var(--primary);
  font-size: 1rem;
}

.modal-body p,
.modal-body li {
  color: #4b5563;
  font-size: 0.96rem;
}

.modal-body ul {
  padding-left: 20px;
  margin-top: 8px;
  margin-bottom: 12px;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
  display: flex;
  justify-content: flex-end;
}

.modal-btn {
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
}

body.modal-open {
  overflow: hidden;
}

/* =========================
   FOOTER
========================= */
.site-footer {
  padding: 16px 0 42px;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}

.site-footer p {
  margin: 0 0 8px;
  line-height: 1.6;
}

.site-footer p:last-child {
  margin-bottom: 0;
}

.site-footer a {
  font-weight: 700;
  word-break: break-word;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 1100px) {
  .container {
    padding: 0 20px;
  }

  .banner-section {
    padding: 20px 0 80px;
  }

  .form-section {
    margin-top: -50px;
  }

  .form-wrapper {
    padding: 26px 22px;
  }
}

@media (max-width: 768px) {
  .site-header {
    position: static;
    backdrop-filter: none;
  }

  .header-inner {
    flex-direction: column;
    justify-content: center;
    text-align: center;
    padding: 14px 0;
  }

  .brand-block {
    flex-direction: column;
    justify-content: center;
    text-align: center;
  }

  .brand-copy {
    align-items: center;
  }

  .brand-logo {
    width: 80px;
  }

  .brand-tagline {
    font-size: 0.95rem;
    max-width: 280px;
    text-align: center;
  }

  .header-actions {
    justify-content: center;
    width: 100%;
  }

  .header-btn {
    width: 100%;
    max-width: 220px;
    padding: 12px 18px;
  }

  .banner-section {
    padding: 16px 0 24px;
  }

  .promo-banner {
    border-radius: 18px;
  }

  .form-section {
    margin-top: 0;
    padding-top: 0;
  }

  .form-wrapper {
    border-radius: 20px;
    padding: 22px 18px;
    box-shadow: var(--shadow-soft);
  }

  .intro-block {
    padding: 16px;
    margin-bottom: 18px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .check-row {
    gap: 12px;
  }

  .captcha-wrap {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .modal-dialog {
    width: calc(100% - 20px);
    margin: 4vh auto;
    max-height: 90vh;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (max-width: 576px) {
  .container {
    padding: 0 14px;
  }

  .site-header {
    padding-top: env(safe-area-inset-top);
  }

  .intro-block h2 {
    font-size: 1.4rem;
  }

  .brand-tagline {
    font-size: 0.92rem;
    max-width: 250px;
  }

  .header-btn,
  .submit-btn {
    font-size: 0.95rem;
  }

  .form-wrapper {
    padding: 20px 16px;
    border-radius: 18px;
  }

  .section-text {
    font-size: 0.95rem;
    margin-bottom: 20px;
  }

  .legal-compact p,
  .captcha-note {
    font-size: 0.92rem;
  }

  .check-row label {
    font-size: 0.95rem;
  }

  .site-footer {
    font-size: 0.9rem;
    padding-bottom: 28px;
  }
}

@media (max-width: 480px) {
  .brand-logo {
    width: 72px;
  }

  .brand-tagline {
    font-size: 0.9rem;
    line-height: 1.35;
    max-width: 230px;
  }

  .header-btn {
    max-width: 100%;
  }
}