/* ==========================================================================
   Cyber-Terminal Portfolio Stylesheet
   Author: Abdul Hayy Khan
   Responsive: Mobile-First, Touch-Optimized, Scalable Architecture
   ========================================================================== */

:root {
  --font-mono: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

/* --------------------------------------------------------------------------
   Themes (Dark / Terminal Skin by default)
   -------------------------------------------------------------------------- */
[data-theme="dark"] {
  --bg-page: #02050b;
  --bg-surface: rgba(5, 13, 24, 0.88);
  --bg-surface-alt: #091423;
  --bg-nav: rgba(6, 16, 27, 0.88);
  --bg-header-bar: #050a07;
  --bg-chip: rgba(10, 36, 14, 0.8);
  --bg-input: rgba(6, 17, 29, 0.92);

  --text-main: #9cff98;
  --text-heading: #f4ffef;
  --text-muted: rgba(181, 255, 159, 0.75);
  --text-subtle: #78ff6b;
  --text-chip: #b5ff9f;
  --text-dim: rgba(156, 255, 152, 0.6);

  --border-color: rgba(119, 255, 112, 0.28);
  --border-subtle: rgba(119, 255, 112, 0.15);
  --border-focus: #78ff6b;
  --border-chip: rgba(120, 255, 107, 0.45);

  --glow-primary: rgba(98, 255, 129, 0.55);
  --glow-soft: rgba(93, 255, 121, 0.18);
  --glow-card: rgba(93, 255, 121, 0.22);
  --glow-text: 0 0 10px rgba(98, 255, 129, 0.45), 0 0 24px rgba(95, 253, 116, 0.2);

  --panel-shadow: 0 0 0 1px rgba(98, 255, 122, 0.16), 0 16px 40px rgba(0, 0, 0, 0.4);
  --hover-shadow: 0 0 0 1px rgba(131, 255, 127, 0.35), 0 18px 48px rgba(17, 122, 44, 0.32), 0 0 24px rgba(65, 255, 131, 0.2);
  --scanline-color: rgba(120, 255, 107, 0.04);
  --grid-line-color: rgba(111, 255, 128, 0.06);
}

[data-theme="light"] {
  --bg-page: #f4fbff;
  --bg-surface: rgba(255, 255, 255, 0.94);
  --bg-surface-alt: #eaf6ff;
  --bg-nav: rgba(255, 255, 255, 0.9);
  --bg-header-bar: #e1f2fe;
  --bg-chip: rgba(224, 242, 254, 0.95);
  --bg-input: #ffffff;

  --text-main: #1e293b;
  --text-heading: #0f172a;
  --text-muted: #334155;
  --text-subtle: #0369a1;
  --text-chip: #0c4a6e;
  --text-dim: #64748b;

  --border-color: rgba(14, 165, 233, 0.28);
  --border-subtle: rgba(14, 165, 233, 0.16);
  --border-focus: #0284c7;
  --border-chip: rgba(14, 116, 144, 0.25);

  --glow-primary: rgba(14, 165, 233, 0.28);
  --glow-soft: rgba(56, 189, 248, 0.1);
  --glow-card: rgba(56, 189, 248, 0.2);
  --glow-text: none;

  --panel-shadow: 0 0 0 1px rgba(56, 189, 248, 0.16), 0 14px 36px rgba(15, 23, 42, 0.06);
  --hover-shadow: 0 0 0 1px rgba(14, 165, 233, 0.35), 0 18px 42px rgba(37, 99, 235, 0.12), 0 0 20px rgba(14, 165, 233, 0.12);
  --scanline-color: rgba(15, 23, 42, 0.015);
  --grid-line-color: rgba(2, 132, 199, 0.06);
}

/* --------------------------------------------------------------------------
   Reset & Base
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  width: 100%;
  overflow-x: hidden;
}

body {
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-page);
  color: var(--text-main);
  font-family: var(--font-mono);
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 300ms ease, color 300ms ease;
}

img, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Selection */
::selection {
  background: rgba(120, 255, 107, 0.3);
  color: #ffffff;
}
[data-theme="light"] ::selection {
  background: rgba(14, 165, 233, 0.3);
  color: #0f172a;
}

/* --------------------------------------------------------------------------
   Background Ambient Grids & CRT Scanlines
   -------------------------------------------------------------------------- */
.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-size: 42px 42px;
  background-image:
    linear-gradient(var(--grid-line-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line-color) 1px, transparent 1px);
  z-index: 0;
}

