*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Brand palette */
  --blue-dark:  #1a3a6b;
  --blue-mid:   #2563b0;
  --blue-light: #5b9bd5;

  /* UI colours */
  --white:      #ffffff;
  --text-dark:  #1a1a2e;
  --text-mid:   #444;
  --ink:        #1a1a1a;
  --muted:      #6b6b6b;
  --border:     #e2e2e2;

  /* Dialog accent (terracotta – kept for retry/hover states) */
  --accent-hover: #a83e1e;

  /* Dialog chrome */
  --shadow: 0 32px 80px rgba(0,0,0,0.18), 0 8px 24px rgba(0,0,0,0.08);
  --radius: 20px;
}

body {
  font-family: 'Lato', sans-serif;
  color: var(--text-dark);
  overflow-x: hidden;
}

/* ── NAVBAR ── */
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 60px;
  background: linear-gradient(160deg, #1e4f96 0%, #2b7ac4 100%);
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Merriweather Sans', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--white);
}

.nav-buttons {
  display: flex;
  gap: 12px;
}

.btn-outline-white {
  border: 2px solid rgba(255,255,255,0.8);
  color: var(--white);
  background: transparent;
  padding: 9px 24px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  letter-spacing: 0.02em;
}
.btn-outline-white:hover { background: rgba(255,255,255,0.15); }

/* ── HERO ── */
.hero {
  position: relative;
  height: 600px;
  background: linear-gradient(120deg, #2b7ac4 0%, #a8c8e8 75%, #dce9f5 100%);
  display: flex;
  align-items: center;
  overflow: hidden;
  justify-content: space-around;
}

.hero-wave {
  position: absolute;
  bottom: -2px; left: 0; right: 0;
  height: 200px;
  width: 100%;
}

.hero-image {
  height: 100%;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-image img {
  width: 550px;
}

.hero-content {
  position: relative;
  z-index: 2;
  padding: 120px 60px 100px;
  max-width: 800px;
}

.hero-content h1 {
  font-family: 'Merriweather Sans', sans-serif;
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--white);
  line-height: 1.2;
  margin-bottom: 6px;
}

.hero-content h2 {
  font-family: 'Merriweather Sans', sans-serif;
  font-size: 1.7rem;
  font-weight: 400;
  color: rgba(255,255,255,0.9);
  margin-bottom: 20px;
}

.hero-content p {
  color: rgba(255,255,255,0.85);
  font-size: 1.05rem;
  line-height: 1.6;
  margin-bottom: 32px;
  max-width: 360px;
}

.btn-outline-hero {
  border: 2px solid var(--white);
  color: var(--white);
  background: transparent;
  padding: 12px 32px;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

/* ── CHALLENGE ── */
.challenge {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  background: var(--white);
  position: relative;
  height: 620px;
  margin-top: -65px;
  overflow: hidden;
}

.challenge-text {
  padding: 70px 60px;
  margin-top: -65px;
}

.challenge-text h3 {
  font-family: 'Merriweather Sans', sans-serif;
  font-size: 1.9rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text-dark);
}

.section-rule {
  width: 280px;
  height: 2px;
  background: linear-gradient(90deg, var(--blue-mid), transparent);
  margin-bottom: 20px;
}

.challenge-text p {
  color: var(--text-mid);
  font-size: 1.05rem;
  line-height: 1.7;
}

.challenge-hex {
  position: absolute;
  right: 0;
  top: 0;
  width: 45%;
  height: 100%;
  opacity: 0.05;
  pointer-events: none;
  z-index: 1;
}

/* Keep text and image above the hex overlay */
.challenge-text,
.challenge-image {
  position: relative;
  z-index: 2;
}

.challenge-image {
  height: 100%;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.challenge-image img {
  width: 730px;
}

/* ── HEMAVET SOLUTION ── */
.solution {
  background: linear-gradient(90deg, #dce9f5 0%, #a8c8e8 25%, #2b7ac4 100%);
  position: relative;
  overflow: visible;
  margin-top: -65px;
}

.solution-top {
  padding: 100px 60px 0;
  margin-bottom: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.solution-text {
  text-align: center;
}

.solution-text h3 {
  font-family: 'Merriweather Sans', sans-serif;
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 14px;
}

.solution-text p {
  color: rgba(255,255,255,0.85);
  font-size: 1.05rem;
  line-height: 1.7;
}

.solution-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(255,255,255,0.92);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  margin: 60px;
}

.solution-card {
  padding: 32px 20px;
  text-align: center;
  border-right: 1px solid #e5edf5;
  transition: background 0.2s;
}
.solution-card:last-child { border-right: none; }
.solution-card:hover { background: rgba(37,99,176,0.04); }

.solution-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
}

.solution-card h4 {
  font-family: 'Merriweather Sans', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-dark);
}

.dashboard-wrapper {
  padding: 0 0 60px;
  width: 100%;
  box-sizing: border-box;
}

.dashboard-wrapper iframe {
  width: 100%;
  height: 360px;
  border: none;
  border-radius: 12px;
  display: block;
}

/* ── KEY BENEFITS ── */
.benefits {
  padding: 70px 60px;
  background: var(--white);
}

.section-title {
  text-align: center;
  font-family: 'Merriweather Sans', sans-serif;
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 12px;
}

.section-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 48px;
}
.section-divider::before {
  content: '';
  flex: 1;
  max-width: 400px;
  height: 1px;
  background: #ccc;
}

