/* =============================================================
   Solengoa v2 — Agente-chat (estética clara, tipo Apple)
   Arquitectura inspirada en el proyecto WEB IEM, adaptada:
   - Light theme + amarillo FFC509 (sin dark, sin Three.js)
   - Split layout desktop: visual panel + chat panel
   - Mobile: chat bottom sheet + visual panel arriba
   ============================================================= */

:root {
  /* Paleta */
  --color-yellow:      #FFC509;
  --color-yellow-dark: #E6AE00;
  --color-yellow-soft: #FFF4CC;
  --color-black:       #0A0A0A;
  --color-ink:         #1A1A1A;
  --color-text:        #1A1A1A;
  --color-text-muted:  #2B2B2B;  /* antes #6B7280 (gris claro) — demasiado tenue sobre amarillo */
  --color-text-dim:    #4A4A4A;  /* antes #9AA0A6 — reservado para notas muy secundarias */
  --color-bg:          #FAFAFA;
  --color-surface:     #FFFFFF;
  --color-border:      rgba(10, 10, 10, 0.08);
  --color-border-soft: rgba(10, 10, 10, 0.04);

  /* Fondo ambiental: gradiente muy sutil amarillo claro → blanco */
  --bg-ambient:
    radial-gradient(ellipse at 20% 10%, rgba(255, 197, 9, 0.08), transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(255, 197, 9, 0.05), transparent 50%),
    linear-gradient(180deg, #FAFAFA 0%, #F5F5F3 100%);

  /* Tipografía */
  --font-sans: "Satoshi", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", sans-serif;

  /* Layout */
  --header-height: 72px;
  --chat-width: clamp(360px, 28vw, 440px);

  /* Radios */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  /* Sombras */
  --shadow-sm: 0 1px 2px rgba(10, 10, 10, 0.04);
  --shadow-md: 0 6px 20px rgba(10, 10, 10, 0.06);
  --shadow-lg: 0 16px 40px rgba(10, 10, 10, 0.08);

  /* Easings */
  --ease-out-expo:  cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring:    cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);

  /* Durations */
  --duration-fast: 180ms;
  --duration-normal: 400ms;
  --duration-slow: 800ms;

  /* Z-index */
  --z-content: 1;
  --z-panel: 5;
  --z-header: 10;
}

/* =================== RESET =================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; border: 0; background: transparent; cursor: pointer; color: inherit; }
input { font: inherit; color: inherit; }

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  color: var(--color-text);
  background: var(--bg-ambient);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

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

.skip-link {
  position: absolute;
  top: -48px;
  left: 16px;
  padding: 10px 16px;
  background: var(--color-black);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  z-index: 100;
  transition: top 0.2s;
}
.skip-link:focus { top: 16px; }

/* =================== PRELOADER =================== */

.preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(255, 197, 9, 0.12), transparent 60%),
    linear-gradient(180deg, #FFFFFF 0%, #FAFAF7 100%);
  opacity: 1;
  visibility: visible;
  transition: opacity 650ms var(--ease-out-quint), visibility 0s linear 650ms;
}

.preloader.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  padding: 24px;
  text-align: center;
  animation: preloader-pop 600ms var(--ease-out-quint) both;
}

.preloader-spinner {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preloader-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  animation: preloader-spin 1400ms linear infinite;
  transform-origin: center;
}

.preloader-ring-track,
.preloader-ring-progress {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
}

.preloader-ring-track {
  stroke: rgba(10, 10, 10, 0.06);
}

.preloader-ring-progress {
  stroke: var(--color-yellow);
  /* circunferencia ≈ 2π·46 = 289; mostramos ~25% como arco */
  stroke-dasharray: 72 217;
  stroke-dashoffset: 0;
}

.preloader-bulb {
  position: relative;
  height: 68px;
  width: auto;
  animation: preloader-breathe 1800ms ease-in-out infinite;
  will-change: transform, opacity;
}

.preloader-credit {
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.01em;
  color: var(--color-text-dim);
  margin-top: 4px;
  opacity: 0.9;
  text-align: center;
}

.preloader-credit strong {
  display: block;
  font-weight: 700;
  color: var(--color-text);
  margin-top: 2px;
}

/* --- Preloader en móvil: todo más compacto --- */
@media (max-width: 640px) {
  .preloader-inner {
    gap: 20px;
    padding: 20px;
  }
  .preloader-spinner {
    width: 110px;
    height: 110px;
  }
  .preloader-bulb {
    height: 54px;
    width: auto;
  }
  .preloader-credit {
    font-size: 10.5px;
  }
}

@media (max-width: 380px) {
  .preloader-spinner { width: 96px; height: 96px; }
  .preloader-bulb { height: 46px; width: auto; }
  .preloader-credit { font-size: 10px; }
}

@keyframes preloader-breathe {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.04); opacity: 0.88; }
}

@keyframes preloader-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

@keyframes preloader-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .preloader-bulb,
  .preloader-ring,
  .preloader-inner { animation: none; }
}

/* =================== HEADER =================== */

.site-header {
  height: var(--header-height);
  padding: 0 clamp(16px, 2vw, 32px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(1.6) blur(20px);
  -webkit-backdrop-filter: saturate(1.6) blur(20px);
  border-bottom: 1px solid var(--color-border);
  z-index: var(--z-header);
  flex-shrink: 0;
}

.logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--color-black);
  flex-shrink: 0;
}

.logo-img {
  display: block;
  height: 46px;
  width: auto;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 12px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.18);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  color: #0E7C5C;
  letter-spacing: -0.005em;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
  animation: pulse-dot 2.2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.35); }
}

/* =================== APP LAYOUT =================== */

.app-layout {
  flex: 1;
  display: flex;
  width: 100%;
  min-height: 0;
  position: relative;
}