.bg-radial {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 0%, var(--glow-soft), transparent 60%);
  z-index: 1;
}

.crt-scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    180deg,
    var(--scanline-color) 0,
    var(--scanline-color) 1px,
    transparent 1px,
    transparent 3px
  );
  z-index: 2;
}

/* --------------------------------------------------------------------------
   Layout Container
   -------------------------------------------------------------------------- */
.container {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0.75rem 0.75rem 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (min-width: 480px) {
  .container {
    padding: 1.25rem 1rem 3.5rem;
    gap: 2rem;
  }
}

@media (min-width: 768px) {
  .container {
    padding: 2rem 2rem 5rem;
    gap: 3rem;
  }
}

/* --------------------------------------------------------------------------
   Terminal Cards & Panels
   -------------------------------------------------------------------------- */
.terminal-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--panel-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
  transition: transform 300ms ease, box-shadow 300ms ease, border-color 300ms ease;
}

@media (min-width: 768px) {
  .terminal-panel {
    border-radius: var(--radius-lg);
  }
}

.tilt-card {
  --tilt-x: 0deg;
  --tilt-y: 0deg;
  --tilt-z: 0px;
  --tilt-scale: 1;
  --tilt-glow-x: 50%;
  --tilt-glow-y: 50%;
  transform-style: preserve-3d;
  transform: perspective(1000px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) translateZ(var(--tilt-z)) scale(var(--tilt-scale));
  transition: transform 250ms cubic-bezier(0.2, 0, 0.2, 1), box-shadow 250ms ease, border-color 250ms ease;
  will-change: transform;
}

.tilt-card::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(circle at var(--tilt-glow-x) var(--tilt-glow-y), var(--glow-card) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 250ms ease;
}

.tilt-card[data-tilt-active="true"]::after {
  opacity: 1;
}

.tilt-card:hover {
  border-color: var(--border-focus);
  box-shadow: var(--hover-shadow);
}

.text-glow {
  text-shadow: var(--glow-text);
}

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */
.nav-panel {
  position: sticky;
  top: 0.5rem;
  z-index: 100;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  background: var(--bg-nav);
  border: 1px solid var(--border-color);
  box-shadow: var(--panel-shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

@media (min-width: 768px) {
  .nav-panel {
    top: 1rem;
    padding: 0.75rem 1.25rem;
    flex-wrap: nowrap;
    gap: 0.75rem;
  }
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-subtle);
  font-weight: 700;
}

@media (min-width: 768px) {
  .nav-brand {
    flex: 0 0 auto;
    order: 1;
  }
}

.nav-brand-icon {
  border-radius: 6px;
  box-shadow: 0 0 8px rgba(120, 255, 107, 0.4);
  flex-shrink: 0;
}

.nav-brand-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 175px;
}

@media (min-width: 400px) {
  .nav-brand-text {
    max-width: 220px;
  }
}

@media (min-width: 768px) {
  .nav-brand-text {
    max-width: none;
  }
}

/* Action controls (Theme Toggle + Mobile Menu Button) */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .nav-actions {
    order: 3;
    gap: 0.5rem;
  }
}

.mobile-menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 38px;
  padding: 0.35rem;
  font-size: 1.15rem;
  line-height: 1;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  cursor: pointer;
  transition: all 180ms ease;
  user-select: none;
}

.mobile-menu-toggle:hover,
.nav-panel.menu-open .mobile-menu-toggle {
  border-color: var(--border-focus);
  color: var(--text-heading);
  background: rgba(120, 255, 107, 0.12);
  box-shadow: 0 0 10px var(--glow-soft);
}

[data-theme="light"] .mobile-menu-toggle:hover,
[data-theme="light"] .nav-panel.menu-open .mobile-menu-toggle {
  background: rgba(14, 165, 233, 0.12);
}

@media (min-width: 768px) {
  .mobile-menu-toggle {
    display: none !important;
  }
}

/* Navigation Links (Mobile Dropdown vs Desktop Inline) */
.nav-links {
  display: none;
  width: 100%;
}

