/**
 * Beta Energy — Shared UI Components
 */

/* =========================================
   BUTTONS
   ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 14px 28px;
  border-radius: var(--be-radio-full);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  border: 1.5px solid transparent;
  cursor: pointer;
  text-align: center;
  transition: background-color var(--be-transicion), border-color var(--be-transicion),
    color var(--be-transicion), box-shadow var(--be-transicion);
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}

/* Primary (also used on dark backgrounds) */
.btn-accent {
  background: var(--be-lima);
  color: var(--be-verde-profundo);
}

.btn-accent:hover {
  background: var(--be-lima-600);
}

/* Secondary */
.btn-dark {
  background: var(--be-verde-profundo);
  color: var(--be-blanco);
}

.btn-dark:hover {
  background: var(--be-verde-800);
}

/* Outline on dark backgrounds */
.btn-outline {
  background: transparent;
  color: var(--be-blanco);
  border-color: var(--be-blanco);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, .1);
}

.btn-sm {
  padding: 12px 22px;
}

/* =========================================
   HEADER & NAVIGATION
   ========================================= */
header.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--be-blanco);
  border-bottom: 1px solid var(--be-gris-300);
}

/* The bottom border only appears once the page scrolls; without scroll-timeline
   support it simply stays visible. */
@keyframes headerBorder {
  from {
    border-bottom-color: transparent;
  }
}

@supports (animation-timeline: scroll()) {
  header.site-header {
    animation: headerBorder linear both;
    animation-timeline: scroll();
    animation-range: 0 64px;
  }
}

/* Container handles width/centering — nav-wrap only adds the flex bar layout */
.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  height: var(--be-header);
}

/* Logo: official SVG files only (see DESIGN.md) */
.logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.logo img {
  height: 36px;
  width: auto;
  min-width: 120px;
}

/* Desktop Main Nav */
/* Pushed to the right, next to the contact button */
nav.main-nav {
  display: flex;
  align-items: center;
  gap: 32px;
  margin-left: auto;
}

nav.main-nav a {
  color: var(--be-verde-profundo);
  font-size: 16px;
  font-weight: 600;
  position: relative;
  padding: 4px 0;
}

nav.main-nav a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0%;
  height: 2px;
  border-radius: var(--be-radio-full);
  background: var(--be-lima);
  transition: width var(--be-transicion);
}

nav.main-nav a:hover::after {
  width: 100%;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Mobile Menu Toggle Button */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 13px 10px;
  border-radius: var(--be-radio-sm);
  transition: background-color var(--be-transicion);
}

.menu-toggle:hover {
  background: var(--be-gris-100);
}

.menu-icon {
  width: 24px;
  height: 18px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.menu-icon span {
  display: block;
  height: 2px;
  width: 100%;
  background-color: var(--be-verde-profundo);
  border-radius: var(--be-radio-full);
  transition: transform var(--be-transicion), opacity var(--be-transicion);
}

.menu-toggle[aria-expanded="true"] .menu-icon span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .menu-icon span:nth-child(2) {
  opacity: 0;
}

.menu-toggle[aria-expanded="true"] .menu-icon span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* Mobile Drawer */
.mobile-nav-drawer {
  position: fixed;
  top: 0;
  right: -320px;
  width: 300px;
  max-width: 85vw;
  height: 100dvh;
  background: var(--be-blanco);
  z-index: 999;
  padding: 96px 24px 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--be-sombra-md);
  transition: right 0.3s ease-out;
}

.mobile-nav-drawer.open {
  right: 0;
}

.mobile-nav-links {
  display: flex;
  flex-direction: column;
}

.mobile-nav-links a {
  color: var(--be-verde-profundo);
  font-size: 18px;
  font-weight: 600;
  padding: 16px 0;
  border-bottom: 1px solid var(--be-gris-300);
}

.mobile-nav-links a:hover {
  color: var(--be-verde-800);
}

.mobile-nav-drawer .btn {
  width: 100%;
  margin-top: 24px;
}

.mobile-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: var(--be-velo);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--be-transicion);
}

