/* ==========================================================================
   DAIPAYAN GHOSAL — VIBRANT GENZ DESIGN SYSTEM & THEME TOKENS
   Dual Theme (Light & Dark), Ambient Aura, Modern Typography & Fluid Micro-Interactions
   ========================================================================== */

:root {
  /* Default: Dark Theme (Nordic Cyber-Forest) */
  --bg-canvas: #0B0F0E;
  --bg-surface: #131C1A;
  --bg-elevated: #162421;
  --bg-subtle: #0e1514;
  --bg-hover: rgba(42, 98, 61, 0.14);

  --border-subtle: rgba(93, 93, 93, 0.25);
  --border-medium: #5D5D5D;
  --border-highlight: #2A623D;

  --text-primary: #E2E8F0;
  --text-secondary: #94A3B8;
  --text-muted: #AAAAAA;

  /* Forest & Emerald Accents */
  --accent-forest: #1A472A;
  --accent-emerald: #2A623D;
  --accent-primary: #2A623D;
  --accent-indigo: #2A623D;
  --accent-violet: #1A472A;
  --accent-cyan: #2A623D;
  --accent-rose: #f43f5e;
  --accent-amber: #f59e0b;
  --accent-glow: rgba(42, 98, 61, 0.35);

  --gradient-brand: linear-gradient(135deg, #2A623D 0%, #1A472A 100%);
  --gradient-cyan: linear-gradient(135deg, #2A623D 0%, #1A472A 100%);
  --gradient-amber: linear-gradient(135deg, #2A623D 0%, #1A472A 100%);
  --gradient-emerald: linear-gradient(135deg, #2A623D 0%, #1A472A 100%);

  /* Card Surfaces & Shadows */
  --card-bg: #131C1A;
  --card-border: rgba(93, 93, 93, 0.25);
  --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
  --card-shadow-hover: 0 20px 40px -15px rgba(42, 98, 61, 0.3);

  /* Geometry - Soft GenZ Curves */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-pill: 9999px;

  /* Fonts */
  --font-display: 'Outfit', 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  --nav-height: 58px;
  --container-max: 1140px;
}

/* Light Theme Override */
html[data-theme="light"] {
  --bg-canvas: #f2f5f3;
  --bg-surface: #ffffff;
  --bg-elevated: #e6ece8;
  --bg-subtle: #f2f5f3;
  --bg-hover: rgba(26, 71, 42, 0.05);

  --border-subtle: rgba(93, 93, 93, 0.2);
  --border-medium: #5D5D5D;
  --border-highlight: #1A472A;

  --text-primary: #0B0F0E;
  --text-secondary: #131C1A;
  --text-muted: #5D5D5D;

  --accent-forest: #1A472A;
  --accent-emerald: #2A623D;
  --accent-primary: #1A472A;
  --accent-indigo: #1A472A;
  --accent-violet: #2A623D;
  --accent-cyan: #1A472A;
  --accent-rose: #e11d48;
  --accent-amber: #d97706;
  --accent-glow: rgba(26, 71, 42, 0.15);

  --gradient-brand: linear-gradient(135deg, #1A472A 0%, #2A623D 100%);
  --gradient-cyan: linear-gradient(135deg, #1A472A 0%, #2A623D 100%);
  --gradient-amber: linear-gradient(135deg, #1A472A 0%, #2A623D 100%);
  --gradient-emerald: linear-gradient(135deg, #1A472A 0%, #2A623D 100%);

  --card-bg: #ffffff;
  --card-border: rgba(93, 93, 93, 0.2);
  --card-shadow: 0 10px 25px -8px rgba(11, 15, 14, 0.08);
  --card-shadow-hover: 0 18px 36px -10px rgba(26, 71, 42, 0.15);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--border-medium) transparent;
  font-size: 16px;
}

html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: clip;
  touch-action: pan-y;
}

body {
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s ease, color 0.25s ease;
  position: relative;
}

::selection {
  background: rgba(99, 102, 241, 0.35);
  color: #ffffff;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  border: none;
  background: none;
}

:focus-visible {
  outline: 2px solid var(--accent-indigo);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}

/* ==========================================================================
   AMBIENT AURA BACKDROP (Compositor-Safe, 120-144fps Guaranteed)
   ========================================================================== */

.ambient-aura-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
  contain: strict;
  transform: translate3d(0, 0, 0);
  opacity: 0.85;
}

.aura-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  transform: translate3d(0, 0, 0);
}

.aura-orb-1 {
  top: -100px;
  left: 5%;
  width: 520px;
  height: 420px;
  background: radial-gradient(circle, rgba(42, 98, 61, 0.22) 0%, transparent 70%);
}

.aura-orb-2 {
  top: 60px;
  right: 5%;
  width: 480px;
  height: 400px;
  background: radial-gradient(circle, rgba(26, 71, 42, 0.25) 0%, transparent 70%);
}

.aura-orb-3 {
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 480px;
  background: radial-gradient(circle, rgba(42, 98, 61, 0.14) 0%, transparent 70%);
}

html[data-theme="light"] .aura-orb-1 {
  background: radial-gradient(circle, rgba(42, 98, 61, 0.12) 0%, transparent 70%);
}
html[data-theme="light"] .aura-orb-2 {
  background: radial-gradient(circle, rgba(26, 71, 42, 0.1) 0%, transparent 70%);
}
html[data-theme="light"] .aura-orb-3 {
  background: radial-gradient(circle, rgba(42, 98, 61, 0.06) 0%, transparent 70%);
}

/* ==========================================================================
   TOP NAVIGATION CHROME (VIBRANT + TACTILE CONTROLS)
   ========================================================================== */

.hud-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  z-index: 100;
  background: rgba(11, 15, 14, 0.88);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  contain: layout style;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

html[data-theme="light"] .hud-nav {
  background: rgba(242, 245, 243, 0.92);
}

.hud-container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.sidebar-toggle-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.18s ease;
}

.sidebar-toggle-btn:hover {
  border-color: var(--accent-indigo);
  color: var(--text-primary);
  background: var(--bg-elevated);
  transform: scale(1.04);
}

.hud-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gradient-brand);
  display: inline-block;
  box-shadow: 0 0 12px var(--accent-indigo);
}

.brand-dossier-text {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  white-space: nowrap;
}

.hud-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-secondary);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.live-dot-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-emerald);
  display: inline-block;
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.7);
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
}