/* Mobile Dropdown Open State */
.nav-panel.menu-open .nav-links {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: 100%;
  margin-top: 0.65rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  animation: navDropdownSlide 200ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes navDropdownSlide {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Desktop View */
@media (min-width: 768px) {
  .nav-links {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    width: auto;
    order: 2;
    margin: 0;
    padding: 0;
    border: none;
  }

  .nav-panel.menu-open .nav-links {
    margin: 0;
    padding: 0;
    border: none;
    animation: none;
  }
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.85rem;
  min-height: 38px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-main);
  text-decoration: none;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: all 180ms ease;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

/* Mobile dropdown link enhancement */
@media (max-width: 767px) {
  .nav-panel.menu-open .nav-link {
    width: 100%;
    justify-content: flex-start;
    padding: 0.65rem 0.95rem;
    min-height: 44px;
    font-size: 0.84rem;
    background: var(--bg-surface-alt);
    border-color: var(--border-subtle);
  }

  .nav-panel.menu-open .nav-link::before {
    content: "$ cd /";
    color: var(--text-subtle);
    font-weight: 700;
    margin-right: 0.35rem;
    opacity: 0.85;
  }
}

.nav-btn:hover {
  border-color: var(--border-focus);
  color: var(--text-heading);
  background: rgba(120, 255, 107, 0.08);
}

[data-theme="light"] .nav-btn:hover {
  background: rgba(14, 165, 233, 0.08);
}

.theme-toggle-btn {
  min-width: 38px;
  min-height: 38px;
  padding: 0.35rem;
  font-size: 0.95rem;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Hero Section
   -------------------------------------------------------------------------- */
.hero-window {
  overflow: hidden;
  border-radius: var(--radius-lg);
}

@media (min-width: 768px) {
  .hero-window {
    border-radius: var(--radius-xl);
  }
}

.terminal-titlebar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  background: var(--bg-header-bar);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.72rem;
  color: var(--text-dim);
}

@media (min-width: 640px) {
  .terminal-titlebar {
    padding: 0.65rem 1.25rem;
    font-size: 0.75rem;
  }
}

.window-dots {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}
.dot-red { background-color: #ef4444; }
.dot-yellow { background-color: #eab308; }
.dot-green { background-color: #22c55e; }

.terminal-prompt-path {
  margin-left: 0.35rem;
  font-weight: 500;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

@media (min-width: 480px) {
  .terminal-prompt-path {
    max-width: 320px;
  }
}

@media (min-width: 768px) {
  .terminal-prompt-path {
    max-width: none;
  }
}

.hero-content {
  padding: 1.25rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

@media (min-width: 480px) {
  .hero-content {
    padding: 1.75rem 1.35rem;
    gap: 1.35rem;
  }
}

@media (min-width: 768px) {
  .hero-content {
    padding: 2.5rem;
    gap: 1.75rem;
  }
}

.hero-eyebrow {
  font-size: clamp(0.65rem, 2.2vw, 0.75rem);
  letter-spacing: clamp(0.08em, 1.5vw, 0.22em);
  color: var(--text-subtle);
  font-weight: 600;
  word-break: break-word;
}

.hero-name {
  font-size: clamp(1.75rem, 6.5vw, 3.8rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  color: var(--text-heading);
  line-height: 1.12;
  word-break: break-word;
}

.hero-bio {
  font-size: clamp(0.88rem, 2.2vw, 1.1rem);
  line-height: 1.68;
  color: var(--text-muted);
  max-width: 860px;
  word-break: break-word;
}

.prompt-char {
  color: var(--text-subtle);
  font-weight: 700;
  margin-right: 0.35rem;
}

/* Stats Row */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
  margin-top: 0.25rem;
}

@media (min-width: 420px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 700px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.stat-card {
  padding: 0.75rem 0.85rem;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

@media (min-width: 640px) {
  .stat-card {
    padding: 1rem 1.25rem;
  }
}

.stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

.stat-value {
  margin-top: 0.35rem;
  font-size: clamp(0.85rem, 2.4vw, 0.95rem);
  font-weight: 700;
  color: var(--text-heading);
  word-break: break-word;
}

/* Action Buttons */
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.25rem;
}

.btn-primary, .btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 0.95rem;
  min-height: 42px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all 180ms ease;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
}

@media (max-width: 440px) {
  .hero-actions .btn-primary,
  .hero-actions .btn-outline {
    flex: 1 1 calc(50% - 0.3rem);
    min-width: 120px;
  }
}

@media (min-width: 640px) {
  .btn-primary, .btn-outline {
    padding: 0.6rem 1.15rem;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
  }
}

.btn-primary {
  color: var(--text-heading);
  background: rgba(120, 255, 107, 0.12);
  border: 1px solid var(--border-color);
}

[data-theme="light"] .btn-primary {
  background: rgba(14, 165, 233, 0.12);
  color: var(--text-heading);
}

.btn-primary:hover {
  background: var(--border-color);
  color: #000000;
  box-shadow: 0 0 16px var(--glow-primary);
}

[data-theme="light"] .btn-primary:hover {
  color: #ffffff;
}

.btn-outline {
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border-subtle);
}

.btn-outline:hover {
  border-color: var(--border-focus);
  color: var(--text-heading);
}

/* --------------------------------------------------------------------------
   Grid Layouts & Sections
   -------------------------------------------------------------------------- */
.grid-2col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 768px) {
  .grid-2col {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }
}

.grid-3col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 600px) {
  .grid-3col {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.15rem;
  }
}

@media (min-width: 1024px) {
  .grid-3col {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
  }
}

.section-card {
  padding: 1.15rem 0.85rem;
}

@media (min-width: 480px) {
  .section-card {
    padding: 1.5rem;
  }
}

.card-meta {
  font-size: 0.7rem;
  color: var(--text-subtle);
  letter-spacing: 0.08em;
}

.card-title {
  margin-top: 0.45rem;
  font-size: clamp(1.05rem, 3vw, 1.25rem);
  font-weight: 700;
  color: var(--text-heading);
  word-break: break-word;
}

.card-body {
  margin-top: 0.65rem;
  font-size: clamp(0.85rem, 2vw, 0.92rem);
  line-height: 1.65;
  color: var(--text-muted);
  word-break: break-word;
}

.card-list {
  list-style: none;
  margin-top: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: clamp(0.82rem, 2vw, 0.92rem);
  color: var(--text-muted);
}

.card-list li {
  word-break: break-word;
}

.card-list li strong {
  color: var(--text-heading);
}

/* --------------------------------------------------------------------------
   Chips & Badges
   -------------------------------------------------------------------------- */
.chip-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.65rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.55rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--bg-chip);
  color: var(--text-chip);
  border: 1px solid var(--border-chip);
  border-radius: var(--radius-sm);
  transition: transform 150ms ease, border-color 150ms ease;
  word-break: break-word;
}

.chip:hover {
  transform: translateY(-1px);
  border-color: var(--border-focus);
}

/* --------------------------------------------------------------------------
   Highlights Section Layout
   -------------------------------------------------------------------------- */
#highlights {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 640px) {
  #highlights {
    gap: 1.25rem;
  }
}

