/* ============================================
   ANCESTRAL INTELLIGENCE - DESIGN SYSTEM EXTENSION
   ============================================

   Extiende design-system.css con:
   - Componentes glassmorphism + brutalism
   - Tipografía Bodoni Moda, Hanken Grotesk, Space Mono
   - Paleta Material Design 3 - Lithic Dark
   - Efectos procedurales y blueprint grids

   ============================================ */

/* ============================================
   RESET: Sobrescribir estilos heredados
   ============================================ */

/* Ancestral Intelligence - Todas las superficies oscuras */
html.ancestral {
  --color-bg-primary: var(--color-background);
  --color-text-primary: var(--color-on-background);
  --color-border: var(--color-blueprint-line);
}

/* ============================================
   1. COMPONENTES BUTTONS - ANCESTRAL
   ============================================ */

.btn {
  border-radius: var(--radius-sharp);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border: 1px solid var(--color-blueprint-line);
  background: transparent;
  color: var(--color-on-surface);
  padding: 1rem 2rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-decoration: none;
  text-align: center;
  display: inline-block;
}

.btn:hover {
  border-color: var(--color-earth-gold);
  color: var(--color-earth-gold);
  box-shadow: none;
  transform: none;
}

.btn:active {
  opacity: 0.9;
}

/* Primary Button - Solid Background */
.btn-primary {
  background-color: var(--color-primary-fixed);
  color: var(--color-on-primary-fixed);
  border: 1px solid var(--color-primary-fixed);
  font-family: var(--font-mono);
}

.btn-primary:hover {
  background-color: var(--color-primary);
  border-color: var(--color-earth-gold);
  color: var(--color-on-primary-fixed);
}

/* Secondary Button - Outline */
.btn-secondary {
  background-color: transparent;
  color: var(--color-on-surface);
  border: 1px solid var(--color-outline);
}

.btn-secondary:hover {
  background-color: transparent;
  border-color: var(--color-earth-gold);
  color: var(--color-earth-gold);
}

/* Tertiary Button - Earth Gold Accent */
.btn-tertiary {
  background-color: transparent;
  color: var(--color-earth-gold);
  border: 1px solid var(--color-earth-gold);
}

.btn-tertiary:hover {
  background-color: rgba(150, 117, 60, 0.1);
  border-color: var(--color-earth-gold);
}

/* Ghost Button - Minimal */
.btn-ghost {
  background-color: transparent;
  color: var(--color-on-surface-variant);
  border: none;
  border-bottom: 1px solid transparent;
}

.btn-ghost:hover {
  color: var(--color-earth-gold);
  border-bottom-color: var(--color-earth-gold);
}

/* ============================================
   2. COMPONENTES CARDS - GLASS PANELS
   ============================================ */

.card {
  border-radius: var(--radius-sharp);
  border: 1px solid var(--color-blueprint-line);
  padding: 2rem;
  position: relative;
}

/* Simple Card - Solid Surface Container */
.card-simple {
  background-color: var(--color-surface-container);
  border: 1px solid var(--color-blueprint-line);
  border-radius: var(--radius-sharp);
  padding: 2rem;
}

.card-simple:hover {
  background-color: var(--color-surface-container-high);
  border-color: var(--color-earth-gold);
}

/* Elevated Card - Subtle Depth */
.card-elevated {
  background-color: var(--color-surface-container-low);
  border: 1px solid var(--color-blueprint-line);
  border-radius: var(--radius-sharp);
  padding: 2rem;
}

/* Glass Panel - Full Glassmorphism Effect */
.glass-panel,
.card-glass {
  background-color: rgba(28, 28, 28, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--color-blueprint-line);
  border-radius: var(--radius-sharp);
  padding: 2rem;
  position: relative;
}

/* Corner markers for glass panels */
.glass-panel::before,
.glass-panel::after,
.card-glass::before,
.card-glass::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  border: 1px solid var(--color-earth-gold);
  opacity: 0.5;
}

.glass-panel::before,
.card-glass::before {
  top: -1px;
  left: -1px;
  border-right: none;
  border-bottom: none;
}

.glass-panel::after,
.card-glass::after {
  bottom: -1px;
  right: -1px;
  border-left: none;
  border-top: none;
}

/* Additional corner markers */
.glass-panel .corner-tr,
.glass-panel .corner-bl,
.card-glass .corner-tr,
.card-glass .corner-bl {
  position: absolute;
  width: 8px;
  height: 8px;
  border: 1px solid var(--color-earth-gold);
  opacity: 0.5;
}

.glass-panel .corner-tr,
.card-glass .corner-tr {
  top: -1px;
  right: -1px;
  border-left: none;
  border-bottom: none;
}

.glass-panel .corner-bl,
.card-glass .corner-bl {
  bottom: -1px;
  left: -1px;
  border-right: none;
  border-top: none;
}

/* ============================================
   3. COMPONENTES INPUTS - TERMINAL STYLE
   ============================================ */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