/* Theme Switcher Button (Sun / Moon) */
.theme-toggle-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
}

.theme-toggle-btn:hover {
  color: var(--accent-amber);
  border-color: var(--accent-amber);
  transform: rotate(18deg) scale(1.05);
}

.theme-icon-sun {
  display: none;
}
.theme-icon-moon {
  display: block;
}

html[data-theme="light"] .theme-icon-sun {
  display: block;
  color: var(--accent-amber);
}
html[data-theme="light"] .theme-icon-moon {
  display: none;
}

/* Interactive Control Buttons */
.ctrl-btn {
  height: 32px;
  padding: 0 0.75rem;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all 0.16s ease;
}

.ctrl-btn:hover {
  border-color: var(--accent-indigo);
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.ctrl-kbd {
  color: var(--text-primary);
  font-weight: 600;
}

.ctrl-label {
  color: var(--text-muted);
}

.hud-cv-btn {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
  border-color: rgba(99, 102, 241, 0.3);
  color: var(--text-primary);
}

.hud-cv-btn:hover {
  border-color: var(--accent-indigo);
  background: var(--accent-indigo);
  color: #ffffff;
}

/* ==========================================================================
   RETRACTABLE SIDEBAR DRAWER (GENZ MODERN REFINEMENT)
   ========================================================================== */

.side-navbar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 300px;
  max-width: 86vw;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  z-index: 300;
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.24s step-end;
  will-change: transform;
  contain: layout style;
  box-shadow: 20px 0 50px rgba(0, 0, 0, 0.4);
}

.side-navbar.open {
  transform: translateX(0);
  visibility: visible;
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s;
}

.side-navbar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 290;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.24s ease, visibility 0.24s step-end;
}

.side-navbar-backdrop.open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.24s ease, visibility 0s;
}

.side-navbar-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: thin;
  padding: 1.5rem;
}

.side-navbar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.25rem;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.side-avatar {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid var(--border-highlight);
}

.side-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.side-name {
  font-family: var(--font-display);
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-primary);
}

.side-title {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.side-close-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.16s ease;
}

.side-close-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.side-nav-heading {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-indigo);
  margin-bottom: 0.65rem;
}

.side-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-weight: 500;
  transition: all 0.16s ease;
}

.side-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  transform: translateX(4px);
}

.side-link.active {
  background: var(--accent-glow);
  color: var(--accent-indigo);
  font-weight: 600;
  border-left: 3px solid var(--accent-indigo);
}

.side-num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.side-nav-footer {
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.side-footer-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.side-action-btn {
  height: 36px;
  padding: 0 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.16s ease;
}

.side-action-btn:hover {
  border-color: var(--accent-indigo);
  color: var(--text-primary);
}

.side-socials-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.76rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.side-socials-row a:hover {
  color: var(--accent-cyan);
}

.side-meta-loc {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ==========================================================================
   COMMAND PALETTE (⌘K) OVERLAY
   ========================================================================== */

.palette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 400;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, visibility 0.18s step-end;
}

.palette-overlay.active {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.18s ease, visibility 0s;
}

.palette-card {
  width: 90%;
  max-width: 580px;
  background: var(--bg-surface);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-md);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5), 0 0 40px var(--accent-glow);
  overflow: hidden;
  transform: translateY(-8px) scale(0.98);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.palette-overlay.active .palette-card {
  transform: translateY(0) scale(1);
}

.palette-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.95rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
}

.palette-icon {
  color: var(--accent-indigo);
  flex-shrink: 0;
}

.palette-input {
  flex: 1;
  background: transparent;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text-primary);
  outline: none;
}

.palette-input::placeholder {
  color: var(--text-muted);
}

.palette-esc {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--bg-surface);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
}

.palette-results {
  max-height: 360px;
  overflow-y: auto;
  padding: 0.5rem;
  scrollbar-width: thin;
}

.palette-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.14s ease;
}

.palette-item:hover,
.palette-item.selected {
  background: var(--bg-hover);
}

.palette-item.selected {
  background: var(--accent-glow);
}

.palette-item-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.88rem;
  color: var(--text-primary);
}

.palette-item-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--accent-cyan);
}

.palette-item kbd {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  background: var(--bg-elevated);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
}

.palette-footer {
  padding: 0.6rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--bg-elevated);
}

@media (max-width: 640px) {
  .hud-container {
    padding: 0 0.85rem;
    gap: 0.5rem;
  }

  .hud-left {
    gap: 0.55rem;
  }

  .hud-right {
    gap: 0.4rem;
  }

  #hud-cmd-trigger {
    display: none;
  }

  .hud-brand .brand-dossier-text {
    font-size: 0.84rem;
    letter-spacing: 0.02em;
  }

  .theme-toggle-btn {
    width: 30px;
    height: 30px;
  }
}

@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;
  }
}
