/* ─── Projects Page ─────────────────────────────────────────────── */

.projects-page {
  background: #f5f4f2;
  color: #0a0a0a;
  overflow: hidden;
  height: 100%;
  cursor: default;
}

/* Remove home-page cursor dot on projects page */
.projects-page::after {
  display: none;
}

/* ─── Page entrance overlay ─────────────────────────────────────── */

#page-overlay {
  position: fixed;
  inset: 0;
  background: #f5f4f2;
  z-index: 400;
  opacity: 1;
  transition: opacity 1.5s ease-in-out;
  pointer-events: none;
}

#page-overlay.cleared {
  opacity: 0;
}

/* ─── Sidebar ───────────────────────────────────────────────────── */

#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 220px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 42px 40px;
  z-index: 100;
  border-right: 1px solid rgba(0, 0, 0, 0.07);
  background: #f5f4f2;
}

#sidebar-wordmark {
  display: block;
  text-decoration: none;
  line-height: 0;
  margin-bottom: 56px;
}

#sidebar-wordmark img {
  display: block;
  width: 130px;
  height: auto;
}

/* ─── Site Nav ──────────────────────────────────────────────────── */

#site-nav > ul {
  list-style: none;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

#site-nav a,
.site-link {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.65rem;
  font-weight: 300;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-decoration: none;
  color: rgba(0, 0, 0, 0.35);
  transition: color 0.25s ease;
  display: inline-block;
  position: relative;
}

#site-nav a::after,
.site-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 1px;
  background: #0a0a0a;
  transition: width 0.3s ease;
}

#site-nav a:hover,
.site-link:hover {
  color: #0a0a0a;
}

#site-nav a:hover::after,
.site-link:hover::after,
#site-nav a.active::after,
.site-link.active::after {
  width: 100%;
}

#site-nav a.active,
.site-link.active {
  color: #0a0a0a;
}

/* ─── Sub Nav (category filters nested under Projects) ──────────── */

.sub-nav {
  list-style: none;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  margin-top: 0;
  transition: max-height 0.35s ease, opacity 0.25s ease, margin-top 0.3s ease;
}

.sub-nav.expanded {
  max-height: 400px;
  opacity: 1;
  margin-top: 16px;
}

/* Expand/collapse indicator on Projects link */
.subnav-indicator {
  display: inline-block;
  margin-left: 7px;
  font-size: 0.65rem;
  font-weight: 300;
  letter-spacing: 0;
  color: rgba(0, 0, 0, 0.28);
  user-select: none;
  vertical-align: middle;
  line-height: 1;
}

.sub-nav .cat-link {
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  color: rgba(0, 0, 0, 0.25);
  margin-left: 10px;
}

.sub-nav .cat-link:hover {
  color: #0a0a0a;
}

.sub-nav .cat-link.active {
  color: rgba(0, 0, 0, 0.65);
}

/* ─── Category Nav ──────────────────────────────────────────────── */

#category-nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.cat-link {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.65rem;
  font-weight: 300;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-decoration: none;
  color: rgba(0, 0, 0, 0.35);
  transition: color 0.25s ease;
  display: inline-block;
  position: relative;
}

.cat-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 1px;
  background: #0a0a0a;
  transition: width 0.3s ease;
}

.cat-link:hover {
  color: #0a0a0a;
}

.cat-link:hover::after,
.cat-link.active::after {
  width: 100%;
}

.cat-link.active {
  color: #0a0a0a;
}

/* ─── Sidebar footer ────────────────────────────────────────────── */

#sidebar-footer {
  margin-top: auto;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.52rem;
  font-weight: 300;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.28);
}

/* ─── Project Grid ──────────────────────────────────────────────── */

#project-grid {
  margin-left: 220px;
  height: 100vh;
  overflow-y: auto;
  overflow-anchor: none;
  padding: 80px 80px 120px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  align-content: start;
}

/* Hide scrollbar but keep scrollability */
#project-grid::-webkit-scrollbar {
  display: none;
}
#project-grid {
  scrollbar-width: none;
}

/* ─── Project Cards ─────────────────────────────────────────────── */

.project-card {
  opacity: 1;
  transition: opacity 0.35s ease;
}

.project-card.hidden {
  display: none;
}

.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.card-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  transition: opacity 0.3s ease;
  background-size: cover;
  background-position: center;
}

.card-link:hover .card-image {
  opacity: 0.82;
}

.card-meta {
  padding: 14px 0 56px;
}

.card-title {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.72rem;
  font-weight: 300;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #0a0a0a;
  margin-bottom: 5px;
}

.card-detail {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.58rem;
  font-weight: 300;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.38);
}

/* ─── Mobile filter strip ───────────────────────────────────────── */

#mobile-filters {
  display: none;
}

/* ─── Responsive ─────────────────────────────────────────────────── */

@media (max-width: 900px) {
  #sidebar {
    width: 180px;
    padding: 28px 24px;
  }

  #project-grid {
    margin-left: 180px;
    padding: 28px 40px 60px;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  /* Fix 2: allow page to scroll — override the global html,body overflow:hidden from style.css */
  html,
  .projects-page {
    overflow-y: auto;
    height: auto;
    min-height: 100%;
  }

  /* Fix 1: sidebar becomes a stacked header — wordmark row, then nav row */
  #sidebar {
    position: relative;
    width: 100%;
    height: auto;
    flex-direction: column;
    align-items: flex-start;
    padding: 20px 24px 16px;
    gap: 14px;
    border-right: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
  }

  #sidebar-wordmark {
    margin-bottom: 0;
    margin-right: 0;
  }

  #site-nav {
    display: none;
  }

  #sidebar-footer {
    display: none;
  }

  #project-grid {
    margin-left: 0;
    height: auto;
    overflow-y: visible;
    grid-template-columns: 1fr;
    padding: 24px 24px 60px;
  }

  #mobile-filters {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 20px;
    padding: 14px 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
  }

  #mobile-filters::-webkit-scrollbar {
    display: none;
  }

  #mobile-filters .cat-link {
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 0;
  }
}