/* Visual panel (izquierda) — fondo amarillo suave que contrasta con el
   header + chat (glass-blanco) y hace "flotar" la ilustración. */
.visual-panel {
  flex: 1;
  padding: clamp(16px, 2vw, 32px);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
  min-height: 0;
  position: relative;
  z-index: var(--z-content);
  scrollbar-width: none;  /* Firefox */
  background:
    radial-gradient(ellipse at 25% 25%, rgba(255, 197, 9, 0.18), transparent 65%),
    radial-gradient(ellipse at 80% 80%, rgba(255, 197, 9, 0.10), transparent 55%),
    linear-gradient(180deg, #FFFBE6 0%, #FFF5CC 100%);
}

.visual-panel::-webkit-scrollbar {
  display: none;  /* Chrome / Safari / Edge */
}

.visual-content-wrapper {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100%;
  padding: 20px 0;
  transition: opacity 0.5s var(--ease-out-expo),
              transform 0.5s var(--ease-out-expo),
              filter 0.5s var(--ease-out-expo);
}
.visual-content-wrapper.fade-out {
  opacity: 0;
  transform: translateY(14px) scale(0.98);
  filter: blur(6px);
}

/* Chat panel (derecha) */
.chat-panel {
  width: var(--chat-width);
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(1.5) blur(24px);
  -webkit-backdrop-filter: saturate(1.5) blur(24px);
  border-left: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  z-index: var(--z-panel);
}

.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scroll-behavior: smooth;
}
.chat-container::before { content: ""; flex: 1 1 auto; }
.chat-container::-webkit-scrollbar { width: 4px; }
.chat-container::-webkit-scrollbar-thumb { background: rgba(10, 10, 10, 0.08); border-radius: 10px; }

/* =================== MENSAJES =================== */

.message-row {
  display: flex;
  width: 100%;
  flex-shrink: 0;
  opacity: 0;
  animation: message-pop 0.55s var(--ease-spring) forwards;
}

@keyframes message-pop {
  0%   { opacity: 0; transform: translateY(16px) scale(0.97); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.message-row.user { justify-content: flex-end; }
.message-row.ai   { justify-content: flex-start; flex-direction: column; align-items: flex-start; gap: 4px; }

.msg-user {
  background: var(--color-black);
  color: #fff;
  padding: 11px 16px;
  border-radius: 20px;
  border-bottom-right-radius: 6px;
  font-size: 14px;
  line-height: 1.45;
  max-width: 85%;
  word-wrap: break-word;
  letter-spacing: -0.005em;
}

.msg-ai-label {
  font-size: 12px;
  font-weight: 600;
  color: #0E7C5C;
  letter-spacing: 0.01em;
  margin-bottom: 2px;
}

.msg-ai-label.thinking {
  background: linear-gradient(
    90deg,
    #0E7C5C 0%,
    #10B981 30%,
    rgba(14, 124, 92, 0.35) 50%,
    #10B981 70%,
    #0E7C5C 100%
  );
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer-sweep 1.8s ease-in-out infinite;
}

@keyframes shimmer-sweep {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.msg-ai-text {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--color-ink);
  width: 100%;
  word-wrap: break-word;
}
.msg-ai-text strong { color: var(--color-black); font-weight: 700; }

.msg-ai-text a,
.msg-ai-text .chat-link {
  color: var(--color-text);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--color-yellow);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s, color 0.2s;
}
.msg-ai-text a:hover,
.msg-ai-text .chat-link:hover {
  color: var(--color-black);
  text-decoration-color: var(--color-yellow-dark);
}

.typing-indicator {
  display: inline-flex;
  gap: 5px;
  padding: 6px 0 2px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: rgba(10, 10, 10, 0.35);
  border-radius: 50%;
  animation: typing-bounce 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.30s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-5px); opacity: 1; }
}

/* =================== INPUT AREA =================== */

.input-area {
  padding: 14px 16px 18px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

.chat-suggestions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  padding: 7px 14px;
  background: rgba(10, 10, 10, 0.04);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--color-text);
  letter-spacing: -0.005em;
  white-space: nowrap;
  transition:
    background 0.2s var(--ease-out-quint),
    transform 0.2s var(--ease-spring),
    border-color 0.2s;
}
.chip:hover {
  background: var(--color-yellow-soft);
  border-color: rgba(255, 197, 9, 0.4);
  transform: translateY(-1px);
}
.chip:active { transform: translateY(0) scale(0.98); }

.prompt-form {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 5px 5px 16px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.prompt-form:focus-within {
  border-color: rgba(255, 197, 9, 0.5);
  box-shadow: 0 0 0 4px rgba(255, 197, 9, 0.12);
}

.prompt-input {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 10px 0;
  font-size: 14.5px;
  outline: none;
  min-width: 0;
}
.prompt-input::placeholder { color: var(--color-text-dim); }

.btn-send {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--color-yellow);
  color: var(--color-black);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.2s,
    transform 0.2s var(--ease-spring),
    box-shadow 0.2s;
  flex-shrink: 0;
}
.btn-send:hover {
  background: var(--color-yellow-dark);
  transform: scale(1.06);
  box-shadow: 0 6px 16px rgba(255, 197, 9, 0.35);
}
.btn-send:active { transform: scale(0.95); }
.btn-send svg { width: 16px; height: 16px; }

/* =================== HERO PHRASE (widget home) =================== */

.hero-phrase-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  width: 100%;
  margin: 0 auto 10px;
  padding: 0 8px;
}

