:root {
  --bg: #0b1220;
  --card: #121a2b;
  --text: #e8eefc;
  --muted: #a8b3cf;
  --line: #22304f;
  --btn: #2563eb;
  --btn2: #1f2937;
  --radius: 18px;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  font-family:
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Arial,
    sans-serif;
  background: var(--bg);
  color: var(--text);
}
a {
  color: inherit;
  text-decoration: none;
}
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ===== HEADER PRO (logo + nombre + menú) ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;

  background: rgba(11, 18, 32, 0.75);
  backdrop-filter: blur(10px);

  border-bottom: 1px solid var(--line);
  transition:
    background 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

/* cuando bajas (scroll) */
.topbar.scrolled {
  background: rgba(11, 18, 32, 0.98);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.65);
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

.topbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

/* marca: logo + texto */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0.2px;
  min-width: 0;
}

.brand-logo {
  height: 54px;
  width: auto;
  display: block;
}

.brand-text {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.3px;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  max-width: 520px;
  opacity: 0.95;
  color: rgba(230, 240, 255, 0.95);
}

/* nav */
.nav a {
  margin-left: 14px;
  color: var(--muted);
}
.nav a:hover {
  color: var(--text);
}

/* tablet */
@media (max-width: 768px) {
  .brand-logo {
    height: 46px;
  }
}

/* móvil */
@media (max-width: 700px) {
  .brand-logo {
    height: 30px;
  }
  .brand-text {
    max-width: 220px;
    font-size: 13px;
  }
}

/* móvil pequeño */
@media (max-width: 480px) {
  .brand-text {
    max-width: 160px;
    font-size: 12px;
  }
  .nav a {
    margin-left: 10px;
    font-size: 14px;
  }
}


.hero {
  padding: 38px 0 18px;
  border-bottom: 1px solid var(--line);

  min-height: 100vh;

  background-image:
    linear-gradient(90deg, rgba(6, 12, 24, 0.78), rgba(6, 12, 24, 0.4)),
    url("assets/solar-bg.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.hero-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr; /* más espacio a la derecha */
  gap: 28px;
  align-items: center;
}
.hero h1 {
  font-size: 40px;
  line-height: 1.05;
  margin: 0 0 10px;
}
.hero p {
  color: var(--muted);
  margin: 0 0 16px;
}
.hint {
  font-size: 14px;
  color: var(--muted);
  margin-top: 16px;
  line-height: 1.5;
  opacity: 0.9;

  max-width: 360px;
  display: inline-block;
  white-space: normal;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: var(--btn);
  color: white;
  font-weight: 700;
  cursor: pointer;
}
.btn.secondary {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}
.btn:hover {
  filter: brightness(1.05);
}

.hero-visual {
  display: flex;
  flex-direction: column;
  gap: 10px;
  opacity: 0;
  transition: opacity 0.8s ease;
}
.hero-visual.visible {
  opacity: 1;
}
.frame-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16/10;
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(180deg, #0f1a33, #0b1220);
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.frame-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}


/* --- Paneles sobre tejado (animación) --- */
#frameImg{
  opacity: 0;
  transform: scale(1.02);
  transition: opacity .45s ease, transform .65s ease;
  will-change: opacity, transform;
}
#frameImg.is-ready{
  opacity: 1;
  transform: scale(1);
}

.panel-grid{
  position: absolute;
  /* Ajusta esta “ventana” para caer sobre la zona del tejado */
  top: 26%;
  left: 10%;
  right: 6%;
  bottom: 34%;

  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 2px;

  pointer-events: none;
}

.panel-tile{
  background-image: var(--panel-img);
  background-repeat: no-repeat;
  /* size y position se fijan por JS para 'cortar' la imagen final en 16 */

  opacity: 0;
  transform: translateY(10px) scale(.985);
  transition: opacity .30s ease, transform .50s cubic-bezier(.2,.8,.2,1);

  border-radius: 6px;
  filter: drop-shadow(0 10px 18px rgba(0,0,0,.35));
}