.mobile-drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* =========================================
   HERO BACKGROUND VIDEO (home and product heroes)
   ========================================= */
.hero-video {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* With reduced motion the video is dropped and the hero keeps its black background */
@media (prefers-reduced-motion: reduce) {
  .hero-video {
    display: none;
  }
}

/* =========================================
   MARQUEE (scrolling logo strip)
   ========================================= */
.marquee {
  overflow: hidden;
  width: 100%;
  -webkit-mask-image: linear-gradient(90deg, transparent, black 10%, black 90%, transparent);
  mask-image: linear-gradient(90deg, transparent, black 10%, black 90%, transparent);
}

.marquee-track {
  display: flex;
  width: max-content;
  animation: marqueeScroll 28s linear infinite;
}

.marquee-track:hover {
  animation-play-state: paused;
}

/* Without motion the strip stops, so let people scroll it by hand */
@media (prefers-reduced-motion: reduce) {
  .marquee {
    overflow-x: auto;
  }
}

@keyframes marqueeScroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

/* =========================================
   CLIENTS (soft section): heading left, 2x2 logos right split by hairlines
   ========================================= */
.clients {
  background: var(--be-lima-50);
}

.clients .container {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 64px;
  align-items: center;
}

.clients .section-head {
  margin: 0;
}

.client-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));   /* equal halves whatever the logo widths */
}

.client-logo {
  height: 136px;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Cross-shaped divider between the four logos */
.client-logo:nth-child(odd) {
  border-right: 1px solid var(--be-gris-300);
}

.client-logo:nth-child(-n+2) {
  border-bottom: 1px solid var(--be-gris-300);
}

/* The files are white-on-transparent (originals in images/clients/originals);
   the filter turns them into a dark single tone for the light background. */
.client-logo img {
  max-height: 56px;
  max-width: 100%;
  filter: brightness(0);
  opacity: 0.7;
}

/* Verzeen is a long, thin wordmark: capped by width so it doesn't outweigh the others */
.client-logo img[src*="verzeen"] {
  max-width: min(150px, 100%);
}

/* =========================================
   FINAL CTA: photo panel with a dark scrim, on a light section
   ========================================= */
/* After another white section, one section gap is enough */
.faq + .final-cta {
  padding-top: 0;
}

.cta-panel {
  position: relative;
  overflow: hidden;
  border-radius: var(--be-radio-md);
  background: var(--be-negro) url('../images/cta-charger.jpg') center / cover no-repeat;
  color: var(--be-sobre-oscuro);
  padding: 96px 64px;
}

/* Scrim: guarantees text contrast over the photo */
.cta-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, .92) 0%, rgba(0, 0, 0, .85) 55%, rgba(0, 0, 0, .1) 100%);
}

.cta-panel > * {
  position: relative;
}

/* Logo weight contrast: light sentence, key words in 800 + lime */
.cta-panel h2 {
  font-size: clamp(32px, 4.4vw, 48px);
  font-weight: 300;
  color: var(--be-blanco);
  max-width: 14em;
  margin-bottom: 16px;
}

.cta-panel h2 strong {
  font-weight: 800;
  color: var(--be-lima);
}

.cta-panel p {
  max-width: 48ch;
  margin-bottom: 24px;
}

.cta-points {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin-bottom: 32px;
}

.cta-points li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--be-blanco);
}

.cta-points li::before {
  content: '✓';
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border-radius: var(--be-radio-full);
  background: var(--be-lima);
  color: var(--be-verde-profundo);
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cta-panel .btn-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px 24px;
}

.cta-mail {
  font-size: 14px;
  font-weight: 600;
  color: var(--be-lima);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cta-panel :focus-visible {
  outline-color: var(--be-lima);
}

/* Home: the panel shares the row with the visible contact form */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: stretch;
}

.contact-grid .cta-panel {
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
}

.contact-grid .cta-panel::before {
  background: rgba(0, 0, 0, .8);
}

.contact-grid .cta-points {
  flex-direction: column;
}