.hero-phrase {
  font-size: clamp(1.9rem, 4vw, 3.4rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1.12;
  text-align: center;
  padding-bottom: 0.14em;
  color: var(--color-black);
  opacity: 0;
  animation: hero-fade-in 1.2s var(--ease-out-expo) forwards;
}

@keyframes hero-fade-in {
  from { opacity: 0; transform: translateY(24px) scale(0.97); filter: blur(8px); }
  to   { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

@keyframes gradient-shift {
  0%   { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

.hero-accent {
  color: inherit;
  font-weight: inherit;
}

.hero-sub {
  text-align: center;
  font-size: clamp(13px, 0.95vw, 15px);
  color: var(--color-text-muted);
  max-width: 560px;
  margin: 0 auto 20px;
  opacity: 0;
  animation: fade-in-up 0.7s var(--ease-out-expo) 0.55s forwards;
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =================== HERO VISUAL (home) =================== */

.home-hero-visual {
  width: 100%;
  max-width: 900px;
  margin: 0 auto 20px;
  opacity: 0;
  animation: hero-visual-in 1s var(--ease-out-expo) 0.4s forwards;
}

.home-hero-visual img {
  width: 100%;
  height: auto;
  max-height: 52vh;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 22px 36px rgba(10, 10, 10, 0.14));
}

@keyframes hero-visual-in {
  from { opacity: 0; transform: translateY(20px) scale(0.97); filter: blur(8px); }
  to   { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

/* =================== MENU INTERACTIVO (home options) =================== */

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}

.menu-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 16px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  font-size: 14.5px;
  font-weight: 500;
  color: var(--color-text);
  text-align: left;
  width: 100%;
  line-height: 1.3;
  letter-spacing: -0.005em;
  transition:
    background 0.3s var(--ease-out-quint),
    transform 0.3s var(--ease-spring),
    border-color 0.3s,
    box-shadow 0.3s;
  opacity: 0;
  animation: menu-pop 0.55s var(--ease-out-expo) forwards;
}

.menu-option:nth-child(1) { animation-delay: 0.85s; }
.menu-option:nth-child(2) { animation-delay: 0.95s; }
.menu-option:nth-child(3) { animation-delay: 1.05s; }
.menu-option:nth-child(4) { animation-delay: 1.15s; }
.menu-option:nth-child(5) { animation-delay: 1.25s; }

@keyframes menu-pop {
  from { opacity: 0; transform: translateY(12px) scale(0.96); filter: blur(4px); }
  to   { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

.menu-option:hover {
  background: #fff;
  border-color: rgba(255, 197, 9, 0.5);
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(10, 10, 10, 0.08), 0 0 0 4px rgba(255, 197, 9, 0.06);
}
.menu-option:active { transform: translateY(-1px) scale(0.99); }

.menu-option svg {
  width: 16px;
  height: 16px;
  opacity: 0.5;
  flex-shrink: 0;
  transition: transform 0.25s var(--ease-spring), opacity 0.2s;
}
.menu-option:hover svg { opacity: 1; transform: translateX(3px); }

/* =================== GLASS CARDS & BENTO =================== */

.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  width: 100%;
}

.glass-card {
  position: relative;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  opacity: 0;
  overflow: hidden;
  transition:
    transform 0.45s var(--ease-spring),
    box-shadow 0.4s var(--ease-out-expo),
    border-color 0.35s,
    background 0.35s;
  animation: progressive-pop-in 0.75s var(--ease-out-expo) forwards;
}

@keyframes progressive-pop-in {
  0%   { opacity: 0; transform: translateY(40px) scale(0.94); filter: blur(12px); }
  60%  { filter: blur(2px); }
  100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

/* Staggered delay for bento items (up to 8) */
.bento-grid > .glass-card:nth-child(1) { animation-delay: 0.10s; }
.bento-grid > .glass-card:nth-child(2) { animation-delay: 0.20s; }
.bento-grid > .glass-card:nth-child(3) { animation-delay: 0.30s; }
.bento-grid > .glass-card:nth-child(4) { animation-delay: 0.40s; }
.bento-grid > .glass-card:nth-child(5) { animation-delay: 0.50s; }
.bento-grid > .glass-card:nth-child(6) { animation-delay: 0.60s; }
.bento-grid > .glass-card:nth-child(7) { animation-delay: 0.70s; }
.bento-grid > .glass-card:nth-child(8) { animation-delay: 0.80s; }

.interactive-card { cursor: pointer; }

.interactive-card::after {
  content: attr(data-action);
  position: absolute;
  bottom: -24px;
  left: 0; right: 0;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-yellow-dark);
  transition: bottom 0.35s var(--ease-spring), opacity 0.3s;
  opacity: 0;
}

.interactive-card:hover {
  transform: translateY(-4px);
  background: #fff;
  border-color: rgba(255, 197, 9, 0.5);
  box-shadow: 0 18px 40px rgba(10, 10, 10, 0.08), 0 0 0 4px rgba(255, 197, 9, 0.08);
}
.interactive-card:hover::after { bottom: 14px; opacity: 1; }
.interactive-card:hover .card-body { transform: translateY(-14px); }

.card-body {
  transition: transform 0.4s var(--ease-spring);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--color-yellow-soft);
  color: var(--color-black);
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}
.card-icon svg { width: 22px; height: 22px; }

.card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-black);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0;
}

.card-text {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--color-text-muted);
  margin: 0;
}

/* Variantes de color: Trámites (rojo) + Iberdrola (verde) */
.glass-card--red {
  background: #DC2626;
  border-color: #DC2626;
}
.glass-card--green {
  background: #15803D;
  border-color: #15803D;
}
.glass-card--dark {
  background: #0A0A0A;
  border-color: #0A0A0A;
}

.glass-card--red .card-title,
.glass-card--green .card-title,
.glass-card--dark .card-title { color: #fff; }

.glass-card--red .card-text,
.glass-card--green .card-text,
.glass-card--dark .card-text { color: rgba(255, 255, 255, 0.86); }

.glass-card--red .card-icon,
.glass-card--green .card-icon,
.glass-card--dark .card-icon {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.glass-card--red.interactive-card:hover {
  background: #DC2626;
  border-color: #DC2626;
  box-shadow: 0 18px 40px rgba(220, 38, 38, 0.28);
}
.glass-card--green.interactive-card:hover {
  background: #15803D;
  border-color: #15803D;
  box-shadow: 0 18px 40px rgba(21, 128, 61, 0.28);
}
.glass-card--dark.interactive-card:hover {
  background: #1A1A1A;
  border-color: #1A1A1A;
  box-shadow: 0 18px 40px rgba(10, 10, 10, 0.32);
}

.glass-card--red.interactive-card::after,
.glass-card--green.interactive-card::after,
.glass-card--dark.interactive-card::after {
  color: rgba(255, 255, 255, 0.88);
}

/* Logos de programas / partner al pie de la card */
.card-partners {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
}

.card-partners-label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.72);
  margin-bottom: 8px;
}

.card-partners-logos {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.card-partners-logos img {
  height: 26px;
  width: auto;
  opacity: 1;
}

/* Image/asset variant — ilustración flotando sin caja de fondo */
.card-media {
  width: 100%;
  aspect-ratio: 5 / 3;
  background: transparent;
  overflow: visible;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
}
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
  transition: transform 0.5s var(--ease-out-expo);
  filter: drop-shadow(0 12px 24px rgba(10, 10, 10, 0.10));
}
.interactive-card:hover .card-media img { transform: scale(1.06); }

/* =================== WIDGET INTRO (título + lead del widget) =================== */

.widget-intro {
  max-width: 640px;
  margin: 0 auto 28px;
  text-align: center;
  opacity: 0;
  animation: fade-in-up 0.7s var(--ease-out-expo) 0.05s forwards;
}

.widget-title {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--color-black);
  margin: 0 0 10px;
}

.widget-lead {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--color-text-muted);
  margin: 0;
}

