/* ===== Variables ===== */
:root {
  --primary: #5a21b6; /* Morado refinado */
  --primary-hover: #4c1d95;
  --bg-main: #fafafa;
  --bg-card: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --border-light: #e2e8f0;
  --radius-lg: 16px;
  --radius-md: 10px;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Ajuste del Hero para que no choque con el botón */
.hero {
  padding-top: 5rem; 
}

/* ===== Layout & Sections ===== */
.section {
  padding: 8rem 1.5rem 5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.container {
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
}

/* ===== Hero ===== */
.hero {
  min-height: 85vh;
  text-align: center;
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.hero-logo {
  max-width: 280px;
  width: 100%;
  height: auto;
}

.hero-tagline {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 480px;
  font-weight: 400;
}

/* ===== Buttons ===== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.8rem;
  background: var(--primary);
  color: #ffffff;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

/* Botón secundario (contorno) */
.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.2rem;
  background: transparent;
  color: var(--primary);
  text-decoration: none;
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.btn-outline:hover {
  background: var(--primary);
  color: #ffffff;
  transform: translateY(-1px);
}

/* ===== Titles ===== */
.section-title {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.section-subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 3.5rem;
  font-size: 1.05rem;
}

/* ===== Services Grid ===== */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.service-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 2.2rem 1.8rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.service-card:hover {
  border-color: #cbd5e1;
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
}

.service-icon {
  width: 42px;
  height: 42px;
  color: var(--primary);
  margin-bottom: 1.25rem;
}

.service-card h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
  color: var(--text-primary);
}

.service-card p {
  font-size: 0.925rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ===== Portfolio List Layout ===== */
.portfolio-list {
  display: flex;
  flex-direction: column;
  gap: 3.5rem;
}

/* Tarjeta uniforme para todos los proyectos */
.portfolio-featured {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.portfolio-featured:hover {
  border-color: #cbd5e1;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

/* Contenedor del Iframe con altura y estilo uniforme */
.iframe-container {
  width: 100%;
  height: 480px;
  background: #f8fafc;
  position: relative;
  border-bottom: 1px solid var(--border-light);
}

.iframe-container iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.portfolio-content {
  padding: 1.5rem;
}

.portfolio-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.portfolio-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.portfolio-content p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.portfolio-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.portfolio-link svg {
  width: 16px;
  height: 16px;
}

.portfolio-link:hover {
  opacity: 0.8;
}

/* Responsive para dispositivos móviles */
@media (max-width: 768px) {
  .iframe-container {
    height: 320px;
  }
}

/* ===== Form ===== */
.contact-form {
  max-width: 440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--primary);
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 3rem 1.5rem;
  border-top: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.footer-icon {
  width: 32px;
  height: auto;
  margin-bottom: 1rem;
  opacity: 0.7;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .glass-nav label {
    padding: 0.5rem 0.8rem;
    font-size: 0.775rem;
  }
}

.service-link {
  display: inline-flex;
  align-items: center;
  margin-top: 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.service-link:hover {
  opacity: 0.8;
}

/* ===== Formulario de Contacto (Estilo Tarjeta) ===== */
.contact-card {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  background-color: var(--bg-card);
  border-radius: 20px;
  box-shadow: 0px 187px 75px rgba(0, 0, 0, 0.01), 
              0px 105px 63px rgba(0, 0, 0, 0.05), 
              0px 47px 47px rgba(0, 0, 0, 0.09), 
              0px 12px 26px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.contact-card-title {
  display: block;
  width: 100%;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  position: relative;
}

.contact-card-title::after {
  content: '';
  width: 40px;
  height: 2px;
  position: absolute;
  bottom: -1px;
  left: 1.5rem;
  background-color: var(--primary);
}

.contact-card-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.input-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.input-group input,
.input-group textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  background-color: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.95rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-group input:focus,
.input-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(90, 33, 182, 0.1);
  background-color: #ffffff;
}

.input-group textarea {
  resize: vertical;
  min-height: 100px;
}

.contact-card-footer {
  padding: 1rem 1.5rem 1.5rem;
  background-color: #f8fafc;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
}

.btn-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background-color: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.btn-send:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-send:active {
  transform: translateY(0);
}

.btn-send svg {
  width: 18px;
  height: 18px;
}

/* Estado de éxito (cuando se envía) */
.btn-send.success {
  background-color: #16a34a;
}

/* Responsive */
@media (max-width: 640px) {
  .contact-card {
    border-radius: 16px;
  }
  
  .contact-card-body {
    padding: 1.25rem;
  }
  
  .contact-card-footer {
    padding: 1rem 1.25rem 1.25rem;
  }
  
  .btn-send {
    width: 100%;
  }
}

/* ===== Sección de Contactos (Wrapper) ===== */
.contact-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  max-width: 1000px;
  margin: 0 auto;
  align-items: start;
}

/* ===== Formulario de Contacto (Estilo Tarjeta) ===== */
.contact-card {
  width: 100%;
  background-color: var(--bg-card);
  border-radius: 20px;
  box-shadow: 0px 187px 75px rgba(0, 0, 0, 0.01), 
              0px 105px 63px rgba(0, 0, 0, 0.05), 
              0px 47px 47px rgba(0, 0, 0, 0.09), 
              0px 12px 26px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.contact-card-title {
  display: block;
  width: 100%;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  position: relative;
}

.contact-card-title::after {
  content: '';
  width: 40px;
  height: 2px;
  position: absolute;
  bottom: -1px;
  left: 1.5rem;
  background-color: var(--primary);
}

.contact-card-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.input-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.input-group input,
.input-group textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  background-color: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.95rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-group input:focus,
.input-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(90, 33, 182, 0.1);
  background-color: #ffffff;
}

.input-group textarea {
  resize: vertical;
  min-height: 100px;
}

.contact-card-footer {
  padding: 1rem 1.5rem 1.5rem;
  background-color: #f8fafc;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
}

.btn-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background-color: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.btn-send:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-send:active {
  transform: translateY(0);
}

.btn-send svg {
  width: 18px;
  height: 18px;
}

.btn-send.success {
  background-color: #16a34a;
}

/* ===== Redes Sociales (Estilo Glass) ===== */
.social-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(90, 33, 182, 0.08);
  height: 100%;
}

.social-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  text-align: center;
}

.social-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  text-align: center;
}

.main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.up,
.down {
  display: flex;
  flex-direction: row;
  gap: 1rem;
}

/* Tarjetas Glass */
.card {
  width: 90px;
  height: 90px;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 16px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.card1 { border-radius: 30px 16px 16px 16px; }
.card2 { border-radius: 16px 30px 16px 16px; }
.card3 { border-radius: 16px 16px 16px 30px; }
.card4 { border-radius: 16px 16px 30px 16px; }

.instagram,
.twitter,
.github,
.whatsapp {
  transition: fill 0.3s ease-in-out;
}

.instagram { fill: #e1306c; }
.x-twitter {
  fill: #0f172a; /* Negro azulado, más elegante que el negro puro */
}
.github { fill: #333; }
.whatsapp { fill: #00a849; }

.card:hover {
  cursor: pointer;
  transform: translateY(-5px);
  box-shadow: 0 12px 25px rgba(90, 33, 182, 0.2);
  background: var(--primary);
  border-color: var(--primary);
}

.card:hover svg {
  fill: white;
}

/* Responsive */
@media (max-width: 900px) {
  .contact-wrapper {
    grid-template-columns: 1fr;
  }
  
  .social-wrapper {
    padding: 1.5rem;
  }
}

@media (max-width: 640px) {
  .contact-card {
    border-radius: 16px;
  }
  
  .contact-card-body {
    padding: 1.25rem;
  }
  
  .contact-card-footer {
    padding: 1rem 1.25rem 1.25rem;
  }
  
  .btn-send {
    width: 100%;
  }

  .card {
    width: 75px;
    height: 75px;
  }
  
  .card svg {
    width: 32px;
    height: 32px;
  }
}

/* ===== Casilla de Aceptación (Rediseñada) ===== */
.checkbox-group {
  padding: 0 1.5rem; /* Alineado con el padding del formulario */
  margin-bottom: 1rem;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  padding: 1rem;
  background-color: #f8fafc;
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-md);
  transition: all 0.3s ease;
}

.checkbox-label:hover {
  background-color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(90, 33, 182, 0.08);
}

/* Ocultar el checkbox nativo */
.checkbox-label input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid #cbd5e1;
  border-radius: 6px;
  background-color: #ffffff;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  margin-top: 0.1rem;
  transition: all 0.2s ease;
}

/* Estado marcado */
.checkbox-label input[type="checkbox"]:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

/* El tick (palomita) */
.checkbox-label input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Estado de foco (accesibilidad) */
.checkbox-label input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.checkbox-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  text-transform: none;
  letter-spacing: normal;
}

.checkbox-text a {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-color: rgba(90, 33, 182, 0.4);
  text-underline-offset: 2px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.checkbox-text a:hover {
  color: var(--primary-hover);
  text-decoration-color: var(--primary-hover);
}

/* Ajuste responsive */
@media (max-width: 640px) {
  .checkbox-group {
    padding: 0 1.25rem;
  }
}

/* ===== Enlaces Legales en el Footer ===== */
.footer-legal-links {
  margin-top: 1rem;
  font-size: 0.8rem;
}

.footer-legal-links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-legal-links a:hover {
  color: var(--primary);
}

/* ===== Páginas Legales (Mejorado) ===== */
.legal-section {
  padding-top: 8rem;
  padding-bottom: 6rem;
  align-items: flex-start;
  background: linear-gradient(180deg, var(--bg-main) 0%, #f1f5f9 100%);
}

.legal-container {
  max-width: 850px;
  background: var(--bg-card);
  padding: 3.5rem 4rem;
  border-radius: 24px;
  border: 1px solid var(--border-light);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.04);
}

/* Título principal de la página legal */
.legal-container .section-title {
  text-align: left;
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.legal-date {
  text-align: left;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 3rem;
  font-style: normal;
  font-weight: 500;
  display: inline-block;
  padding: 0.4rem 1rem;
  background: #f1f5f9;
  border-radius: 999px;
}

.legal-content {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

/* Estilo de cada bloque de contenido */
.legal-content h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Pequeño adorno antes de cada título */
.legal-content h2::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 24px;
  background-color: var(--primary);
  border-radius: 4px;
}

.legal-content p {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.8;
  text-align: justify;
}

.legal-content a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px dashed var(--primary);
  transition: all 0.2s ease;
}

.legal-content a:hover {
  color: var(--primary-hover);
  border-bottom-style: solid;
}

/* Responsive para páginas legales */
@media (max-width: 768px) {
  .legal-container {
    padding: 2rem 1.5rem;
    border-radius: 16px;
  }
  
  .legal-container .section-title {
    font-size: 1.8rem;
  }
  
  .legal-content p {
    font-size: 0.95rem;
    text-align: left;
  }
  
}

/* ===== Estilo para el Botón Deshabilitado ===== */
.btn-send:disabled,
.btn-send.disabled {
  background-color: #cbd5e1; /* Gris claro */
  color: #94a3b8; /* Texto gris */
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
  opacity: 0.7;
}

.btn-send:disabled:hover,
.btn-send.disabled:hover {
  background-color: #cbd5e1; /* Mantener gris al pasar el mouse */
  transform: none;
  box-shadow: none;
}

.btn-send:disabled svg,
.btn-send.disabled svg {
  opacity: 0.5;
}

/* ===== Barra de navegación superior ===== */
.topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  transition: box-shadow 0.25s ease, background 0.25s ease;
}

.topnav.scrolled {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
}

.topnav-inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 64px;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.topnav-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.topnav-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.topnav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.topnav-links a {
  position: relative;
  padding: 0.5rem 0.9rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 999px;
  transition: color 0.2s ease, background 0.2s ease;
}

.topnav-links a:hover {
  color: var(--primary);
  background: rgba(90, 33, 182, 0.07);
}

.topnav-links a.active,
.topnav-links a[aria-current] {
  color: var(--primary);
  font-weight: 600;
  background: rgba(90, 33, 182, 0.09);
}

.topnav-links a:focus-visible,
.topnav-toggle:focus-visible,
.topnav-brand:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.topnav-links a.topnav-cta {
  margin-left: 0.5rem;
  background: var(--primary);
  color: #ffffff;
  font-weight: 600;
}

.topnav-links a.topnav-cta:hover {
  background: var(--primary-hover);
  color: #ffffff;
}

.topnav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  color: var(--primary);
  cursor: pointer;
}

.topnav-toggle svg {
  width: 24px;
  height: 24px;
}

.topnav-toggle .bar {
  transform-origin: center;
  transform-box: fill-box;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.topnav-toggle[aria-expanded="true"] .bar1 { transform: translateY(6px) rotate(45deg); }
.topnav-toggle[aria-expanded="true"] .bar2 { opacity: 0; }
.topnav-toggle[aria-expanded="true"] .bar3 { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 860px) {
  .topnav-toggle { display: inline-flex; }

  .topnav-links {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    padding: 0.75rem 1.5rem 1.25rem;
    background: #ffffff;
    border-bottom: 1px solid var(--border-light);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
    /* Oculto: no recibe foco ni clics hasta abrirse */
    visibility: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  }

  .topnav-links.open {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
  }

  .topnav-links a {
    padding: 0.8rem 1rem;
    font-size: 1rem;
    border-radius: var(--radius-md);
  }

  .topnav-links a.topnav-cta {
    margin: 0.5rem 0 0;
    text-align: center;
  }
}

@media (max-width: 400px) {
  .topnav-brand span { font-size: 0.95rem; }
}


/* ===== Aviso de cookies ===== */
.ck-banner {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  z-index: 1200;
  width: min(760px, calc(100% - 2rem));
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.25rem 1.5rem;
  background: #ffffff;
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  animation: ck-in 0.35s ease both;
}

@keyframes ck-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

.ck-body {
  flex: 1;
  min-width: 0;
}

.ck-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.ck-text {
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.ck-text a {
  color: var(--primary);
  font-weight: 600;
}

.ck-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ck-main-actions {
  flex-shrink: 0;
  justify-content: flex-end;
}

.ck-btn {
  padding: 0.6rem 1rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.ck-btn:focus-visible,
.ck-footer-link:focus-visible,
.ck-switch input:focus-visible + .ck-slider {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* "Solo necesarias" y "Aceptar todas" tienen el mismo peso visual */
.ck-btn-primary { background: var(--primary); color: #ffffff; border-color: var(--primary); }
.ck-btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.ck-btn-outline { background: #ffffff; color: var(--primary); border-color: var(--primary); }
.ck-btn-outline:hover { background: rgba(90, 33, 182, 0.08); }
.ck-btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.ck-btn-ghost:hover { color: var(--primary); background: rgba(90, 33, 182, 0.06); }

/* Panel de preferencias */
.ck-panel {
  margin-top: 1rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-light);
}

.ck-panel[hidden] { display: none; }

.ck-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-light);
}

.ck-row-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.ck-row-text strong { font-size: 0.875rem; }
.ck-row-text span { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.45; }

.ck-panel .ck-actions {
  justify-content: flex-end;
  padding-top: 0.9rem;
}

/* Interruptor */
.ck-switch {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 26px;
}

.ck-switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}

.ck-slider {
  position: absolute;
  inset: 0;
  background: #cbd5e1;
  border-radius: 999px;
  transition: background 0.2s ease;
}

.ck-slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
}

.ck-switch input:checked + .ck-slider { background: var(--primary); }
.ck-switch input:checked + .ck-slider::after { transform: translateX(18px); }
.ck-switch input:disabled { cursor: not-allowed; }
.ck-switch input:disabled + .ck-slider { opacity: 0.55; }

/* Enlace "Configurar cookies" del pie */
.ck-footer-link {
  padding: 0;
  background: none;
  border: none;
  font: inherit;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s ease;
}

.ck-footer-link:hover { color: var(--primary); }

/* Vistas previas de proyectos (iframes bajo consentimiento) */
.embed-placeholder {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  padding: 1.5rem;
  text-align: center;
  background: linear-gradient(135deg, #f8fafc 0%, #eef2f7 100%);
}

.embed-placeholder svg {
  width: 44px;
  height: 44px;
  color: var(--primary);
  opacity: 0.8;
}

.embed-placeholder p {
  max-width: 340px;
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.embed-placeholder .btn-outline {
  cursor: pointer;
  font-family: inherit;
  background: #ffffff;
}

.iframe-container.embed-loaded .embed-placeholder { display: none; }

/* Responsive */
@media (max-width: 640px) {
  .ck-banner {
    flex-direction: column;
    align-items: stretch;
    bottom: 0.75rem;
    padding: 1.1rem 1.1rem 1rem;
    max-height: calc(100vh - 1.5rem);
    overflow-y: auto;
  }

  .ck-main-actions {
    flex-direction: column-reverse;
  }

  .ck-main-actions .ck-btn,
  .ck-panel .ck-btn {
    width: 100%;
    padding: 0.8rem 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ck-banner { animation: none; }
  .ck-slider,
  .ck-slider::after { transition: none; }
}

/* Aviso de cookies: panel de preferencias abierto */
.ck-banner.ck-expanded {
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

/* Con el panel abierto, "Guardar preferencias" sustituye a los botones rápidos */
.ck-banner.ck-expanded .ck-main-actions .ck-btn-outline,
.ck-banner.ck-expanded .ck-main-actions .ck-btn-primary {
  display: none;
}

.ck-banner.ck-expanded .ck-main-actions {
  justify-content: flex-start;
}