/* ==========================================================================
   Kasboard - Estilos Globales, Sistema de Temas (Dark/Light) y Componentes
   Fuente Única de Verdad: docs/directrices-diseno.md & docs/arquitectura-tecnica.md
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Montserrat:wght@700;800&display=swap');

/* ==========================================================================
   Variables y Tokens de Diseño Centrales
   ========================================================================== */
:root {
  --color-kas-navy: #0d1b39;
  --color-kas-purple: #8e5ccf;
  --color-kas-blue: #4a5bd6;
  --color-kas-darkcard: #132347;
  --color-kas-lightbg: #f8fafc;

  /* Modo Claro por Defecto */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-header: rgba(255, 255, 255, 0.92);
  
  --text-main: #0d1b39;
  --text-body: #334155;
  --text-muted: #64748b;
  
  --border-subtle: #e2e8f0;
  --border-medium: #cbd5e1;
}

html.dark {
  /* Modo Oscuro Sobrescrito */
  --bg-primary: #0d1b39;
  --bg-secondary: #081226;
  --bg-tertiary: #0b1730;
  --bg-card: #132347;
  --bg-header: rgba(13, 27, 57, 0.95);
  
  --text-main: #ffffff;
  --text-body: #e2e8f0;
  --text-muted: #94a3b8;
  
  --border-subtle: rgba(255, 255, 255, 0.1);
  --border-medium: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   Comportamiento General del Documento
   ========================================================================== */
html {
  scroll-behavior: smooth;
  color-scheme: light dark;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow-x: hidden;
  background-color: var(--bg-primary);
  color: var(--text-body);
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

html.dark body {
  background-color: #0d1b39;
  color: #e2e8f0;
}

h1, h2, h3, h4, .font-title {
  font-family: 'Montserrat', 'Inter', sans-serif;
  color: var(--text-main);
}

html.dark h1, 
html.dark h2, 
html.dark h3, 
html.dark h4 {
  color: #ffffff;
}

/* Enlaces y Navegación */
a {
  transition: color 0.2s ease;
}

/* ==========================================================================
   Garantía de Contraste en Modo Oscuro (CSS Directo + Clases Tailwind)
   ========================================================================== */
html.dark .dark\:bg-kas-navy {
  background-color: #0d1b39 !important;
}

html.dark .dark\:bg-kas-darkcard {
  background-color: #132347 !important;
}

html.dark .dark\:text-white {
  color: #ffffff !important;
}

html.dark .dark\:text-slate-100 {
  color: #f1f5f9 !important;
}

html.dark .dark\:text-slate-200 {
  color: #e2e8f0 !important;
}

html.dark .dark\:text-slate-300 {
  color: #cbd5e1 !important;
}

html.dark .dark\:border-slate-800 {
  border-color: #1e293b !important;
}

html.dark .dark\:border-slate-700 {
  border-color: #334155 !important;
}

/* Header Flotante */
#header {
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

html.dark #header {
  background-color: rgba(13, 27, 57, 0.95);
  border-bottom-color: #1e293b;
}

/* ==========================================================================
   3D Flip Cards (Sección 3: Propuesta de Valor y Solución de Dolores)
   ========================================================================== */
.perspective-1000 {
  perspective: 1000px;
}

.flip-card-container {
  perspective: 1000px;
  min-height: 380px;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: left;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

/* Desktop hover & Mobile toggle class */
@media (hover: hover) and (pointer: fine) {
  .flip-card-container:hover .flip-card-inner {
    transform: rotateY(180deg);
  }
}

.flip-card-container.is-flipped .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 1rem;
}

.flip-card-front {
  background-color: var(--bg-card);
  color: var(--text-body);
  border: 2px solid var(--border-medium);
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

html.dark .flip-card-front {
  background-color: #132347;
  color: #ffffff;
  border-color: #334155;
}

.flip-card-back {
  transform: rotateY(180deg);
}

/* ==========================================================================
   Wistia Responsive Aspect Ratio & Web Component
   ========================================================================== */
wistia-player {
  display: block;
  width: 100%;
  height: 100%;
}

wistia-player[media-id='ylwv2nyrq8']:not(:defined) {
  background: center / contain no-repeat url('https://fast.wistia.com/embed/medias/ylwv2nyrq8/swatch');
  display: block;
  filter: blur(5px);
  padding-top: 56.25%;
}

.wistia_responsive_wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 Aspect Ratio */
}

.wistia_responsive_wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}


/* ==========================================================================
   Glassmorphism y Paneles
   ========================================================================== */
.glass-panel {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid #e2e8f0;
  transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

html.dark .glass-panel {
  background: rgba(19, 35, 71, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-color: rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   Footer Fijo Corporativo (Siempre Navy #0d1b39)
   ========================================================================== */
#footer {
  background-color: #0d1b39 !important;
  color: #cbd5e1 !important;
  border-top: 1px solid #1e293b !important;
}

#footer h2, #footer h3, #footer h4 {
  color: #ffffff !important;
}

#footer p {
  color: #cbd5e1 !important;
}

#footer a {
  color: #94a3b8;
}

#footer a:hover {
  color: #8e5ccf;
}