/* =================== STATS BAR (Nosotros) =================== */

.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 18px 24px;
  margin: 0 0 24px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  animation: progressive-pop-in 0.7s var(--ease-out-expo) 0.15s forwards;
}

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 4px;
}

.stat-num {
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--color-black);
}

.stat-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

@media (max-width: 640px) {
  .stats-bar { grid-template-columns: repeat(2, 1fr); gap: 14px 8px; padding: 16px 14px; }
}

/* =================== DEEP DIVE de servicio =================== */

.deep-view {
  max-width: 100%;
  margin: 0 auto;
  padding: 0 0 16px;
  animation: progressive-pop-in 0.7s var(--ease-out-expo) forwards;
  opacity: 0;
}

/* Cuando el panel visual contiene un deep-view, alinea el contenido arriba
   (en vez de centrado) para que el botón "Volver" quede pegado al header,
   y libera el max-width de 980px para que el layout de dos columnas respire. */
.visual-content-wrapper:has(.deep-view) {
  justify-content: flex-start;
  padding-top: 0;
  max-width: 1500px;
}

.deep-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px 8px 14px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 8px;
  backdrop-filter: blur(8px);
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.deep-back:hover {
  background: var(--color-yellow-soft);
  border-color: rgba(255, 197, 9, 0.5);
  transform: translateX(-2px);
}

.deep-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: center;
  min-height: 72vh;
}

.deep-visual {
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: visible;  /* permite que la ilustración escale hacia fuera sin recortarse */
}

.deep-illustration {
  width: 100%;
  max-width: 780px;
  height: auto;
  max-height: 78vh;
  object-fit: contain;
  filter: drop-shadow(0 28px 48px rgba(10, 10, 10, 0.16));
  animation: hero-visual-in 1s var(--ease-out-expo) 0.15s both;
  /* Escalado visual: hace la ilustración ~15% mayor sin alterar el grid */
  transform: scale(1.15);
  transform-origin: center center;
}

.deep-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  /* Cap de legibilidad: evita líneas demasiado largas en pantallas anchas */
  max-width: 560px;
}

.deep-eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-yellow-dark);
}

.deep-title {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 1.1;
  color: var(--color-black);
  margin: 0;
  padding-bottom: 0.08em;
}

.deep-lead {
  font-size: 15px;
  line-height: 1.55;
  color: var(--color-text-muted);
  margin: 0;
}

.deep-benefits {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.deep-benefits li {
  position: relative;
  padding-left: 28px;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--color-text);
}

.deep-benefits li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-yellow);
  /* Checkmark dibujado con mask */
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / 12px 12px no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / 12px 12px no-repeat;
}

.deep-benefits li strong { color: var(--color-black); font-weight: 700; }

.deep-actions {
  margin-top: 18px;
}

.deep-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 22px 11px 20px;
  background: var(--color-yellow);
  border: 1px solid var(--color-yellow-dark);
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--color-black);
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(255, 197, 9, 0.28);
  transition:
    background 0.2s var(--ease-out-quint),
    border-color 0.2s,
    transform 0.2s var(--ease-spring),
    box-shadow 0.25s;
}

.deep-cta:hover {
  background: var(--color-yellow-dark);
  border-color: var(--color-yellow-dark);
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(255, 197, 9, 0.36);
}

.deep-cta:active {
  transform: translateY(0) scale(0.98);
}

.deep-cta-arrow {
  display: inline-block;
  font-weight: 700;
  transition: transform 0.25s var(--ease-spring);
}

.deep-cta:hover .deep-cta-arrow { transform: translateX(3px); }

@media (max-width: 960px) {
  .deep-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .deep-illustration { max-height: 36vh; max-width: 380px; }
  .deep-title { font-size: clamp(22px, 5.5vw, 30px); }
  .deep-benefits li { font-size: 14px; }
}

/* =================== LEGAL DOCS (privacidad / cookies / términos / aviso) =================== */

