/* ==========================================================================
   RESET & ROOT VARIABLES
   ========================================================================== */
:root {
  --bg-main: #090a0f;
  --bg-surface: #11131a;
  --bg-surface-elevated: #161922;
  --bg-hover: #1f2330;
  --border-subtle: #202433;
  --border-active: #3b4259;
  
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-cyan: #38bdf8;
  --accent-green: #34d399;
  --accent-purple: #c084fc;
  --accent-amber: #fbbf24;
  --accent-red: #f87171;
  --accent-blue: #60a5fa;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Fira Code', 'JetBrains Mono', Menlo, Monaco, Consolas, monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  --shadow-lg: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 40px rgba(56, 189, 248, 0.15);

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Light / High-contrast theme alternatives if toggled */
body.theme-matrix {
  --bg-main: #030a05;
  --bg-surface: #07140b;
  --border-subtle: #0d2817;
  --accent-cyan: #00ff66;
  --text-primary: #a3ffc7;
  --text-secondary: #52b77c;
}

body.theme-dracula {
  --bg-main: #21222c;
  --bg-surface: #282a36;
  --border-subtle: #44475a;
  --accent-cyan: #8be9fd;
  --accent-purple: #bd93f9;
  --text-primary: #f8f8f2;
  --text-secondary: #6272a4;
}

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

html, body {
  height: 100%;
  width: 100%;
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-sans);
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   TOP NAVIGATION / VIEW SWITCHER
   ========================================================================== */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: rgba(9, 10, 15, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  letter-spacing: -0.5px;
}

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

.brand-name {
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.2px;
}

.brand-domain {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* View Mode Selector (Segmented control) */
.view-mode-selector {
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mode-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.mode-btn.active {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-active);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-social-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-family: var(--font-mono);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.nav-social-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-active);
}

.editorial-links {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* ==========================================================================
   SHOWCASE MAIN LAYOUT
   ========================================================================== */
.showcase-container {
  display: grid;
  height: calc(100vh - 61px);
  padding: 16px;
  gap: 16px;
  box-sizing: border-box;
}

/* View States */
body.view-split .showcase-container {
  grid-template-columns: 1fr 1fr;
}

body.view-terminal .showcase-container {
  grid-template-columns: 1fr;
  max-width: 1060px;
  margin: 0 auto;
  width: 100%;
}
body.view-terminal #pane-raycast {
  display: none;
}

body.view-raycast .showcase-container {
  grid-template-columns: 1fr;
  max-width: 840px;
  margin: 0 auto;
  width: 100%;
}
body.view-raycast #pane-terminal {
  display: none;
}

/* Panes */
.pane {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.pane-badge {
  position: absolute;
  top: -8px;
  right: 18px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-active);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 2px 10px;
  border-radius: 999px;
  z-index: 10;
  pointer-events: none;
}

/* ==========================================================================
   OPTION 1: MODERN UNIX TERMINAL
   ========================================================================== */
.terminal-window {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #0d0f17;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  font-family: var(--font-mono);
}

.terminal-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #141722;
  border-bottom: 1px solid var(--border-subtle);
  user-select: none;
}

.window-controls {
  display: flex;
  gap: 8px;
}

.control-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.control-dot.close { background: #ff5f56; }
.control-dot.minimize { background: #ffbd2e; }
.control-dot.expand { background: #27c93f; }

.terminal-title {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.term-icon {
  color: var(--accent-amber);
}

.terminal-bar-actions button {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-left: 6px;
  transition: all var(--transition-fast);
}

.terminal-bar-actions button:hover {
  color: var(--text-primary);
  border-color: var(--border-active);
  background: rgba(255, 255, 255, 0.05);
}

.terminal-body {
  position: relative;
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  font-size: 0.88rem;
  line-height: 1.6;
  color: #e2e8f0;
}

.matrix-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.22;
  z-index: 1;
}

.matrix-canvas.hidden {
  display: none;
}

.terminal-output {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Terminal output entries */
.term-entry {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.term-command-echo {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--text-secondary);
}

.term-prompt-prefix {
  color: var(--accent-cyan);
  font-weight: 600;
}

.term-command-text {
  color: #ffffff;
  font-weight: 600;
}

.term-result {
  color: #cbd5e1;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Color classes for rich terminal output */
.term-cyan { color: var(--accent-cyan); }
.term-green { color: var(--accent-green); }
.term-purple { color: var(--accent-purple); }
.term-yellow { color: var(--accent-amber); }
.term-red { color: var(--accent-red); }
.term-blue { color: var(--accent-blue); }
.term-dim { color: var(--text-muted); }
.term-bold { font-weight: 700; }
.term-link {
  color: var(--accent-cyan);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.term-link:hover {
  color: #7dd3fc;
}

/* Active Prompt Line */
.terminal-prompt-line {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.prompt-user { color: var(--accent-green); font-weight: 600; }
.prompt-at { color: var(--text-muted); }
.prompt-host { color: var(--accent-cyan); font-weight: 600; }
.prompt-dir { color: var(--accent-purple); font-weight: 600; }
.prompt-symbol { color: var(--accent-amber); font-weight: 700; }

.input-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
}

.terminal-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: #ffffff;
  caret-color: var(--accent-cyan);
}

/* Quick pills footer */
.terminal-quick-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px;
  background: #11131c;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.76rem;
}

.pills-label {
  color: var(--text-muted);
  font-weight: 600;
  margin-right: 2px;
}

.pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pill:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: var(--accent-cyan);
  color: var(--text-primary);
}

/* ==========================================================================
   OPTION 2: RAYCAST / SPOTLIGHT PALETTE
   ========================================================================== */
.raycast-preview-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #0e111a;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.ambient-glow {
  position: absolute;
  top: -120px;
  right: -80px;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.12) 0%, rgba(168, 85, 247, 0.06) 50%, transparent 70%);
  pointer-events: none;
  z-index: 1;
}