.contact-card {
  background: var(--be-blanco);
  border: 1px solid var(--be-gris-300);
  border-radius: var(--be-radio-md);
  padding: 32px;
}

/* =========================================
   FOOTER (dark)
   ========================================= */
footer.site-footer {
  background: var(--be-negro);
  padding: 64px 0 32px;
  font-size: 14px;
  line-height: 1.5;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr 1.3fr;
  gap: 32px;
  margin-bottom: 48px;
}

/* Column titles use the overline style */
.footer-col h4 {
  color: var(--be-lima);
  font-size: 13px;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.footer-col ul li {
  margin-bottom: 12px;
}

.site-footer a:hover {
  color: var(--be-lima);
  text-decoration: underline;
}

.footer-brand .logo img {
  height: 40px;
}

.footer-brand p {
  margin-top: 16px;
  max-width: 290px;
}

.footer-bottom {
  border-top: 1px solid var(--be-borde-oscuro);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

/* =========================================
   LEAD MODAL DIALOG
   ========================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--be-velo);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  opacity: 0;
  transition: opacity var(--be-transicion);
}

.modal-overlay.open {
  display: flex;
  opacity: 1;
}

.modal {
  background: var(--be-blanco);
  border-radius: var(--be-radio-md);
  max-width: 520px;
  width: 100%;
  max-height: 90dvh;
  overflow-y: auto;
  padding: 32px;
  position: relative;
  box-shadow: var(--be-sombra-md);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  color: var(--be-gris-600);
  cursor: pointer;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--be-radio-full);
  transition: background-color var(--be-transicion), color var(--be-transicion);
}

.modal-close:hover {
  color: var(--be-verde-profundo);
  background: var(--be-gris-100);
}

.modal h3,
.contact-card h3 {
  margin-bottom: 8px;
}

.modal-sub {
  color: var(--be-gris-600);
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--be-tinta);
  margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border: 1px solid var(--be-gris-300);
  border-radius: var(--be-radio-sm);
  font-size: 16px;              /* 16px minimum avoids iOS zoom on focus */
  color: var(--be-tinta);
  background: var(--be-blanco);
  transition: border-color var(--be-transicion), box-shadow var(--be-transicion);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--be-lima-700);
  box-shadow: 0 0 0 3px var(--be-lima-100);
}

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

.form-error {
  color: var(--be-error);
  font-size: 14px;
  line-height: 1.5;
  margin-top: 4px;
  display: none;
}

.form-group.invalid input,
.form-group.invalid textarea {
  border-color: var(--be-error);
}

.form-group.invalid .form-error {
  display: block;
}

.lead-form .btn-accent {
  width: 100%;
  margin-top: 8px;
}

/* Shown only when sending fails */
.form-status {
  margin-top: 16px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--be-error);
}

.form-status a {
  font-weight: 600;
  text-decoration: underline;
}

.lead-success {
  display: none;
  text-align: center;
  padding: 24px 0;
}

.lead-success.show {
  display: block;
}

.lead-success p {
  margin: 8px auto 0;
}

.lead-success .check {
  width: 64px;
  height: 64px;
  border-radius: var(--be-radio-full);
  background: var(--be-lima);
  color: var(--be-verde-profundo);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  margin: 0 auto 16px;
}

.lead-form.hide {
  display: none;
}

/* =========================================
   RESPONSIVE COMPONENT RULES
   ========================================= */
@media (max-width: 900px) {
  nav.main-nav {
    display: none;
  }

  .menu-toggle {
    display: block;
  }

  .clients .container {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .client-logo {
    height: 112px;
    padding: 16px;
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-brand {
    grid-column: 1 / -1;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .modal {
    padding: 24px;
  }

  .cta-panel,
  .contact-grid .cta-panel {
    padding: 48px 24px;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }

  .contact-card {
    padding: 24px;
  }

  .cta-panel::before {
    background: rgba(0, 0, 0, .75);
  }
}

@media (max-width: 580px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

/* Header CTA doesn't fit next to the logo on small phones — the drawer carries it */
@media (max-width: 560px) {
  .nav-actions .btn {
    display: none;
  }
}