.benefits-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  max-width: 900px;
  margin: 0 auto;
}

.benefit-card {
  border: 1px solid #e0e8f0;
  border-radius: 12px;
  padding: 36px 24px 28px;
  text-align: center;
  transition: box-shadow 0.2s, transform 0.2s;
}
.benefit-card:hover { box-shadow: 0 6px 24px rgba(37,99,176,0.1); transform: translateY(-2px); }

.benefit-card h4 {
  font-family: 'Merriweather Sans', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-dark);
}

.benefit-card p {
  font-size: 0.95rem;
  color: var(--text-mid);
  line-height: 1.5;
}

/* ── PARTNER ── */
.partner {
  background: linear-gradient(160deg, #f0f5fc 0%, #dce8f5 40%, #c5d8ed 70%, #e8f0f8 100%);
  padding: 80px 60px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.partner .section-title { margin-bottom: 8px; }

.partner p {
  color: var(--text-mid);
  font-size: 1.05rem;
  line-height: 1.6;
  margin-bottom: 36px;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

.btn-cta {
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue-mid) 100%);
  color: var(--white);
  border: none;
  padding: 16px 50px;
  border-radius: 50px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
  letter-spacing: 0.03em;
  box-shadow: 0 4px 16px rgba(26,58,107,0.3);
}
.btn-cta:hover { opacity: 0.9; transform: translateY(-1px); }

.partner .civisagro-references {
  display: flex;
  align-items: center;
  gap: 27px; /* controls spacing between logos */
  justify-content: center;
}

/* ──────────────────────────────────────
   DIALOG
────────────────────────────────────── */

/* Overlay */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20,18,14,0.45);
  -webkit-backdrop-filter: blur(4px); /* Safari */
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 200;
}
.overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* Dialog panel */
.dialog {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 480px;
  padding: 48px 44px 44px;
  position: relative;
  transform: translateY(24px) scale(0.97);
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s ease;
  opacity: 0;
}
.overlay.open .dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Close button */
.close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.close-btn:hover { background: #f0f4f9; color: var(--ink); border-color: #ccc; }
.close-btn svg { width: 14px; height: 14px; }

/* Header */
.dialog-header { margin-bottom: 32px; }

.dialog-title {
  font-family: 'Merriweather Sans', sans-serif;
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}
.dialog-subtitle {
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.5;
}

/* Form fields */
.form-group { margin-bottom: 20px; }

label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 7px;
}