.editorial-content {
  position: relative;
  z-index: 2;
  padding: 32px 36px;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.25);
  font-size: 0.75rem;
  color: var(--accent-green);
  font-weight: 500;
  margin-bottom: 18px;
}

.status-indicator-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulse-dot 2s infinite ease-in-out;
}

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

.editorial-title {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: #ffffff;
  margin-bottom: 8px;
}

.editorial-subtitle {
  font-size: 0.96rem;
  color: var(--text-secondary);
  max-width: 520px;
  line-height: 1.6;
  margin-bottom: 24px;
}

/* Trigger search bar */
.raycast-trigger-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: rgba(22, 26, 38, 0.7);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  transition: all var(--transition-normal);
  margin-bottom: 28px;
}

.raycast-trigger-bar:hover,
.raycast-trigger-bar:focus {
  border-color: var(--accent-cyan);
  background: rgba(28, 33, 48, 0.9);
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.18);
  outline: none;
}

.trigger-left {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
}

.trigger-placeholder {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.shortcut-badge {
  display: flex;
  gap: 4px;
}

kbd {
  display: inline-block;
  padding: 2px 6px;
  background: #1e2230;
  border: 1px solid #33394d;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Pinned Projects mini cards */
.pinned-projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.project-mini-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.project-mini-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-active);
  transform: translateY(-2px);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.project-lang-pill {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}

.lang-rust { background: rgba(248, 113, 113, 0.15); color: #fca5a5; }
.lang-cpp { background: rgba(56, 189, 248, 0.15); color: #7dd3fc; }
.lang-go { background: rgba(52, 211, 153, 0.15); color: #6ee7b7; }

.project-year {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.project-mini-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: #fff;
  font-family: var(--font-mono);
}

.project-mini-card p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.editorial-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.8rem;
}

.tech-stack-summary {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.subtle-link {
  color: var(--accent-cyan);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  transition: opacity var(--transition-fast);
}

.subtle-link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* ==========================================================================
   RAYCAST POPUP MODAL (The spotlight itself)
   ========================================================================== */
.raycast-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: opacity var(--transition-normal);
}

.raycast-modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.raycast-modal {
  width: 100%;
  max-width: 580px;
  background: #141722;
  border: 1px solid var(--border-active);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.85), 0 0 40px rgba(56, 189, 248, 0.12);
  display: flex;
  flex-direction: column;
  max-height: 85%;
  overflow: hidden;
  animation: modal-enter 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-enter {
  from { opacity: 0; transform: scale(0.96) translateY(-8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.raycast-search-header {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  gap: 12px;
}

.search-icon {
  color: var(--accent-cyan);
  flex-shrink: 0;
}

.raycast-search-header input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.98rem;
  color: #ffffff;
  font-family: var(--font-sans);
}

.raycast-search-header input::placeholder {
  color: var(--text-muted);
}

.raycast-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  border-radius: 4px;
}

.raycast-close-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.raycast-results {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.result-section-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 700;
  padding: 8px 10px 4px 10px;
}

.result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.result-item:hover,
.result-item.selected {
  background: rgba(56, 189, 248, 0.12);
  color: #fff;
}

.result-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.result-icon {
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
}

.result-title {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
}

.result-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-left: 6px;
}

.result-badge {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 2px 6px;
  border-radius: 4px;
}

.raycast-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #10121b;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.footer-left {
  display: flex;
  gap: 12px;
}

.shortcut-tip {
  display: flex;
  align-items: center;
  gap: 4px;
}

.raycast-brand-tag {
  font-family: var(--font-mono);
  color: var(--accent-cyan);
}

/* ==========================================================================
   DETAIL MODAL FOR DIALOGS / REPO VIEW
   ========================================================================== */
.detail-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.detail-modal-overlay.hidden {
  display: none;
}

.detail-modal-box {
  background: #161924;
  border: 1px solid var(--border-active);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0,0,0,0.8);
}

.detail-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.detail-modal-header h3 {
  font-size: 1.05rem;
  color: #fff;
}

.modal-close-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
}

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

.detail-modal-body {
  padding: 20px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 900px) {
  body.view-split .showcase-container {
    grid-template-columns: 1fr;
    height: auto;
  }
  .showcase-container {
    height: auto;
    min-height: calc(100vh - 61px);
  }
  .pane {
    height: 580px;
    margin-bottom: 16px;
  }
  .editorial-content {
    padding: 24px;
  }
}

@media (max-width: 768px) {
  .desktop-only {
    display: none !important;
  }
  .top-nav {
    padding: 10px 14px;
  }
  .brand-domain {
    display: none;
  }
  .showcase-container {
    padding: 10px;
    height: auto;
    min-height: calc(100vh - 58px);
  }
  .pane {
    height: calc(100vh - 78px);
    min-height: 540px;
  }
  .editorial-content {
    padding: 22px 16px;
  }
  .editorial-title {
    font-size: 1.85rem;
  }
  .editorial-subtitle {
    font-size: 0.88rem;
  }
  .terminal-body {
    padding: 12px;
    font-size: 0.8rem;
  }
  .term-result {
    font-size: 0.78rem;
  }
  .pinned-projects-grid {
    grid-template-columns: 1fr;
  }
}