.highlights-2col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .highlights-2col {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }
}

/* --------------------------------------------------------------------------
   Experience Card — full-width accordion
   -------------------------------------------------------------------------- */
.exp-card {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.exp-item {
  border-top: 1px solid var(--border-subtle);
  padding: 0;
}

.exp-item:first-of-type {
  border-top: none;
  margin-top: 0.65rem;
}

.exp-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  padding: 0.8rem 2rem 0.8rem 0;
  min-height: 44px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  outline: none;
  position: relative;
}

/* Remove default browser triangle */
.exp-summary::-webkit-details-marker { display: none; }
.exp-summary::marker { display: none; }

.exp-summary:hover .exp-org {
  color: var(--text-heading);
}

.exp-org {
  font-size: clamp(0.88rem, 2.5vw, 0.98rem);
  font-weight: 700;
  color: var(--text-subtle);
  transition: color 150ms ease;
  word-break: break-word;
}

.exp-role {
  font-size: clamp(0.78rem, 2vw, 0.84rem);
  color: var(--text-muted);
  word-break: break-word;
}

.exp-date {
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  display: inline-block;
}

.exp-chevron {
  position: absolute;
  right: 0.25rem;
  top: 1rem;
  font-size: 1.05rem;
  color: var(--text-dim);
  transition: transform 250ms ease;
  line-height: 1;
}

