/* =============================================================
   PROJECTS PAGE STYLESHEET
   Extends the design tokens from the main portfolio.
   ============================================================= */

/* -------------------------------------------------------------
   1. DESIGN TOKENS (mirrored from main site for standalone use)
   ------------------------------------------------------------- */
:root {
  --c-bg: #090c11;
  --c-bg-soft: #0d1119;
  --c-surface: #11161f;
  --c-surface-2: #171d29;
  --c-border: #232b3a;
  --c-border-soft: #1a212e;
  --c-text: #e7ecf3;
  --c-text-dim: #8996a8;
  --c-text-faint: #4f5b70;
  --c-cyan: #4cf5e8;
  --c-purple: #b478ff;
  --c-green: #5eeb8f;
  --c-red: #ff6b6b;
  --c-yellow: #f5c451;
  --grad-accent: linear-gradient(120deg, var(--c-cyan), var(--c-purple));
  --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
  --nav-height: 76px;
  --max-width: 1180px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 0.2s;
  --dur-med: 0.45s;
}

/* -------------------------------------------------------------
   2. RESET & BASE
   ------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-height);
}

body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60vw 40vh at 12% 0%, rgba(76, 245, 232, 0.07), transparent 60%),
    radial-gradient(50vw 40vh at 88% 20%, rgba(180, 120, 255, 0.07), transparent 60%);
  pointer-events: none;
}

body.no-scroll { overflow: hidden; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

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

ul { list-style: none; margin: 0; padding: 0; }

img { max-width: 100%; display: block; }

button { font: inherit; cursor: pointer; }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--c-cyan);
  outline-offset: 3px;
  border-radius: 4px;
}

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--c-bg); }
::-webkit-scrollbar-thumb {
  background: var(--c-border);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { background: var(--c-cyan); }
html { scrollbar-color: var(--c-border) var(--c-bg); scrollbar-width: thin; }

/* -------------------------------------------------------------
   3. UTILITIES
   ------------------------------------------------------------- */
.accent-cyan { color: var(--c-cyan); }
.accent-purple { color: var(--c-purple); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--c-cyan);
  letter-spacing: 0.04em;
  margin: 0 0 0.9rem;
}

.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 6.5rem 2rem;
}

.section-inner--narrow { max-width: 700px; text-align: center; }

.cursor-blink {
  animation: blink 1.1s steps(1) infinite;
  color: var(--c-cyan);
}

.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot--red { background: var(--c-red); }
.dot--yellow { background: var(--c-yellow); }
.dot--green { background: var(--c-green); }

/* -------------------------------------------------------------
   4. BUTTONS
   ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}

.btn__icon { width: 1em; height: 1em; }

.btn--primary {
  background: var(--grad-accent);
  color: #05070a;
  font-weight: 600;
}
.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px -8px rgba(76, 245, 232, 0.45);
}

.btn--ghost {
  background: transparent;
  color: var(--c-text);
  border-color: var(--c-border);
}
.btn--ghost:hover {
  border-color: var(--c-cyan);
  color: var(--c-cyan);
  transform: translateY(-2px);
}

.btn--sm { padding: 0.6rem 1.1rem; font-size: 0.82rem; }

/* -------------------------------------------------------------
   5. LOADER / TERMINAL ANIMATION
   ------------------------------------------------------------- */
.projects-loader {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  background: var(--c-bg);
  transition: opacity 0.6s var(--ease-out), visibility 0.6s var(--ease-out);
}

.projects-loader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.projects-loader__window {
  width: min(90vw, 520px);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 40px 80px -30px rgba(76, 245, 232, 0.15);
}

.projects-loader__bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.85rem 1rem;
  background: var(--c-surface-2);
  border-bottom: 1px solid var(--c-border);
}

.projects-loader__filename {
  margin-left: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--c-text-faint);
}

.projects-loader__body {
  margin: 0;
  min-height: 100px;
  padding: 1.4rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.9;
  color: var(--c-text-dim);
  white-space: pre-wrap;
  word-break: break-word;
}

.projects-loader__skip {
  background: none;
  border: none;
  color: var(--c-text-faint);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  transition: color var(--dur-fast) var(--ease-out);
}
.projects-loader__skip:hover { color: var(--c-cyan); }

/* -------------------------------------------------------------
   6. NAV
   ------------------------------------------------------------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  background: rgba(9, 12, 17, 0.6);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-med) var(--ease-out), background var(--dur-med) var(--ease-out);
}

.nav.is-scrolled {
  border-bottom-color: var(--c-border-soft);
  background: rgba(9, 12, 17, 0.85);
}

.nav__inner {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav__brand {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 2.25rem;
}

.nav__link {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--c-text-dim);
  position: relative;
  padding: 0.3rem 0;
  transition: color var(--dur-fast) var(--ease-out);
}
.nav__link::after {
  content: '';
  position: absolute;
  left: 0; bottom: -2px;
  width: 0;
  height: 1px;
  background: var(--grad-accent);
  transition: width var(--dur-fast) var(--ease-out);
}
.nav__link:hover { color: var(--c-text); }
.nav__link:hover::after { width: 100%; }

.nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
}
.nav__toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 0 auto;
  background: var(--c-text);
  transition: transform var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out);
}
.nav__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* -------------------------------------------------------------
   7. PAGE HEADER
   ------------------------------------------------------------- */
.page-header {
  padding-top: var(--nav-height);
}