.legal-view {
  max-width: 860px;
  margin: 0 auto;
}

.legal-doc {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: clamp(24px, 3.5vw, 44px);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.legal-eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-yellow-dark);
  margin-bottom: 8px;
}

.legal-title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--color-black);
  margin: 0 0 24px;
  padding-bottom: 0.08em;
}

.legal-body h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-black);
  margin: 26px 0 10px;
  letter-spacing: -0.01em;
}
.legal-body h3:first-child { margin-top: 0; }

.legal-body p {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--color-text);
  margin: 0 0 12px;
  overflow-wrap: anywhere;  /* evita que URLs/emails largos desborden en móvil */
  word-break: break-word;
}

.legal-body ul,
.legal-body ol {
  margin: 0 0 16px;
  padding-left: 22px;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--color-text);
}
.legal-body li { margin-bottom: 6px; }

.legal-body strong { font-weight: 700; color: var(--color-black); }

.legal-body a {
  color: var(--color-yellow-dark);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.15s;
}
.legal-body a:hover { color: #B38600; }

.legal-ordered { counter-reset: item; }
.legal-ordered li {
  font-size: 14.5px;
  line-height: 1.6;
  margin-bottom: 10px;
}

/* Caja destacada con los datos de la empresa */
.legal-data {
  background: rgba(255, 197, 9, 0.10);
  border: 1px solid rgba(255, 197, 9, 0.28);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.75;
  color: var(--color-text);
}
.legal-data strong { color: var(--color-black); }

/* Tabla de cookies */
.legal-table-wrap {
  overflow-x: auto;
  margin: 6px 0 18px;
}
.legal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.5;
  min-width: 520px;
}
.legal-table th {
  text-align: left;
  font-weight: 700;
  color: var(--color-black);
  padding: 10px 12px;
  background: rgba(10, 10, 10, 0.04);
  border-bottom: 2px solid var(--color-border);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.legal-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  vertical-align: top;
}
.legal-table tr:last-child td { border-bottom: 0; }

@media (max-width: 640px) {
  .legal-doc { padding: 22px 18px; }
  .legal-body h3 { font-size: 15px; margin-top: 20px; }
  .legal-body p, .legal-body ul, .legal-body ol { font-size: 14px; }
}

/* =================== RESEÑAS DE GOOGLE (widget Elfsight) =================== */

.reviews-section {
  margin-top: 8px;
  opacity: 0;
  animation: progressive-pop-in 0.75s var(--ease-out-expo) 0.65s forwards;
}

.reviews-intro {
  text-align: center;
  margin-bottom: 14px;
}

.reviews-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.reviews-title {
  font-size: clamp(18px, 1.6vw, 22px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-black);
  margin: 0;
  line-height: 1.2;
}

/* Contenedor del widget: caja glass que enmarca el iframe de Elfsight.
   Sin cap de altura — el panel visual tiene scroll invisible (wheel/trackpad),
   así el usuario puede desplazarse y leer todas las reseñas. */
.reviews-widget {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  min-height: 300px;
}

@media (max-width: 900px) {
  .reviews-widget {
    min-height: 360px;
  }
}

/* =================== CONTACT META (en widget contacto) =================== */

.contact-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin-top: 24px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(12px);
  opacity: 0;
  animation: progressive-pop-in 0.7s var(--ease-out-expo) 0.75s forwards;
}

.contact-meta .meta-label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.contact-meta p {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--color-ink);
  margin: 0;
}

.meta-note {
  color: var(--color-text-muted);
  font-size: 12.5px;
}

.meta-link {
  color: var(--color-ink);
  text-decoration: none;
  transition: color 0.15s;
}
.meta-link:hover { color: var(--color-yellow-dark); }

@media (max-width: 760px) {
  .contact-meta { grid-template-columns: 1fr; gap: 18px; }
}

/* =================== CONTACT TILES (widget contacto) =================== */

.contact-grid .glass-card {
  min-height: 128px;
}

.contact-tile { text-decoration: none; }

.contact-tile--whatsapp .card-icon {
  background: rgba(18, 140, 126, 0.1);
  color: #128C7E;
}

/* Layout centrado vertical: icono → nombre → detalle */
.contact-tile .card-body,
.info-card .card-body {
  align-items: center;
  text-align: center;
  padding: 14px 12px;
  gap: 10px;
  justify-content: center;
}

.contact-tile .card-icon,
.info-card .card-icon {
  margin: 0 auto 2px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.contact-tile .card-icon svg,
.info-card .card-icon svg {
  width: 17px;
  height: 17px;
}

.contact-tile .card-title,
.info-card .card-title {
  font-size: 15px;
  margin-bottom: 0;
}

.contact-tile .card-text,
.info-card .card-text {
  font-size: 12.5px;
  line-height: 1.4;
  max-width: 100%;
}

.info-card .social-buttons {
  justify-content: center;
  margin-top: 3px;
  gap: 6px;
}
.info-card .social-btn {
  width: 30px;
  height: 30px;
  border-radius: 10px;
}
.info-card .social-btn svg {
  width: 14px;
  height: 14px;
}

/* Info cards (Horario, Oficina, Síguenos) — glass sin hover interactivo */
.info-card {
  cursor: default;
}
.info-card:hover {
  /* Se cancela el transform del glass-card genérico (esos tienen opacity animada al entrar) */
  transform: none;
}

.card-text .text-dim {
  color: var(--color-text-dim);
  font-size: 0.9em;
}

.contact-socials a {
  color: var(--color-ink);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}
.contact-socials a:hover { color: var(--color-yellow-dark); }

/* Botones circulares para redes sociales */
.social-buttons {
  display: flex;
  gap: 8px;
  margin-top: 2px;
  flex-wrap: wrap;
}

.social-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: rgba(10, 10, 10, 0.04);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-ink);
  text-decoration: none;
  transition:
    background 0.2s var(--ease-out-quint),
    border-color 0.2s,
    color 0.2s,
    transform 0.25s var(--ease-spring);
}

