/* ==========================================================================
   GHOST IN THE MACHINE - CORE DESIGN SYSTEM & STYLESHEET
   A Cyber-Gothic & Día de los Muertos Open-Source AI Workstation
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@700;900&family=Cinzel:wght@500;700&family=Fira+Code:wght@400;500;600&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  /* Color Palette */
  --bg-void: #06070a;
  --bg-tomb: #0d0f17;
  --bg-crypt: #141724;
  --bg-glass: rgba(18, 22, 34, 0.78);
  --bg-glass-card: rgba(22, 27, 43, 0.65);
  --bg-glass-hover: rgba(30, 37, 58, 0.85);

  /* Spectral Accents */
  --cempasuchil: #ff8c00;
  --cempasuchil-glow: rgba(255, 140, 0, 0.45);
  --marigold-gold: #ffbe0b;
  --marigold-soft: #ffe066;
  --spectral-cyan: #00f5d4;
  --spectral-cyan-glow: rgba(0, 245, 212, 0.4);
  --spirit-violet: #9d4edd;
  --spirit-purple: #7b2cbf;
  --spirit-glow: rgba(157, 78, 221, 0.35);
  --phosphor-green: #39ff14;
  --phosphor-amber: #ffaa00;
  --candle-flame: #ff5400;
  --candle-glow: rgba(255, 84, 0, 0.35);
  --blood-red: #e63946;

  /* Text & Neutrals */
  --text-primary: #f0f3fa;
  --text-secondary: #a0aec0;
  --text-muted: #64748b;
  --border-subtle: rgba(255, 180, 50, 0.15);
  --border-active: rgba(0, 245, 212, 0.5);
  --border-glow: 0 0 15px rgba(255, 140, 0, 0.2);

  /* Fonts */
  --font-display: 'Cinzel Decorative', 'Cinzel', Georgia, serif;
  --font-heading: 'Cinzel', Georgia, serif;
  --font-body: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Fira Code', 'Courier New', monospace;

  /* Transitions & Shadows */
  --transition-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --shadow-elevation: 0 20px 40px -15px rgba(0, 0, 0, 0.8);
}

/* Reset & Baseline */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
  scroll-behavior: smooth;
}

/* Background Atmosphere Canvas */
#particles-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  opacity: 0.85;
}

/* Subtle Vignette & Fog Overlay */
.fog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at 50% 30%, transparent 20%, rgba(6, 7, 10, 0.75) 75%, #06070a 100%);
  pointer-events: none;
  z-index: 1;
}

/* App Container */
.app-container {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1560px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

/* Top App Header / Bar */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  margin-top: 16px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  position: sticky;
  top: 16px;
  z-index: 100;
  transition: all var(--transition-smooth);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  color: inherit;
}

.brand-logo-frame {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(135deg, var(--cempasuchil), var(--spectral-cyan), var(--spirit-violet));
  box-shadow: 0 0 15px var(--cempasuchil-glow);
  animation: pulse-border 4s infinite alternate;
}

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  background: var(--bg-void);
  display: block;
}

.brand-titles {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: linear-gradient(90deg, #fff 0%, var(--marigold-gold) 60%, var(--cempasuchil) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

.brand-subtitle {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--spectral-cyan);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pulse-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--spectral-cyan);
  box-shadow: 0 0 8px var(--spectral-cyan);
  animation: blink 1.4s infinite;
}

/* Nav Tabs */
.nav-navigation {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10, 12, 18, 0.7);
  padding: 5px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.nav-btn svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  transition: stroke var(--transition-fast);
}

.nav-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(255, 140, 0, 0.25), rgba(157, 78, 221, 0.25));
  border: 1px solid rgba(255, 158, 0, 0.4);
  box-shadow: 0 0 15px rgba(255, 140, 0, 0.2);
}

.nav-btn.active svg {
  stroke: var(--cempasuchil);
}

/* Header Utilities */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.badge-ai-mode {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: rgba(0, 245, 212, 0.08);
  border: 1px solid rgba(0, 245, 212, 0.25);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--spectral-cyan);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.badge-ai-mode:hover {
  background: rgba(0, 245, 212, 0.15);
  box-shadow: 0 0 12px var(--spectral-cyan-glow);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.icon-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 140, 0, 0.4);
  box-shadow: 0 0 12px var(--cempasuchil-glow);
}

.icon-btn.active {
  color: var(--cempasuchil);
  border-color: var(--cempasuchil);
  box-shadow: 0 0 12px var(--cempasuchil-glow);
}