.page-header__title {
  font-size: clamp(2rem, 4vw, 2.75rem);
  margin-bottom: 0.75rem;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.page-header__subtitle {
  color: var(--c-text-dim);
  max-width: 560px;
  font-size: 1.05rem;
}

/* -------------------------------------------------------------
   8. PROJECTS GRID
   ------------------------------------------------------------- */
.projects__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem;
}

/* Featured (main) project: spans 2 columns and 2 rows */
.project-card--main {
  grid-column: span 2;
  grid-row: span 2;
}

.project-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--dur-med) var(--ease-out),
              border-color var(--dur-med) var(--ease-out),
              box-shadow var(--dur-med) var(--ease-out);
}

.project-card:hover {
  transform: translateY(-6px);
  border-color: rgba(76, 245, 232, 0.4);
  box-shadow: 0 25px 50px -20px rgba(76, 245, 232, 0.25);
}

.project-card__bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.8rem 1rem;
  background: var(--c-surface-2);
  border-bottom: 1px solid var(--c-border);
}

.project-card__body {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.project-card__title {
  font-size: 1.2rem;
  margin-bottom: 0.6rem;
  transition: color var(--dur-fast) var(--ease-out);
}
.project-card:hover .project-card__title { color: var(--c-cyan); }

.project-card--main .project-card__title {
  font-size: 1.5rem;
}

.project-card__desc {
  color: var(--c-text-dim);
  font-size: 0.92rem;
  margin-bottom: 1.25rem;
  flex: 1;
}

.project-card--main .project-card__desc {
  font-size: 1rem;
}

.project-card__stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.project-card__stack li {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--c-purple);
  background: rgba(180, 120, 255, 0.1);
  border: 1px solid rgba(180, 120, 255, 0.25);
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
}

.project-card__footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--c-border-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* -------------------------------------------------------------
   9. FILTERS / CATEGORY TABS
   ------------------------------------------------------------- */
.filters-section {
  padding-top: 0;
}

.filters-section .section-inner {
  padding-top: 0;
  padding-bottom: 2rem;
}

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.category-tab {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 0.55rem 1.2rem;
  border-radius: 999px;
  border: 1px solid var(--c-border);
  background: transparent;
  color: var(--c-text-dim);
  transition: all var(--dur-fast) var(--ease-out);
}

.category-tab:hover {
  border-color: var(--c-cyan);
  color: var(--c-cyan);
}

.category-tab.is-active {
  background: var(--grad-accent);
  border-color: transparent;
  color: #05070a;
  font-weight: 600;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.tech-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  flex: 1;
}

.tech-filter {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(180, 120, 255, 0.25);
  background: rgba(180, 120, 255, 0.08);
  color: var(--c-purple);
  transition: all var(--dur-fast) var(--ease-out);
  cursor: pointer;
}

.tech-filter:hover {
  background: rgba(180, 120, 255, 0.18);
  border-color: var(--c-purple);
}

.tech-filter.is-active {
  background: var(--c-purple);
  border-color: var(--c-purple);
  color: #fff;
}

.search-wrapper {
  position: relative;
  min-width: 220px;
  flex-shrink: 0;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--c-text-faint);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 0.6rem 1rem 0.6rem 2.2rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--c-text);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--dur-fast) var(--ease-out);
}

.search-input::placeholder {
  color: var(--c-text-faint);
}

.search-input:focus {
  border-color: var(--c-cyan);
}

.filter-summary {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--c-text-faint);
  min-height: 1.5rem;
}

/* -------------------------------------------------------------
   10. NO RESULTS / EMPTY STATE
   ------------------------------------------------------------- */
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 2rem;
  color: var(--c-text-dim);
  font-family: var(--font-mono);
}

.no-results p {
  margin-bottom: 1.5rem;
}

/* -------------------------------------------------------------
   11. BACK SECTION
   ------------------------------------------------------------- */
.back-section {
  padding-bottom: 2rem;
}

/* -------------------------------------------------------------
   12. FOOTER
   ------------------------------------------------------------- */
.footer { border-top: 1px solid var(--c-border-soft); }

.footer__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--c-text-faint);
}

/* -------------------------------------------------------------
   13. SCROLL REVEAL
   ------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* -------------------------------------------------------------
   14. KEYFRAMES
   ------------------------------------------------------------- */
@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* -------------------------------------------------------------
   15. RESPONSIVE
   ------------------------------------------------------------- */
@media (max-width: 1024px) {
  .projects__grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .project-card--main {
    grid-column: span 2;
    grid-row: span 1;
  }
}

@media (max-width: 720px) {
  .nav__links {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: rgba(9, 12, 17, 0.97);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--c-border-soft);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out), visibility var(--dur-fast);
  }
  .nav__links.is-open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }
  .nav__links .nav__link {
    width: 100%;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--c-border-soft);
  }
  .nav__toggle { display: flex; }

  .section-inner { padding: 4.5rem 1.5rem; }

  .projects__grid {
    grid-template-columns: 1fr;
  }
  .project-card--main {
    grid-column: span 1;
    grid-row: span 1;
  }
}

@media (max-width: 480px) {
  .project-card__footer {
    flex-direction: column;
  }
  .project-card__footer .btn {
    justify-content: center;
  }
}

/* -------------------------------------------------------------
   16. REDUCED MOTION
   ------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
    scroll-behavior: auto !important;
  }
}