textarea {
  font-family: var(--font-body);
  font-size: 16px;
  border: none;
  border-bottom: 1px solid var(--color-blueprint-line);
  background-color: transparent;
  color: var(--color-on-surface);
  padding: 0.5rem 0;
  transition: all 0.3s ease;
  width: 100%;
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder,
input[type="search"]::placeholder,
input[type="tel"]::placeholder,
textarea::placeholder {
  color: var(--color-on-surface-variant);
  opacity: 0.7;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
textarea:focus {
  outline: none;
  border-bottom-color: var(--color-earth-gold);
  box-shadow: none;
}

label {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-earth-gold);
  margin-bottom: 0.5rem;
  font-weight: 400;
}

/* ============================================
   4. COMPONENTES BADGES / CHIPS - STATUS
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--color-blueprint-line);
  border-radius: var(--radius-sharp);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background-color: transparent;
  color: var(--color-on-surface-variant);
}

.badge-gold {
  border-color: var(--color-earth-gold);
  color: var(--color-earth-gold);
}

.badge-emerald {
  border-color: var(--color-deep-emerald);
  color: var(--color-tertiary);
}

.badge-error {
  border-color: var(--color-error);
  color: var(--color-error);
}

.badge-success {
  border-color: var(--color-terminal-green);
  color: var(--color-terminal-green);
}

/* ============================================
   5. COMPONENTES GRID / PROCEDURAL PATTERNS
   ============================================ */

/* Blueprint grid background */
.bg-blueprint {
  background-size: var(--grid-size) var(--grid-size);
  background-image:
    linear-gradient(to right, var(--color-blueprint-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--color-blueprint-line) 1px, transparent 1px);
  background-color: var(--color-graphite);
}

/* Procedural noise overlay */
.noise-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Scan line effect */
.scanline {
  width: 100%;
  height: 100px;
  position: absolute;
  pointer-events: none;
  background: linear-gradient(0deg, rgba(0,0,0,0) 0%, var(--color-earth-gold) 50%, rgba(0,0,0,0) 100%);
  opacity: 0.05;
  animation: scan 8s linear infinite;
}

@keyframes scan {
  0% { top: -10%; }
  100% { top: 110%; }
}

/* ============================================
   6. TIPOGRAFÍA - HIERARCHY UPDATES
   ============================================ */

/* Display - Bodoni Moda Large */
.text-display-lg {
  font-family: var(--font-display);
  font-size: 84px;
  font-weight: 700;
  line-height: 92px;
  letter-spacing: -0.02em;
}

/* Headline XL - Bodoni Moda */
.text-headline-xl {
  font-family: var(--font-display);
  font-size: 60px;
  font-weight: 600;
  line-height: 68px;
  letter-spacing: -0.01em;
}

/* Headline XL Mobile */
.text-headline-xl-mobile {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 600;
  line-height: 48px;
}

/* Headline LG - Hanken Grotesk */
.text-headline-lg {
  font-family: var(--font-body);
  font-size: 32px;
  font-weight: 300;
  line-height: 40px;
  letter-spacing: 0.05em;
}

/* Body LG */
.text-body-lg {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 400;
  line-height: 28px;
}

/* Body MD */
.text-body-md {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
}

/* Label Mono */
.text-label-mono {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  line-height: 16px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Label Link */
.text-label-link {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  letter-spacing: 0.02em;
}

/* ============================================
   7. UTILIDADES - SPACING & LAYOUT
   ============================================ */

.container-ancestral {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--margin-mobile);
}

@media (min-width: 768px) {
  .container-ancestral {
    padding: 0 var(--margin-desktop);
  }
}

.section-ancestral {
  padding: var(--margin-mobile);
  position: relative;
}

@media (min-width: 768px) {
  .section-ancestral {
    padding: var(--margin-desktop);
  }
}

/* Grid 12-column system */
.grid-12 {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--gutter);
}

.col-span-4 { grid-column: span 4; }
.col-span-6 { grid-column: span 6; }
.col-span-8 { grid-column: span 8; }
.col-span-12 { grid-column: span 12; }

@media (max-width: 768px) {
  .grid-12 {
    grid-template-columns: 1fr;
  }
  .col-span-4,
  .col-span-6,
  .col-span-8 {
    grid-column: span 12;
  }
}

/* ============================================
   8. UTILIDADES - COLORS & EFFECTS
   ============================================ */

.text-on-surface {
  color: var(--color-on-surface);
}

.text-on-surface-variant {
  color: var(--color-on-surface-variant);
}

.text-earth-gold {
  color: var(--color-earth-gold);
}

.text-deep-emerald {
  color: var(--color-deep-emerald);
}

.text-terminal-green {
  color: var(--color-terminal-green);
}

.bg-graphite {
  background-color: var(--color-graphite);
}

.bg-surface-container {
  background-color: var(--color-surface-container);
}

.border-blueprint {
  border: 1px solid var(--color-blueprint-line);
}

.border-earth-gold {
  border-color: var(--color-earth-gold);
}

/* ============================================
   9. RESPONSIVE TYPOGRAPHY
   ============================================ */

@media (max-width: 768px) {
  .text-display-lg {
    font-size: 48px;
    line-height: 56px;
  }

  .text-headline-xl {
    font-size: 42px;
    line-height: 48px;
  }

  .text-headline-lg {
    font-size: 24px;
    line-height: 32px;
  }

  h1 {
    font-size: 42px !important;
    line-height: 48px !important;
  }

  h2 {
    font-size: 32px !important;
    line-height: 40px !important;
  }

  h3 {
    font-size: 24px !important;
    line-height: 32px !important;
  }
}

/* ============================================
   10. ACCESSIBILITY & TRANSITIONS
   ============================================ */

/* Prefiere animaciones reducidas */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* Focus states para navegación por teclado */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--color-earth-gold);
  outline-offset: 2px;
}

/* ============================================
   11. DARK MODE SUPPORTS (si es necesario)
   ============================================ */

@media (prefers-color-scheme: dark) {
  html {
    --color-bg-primary: var(--color-background);
    --color-text-primary: var(--color-on-background);
  }
}

/* ============================================
   12. FALLBACK PARA NAVEGADORES SIN SOPORTE
   ============================================ */

/* Si no soporta backdrop-filter, usar solid backgrounds */
@supports not (backdrop-filter: blur(1px)) {
  .glass-panel,
  .card-glass {
    background-color: rgba(28, 28, 28, 0.8);
    backdrop-filter: none;
  }
}
