/* About & Contact section styles - Dark theme with background image */
.about {
  position: relative;
  background: linear-gradient(135deg, var(--dark) 0, #0d2137 100%);
  color: #fff;
  overflow: hidden;
  padding: var(--spacing-xl) 0 0 0;
}

.about::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url('./public/hero-drainage-software.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.25;
  z-index: 0;
}

.about::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(10, 25, 41, 0.85) 0, rgba(13, 33, 55, 0.9) 100%);
  z-index: 1;
}

.about>.container {
  position: relative;
  z-index: 2;
  padding-bottom: var(--spacing-xl);
}

.about .section-header .gradient-divider {
  width: 100px;
  height: 6px;
  background: linear-gradient(90deg, var(--brand) 0, var(--brandAccent) 50%, var(--brandMedium) 100%);
  margin: 0 auto var(--spacing-md);
  border-radius: 3px;
  box-shadow: 0 0 20px rgba(8, 145, 178, 0.6),
    0 0 40px rgba(6, 182, 212, 0.3);
}

.about .section-header h2 {
  color: #fff;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  font-size: clamp(2.5rem, 5vw, 4rem);
}

.about .section-intro {
  color: rgba(255, 255, 255, 0.95);
  font-size: 1.15rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.about-contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-lg);
  align-items: stretch;
  /* Changed from start to stretch so columns match height */
  position: relative;
  /* allow absolutely positioned floating success card */
  max-width: 1200px;
  margin: 0 auto;
}