input,
textarea {
  width: 100%;
  font-family: 'Lato', sans-serif;
  font-size: 0.95rem;
  color: var(--ink);
  background: #fafafa;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  resize: none;
}
input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder { color: #bbb; }
input::placeholder,
textarea::placeholder { color: #bbb; }

input:focus,
textarea:focus {
  border-color: var(--blue-mid);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(37,99,176,0.1);
}

input.error,
textarea.error {
  border-color: #d94f3d;
  background: #fff9f9;
}

textarea { height: 110px; line-height: 1.6; }

.error-msg {
  font-size: 0.76rem;
  color: #d94f3d;
  margin-top: 5px;
  display: none;
}
.error-msg.visible { display: block; }

/* Submit button */
.submit-btn {
  width: 100%;
  font-family: 'Lato', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--white);
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue-mid) 100%);
  border: none;
  padding: 16px 50px;
  border-radius: 50px;
  cursor: pointer;
  margin-top: 8px;
  transition: opacity 0.2s, transform 0.2s;
}
.submit-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.submit-btn:active { transform: translateY(0); }
.submit-btn:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }

/* Form/state visibility */
.form-content { transition: opacity 0.3s; }
.form-content.hidden { display: none; }

/* Success state */
.success-state {
  display: none;
  text-align: center;
  padding: 16px 0 8px;
}
.success-state.visible { display: block; }

