/* ═══════════════════════════════════════════════════════
   Projects Page — Mobile Overrides (≤ 768px)
   Design reference: TimeXi Projects.dc.html (390×844)
   ═══════════════════════════════════════════════════════ */

/* ── Mobile drawer (hidden on desktop) ── */
#proj-drawer {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: #07070e;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.16,1,0.3,1);
  flex-direction: column;
  padding: 80px 20px 40px;
}
#proj-drawer.open {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}
#proj-drawer a.proj-drawer-link {
  display: block;
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -2px;
  color: #fff;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  line-height: 1;
  text-decoration: none;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.4s, transform 0.4s;
}
#proj-drawer a.proj-drawer-link:last-child { border-bottom: none; }
#proj-drawer.open a.proj-drawer-link {
  opacity: 1;
  transform: translateY(0);
}
#proj-drawer.open a.proj-drawer-link:nth-child(1) { transition-delay: 0.08s; }
#proj-drawer.open a.proj-drawer-link:nth-child(2) { transition-delay: 0.15s; }
#proj-drawer.open a.proj-drawer-link:nth-child(3) { transition-delay: 0.22s; }
#proj-drawer.open a.proj-drawer-link:nth-child(4) { transition-delay: 0.29s; }
#proj-drawer a.proj-drawer-link.active { color: #00d4ff; }
#proj-drawer .proj-drawer-footer { padding-top: 28px; }
#proj-drawer .proj-drawer-footer a { text-decoration: none; }