.team-column {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.contact-column {
  /* Removed position: sticky so form doesn't move on scroll */
  display: flex;
  flex-direction: column;
}

.about .team-member {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(15px);
  border: 2px solid rgba(255, 255, 255, 0.2);
  padding: var(--spacing-md);
  border-radius: var(--radius);
  display: flex;
  gap: var(--spacing-md);
  align-items: flex-start;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  /* Adding scroll animation support - only animates when section is visible */
  opacity: 0;
  transform: translate3d(0, 30px, 0);
  will-change: opacity, transform;
  transition: opacity var(--anim-duration) ease-out, transform var(--anim-duration) ease-out, border-color 0.35s ease, box-shadow 0.35s ease, background 0.35s ease;
  contain: layout style paint;
}

.about.section-reveal.visible .team-member,
.section-reveal.visible .team-member {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  will-change: auto;
}

.about .team-member:hover {
  border-color: var(--brand);
  background: rgba(255, 255, 255, 0.12);
  transform: translate3d(0, -6px, 0);
  box-shadow: 0 16px 48px rgba(0, 188, 212, 0.5),
    0 0 30px rgba(8, 145, 178, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

.team-column .team-member.stagger-item:nth-child(1) {
  --stagger-delay: 0s;
  transition-delay: 0s;
}

.team-column .team-member.stagger-item:nth-child(2) {
  --stagger-delay: 0.2s;
  transition-delay: 0.2s;
}

.team-photo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 4px solid var(--brand);
  box-shadow: 0 8px 24px rgba(0, 188, 212, 0.4),
    0 0 20px rgba(8, 145, 178, 0.3),
    inset 0 0 20px rgba(255, 255, 255, 0.1);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.about .team-member:hover .team-photo {
  border-color: var(--brandAccent);
  box-shadow: 0 12px 32px rgba(0, 188, 212, 0.6),
    0 0 30px rgba(6, 182, 212, 0.4),
    inset 0 0 30px rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
}

.team-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.team-info {
  flex: 1;
}

.team-info h3 {
  color: #fff;
  font-size: 1.5rem;
  margin-bottom: .25rem;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.team-role {
  color: var(--brandAccent);
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: var(--spacing-sm);
  text-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
  letter-spacing: 0.5px;
}

.team-bio {
  color: rgba(255, 255, 255, 0.95);
  line-height: 1.7;
  margin-bottom: var(--spacing-sm);
  font-size: 1rem;
  font-weight: 400;
}

.team-highlights {
  list-style: none;
  padding: 0;
  margin: 0;
}

.team-highlights li {
  padding-left: 1.75rem;
  position: relative;
  margin-bottom: .6rem;
  color: rgba(255, 255, 255, 0.9);
  font-size: .95rem;
  line-height: 1.6;
  font-weight: 400;
}

.team-highlights li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--brandAccent);
  font-weight: 700;
  font-size: 1.2rem;
  text-shadow: 0 0 8px rgba(6, 182, 212, 0.6);
}

.contact-form-wrapper {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(15px);
  padding: 2.5rem;
  border-radius: var(--radius);
  border: 2px solid rgba(255, 255, 255, 0.2);
  height: 100%;
  /* Changed from fit-content to 100% to match team column height */
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  /* Adding scroll animation support - animates after team members */
  opacity: 0;
  transform: translate3d(50px, 0, 0);
  will-change: opacity, transform;
  transition: opacity var(--anim-duration) ease-out, transform var(--anim-duration) ease-out, border-color 0.35s ease, box-shadow 0.35s ease, background 0.35s ease;
  transition-delay: 0.35s;
  /* Start after team members begin animating */
  contain: layout style paint;
}

/* When the form is replaced by the success panel, make the wrapper visually passive
   so the success panel can be a compact, centered card instead of a full-height column. */
.contact-form-wrapper.success-visible {
  /* Keep the glass card look for the full-height layout */
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  padding: 2.5rem;
  border-radius: var(--radius);
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  display: block;
}

.contact-form-wrapper.success-visible .success-panel {
  /* Make the success panel fill the wrapper vertically and space content */
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  /* wrapper already has padding */
}

/* Close button inside success panel */
.success-close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #fff;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.1rem;
}

.success-close:focus {
  outline: 3px solid rgba(6, 182, 212, 0.25);
}

.section-reveal.visible .contact-form-wrapper {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  will-change: auto;
}

.contact-form-wrapper:hover {
  border-color: var(--brand);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 16px 48px rgba(0, 188, 212, 0.5),
    0 0 30px rgba(8, 145, 178, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.2) inset;
  transform: translate3d(0, -4px, 0);
}

.contact-heading {
  color: #fff;
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
  text-align: center;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.contact-intro {
  color: rgba(255, 255, 255, 0.95);
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 2rem;
  text-align: center;
  font-weight: 400;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
  /* Added flex: 1 to make form expand to fill available space */
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-weight: 700;
  color: #fff;
  font-size: 0.9rem;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  margin-bottom: 0.25rem;
}

.form-group input,
.form-group textarea {
  padding: 0.875rem;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) inset;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.form-group input:focus:not(.valid):not(.invalid),
.form-group textarea:focus:not(.valid):not(.invalid) {
  outline: none;
  border-color: var(--brandAccent);
  background: rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.3),
    0 0 20px rgba(6, 182, 212, 0.2),
    0 2px 8px rgba(0, 0, 0, 0.2) inset;
  transform: translateY(-1px);
}

/* Validation styles - Bright green for valid, red for invalid */
.form-group input.valid,
.form-group textarea.valid {
  border-color: #22c55e !important;
  border-width: 2px !important;
  background: rgba(34, 197, 94, 0.08);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0),
    0 2px 8px rgba(0, 0, 0, 0.2) inset;
}

.form-group input.valid:focus,
.form-group textarea.valid:focus {
  border-color: #22c55e !important;
  background: rgba(34, 197, 94, 0.12);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0),
    0 2px 8px rgba(0, 0, 0, 0.2) inset;
}

.form-group input.invalid,
.form-group textarea.invalid {
  border-color: #ef4444 !important;
  border-width: 2px !important;
  background: rgba(239, 68, 68, 0.08);
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0),
    0 2px 8px rgba(0, 0, 0, 0.2) inset;
}

.form-group input.invalid:focus,
.form-group textarea.invalid:focus {
  border-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.12);
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0),
    0 2px 8px rgba(0, 0, 0, 0.2) inset;
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

