/* ============================================
   COMPONENTS — Navbar, Footer, Back-to-top, Modal
   ============================================ */

/* ---------- INTRO LOADER ---------- */
#intro-loader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #0A0E1A;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: clip-path 0.7s cubic-bezier(0.77, 0, 0.175, 1);
  clip-path: inset(0 0 0 0);
}

#intro-loader.exit {
  clip-path: inset(0 0 100% 0);
}

.loader-terminal {
  max-width: 520px;
  width: 100%;
  padding: 24px;
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

.loader-lines {
  margin-bottom: 20px;
}

.loader-line {
  font-size: 0.8rem;
  color: #6C7086;
  line-height: 1.8;
  animation: loaderLineIn 0.3s ease forwards;
  opacity: 0;
}

.loader-line:last-child {
  color: var(--accent-light, #FBBF24);
}

@keyframes loaderLineIn {
  to { opacity: 1; }
}

.loader-name-wrap {
  display: flex;
  align-items: center;
  margin-bottom: 24px;
}

.loader-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: #CDD6F4;
  letter-spacing: -0.5px;
}

.loader-cursor {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent, #6366F1);
  margin-left: 2px;
}

.loader-cursor.blink {
  animation: cursorBlink 0.7s step-end infinite;
}

@keyframes cursorBlink {
  50% { opacity: 0; }
}

.loader-bar {
  width: 100%;
  height: 3px;
  background: #1E1E2E;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 16px;
}

.loader-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-gradient);
  transition: width 0.8s ease;
  border-radius: 2px;
}

.loader-hint {
  font-size: 0.7rem;
  color: #45475A;
  opacity: 0;
  transition: opacity 0.4s ease;
  text-align: center;
}

.loader-hint.show {
  opacity: 1;
}

/* ---------- CUSTOM CURSOR ---------- */
@media (pointer: fine) {
  body { cursor: none; }
  a, button, input, textarea { cursor: none; }
}

#cursor-dot {
  position: fixed;
  top: -4px;
  left: -4px;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 99999;
  transition: width 0.2s ease, height 0.2s ease, opacity 0.2s ease;
  will-change: transform;
}

#cursor-ring {
  position: fixed;
  top: -20px;
  left: -20px;
  width: 40px;
  height: 40px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 99998;
  opacity: 0.4;
  transition: width 0.3s ease, height 0.3s ease, opacity 0.3s ease, border-color 0.3s ease;
  will-change: transform;
}

#cursor-dot.hover {
  width: 6px;
  height: 6px;
  opacity: 0.5;
}

#cursor-ring.hover {
  width: 60px;
  height: 60px;
  top: -30px;
  left: -30px;
  opacity: 0.2;
  border-color: var(--accent-cyan);
}

/* ---------- NAVBAR ---------- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--navbar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: box-shadow 0.3s ease, background 0.3s ease;
  border-bottom: 1px solid transparent;
}

.navbar.scrolled {
  box-shadow: var(--navbar-shadow);
  border-bottom-color: var(--border);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
}

.nav-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  position: relative;
  padding-bottom: 4px;
  transition: color 0.2s ease;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent-gradient);
  border-radius: 1px;
  transition: width 0.3s ease;
}

.nav-links a:hover,
.nav-links a.active { color: var(--text-primary); }

.nav-links a:hover::after,
.nav-links a.active::after { width: 100%; }

/* Theme Toggle */
.theme-toggle {
  background: none;
  border: 2px solid var(--border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--text-primary);
  transition: border-color 0.3s ease, transform 0.3s ease, color 0.3s ease;
  position: relative;
  overflow: hidden;
}

.theme-toggle:hover {
  border-color: var(--accent);
  transform: rotate(15deg);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  position: absolute;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.theme-toggle .icon-sun { opacity: 1; transform: rotate(0deg) scale(1); }
.theme-toggle .icon-moon { opacity: 0; transform: rotate(-90deg) scale(0.5); }

[data-theme="dark"] .theme-toggle .icon-sun { opacity: 0; transform: rotate(90deg) scale(0.5); }
[data-theme="dark"] .theme-toggle .icon-moon { opacity: 1; transform: rotate(0deg) scale(1); }

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
  z-index: 1100;
}