.social-btn svg {
  width: 18px;
  height: 18px;
}

.social-btn:hover {
  background: var(--color-yellow-soft);
  border-color: rgba(255, 197, 9, 0.45);
  color: var(--color-black);
  transform: translateY(-2px);
}

.social-btn:active { transform: translateY(0) scale(0.95); }

/* Respuesta del agente embebida en el panel visual (SOLO MÓVIL) */
.mobile-agent-bubble {
  display: none;  /* oculto por defecto, solo visible en móvil */
}

/* =================== COMPACTACIÓN DESKTOP DEL HOME =================== */
/* Subimos la ilustración hacia el título y ponemos los 4 pills en una fila
   para que todo el home quepa sin scroll en escritorio. */
@media (min-width: 961px) {
  .hero-phrase-container { margin: 0 auto 2px; }
  .hero-sub { margin: 0 auto 4px; max-width: 640px; }
  .home-hero-visual { margin: -4px auto 8px; }

  .menu-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-width: 720px;
    margin: 0 auto;
    gap: 10px;
    justify-items: stretch;
  }
  .menu-option {
    padding: 10px 14px;
    font-size: 13.5px;
    gap: 8px;
  }
  .menu-option svg {
    width: 14px;
    height: 14px;
  }
}

/* =================== RESPONSIVE =================== */