.field-error {
  color: #ef4444;
  font-size: 0.85rem;
  margin-top: 0.25rem;
  min-height: 1.2rem;
  display: block;
  opacity: 0;
  transform: translateY(-5px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.field-error.show {
  opacity: 1;
  transform: translateY(0);
}

/* Hide any character count displays */
.character-count,
[class*="character"],
[id*="message-count"],
[id*="character-count"] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  height: 0 !important;
  width: 0 !important;
  overflow: hidden !important;
}

.turnstile-group {
  display: block;
  position: relative;
  margin: 1rem 0;
  padding: 0.5rem 0;
  width: 100%;
}

.turnstile-center {
  position: relative;
  width: 100%;
  height: 65px;
}

.turnstile-center .cf-turnstile {
  position: absolute;
  top: 0;
  left: 50%;
  display: block;
  padding: 0 !important;
  margin: 0 !important;
  width: 300px;
  max-width: 100%;
  transform: translateX(calc(-50% - 3px));
}

.turnstile-group .cf-turnstile iframe {
  margin: 0 auto !important;
  display: block;
  transform: none;
}

.form-error {
  background: rgba(239, 68, 68, 0.15);
  border: 2px solid rgba(239, 68, 68, 0.5);
  color: #ff6b6b;
  padding: 0.875rem 1rem;
  border-radius: 8px;
  margin: 0.5rem 0;
  font-size: 0.9rem;
  text-align: center;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}

.form-success {
  background: rgba(34, 197, 94, 0.15);
  border: 2px solid rgba(34, 197, 94, 0.5);
  color: #4ade80;
  padding: 0.875rem 1rem;
  border-radius: 8px;
  margin: 0.5rem 0;
  font-size: 0.9rem;
  text-align: center;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.2);
}

.contact-form .btn-primary {
  padding: 0.75rem 1.75rem;
  margin-top: 0.5rem;
  width: 100%;
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.contact-form .btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  background: rgba(8, 145, 178, 0.4);
  border-color: rgba(255, 255, 255, 0.2);
}

.contact-form .btn-primary:disabled:hover {
  background: rgba(8, 145, 178, 0.4);
  border-color: rgba(255, 255, 255, 0.2);
  transform: none;
  box-shadow: none;
}

@media (max-width: 1024px) {
  .about-contact-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
  }

  .contact-column {
    position: static;
  }

  /* Adjust background image opacity on tablets for better readability */
  .about::before {
    opacity: 0.15;
  }
}

/* Slightly tighten vertical spacing in the contact form for wide screens so
   the card height is smaller and avoids showing a scrollbar next to the form.
   This preserves existing spacing on tablets and mobile. */
@media (min-width: 1025px) {
  .contact-form-wrapper {
    padding: 1.75rem; /* slightly tighter */
  }

  .contact-heading { margin-bottom: 0.5rem; }
  .contact-intro { margin-bottom: 1.5rem; }
  .contact-form { gap: 0.6rem; }
  .form-group { gap: 0.28rem; }
  .form-group input, .form-group textarea { padding: 0.6rem; font-size: 0.92rem; }
  .form-group textarea { min-height: 8.5rem; }
  /* Tighter spacing around the Cloudflare turnstile and send button */
  .turnstile-group { margin: 0.35rem 0 0.35rem 0; padding: 0.15rem 0; }
  .turnstile-group .cf-turnstile { width: 300px; max-width: 100%; }
  .contact-form .btn-primary { margin-top: 0.12rem; padding: 0.5rem 1rem; font-size: 0.92rem; }
  .form-error { margin: 0.25rem 0; padding: 0.45rem 0.6rem; }
}

/* Improving mobile responsive styles for about section */
@media (max-width: 768px) {
  .about-contact-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }

  .about .team-member {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .team-photo {
    width: 100px;
    height: 100px;
  }

  .team-info h3 {
    font-size: 1.2rem;
  }

  .team-highlights li {
    text-align: left;
  }

  .contact-form-wrapper {
    padding: 1.5rem;
  }

  .contact-heading {
    font-size: 1.3rem;
  }

  /* Reduce background image visibility on mobile for better performance and readability */
  .about::before {
    opacity: 0.1;
  }

  .about::after {
    background: linear-gradient(135deg, rgba(10, 25, 41, 0.9) 0, rgba(13, 33, 55, 0.95) 100%);
  }
}

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

@media (max-width: 480px) {
  .about {
    padding: 2rem 0;
  }

  .about .section-header h2 {
    font-size: clamp(2rem, 6vw, 3rem);
  }

  .about .section-intro {
    font-size: 1rem;
    padding: 0 var(--spacing-sm);
  }

  .about .team-member {
    padding: var(--spacing-sm);
    flex-direction: column;
    text-align: center;
  }

  .team-photo {
    width: 80px;
    height: 80px;
  }

  .team-info h3 {
    font-size: 1.1rem;
  }

  .team-info p {
    font-size: 0.85rem;
  }

  .contact-form-wrapper {
    padding: 1rem;
  }

  .contact-heading {
    font-size: 1.2rem;
  }

  .form-group input,
  .form-group textarea {
    padding: 0.6rem;
    font-size: 0.85rem;
    min-height: 44px;
    /* Better touch target */
  }

  .contact-form .btn-primary {
    padding: 0.875rem 1.5rem;
    font-size: 0.95rem;
  }
}