.panel-tile.on{
  opacity: 1;
  transform: translateY(0) scale(1);
}

@media (max-width: 700px){
  .panel-grid{
    top: 36%;
    left: 10%;
    right: 8%;
    bottom: 20%;
    gap: 5px;
  }
}

@media (max-width: 420px){
  .panel-grid{
    gap: 2px;
  }
  .panel-tile{
    border-radius: 5px;
  }
}


.frame-progress {
  display: none;
}

.section {
  padding: 36px 0;
}
.section h2 {
  margin: 0 0 8px;
  font-size: 28px;
}
.sub {
  margin: 0 0 18px;
  color: var(--muted);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin: 10px 0 6px;
}
input,
textarea {
  width: 100%;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #0c1426;
  color: var(--text);
  outline: none;
}
input:focus,
textarea:focus {
  border-color: #335cbe;
}
.or {
  margin: 12px 0;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
.row {
  margin-top: 4px;
}

.results {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.results.empty .result-eco {
  display: none;
}
.result-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #0c1426;
}
.result-line span {
  color: var(--muted);
}
.small {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

@keyframes row-pulse {
  0%   { border-color: var(--btn); background: rgba(37,99,235,0.18); }
  100% { border-color: var(--line); background: #0c1426; }
}
.result-line.pulse {
  animation: row-pulse 0.9s ease forwards;
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  user-select: none;
}
.check-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--btn);
  cursor: pointer;
  flex-shrink: 0;
}

.footer {
  border-top: 1px solid var(--line);
  padding: 18px 0;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }
  .hero h1 {
    font-size: 34px;
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* ===== HERO SERVICES: centrado, fila en web, columna en móvil ===== */
.hero-services {
  padding: 40px 0 20px;
  text-align: center;
}

.hero-services-title {
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 24px;
  color: var(--text);
}

.hero-services-row {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 16px;
  flex-wrap: nowrap;
}

.hero-service {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 24px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  flex: 1;
  max-width: 280px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  backdrop-filter: blur(6px);

  cursor: pointer;
  user-select: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.hero-service:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 36px rgba(37, 99, 235, 0.28);
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(37, 99, 235, 0.5);
}
.hero-service:active {
  transform: translateY(-3px);
}

.hero-service-hint {
  font-size: 11px;
  color: var(--btn);
  opacity: 0;
  transition: opacity 0.2s ease;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.hero-service:hover .hero-service-hint {
  opacity: 1;
}

/* ===== MODAL SERVICIOS ===== */
.svc-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.svc-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.svc-modal {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 24px;
  max-width: 440px;
  width: calc(100% - 32px);
  position: relative;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.svc-overlay.open .svc-modal {
  transform: translateY(0) scale(1);
}
.svc-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: color 0.15s ease, background 0.15s ease;
}
.svc-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}
.svc-modal-ico {
  font-size: 40px;
  margin-bottom: 10px;
  line-height: 1;
}
.svc-modal-title {
  margin: 0 0 18px;
  font-size: 20px;
  font-weight: 700;
  padding-right: 32px;
}
.svc-spec-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.svc-spec-list li {
  padding: 10px 14px;
  background: #0c1426;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.45;
}
.svc-spec-list li strong {
  color: var(--text);
  font-weight: 600;
}

.hero-ico {
  font-size: 28px;
  line-height: 1;
}

/* Móvil: columna */
@media (max-width: 700px) {
  .hero-services-row {
    flex-direction: column;
    align-items: center;
  }

  .hero-service {
    flex-direction: row;
    justify-content: flex-start;
    max-width: 100%;
    width: 100%;
    padding: 14px 18px;
    gap: 12px;
    font-size: 14px;
  }

  .hero-service-hint {
    margin-left: auto;
    opacity: 1;
    font-size: 12px;
  }

  .hero-ico {
    font-size: 22px;
  }
}