@media (max-width: 768px) {

  /* ══ GLOBAL ══ */
  body {
    background: #07070e !important;
    color: #fff !important;
  }

  /* ══ NAV ══ */
  #main-nav {
    height: 60px !important;
    padding: 0 !important;
    background: transparent !important;
    border-bottom: none !important;
  }
  #main-nav > div {
    width: calc(100% - 40px) !important;
  }
  #main-nav img { height: 20px !important; }
  .nav-desktop-links { display: none !important; }
  .nav-hamburger { display: flex !important; }
  .nav-cta {
    font-size: 13px !important;
    padding: 8px 16px !important;
    border-radius: 6px !important;
  }
  #nav-mobile-menu { display: none !important; }
  #proj-drawer { display: flex; }

  /* ══ HERO ══ */
  .projects-hero-panel {
    padding: 0 !important;
  }
  .projects-hero-panel .dark-panel {
    border-radius: 0 !important;
    background: radial-gradient(ellipse 130% 50% at 10% 20%, rgba(0,212,255,0.07) 0%, transparent 60%), #07070e !important;
  }
  .projects-hero-panel .dark-panel > div:first-child {
    display: none !important;
  }
  .projects-hero-panel .dark-panel > div:last-child {
    padding: 96px 20px 52px !important;
  }

  /* Breadcrumb */
  .projects-hero-panel p:first-child {
    font-size: 12px !important;
    margin-bottom: 32px !important;
  }

  /* Hero grid */
  .hero-grid {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }

  .hero-grid h1 {
    font-size: clamp(44px, 13vw, 56px) !important;
    letter-spacing: -2px !important;
    line-height: 0.95 !important;
    margin-bottom: 28px !important;
  }
  .hero-grid > div:first-child > p {
    display: none !important;
  }

  /* Stats row */
  .hero-stats-right {
    flex-direction: row !important;
    gap: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    align-items: center !important;
  }
  .hero-stats-right > div {
    text-align: left !important;
    border: none !important;
    padding: 0 !important;
  }
  .hero-stats-right > div:first-child {
    padding-right: 24px !important;
  }
  .hero-stats-right > div:last-child {
    padding-left: 24px !important;
    border-left: 1px solid rgba(255,255,255,0.1) !important;
  }
  .hero-stat-num {
    font-size: 38px !important;
    letter-spacing: -2px !important;
  }
  .hero-stats-right p:last-child {
    font-size: 10px !important;
    letter-spacing: 2.5px !important;
    color: rgba(255,255,255,0.65) !important;
  }

  /* ══ FILTER BAR ══ */
  .filter-sticky {
    position: sticky !important;
    top: 60px !important;
    background: rgba(7,7,14,0.95) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border-bottom: 1px solid rgba(255,255,255,0.06) !important;
    padding: 0 !important;
    z-index: 100 !important;
  }
  .filter-sticky > div {
    width: calc(100% - 40px) !important;
    padding: 12px 0 !important;
    gap: 8px !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }
  .filter-sticky > div::-webkit-scrollbar { display: none; }

  .filter-btn {
    padding: 9px 16px !important;
    border-radius: 20px !important;
    font-size: 13px !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    color: rgba(255,255,255,0.55) !important;
    background: rgba(255,255,255,0.04) !important;
  }
  .filter-btn.active {
    background: #00d4ff !important;
    color: #000 !important;
    border: none !important;
    font-weight: 700 !important;
  }

  /* Hide filter-as-nav behavior on mobile */
  .filter-sticky.filter-as-nav {
    top: 60px !important;
  }
  #main-nav.nav-hidden {
    transform: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  /* ══ PROJECTS GRID ══ */
  #projects-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
    padding: 0 !important;
    width: calc(100% - 40px) !important;
    margin: 0 auto !important;
  }

  /* Section padding */
  section:has(#projects-grid) {
    padding: 32px 0 80px !important;
  }

  /* ── All project cards ── */
  .project-article {
    border-radius: 16px !important;
    overflow: hidden !important;
  }

  /* ── Featured cards: stack, single column ── */
  .project-article.featured {
    grid-column: span 1 !important;
  }
  .featured-layout {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: 1fr !important;
  }

  /* Featured card image area */
  .featured-layout > div:first-child {
    height: 256px !important;
    min-height: 256px !important;
    max-height: 256px !important;
    position: relative !important;
  }
  .featured-layout > div:first-child::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.25) 0%, transparent 40%, rgba(7,7,14,0.94) 100%);
    pointer-events: none;
    z-index: 2;
  }

  /* Featured card content */
  .featured-layout > div:last-child {
    padding: 24px 20px !important;
  }
  .featured-layout > div:last-child h2 {
    font-size: 21px !important;
  }
  .featured-layout > div:last-child p {
    font-size: 13px !important;
    color: rgba(255,255,255,0.7) !important;
    line-height: 1.6 !important;
    margin-bottom: 12px !important;
  }
  .featured-layout > div:last-child p + p {
    display: none !important;
  }

  /* ── Regular cards ── */
  .project-article:not(.featured) {
    display: flex !important;
    flex-direction: column !important;
  }
  .project-article:not(.featured) > div:first-child {
    height: 256px !important;
    position: relative !important;
  }
  .project-article:not(.featured) > div:first-child::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.25) 0%, transparent 40%, rgba(7,7,14,0.94) 100%);
    pointer-events: none;
    z-index: 2;
  }
  .project-article:not(.featured) > div:last-child {
    padding: 24px 20px !important;
  }
  .project-article:not(.featured) > div:last-child h3 {
    font-size: 21px !important;
  }
  .project-article:not(.featured) > div:last-child p {
    font-size: 13px !important;
    color: rgba(255,255,255,0.7) !important;
    line-height: 1.6 !important;
    margin-bottom: 12px !important;
  }
  /* Hide second paragraph */
  .project-article:not(.featured) > div:last-child p + p {
    display: none !important;
  }

  /* Tech tags */
  .project-article span[style*="border-radius: 20px"] {
    font-size: 11px !important;
    color: rgba(255,255,255,0.8) !important;
  }

  /* Visit links */
  .visit-link,
  .project-article a[style*="gap: 8px"] {
    font-size: 14px !important;
  }

  /* ══ CTA CARD ══ */
  .proj-cta-card {
    grid-column: span 1 !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    padding: 52px 20px 64px !important;
    gap: 28px !important;
    background: #090910 !important;
    border: none !important;
    border-top: 1px solid rgba(255,255,255,0.05) !important;
    border-radius: 0 !important;
    margin-top: 0 !important;
  }
  .proj-cta-card h2 {
    font-size: 36px !important;
    letter-spacing: -1.5px !important;
  }
  .proj-cta-card p {
    font-size: 15px !important;
    color: rgba(255,255,255,0.7) !important;
  }
  .cta-btn-group {
    width: auto !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
  }
  .cta-primary {
    padding: 14px 24px !important;
    font-size: 14px !important;
    border-radius: 8px !important;
  }
  .cta-secondary {
    padding: 14px 24px !important;
    font-size: 14px !important;
    border-radius: 8px !important;
    color: rgba(255,255,255,0.7) !important;
  }

  /* ══ FOOTER ══ */
  footer {
    background: #050509 !important;
    padding: 36px 20px 28px !important;
    border-top: 1px solid rgba(255,255,255,0.05) !important;
  }
  footer > div {
    width: 100% !important;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 28px !important;
    margin-bottom: 28px !important;
  }
  .footer-grid > div:first-child {
    grid-column: 1 / -1;
  }
  .footer-grid > div:first-child img {
    height: 17px !important;
    opacity: 0.55 !important;
  }
  .footer-grid > div:first-child > p {
    font-size: 13px !important;
    color: rgba(255,255,255,0.65) !important;
  }
  .footer-grid > div:first-child > div:last-child {
    display: none !important;
  }
  .footer-grid > div:not(:first-child) > p:first-child {
    font-size: 10px !important;
    letter-spacing: 2.5px !important;
    color: rgba(255,255,255,0.6) !important;
  }
  .footer-link {
    font-size: 13px !important;
    color: rgba(255,255,255,0.7) !important;
  }
  .footer-bottom {
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
  }
  .footer-bottom p {
    font-size: 12px !important;
  }
}