.hamburger span {
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* Mobile Nav Drawer */
.nav-drawer { display: none; }

/* ---------- FOOTER ---------- */
.footer {
  background: var(--footer-bg);
  border-top: 1px solid var(--border);
  padding: 40px 0;
  text-align: center;
  transition: background 0.3s ease;
}

.footer-socials {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}

.footer-socials a {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.footer-socials a:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.footer-text {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.footer-secrets {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.5;
  margin-top: 8px;
  transition: opacity 0.3s ease;
}

.footer-secrets:hover {
  opacity: 1;
}

/* ---------- BACK TO TOP ---------- */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 44px;
  height: 44px;
  background: var(--accent-gradient);
  color: #FFF;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
  z-index: 100;
  box-shadow: 0 4px 15px rgba(159,18,57,0.3);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover { transform: translateY(-3px); }

/* ---------- PROJECT DETAIL MODAL ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  padding: 24px;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  max-width: 700px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 40px;
  position: relative;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.modal-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.modal-header h3 {
  font-size: 1.4rem;
  font-weight: 700;
}

.modal-year {
  padding: 3px 10px;
  background: var(--pill-bg);
  color: var(--pill-text);
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
}

.modal-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.8;
  margin: 16px 0 20px;
}

.modal-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.modal-links {
  display: flex;
  gap: 12px;
}

.modal-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.modal-links .btn-github {
  background: var(--accent-gradient);
  color: #FFF;
}

.modal-links .btn-github:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(159,18,57,0.3);
  color: #FFF;
}

/* ---------- COMMAND PALETTE ---------- */
.palette-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: var(--modal-overlay);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 18vh;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.palette-overlay.active {
  opacity: 1;
  visibility: visible;
}

.palette-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transform: translateY(-10px);
  transition: transform 0.2s ease;
}

.palette-overlay.active .palette-box {
  transform: translateY(0);
}

.palette-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.palette-input-wrap i {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.palette-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 1rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--text-primary);
}

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

.palette-input-wrap kbd {
  padding: 2px 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: 'Space Grotesk', sans-serif;
}

.palette-list {
  max-height: 320px;
  overflow-y: auto;
  padding: 8px;
}

.palette-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: background 0.1s ease, color 0.1s ease;
}

.palette-item i {
  width: 20px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.palette-item.selected {
  background: var(--pill-bg);
  color: var(--text-primary);
}

.palette-item.selected i {
  color: var(--accent);
}

/* ---------- TERMINAL EASTER EGG ---------- */
.terminal-overlay {
  position: fixed;
  inset: 0;
  z-index: 6000;
  background: var(--modal-overlay);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.terminal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.terminal-box {
  background: #1E1E2E;
  border-radius: 12px;
  width: 100%;
  max-width: 640px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  overflow: hidden;
  transform: translateY(10px) scale(0.97);
  transition: transform 0.2s ease;
}

.terminal-overlay.active .terminal-box {
  transform: translateY(0) scale(1);
}

.terminal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #181825;
  border-bottom: 1px solid #313244;
}

.terminal-dots {
  display: flex;
  gap: 6px;
}

.terminal-dots span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot-red { background: #F38BA8; }
.dot-yellow { background: #F9E2AF; }
.dot-green { background: #A6E3A1; }

.terminal-title {
  flex: 1;
  font-family: 'Space Grotesk', monospace;
  font-size: 0.8rem;
  color: #A6ADC8;
}

.terminal-close {
  background: none;
  border: none;
  color: #6C7086;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.2s;
}

.terminal-close:hover { color: #F38BA8; }

.terminal-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  color: #CDD6F4;
}

.terminal-output {
  white-space: pre-wrap;
  word-break: break-word;
}

.terminal-line { margin-bottom: 2px; }

.terminal-cmd { color: #89B4FA; }
.terminal-accent { color: #A6E3A1; font-weight: 600; }
.terminal-error { color: #F38BA8; }

.terminal-input-line {
  display: flex;
  align-items: center;
  margin-top: 8px;
}

.terminal-prompt {
  color: #A6E3A1;
  font-weight: 600;
  margin-right: 4px;
}

.terminal-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: #CDD6F4;
  font-family: inherit;
  font-size: inherit;
  caret-color: #A6E3A1;
}

/* ---------- CONFETTI CANVAS ---------- */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 99999;
}