.success-icon {
  width: 56px;
  height: 56px;
  background: #f0faf4;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}
.success-icon svg { width: 26px; height: 26px; color: #2d9e5f; }

.success-title {
  font-family: 'Merriweather Sans', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 10px;
}
.success-text { font-size: 0.9rem; color: var(--muted); line-height: 1.6; }

/* Error state */
.error-state {
  display: none;
  text-align: center;
  padding: 16px 0 8px;
}
.error-state.visible { display: block; }

.error-icon {
  width: 56px;
  height: 56px;
  background: #fff4f3;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}
.error-icon svg { width: 26px; height: 26px; color: #d94f3d; }

.error-state-title {
  font-family: 'Merriweather Sans', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 10px;
}
.error-state-text { font-size: 0.9rem; color: var(--muted); line-height: 1.7; }
.error-state-text a { color: var(--blue-dark); text-decoration: none; border-bottom: 1px solid currentColor; }
.error-state-text a:hover { color: var(--blue-mid); }

.retry-btn {
  margin-top: 24px;
  font-family: 'Lato', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  padding: 10px 24px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.retry-btn:hover { background: #f0f4f9; border-color: #ccc; }

/* Auto-close countdown ring */
.countdown-ring {
  position: absolute;
  bottom: 18px;
  right: 18px;
  width: 28px;
  height: 28px;
}
.countdown-ring svg { transform: rotate(-90deg); }
.countdown-ring circle {
  fill: none;
  stroke: #e2e2e2;
  stroke-width: 2.5;
}
.countdown-ring .progress {
  stroke: var(--blue-mid);
  stroke-dasharray: 69.1;
  stroke-dashoffset: 0;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.4s linear;
}


/* ══════════════════════════════════════════════
   RESPONSIVE STYLES
   Breakpoints:
     Tablet  → max-width: 1023px
     Mobile  → max-width: 599px
   All desktop styles live above this block.
══════════════════════════════════════════════ */

/* ─────────────────────────────────────────────
   TABLET  (600px – 1023px)
───────────────────────────────────────────── */
@media (max-width: 1023px) {

  /* Navbar */
  nav {
    padding: 16px 32px;
  }

  /* Hero: stack content over image */
  .hero {
    height: auto;
    flex-direction: column;
    justify-content: flex-start;
    padding-bottom: 65px; /* room for the wave */
  }

  .hero-content {
    padding: 60px 40px 32px;
    max-width: 100%;
    text-align: center;
  }

  .hero-content p {
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  .hero-content h1 { font-size: 2rem; }
  .hero-content h2 { font-size: 1.3rem; }

  .hero-image {
    height: 320px;
    width: 100%;
  }

  .hero-image img {
    width: auto;
    height: 100%;
    object-fit: contain;
  }

  /* Challenge: stack image above text */
  .challenge {
    grid-template-columns: 1fr;
    height: auto;
    padding-bottom: 100px;
  }

  /* On tablet we keep image on top, text below */
  .challenge-image {
    height: 300px;
    width: 100%;
    order: -1;
  }

  .challenge-image img {
    width: auto;
    height: 100%;
    object-fit: contain;
  }

  .challenge-text {
    padding: 48px 40px;
  }

  /* Solution */
  .solution-top {
    padding: 60px 40px 0;
  }

  .solution-cards {
    grid-template-columns: repeat(3, 1fr); /* keep 3-col on tablet */
    margin: 40px 40px 60px;
  }

  /* Benefits: 2-column on tablet */
  .benefits {
    padding: 60px 40px;
  }

  .benefits-grid {
    grid-template-columns: repeat(2, 1fr);
    max-width: 640px;
  }

  /* Centre the lone third card */
  .benefit-card:last-child {
    grid-column: 1 / -1;
    max-width: 300px;
    margin: 0 auto;
  }

  /* Partner */
  .partner {
    padding: 60px 40px;
  }

  /* Dialog: tighter padding */
  .dialog {
    padding: 40px 32px 36px;
  }
}

/* ─────────────────────────────────────────────
   MOBILE  (up to 599px)
───────────────────────────────────────────── */
@media (max-width: 599px) {

  /* Navbar */
  nav {
    padding: 14px 20px;
  }

  .logo {
    font-size: 1.25rem;
  }

  .logo svg {
    width: 30px;
    height: 30px;
  }

  .btn-outline-white {
    padding: 7px 16px;
    font-size: 0.82rem;
  }

  /* Hero: hide the image, let content breathe */
  .hero {
    height: auto;
    flex-direction: column;
    padding-bottom: 60px;
  }

  .hero-content {
    padding: 48px 24px 32px;
    text-align: center;
  }

  .hero-content h1 { font-size: 1.65rem; }
  .hero-content h2 { font-size: 1.1rem; }

  .hero-content p {
    font-size: 0.9rem;
    max-width: 100%;
  }

  /* Challenge */
  .challenge {
    grid-template-columns: 1fr;
    height: auto;
  }

  .challenge-image {
    height: 220px;
    order: -1;
  }

  .challenge-image img {
    width: auto;
    height: 100%;
    object-fit: contain;
  }

  .challenge-text {
    padding: 32px 24px 40px;
  }

  .challenge-text h3 { font-size: 1.25rem; }

  .section-rule { width: 180px; }

  /* Solution */
  .solution-top {
    padding: 48px 24px 0;
  }

  .solution-text h3 { font-size: 1.4rem; }

  /* Stack solution cards vertically */
  .solution-cards {
    grid-template-columns: 1fr;
    margin: 32px 24px 48px;
    border-radius: 12px;
  }

  .solution-card {
    border-right: none;
    border-bottom: 1px solid #e5edf5;
    padding: 28px 20px;
  }

  .solution-card:last-child { border-bottom: none; }

  /* Benefits: single column */
  .benefits {
    padding: 48px 24px;
  }

  .section-title { font-size: 1.4rem; }

  .benefits-grid {
    grid-template-columns: 1fr;
    max-width: 100%;
  }

  .benefit-card:last-child {
    grid-column: auto;
    max-width: 100%;
    margin: 0;
  }

  /* Partner */
  .partner {
    padding: 48px 24px;
  }

  .partner p { font-size: 0.92rem; }

  .btn-cta {
    padding: 14px 36px;
    font-size: 0.95rem;
  }

  /* Dialog: near full-screen sheet on mobile */
  .overlay {
    align-items: flex-end; /* slide up from bottom */
    padding: 0;
  }

  .dialog {
    max-width: 100%;
    border-radius: 20px 20px 0 0; /* rounded top, flush bottom */
    padding: 32px 24px 40px;
    transform: translateY(40px) scale(1); /* simpler entrance on mobile */
  }

  .overlay.open .dialog {
    transform: translateY(0) scale(1);
  }

  .dialog-title { font-size: 1.5rem; }
}