@media (max-width: 900px) {
  :root { --header-height: 64px; }

  .site-header { padding: 0 14px; }
  .logo-img { height: 34px; }
  .status-pill { padding: 5px 12px 5px 10px; font-size: 12px; }

  .app-layout {
    flex-direction: column;
  }

  .visual-panel {
    flex: 1 1 100%;
    padding: 20px 16px calc(180px + env(safe-area-inset-bottom)) 16px;
  }

  .chat-panel {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    width: 100%;
    height: auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 0;
    border-top: 1px solid var(--color-border);
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -12px 32px rgba(10, 10, 10, 0.06);
    z-index: 20;
  }

  .chat-container {
    display: none;  /* en móvil las respuestas aparecen encima, en el visual-panel */
  }

  .input-area {
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    border-top: 0;
    border-radius: 24px 24px 0 0;
  }

  .chat-suggestions {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 2px 2px 6px;
    mask-image: linear-gradient(to right, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
  }
  .chat-suggestions::-webkit-scrollbar { display: none; }

  /* Home compacto en móvil */
  .hero-phrase { font-size: clamp(1.7rem, 7vw, 2.3rem); line-height: 1.1; }
  .hero-phrase-container { min-height: 0; margin: 0 auto 6px; }
  .hero-sub { font-size: 13px; max-width: none; margin: 0 auto 14px; }

  .home-hero-visual { max-width: 100%; margin: 0 auto 14px; }
  .home-hero-visual img { max-height: 40vh; }

  .menu-grid { grid-template-columns: 1fr; gap: 8px; max-width: 100%; }
  .menu-option { padding: 12px 14px; font-size: 14px; }

  .bento-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .glass-card { padding: 14px; border-radius: 16px; }

  /* --- Widget intro más compacto --- */
  .widget-intro { margin: 0 auto 16px; }
  .widget-title { font-size: clamp(1.4rem, 6vw, 1.9rem); margin-bottom: 6px; }
  .widget-lead  { font-size: 13px; line-height: 1.5; }

  /* --- Cards de servicios (con ilustración): imagen y padding pequeños para 2 cols --- */
  .card-media { aspect-ratio: 4 / 3; }
  .card-media img { padding: 2px; }
  .card-title  { font-size: 13.5px; letter-spacing: -0.015em; }
  .card-text   { font-size: 11.5px; line-height: 1.4; }

  /* En móvil, en la parrilla de servicios ocultamos la descripción — al pulsar
     la card se abre la vista en detalle con todo el contexto. */
  .bento-grid:not(.contact-grid) .card-text { display: none; }

  /* Título centrado (y card-body centrado) en móvil para alinearlo con la ilustración */
  .bento-grid:not(.contact-grid) .card-body {
    padding: 10px 8px 14px;
    gap: 4px;
    align-items: center;
    text-align: center;
  }
  .bento-grid:not(.contact-grid) .card-title { text-align: center; }

  /* --- Cards partner (subvenciones, iberdrola): logos más pequeños y centrados --- */
  .card-partners { padding-top: 8px; margin-top: 10px; text-align: center; }
  .card-partners-logos { gap: 10px; justify-content: center; flex-wrap: wrap; }
  .card-partners-logos img { height: 16px; }
  .card-partners-label { font-size: 9px; margin-bottom: 6px; text-align: center; }

  /* --- Card-icon del "¿Algo a medida?" y similares en servicios --- */
  .bento-grid:not(.contact-grid) .card-icon { width: 32px; height: 32px; border-radius: 9px; }
  .bento-grid:not(.contact-grid) .card-icon svg { width: 16px; height: 16px; }

  /* --- Stats (nosotros): más tight --- */
  .stats-bar { padding: 14px 12px; margin-bottom: 18px; }
  .stat-num  { font-size: clamp(20px, 6vw, 26px); }
  .stat-label { font-size: 9.5px; letter-spacing: 0.04em; }

  /* --- Contacto: 2 columnas en móvil, cards más pequeñas --- */
  .contact-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .contact-grid .glass-card { min-height: 0; padding: 14px 10px; border-radius: 16px; }

  .contact-tile .card-body,
  .info-card .card-body {
    padding: 4px 2px;
    gap: 6px;
  }
  .contact-tile .card-icon,
  .info-card .card-icon {
    width: 30px; height: 30px; border-radius: 9px;
  }
  .contact-tile .card-icon svg,
  .info-card .card-icon svg {
    width: 14px; height: 14px;
  }
  .contact-tile .card-title,
  .info-card .card-title {
    font-size: 13px; letter-spacing: -0.01em;
  }
  .contact-tile .card-text,
  .info-card .card-text {
    font-size: 11.5px; line-height: 1.4;
  }

  /* Social buttons (Síguenos) más tight */
  .social-buttons { gap: 6px; }
  .social-btn { width: 28px; height: 28px; border-radius: 9px; }
  .social-btn svg { width: 14px; height: 14px; }

  /* --- Deep view (vistas de servicio): más compacto --- */
  .deep-view { padding-bottom: 8px; }
  .deep-layout { gap: 16px; min-height: 0; }
  .deep-illustration { max-height: 32vh; max-width: 320px; transform: scale(1.05); }
  .deep-eyebrow { font-size: 10px; }
  .deep-title { font-size: clamp(1.25rem, 5.5vw, 1.6rem); line-height: 1.15; }
  .deep-lead  { font-size: 13.5px; line-height: 1.5; }
  .deep-benefits li { font-size: 13.5px; padding-left: 22px; }
  .deep-content { gap: 10px; max-width: 100%; }
  .deep-actions { margin-top: 10px; }
  .deep-cta { padding: 10px 18px; font-size: 13.5px; }
  .deep-back { padding: 6px 12px 6px 10px; font-size: 12px; }

  /* Legal docs: defensivo contra overflow en móviles estrechos */
  .legal-view  { width: 100%; max-width: 100%; }
  .legal-doc   { padding: 18px 14px; border-radius: 16px; max-width: 100%; min-width: 0; overflow: hidden; }
  .legal-body  { overflow-wrap: anywhere; word-break: break-word; }
  .legal-body * { max-width: 100%; min-width: 0; }

  .legal-eyebrow { font-size: 10px; letter-spacing: 0.08em; }
  .legal-title { font-size: clamp(1.25rem, 5.8vw, 1.5rem); margin-bottom: 12px; line-height: 1.18; }
  .legal-body h3 { font-size: 13.5px; margin: 16px 0 6px; }
  .legal-body p { font-size: 12.5px; line-height: 1.55; margin-bottom: 10px; }

  /* Listas: indentación más pequeña para ganar ancho útil */
  .legal-body ul,
  .legal-body ol { font-size: 12.5px; line-height: 1.55; padding-left: 18px; margin-bottom: 12px; }
  .legal-body li { margin-bottom: 4px; }
  .legal-ordered li { font-size: 12.5px; line-height: 1.5; margin-bottom: 8px; }

  /* Caja amarilla con los datos de la empresa */
  .legal-data { padding: 12px 14px; font-size: 12.5px; line-height: 1.55; border-radius: 12px; }

  /* Tabla de cookies: tipografía más pequeña, celdas tight + scroll horizontal */
  .legal-table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .legal-table { font-size: 11.5px; line-height: 1.4; min-width: 380px; }
  .legal-table th,
  .legal-table td { padding: 8px 10px; }

  /* Wrapper visual en deep-view: en móvil, bajar max-width al ancho real del panel */
  .visual-content-wrapper:has(.deep-view) { max-width: 100%; }
}

/* --- Breakpoint muy estrecho: apretar aún más --- */
@media (max-width: 380px) {
  .visual-panel { padding: 16px 12px calc(180px + env(safe-area-inset-bottom)); }
  .contact-grid { gap: 6px; }
  .contact-grid .glass-card { padding: 12px 8px; }
  .contact-tile .card-title,
  .info-card .card-title { font-size: 12.5px; }
  .contact-tile .card-text,
  .info-card .card-text { font-size: 11px; }
  .widget-title { font-size: clamp(1.25rem, 6.5vw, 1.6rem); }
  .stat-num { font-size: 20px; }
}

/* =================== HEADER LEGAL MENU (dropdown "Legal") =================== */
/* Usa <details>/<summary> nativo HTML, sin JS. Se despliega al hacer click. */

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-legal-menu {
  position: relative;
}

.header-legal-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px 7px 14px;
  background: rgba(10, 10, 10, 0.04);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background 0.2s, border-color 0.2s;
}
/* Ocultar el marker nativo de <summary> en todos los navegadores */
.header-legal-trigger::-webkit-details-marker { display: none; }
.header-legal-trigger::marker { display: none; content: ''; }

.header-legal-trigger:hover {
  background: var(--color-yellow-soft);
  border-color: rgba(255, 197, 9, 0.45);
}

.header-legal-trigger svg {
  width: 12px;
  height: 12px;
  opacity: 0.6;
  transition: transform 0.2s var(--ease-out-quint);
}
.header-legal-menu[open] .header-legal-trigger svg {
  transform: rotate(180deg);
}
.header-legal-menu[open] .header-legal-trigger {
  background: var(--color-yellow-soft);
  border-color: rgba(255, 197, 9, 0.5);
}

.header-legal-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  padding: 6px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 18px 40px rgba(10, 10, 10, 0.12);
  z-index: 50;
  animation: legal-menu-pop 0.2s var(--ease-out-expo);
}

@keyframes legal-menu-pop {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.header-legal-panel a {
  display: block;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--color-text);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
}
.header-legal-panel a:hover {
  background: var(--color-yellow-soft);
  color: var(--color-black);
}

@media (max-width: 640px) {
  .header-legal-trigger {
    padding: 6px 10px 6px 12px;
    font-size: 12px;
  }
  .header-legal-trigger svg { width: 11px; height: 11px; }
  .header-legal-panel {
    min-width: 200px;
    right: 0;
  }
  .header-legal-panel a { font-size: 12.5px; padding: 8px 10px; }
}