/* Hero Banner & Thematic Interlude */
.hero-manifesto {
  position: relative;
  margin-top: 24px;
  padding: 32px 36px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(22, 17, 34, 0.85) 0%, rgba(13, 15, 23, 0.95) 100%);
  border: 1px solid rgba(255, 140, 0, 0.2);
  overflow: hidden;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 32px;
  align-items: center;
}

.hero-backdrop-img {
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.18;
  mix-blend-mode: screen;
  pointer-events: none;
  filter: saturate(1.4) contrast(1.1);
}

.hero-content {
  position: relative;
  z-index: 2;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--marigold-gold);
  background: rgba(255, 190, 11, 0.1);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 190, 11, 0.25);
  margin-bottom: 14px;
}

.hero-title {
  font-family: var(--font-display);
  font-size: 2.35rem;
  font-weight: 900;
  line-height: 1.15;
  margin-bottom: 14px;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.hero-title .gradient-text {
  background: linear-gradient(120deg, #ff9e00 0%, #ff5400 45%, #9d4edd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: 0.98rem;
  color: var(--text-secondary);
  line-height: 1.65;
  max-width: 620px;
  margin-bottom: 22px;
}

.hero-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.82rem;
  color: #e2e8f0;
}

.hero-pill svg {
  width: 14px;
  height: 14px;
  color: var(--spectral-cyan);
}

.hero-visual-card {
  position: relative;
  z-index: 2;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(255, 158, 0, 0.3);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 20px rgba(255, 140, 0, 0.15);
  background: #000;
  aspect-ratio: 16 / 9;
}

.hero-visual-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-visual-card:hover img {
  transform: scale(1.04);
}

.hero-card-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 14px;
  background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, transparent 100%);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--marigold-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Main Workspace View Switcher */
.views-container {
  margin-top: 24px;
  position: relative;
}

.view-section {
  display: none;
  animation: fadeIn 0.35s ease-out forwards;
}

.view-section.active {
  display: block;
}

/* Modals & Overlays */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(4, 5, 8, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal-window {
  background: var(--bg-tomb);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9), 0 0 30px var(--spectral-cyan-glow);
  width: 100%;
  max-width: 820px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px;
  position: relative;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.open .modal-window {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color var(--transition-fast);
  padding: 4px;
}

.modal-close-btn:hover {
  color: #fff;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

::-webkit-scrollbar-track {
  background: rgba(10, 12, 18, 0.6);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 140, 0, 0.25);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 140, 0, 0.5);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse-border {
  0% {
    box-shadow: 0 0 8px var(--cempasuchil-glow);
  }
  50% {
    box-shadow: 0 0 20px var(--spectral-cyan-glow);
  }
  100% {
    box-shadow: 0 0 14px var(--spirit-glow);
  }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

/* Buttons and Form Controls */
.btn-primary {
  background: linear-gradient(135deg, var(--cempasuchil) 0%, #ff5400 100%);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 10px 22px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 15px rgba(255, 84, 0, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(255, 84, 0, 0.55);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.92rem;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  transition: all var(--transition-fast);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(0, 245, 212, 0.4);
  color: #fff;
}

.btn-spectral {
  background: linear-gradient(135deg, rgba(0, 245, 212, 0.2), rgba(157, 78, 221, 0.3));
  border: 1px solid var(--spectral-cyan);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 8px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-fast);
}

.btn-spectral:hover {
  background: linear-gradient(135deg, rgba(0, 245, 212, 0.35), rgba(157, 78, 221, 0.45));
  box-shadow: 0 0 18px var(--spectral-cyan-glow);
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--bg-crypt);
  border: 1px solid var(--cempasuchil);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.84rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.7), 0 0 15px var(--cempasuchil-glow);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideInRight 0.3s ease forwards;
  max-width: 380px;
}

.toast.cyan {
  border-color: var(--spectral-cyan);
  box-shadow: 0 10px 25px rgba(0,0,0,0.7), 0 0 15px var(--spectral-cyan-glow);
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Responsive queries */
@media (max-width: 1024px) {
  .hero-manifesto {
    grid-template-columns: 1fr;
  }
  .app-header {
    flex-wrap: wrap;
    gap: 14px;
  }
  .nav-navigation {
    order: 3;
    width: 100%;
    justify-content: center;
    overflow-x: auto;
  }
}

@media (max-width: 640px) {
  .hero-title {
    font-size: 1.8rem;
  }
  .app-container {
    padding: 0 12px 24px;
  }
  .nav-btn {
    padding: 6px 10px;
    font-size: 0.78rem;
  }
  .nav-btn span {
    display: none;
  }
}
