/* =========================================================
   Melih Hopa — Portfolio styles
   Loaded after Tailwind CDN. Custom utilities + animations.
   ========================================================= */

:root {
  --c-cyan: #06b6d4;
  --c-blue: #3b82f6;
  --c-violet: #8b5cf6;
  --c-bg: #0f172a;
  --c-bg-2: #1e293b;
  --c-text: #e5e7eb;
  --c-mute: #6b7280;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.font-mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* Gradient text utility */
.gradient-text {
  background: linear-gradient(135deg, var(--c-cyan) 0%, var(--c-blue) 50%, var(--c-violet) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--c-bg); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--c-cyan), var(--c-violet));
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #22d3ee, #a78bfa); }

/* Selection */
::selection { background: rgba(6, 182, 212, 0.4); color: #fff; }

/* ---------- Loading screen ---------- */
#loading-screen {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  display: flex; justify-content: center; align-items: center;
  z-index: 9999; transition: opacity 0.5s ease-out;
}
#loading-screen.hidden { opacity: 0; pointer-events: none; }
.loader {
  width: 60px; height: 60px;
  border: 5px solid #1e293b;
  border-top: 5px solid var(--c-cyan);
  border-right: 5px solid var(--c-blue);
  border-bottom: 5px solid var(--c-violet);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Scroll progress bar ---------- */
#scroll-progress {
  position: fixed; top: 0; left: 0;
  width: 0%; height: 3px;
  background: linear-gradient(90deg, var(--c-cyan) 0%, var(--c-blue) 50%, var(--c-violet) 100%);
  z-index: 9998; transition: width 0.1s ease-out;
}

/* ---------- Animations ---------- */
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-15px); } }
.float-animation { animation: float 6s ease-in-out infinite; }

@keyframes slide-up { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: translateY(0); } }
.animate-slide-up { animation: slide-up 0.8s ease-out forwards; opacity: 0; }

@keyframes glow {
  0%,100% { box-shadow: 0 0 20px rgba(6,182,212,0.4); }
  50% { box-shadow: 0 0 40px rgba(6,182,212,0.8), 0 0 60px rgba(59,130,246,0.5); }
}
.glow-animation { animation: glow 3s ease-in-out infinite; }

@keyframes rotate { to { transform: rotate(360deg); } }
.rotate-animation { animation: rotate 20s linear infinite; }

@keyframes pulse-ring {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(6,182,212,0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 24px rgba(6,182,212,0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(6,182,212,0); }
}
.pulse-ring { animation: pulse-ring 2.4s ease-out infinite; }

/* ---------- Nav ---------- */
.nav-link { position: relative; }
.nav-link::after {
  content: ''; position: absolute; bottom: -4px; left: 0;
  width: 0; height: 2px;
  background: linear-gradient(90deg, var(--c-cyan), var(--c-violet));
  transition: width 0.3s ease;
}
.nav-link:hover::after,
.nav-link.active::after { width: 100%; }

.lang-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

/* ---------- Terminal ---------- */
.term-prompt  { color: #34d399; }
.term-user    { color: var(--c-cyan); }
.term-path    { color: #a78bfa; }
.term-sym     { color: #6b7280; }
.term-cmd     { color: #f3f4f6; }
.term-out     { color: #cbd5e1; }
.term-key     { color: #fbbf24; }
.term-val     { color: #67e8f9; }
.term-success { color: #34d399; }
.term-muted   { color: #6b7280; }
.term-link    { color: #60a5fa; text-decoration: underline; text-underline-offset: 2px; }
.term-cursor {
  display: inline-block;
  width: 8px; height: 14px;
  background: var(--c-cyan);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: term-blink 1s steps(2) infinite;
}
@keyframes term-blink { 50% { opacity: 0; } }
.term-line { white-space: pre-wrap; word-break: break-word; }
.term-art {
  color: var(--c-cyan);
  line-height: 1.05;
  font-size: 0.72rem;
}

/* ---------- Mermaid wrap (case studies) ---------- */
.mermaid-wrap {
  background: var(--c-bg);
  border-radius: 1rem;
  padding: 1.5rem;
  border: 1px solid rgba(75,85,99,.4);
}
.mermaid { font-family: 'JetBrains Mono', monospace !important; }

/* ---------- Project filter buttons ---------- */
.project-filter {
  background: rgba(31, 41, 55, 0.6);
  border-color: rgb(55, 65, 81);
  color: rgb(209, 213, 219);
}
.project-filter:hover {
  border-color: rgba(6, 182, 212, 0.4);
  color: rgb(103, 232, 249);
}
.project-filter--active {
  background: rgba(6, 182, 212, 0.15);
  border-color: rgba(6, 182, 212, 0.4);
  color: rgb(165, 243, 252);
}

/* ---------- Cmd+K palette ---------- */
#cmdk-overlay { align-items: flex-start; }
#cmdk-modal { animation: cmdk-in 0.18s ease-out; }
@keyframes cmdk-in {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cmdk-item { transition: background-color 0.12s ease; }

/* ---------- Mobile / responsive ---------- */
@media (max-width: 768px) {
  .text-7xl { font-size: 2.5rem; }
  .text-5xl { font-size: 2.1rem; }
  #particles-js { opacity: 0.4; }

  /* Larger touch targets */
  nav a, nav button, footer a { min-height: 40px; }

  /* Terminal smaller on mobile */
  .term-art { font-size: 0.58rem; }

  /* Hero CTAs full-width on tiny screens */
  .hero-cta-row > a {
    flex: 1 1 calc(50% - 0.5rem);
    text-align: center;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .text-7xl { font-size: 2rem; }
  #particles-js { opacity: 0.25; }
  .term-art { font-size: 0.5rem; line-height: 1; }

  /* Cmd+K becomes bottom-sheet style */
  #cmdk-overlay { padding-top: 0; align-items: flex-end; }
  #cmdk-modal {
    border-radius: 1.25rem 1.25rem 0 0;
    max-height: 85vh;
    width: 100%;
    margin: 0 !important;
  }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .term-cursor { animation: none; opacity: 1; }
}