/* Success Panel Styles - match team-member glass */
.success-panel {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  padding: var(--spacing-md);
  border-radius: var(--radius);
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  text-align: left;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.45s cubic-bezier(.2, .9, .2, 1), transform 0.45s cubic-bezier(.2, .9, .2, 1);
  display: block;
  width: 100%;
  box-sizing: border-box;
}

.success-panel-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 0.25rem;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brandAccent) 60%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45), 0 2px 18px rgba(8, 145, 178, 0.08) inset;
  flex-shrink: 0;
}

@keyframes successIconPulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.06);
  }

  100% {
    transform: scale(1);
  }
}

.success-panel .success-panel-title,
.success-panel h3.success-panel-title {
  color: #fff;
  font-size: 1.5rem;
  margin: 0 0 0.5rem 0;
  font-weight: 700;
  line-height: 1.2;
  text-align: left;
}

.success-panel .success-panel-message,
.success-panel p.success-panel-message {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0 0 1rem 0;
  font-weight: 400;
  text-align: left;
}

.success-panel .success-panel-steps,
.success-panel-steps {
  text-align: left;
  margin: 0;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: calc(var(--radius) - 4px);
  border: 1px solid rgba(255, 255, 255, 0.03);
  width: 100%;
  box-shadow: none;
  display: block;
}

.success-panel-steps h4 {
  color: rgba(255, 255, 255, 0.95);
  font-size: 1.05rem;
  margin: 0 0 0.75rem 0;
  font-weight: 700;
  letter-spacing: 0.25px;
}

.success-panel-steps ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: stretch;
}

.success-panel .success-panel-steps li,
.success-panel-steps li {
  padding-left: 2.4rem;
  position: relative;
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.98rem;
  line-height: 1.5;
  font-weight: 400;
  text-align: left;
  width: 100%;
}

.success-panel-steps li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0.05rem;
  color: #05212a;
  font-weight: 700;
  font-size: 0.9rem;
  background: var(--brandAccent);
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(6, 182, 212, 0.08);
}

.success-panel .success-panel-footer,
.success-panel p.success-panel-footer {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.98rem;
  line-height: 1.6;
  margin: 0 auto;
  margin-top: 0.5rem;
  font-style: italic;
  font-weight: 400;
  text-align: center;
  width: 100%;
  max-width: 92%;
  display: block;
}

/* Floating small success card positioned near the bottom-right next to the second team member */
.success-panel.floating {
  position: absolute;
  /* left will be set by JS to center the card between columns */
  width: 420px;
  max-width: calc(100% - 48px);
  box-shadow: 0 18px 40px rgba(2, 6, 12, 0.45);
  border-radius: calc(var(--radius) - 4px);
  padding: 1.25rem 1.5rem;
  z-index: 9999;
  display: block;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  min-height: 160px;
  min-width: 320px;
  color: #ffffff;
}

.success-panel.floating .success-panel-steps {
  margin-top: 0.75rem;
}

.success-panel.floating .success-panel-footer {
  margin-top: 1rem;
}

@media (max-width: 768px) {
  .success-panel {
    padding: 2rem 1.5rem;
    gap: 1.25rem;
  }

  .success-panel-icon {
    width: 64px;
    height: 64px;
  }

  .success-panel-icon svg {
    width: 36px;
    height: 36px;
  }

  .success-panel-title {
    font-size: 1.5rem;
  }

  .success-panel-message {
    font-size: 0.95rem;
  }

  .success-panel-steps {
    padding: 1.25rem;
  }

  .success-panel-steps h4 {
    font-size: 1.05rem;
    margin-bottom: 1rem;
  }

  .success-panel-steps ul {
    gap: 0.75rem;
  }

  .success-panel-steps li {
    font-size: 0.9rem;
    padding-left: 1.5rem;
    line-height: 1.5;
  }

  .success-panel-footer {
    font-size: 0.9rem;
  }
}