details[open] > .exp-summary .exp-chevron {
  transform: rotate(180deg);
}

.exp-bullets {
  list-style: none;
  padding: 0 0 0.85rem 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.exp-bullets li {
  font-size: clamp(0.82rem, 2vw, 0.88rem);
  line-height: 1.6;
  color: var(--text-muted);
  padding-left: 1.15rem;
  position: relative;
  word-break: break-word;
}

.exp-bullets li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--text-subtle);
  font-size: 0.75rem;
  top: 0.18em;
}

.exp-bullets li strong {
  color: var(--text-heading);
}

/* --------------------------------------------------------------------------
   Projects Showcase & Filtering
   -------------------------------------------------------------------------- */
.projects-header-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.projects-top-bar {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

@media (min-width: 640px) {
  .projects-top-bar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.projects-title {
  font-size: clamp(0.95rem, 2.8vw, 1.2rem);
  font-weight: 700;
  color: var(--text-heading);
  word-break: break-word;
}

.projects-count-badge {
  font-size: 0.72rem;
  color: var(--text-subtle);
}

/* Search & Filter Controls */
.filter-controls {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.4rem;
}

@media (min-width: 768px) {
  .filter-controls {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.search-input-wrapper {
  position: relative;
  width: 100%;
  max-width: 100%;
}

@media (min-width: 768px) {
  .search-input-wrapper {
    max-width: 400px;
  }
}

.search-input {
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 1rem 0.55rem 2.2rem;
  font-size: 0.84rem;
  font-family: inherit;
  color: var(--text-heading);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 10px var(--glow-primary);
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 0.85rem;
  pointer-events: none;
}

.filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.filter-btn {
  padding: 0.35rem 0.65rem;
  min-height: 36px;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  transition: all 150ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.filter-btn:hover {
  color: var(--text-heading);
  border-color: var(--border-focus);
}

.filter-btn.active {
  background: var(--border-color);
  color: #000000;
  border-color: var(--border-color);
  font-weight: 700;
}

[data-theme="light"] .filter-btn.active {
  color: #ffffff;
}

.projects-grid {
  margin-top: 1.25rem;
}

@media (min-width: 640px) {
  .projects-grid {
    margin-top: 1.5rem;
  }
}

/* Project Card */
.project-card {
  padding: 1.1rem 0.95rem;
  min-height: auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.85rem;
  word-break: break-word;
}

@media (min-width: 600px) {
  .project-card {
    padding: 1.25rem;
    min-height: 220px;
    gap: 1rem;
  }
}

.project-card-header {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.project-repo-index {
  font-size: 0.68rem;
  color: var(--text-subtle);
  letter-spacing: 0.08em;
}

.project-card-title {
  font-size: clamp(0.98rem, 2.5vw, 1.08rem);
  font-weight: 700;
  color: var(--text-heading);
  word-break: break-word;
}

.project-card-desc {
  font-size: clamp(0.82rem, 2vw, 0.86rem);
  line-height: 1.55;
  color: var(--text-muted);
  flex-grow: 1;
  word-break: break-word;
}

.project-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-subtle);
}

.project-repo-link {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-subtle);
  text-decoration: none;
  font-weight: 600;
  transition: color 150ms ease;
}

.project-repo-link:hover {
  color: var(--text-heading);
}

.chip--flagship {
  background: rgba(255, 210, 60, 0.12);
  border-color: rgba(255, 210, 60, 0.5);
  color: #ffd23c;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.project-card--flagship {
  border-color: rgba(255, 210, 60, 0.22);
  box-shadow: 0 0 0 1px rgba(255, 210, 60, 0.14), var(--panel-shadow);
}

.view-all-repos {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  padding: 1.25rem 0 0.25rem;
}

.view-all-repos .btn-outline {
  min-height: 44px;
  width: 100%;
  max-width: 380px;
  justify-content: center;
}

.no-results-msg {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-dim);
  font-size: 0.88rem;
}

/* --------------------------------------------------------------------------
   Tech Stack Section
   -------------------------------------------------------------------------- */
.stack-title {
  margin-top: 0;
}

.stack-grid {
  margin-top: 1rem;
}

@media (min-width: 768px) {
  .stack-grid {
    margin-top: 1.25rem;
  }
}

.stat-card--full {
  grid-column: 1;
}

@media (min-width: 768px) {
  .stat-card--full {
    grid-column: 1 / -1;
  }
}

/* --------------------------------------------------------------------------
   Contact Section & Footer
   -------------------------------------------------------------------------- */
.contact-window {
  padding: 1.5rem 1rem;
  border-radius: var(--radius-lg);
}

@media (min-width: 480px) {
  .contact-window {
    padding: 2rem 1.5rem;
  }
}

@media (min-width: 768px) {
  .contact-window {
    padding: 3rem;
    border-radius: var(--radius-xl);
  }
}

.contact-title {
  font-size: clamp(1.2rem, 4.5vw, 1.8rem);
  line-height: 1.2;
  word-break: break-word;
}

.contact-bio {
  margin-top: 0.65rem;
  font-size: clamp(0.86rem, 2.2vw, 0.95rem);
  line-height: 1.65;
  word-break: break-word;
}

.contact-actions {
  margin-top: 1.1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

@media (max-width: 440px) {
  .contact-actions .btn-primary,
  .contact-actions .btn-outline {
    flex: 1 1 calc(50% - 0.3rem);
    min-width: 120px;
  }
}

.site-footer {
  text-align: center;
  padding: 1.75rem 0.5rem;
  font-size: clamp(0.72rem, 2vw, 0.78rem);
  color: var(--text-dim);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  line-height: 1.6;
  word-break: break-word;
}

.site-footer a {
  color: var(--text-subtle);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Touch Device Micro-Interactions & Optimizations
   -------------------------------------------------------------------------- */
@media (hover: none) {
  .tilt-card {
    transform: none !important;
  }

  .nav-btn:active,
  .filter-btn:active,
  .btn-primary:active,
  .btn-outline:active {
    transform: scale(0.97);
    opacity: 0.9;
  }

  .exp-summary:active {
    opacity: 0.85;
  }
}

/* --------------------------------------------------------------------------
   Theme Switch Confirmation Modal (Cyber-Terminal Warning)
   -------------------------------------------------------------------------- */
.theme-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(2, 5, 11, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: none;
}

.theme-modal-backdrop:not([hidden]) {
  pointer-events: auto;
}

.theme-modal-backdrop.modal-visible {
  opacity: 1;
}

.theme-modal-box {
  width: 100%;
  max-width: 480px;
  background: var(--bg-surface);
  border: 1px solid rgba(234, 179, 8, 0.5);
  box-shadow: 0 0 24px rgba(234, 179, 8, 0.22), var(--panel-shadow);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transform: scale(0.92) translateY(10px);
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 200ms ease;
}

.theme-modal-backdrop.modal-visible .theme-modal-box {
  transform: scale(1) translateY(0);
}

.theme-modal-content {
  padding: 1.35rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

@media (min-width: 480px) {
  .theme-modal-content {
    padding: 1.6rem 1.5rem 1.35rem;
  }
}

.theme-modal-badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #eab308;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.theme-modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.25;
}

.theme-modal-desc {
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text-muted);
}

.theme-modal-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

@media (max-width: 420px) {
  .theme-modal-actions {
    flex-direction: column;
    width: 100%;
  }

  .theme-modal-actions .btn-primary,
  .theme-modal-actions .btn-outline {
    width: 100%;
  }
}

#btn-keep-dark {
  background: rgba(120, 255, 107, 0.18);
  border-color: var(--border-focus);
  color: var(--text-heading);
  font-weight: 700;
}

#btn-keep-dark:hover {
  background: var(--border-focus);
  color: #000000;
  box-shadow: 0 0 16px var(--glow-primary);
}

.btn-switch-anyway {
  border-color: var(--border-subtle);
  color: var(--text-dim);
}

.btn-switch-anyway:hover {
  border-color: #eab308;
  color: #fde047;
  box-shadow: 0 0 12px rgba(234, 179, 8, 0.25);
}

/* --------------------------------------------------------------------------
   Accessibility & Reduced Motion
   -------------------------------------------------------------------------- */
@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;
  }
  .tilt-card {
    transform: none !important;
  }
}