/* =================== BANNER DE COOKIES =================== */

.cookie-banner {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%) translateY(24px);
  width: calc(100% - 32px);
  max-width: 720px;
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: saturate(1.6) blur(16px);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 16px 20px;
  box-shadow: 0 18px 48px rgba(10, 10, 10, 0.32);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.4s var(--ease-out-expo),
    transform 0.4s var(--ease-out-expo);
  z-index: 9999;
}

.cookie-banner.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.cookie-banner-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
}

.cookie-banner-text strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}

.cookie-banner-text p {
  font-size: 12.5px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.8);
  margin: 0;
}

.cookie-banner-text a {
  color: var(--color-yellow);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.cookie-banner-text a:hover { color: #FFD84D; }

.cookie-banner-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.cookie-btn {
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition:
    background 0.2s,
    border-color 0.2s,
    transform 0.2s var(--ease-spring);
}

.cookie-btn--reject {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.88);
}
.cookie-btn--reject:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.35);
}

.cookie-btn--accept {
  background: var(--color-yellow);
  border: 1px solid var(--color-yellow);
  color: var(--color-black);
}
.cookie-btn--accept:hover {
  background: #FFD84D;
  border-color: #FFD84D;
  transform: translateY(-1px);
}

.cookie-btn:active { transform: scale(0.96); }

@media (max-width: 640px) {
  .cookie-banner {
    bottom: 16px;
    width: calc(100% - 20px);
    padding: 14px 16px;
    border-radius: 16px;
  }
  .cookie-banner-inner {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .cookie-banner-actions {
    justify-content: flex-end;
  }
  .cookie-btn { padding: 8px 14px; font-size: 12.5px; }
  .cookie-banner-text strong { font-size: 13px; }
  .cookie-banner-text p { font-size: 12px; }
}

/* Cuando se muestra sobre el chat móvil (input fijo abajo), subirlo un poco más */
@media (max-width: 900px) {
  .cookie-banner { bottom: calc(150px + env(safe-area-inset-bottom)); }
}

/* =================== ACCESIBILIDAD: FOCUS VISIBLE GLOBAL =================== */

*:focus { outline: none; }

.menu-option:focus-visible,
.chip:focus-visible,
.interactive-card:focus-visible,
.contact-tile:focus-visible,
.btn-send:focus-visible,
.social-btn:focus-visible,
.deep-cta:focus-visible,
.deep-back:focus-visible,
.prompt-input:focus-visible,
.legal-back-home:focus-visible,
.legal-page-nav a:focus-visible,
a:focus-visible {
  outline: 2px solid var(--color-yellow-dark);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* =================== PÁGINAS LEGALES ESTÁTICAS (privacidad/cookies/términos/aviso) =================== */

html:has(body.legal-page) {
  height: auto;
  overflow: visible;
}

body.legal-page {
  display: block;
  height: auto;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background:
    radial-gradient(ellipse at 25% 15%, rgba(255, 197, 9, 0.12), transparent 60%),
    radial-gradient(ellipse at 75% 85%, rgba(255, 197, 9, 0.08), transparent 60%),
    linear-gradient(180deg, #FFFDF2 0%, #FFFAE0 100%);
}

.legal-page .site-header.legal-header {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(1.6) blur(16px);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.legal-back-home {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px 8px 14px;
  background: rgba(10, 10, 10, 0.04);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  transition:
    background 0.2s var(--ease-out-quint),
    border-color 0.2s,
    transform 0.2s var(--ease-spring);
}
.legal-back-home:hover {
  background: var(--color-yellow-soft);
  border-color: rgba(255, 197, 9, 0.5);
  transform: translateX(-2px);
}

.legal-page-main {
  max-width: 860px;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 48px) clamp(16px, 3vw, 24px) clamp(32px, 5vw, 64px);
}

.legal-page-main .legal-doc {
  animation: progressive-pop-in 0.55s var(--ease-out-expo) 0.05s both;
  opacity: 0;
}

.legal-page-main .legal-title {
  /* En la página estática el título es h1 y merece un pelín más de peso */
  font-size: clamp(1.8rem, 3.4vw, 2.4rem);
  margin-bottom: 22px;
}

.legal-page-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
}
.legal-page-nav a {
  display: inline-block;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, transform 0.2s var(--ease-spring);
}
.legal-page-nav a:hover {
  background: var(--color-yellow-soft);
  border-color: rgba(255, 197, 9, 0.5);
  transform: translateY(-1px);
}
.legal-page-nav a.is-current {
  background: var(--color-black);
  border-color: var(--color-black);
  color: #fff;
  pointer-events: none;
}

.legal-page-footer {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px clamp(16px, 3vw, 24px) calc(32px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--color-border);
  text-align: center;
  font-size: 12.5px;
  color: var(--color-text-dim);
  line-height: 1.7;
}
.legal-page-footer a {
  color: var(--color-text);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, color 0.2s;
}
.legal-page-footer a:hover {
  color: var(--color-yellow-dark);
  border-color: var(--color-yellow-dark);
}

@media (max-width: 640px) {
  .legal-header { padding: 0 14px; gap: 10px; }
  .legal-back-home { padding: 6px 12px 6px 10px; font-size: 12px; }
  .legal-page-main { padding: 20px 16px 32px; }
  .legal-page-nav { gap: 6px; margin-top: 24px; padding-top: 20px; }
  .legal-page-nav a { padding: 7px 12px; font-size: 12px; }
  .legal-page-footer { padding: 20px 16px calc(28px + env(safe-area-inset-bottom)); font-size: 12px; }
}

/* Mejora de contraste WCAG AA: eyebrow de servicios más oscuro */
.deep-eyebrow { color: #B88800; }

/* =================== REDUCED MOTION =================== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
