/* =========================================================
   GALLERY.HTML, ARCHIVIO PROGETTI E CANTIERI
   ========================================================= */

/* ---------- Nav current-page indicator ---------- */
.main-nav a.current { color: var(--blue-dark); }
.main-nav a.current::after { width: 100%; }

/* ---------- Page hero ---------- */
.gallery-hero {
  background: var(--graphite);
  color: var(--white);
  position: relative;
  overflow: hidden;
}
.gallery-hero .blueprint-grid {
  background-image:
    linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px);
}
.gallery-hero-inner {
  position: relative;
  padding-top: clamp(64px, 10vw, 120px);
  padding-bottom: clamp(48px, 6vw, 80px);
  max-width: 760px;
}
.gallery-hero .eyebrow { color: var(--white); margin-bottom: 22px; }
.gallery-hero .eyebrow .idx { color: rgba(255,255,255,0.55); }
.gallery-hero h1 {
  color: var(--white);
  font-size: clamp(2.1rem, 4.6vw, 3.6rem);
  margin-bottom: 20px;
}
.gallery-hero h1 .accent { color: var(--orange); }
.gallery-hero p {
  color: rgba(255,255,255,0.75);
  max-width: 56ch;
  font-size: 1.02rem;
}
.gallery-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(20px, 4vw, 48px) clamp(24px, 4vw, 48px);
  margin-top: 40px;
  padding-top: 26px;
  border-top: 1px solid rgba(255,255,255,0.18);
}
.gallery-hero-meta .metric .num { color: var(--white); }
.gallery-hero-meta .metric .label { color: rgba(255,255,255,0.55); }

/* ---------- Portfolio layout: sidebar (desktop) + grid ---------- */
.portfolio-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: clamp(32px, 4vw, 64px);
  align-items: start;
}
@media (max-width: 900px) {
  .portfolio-layout { grid-template-columns: 1fr; }
}

/* ---------- Sidebar: DEMO category menu, desktop / non-touch only ---------- */
.portfolio-sidebar {
  border: 1px solid var(--line);
  background: var(--offwhite);
  position: sticky;
  top: calc(var(--topbar-h) + var(--header-h) + 24px);
}
.site-header.is-sticky ~ section .portfolio-sidebar {
  top: calc(var(--header-h-sticky) + 24px);
}
@media (max-width: 900px) {
  .portfolio-sidebar { display: none; }
}
.sidebar-label {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--graphite);
}
.sidebar-menu { padding: 10px 0; }
.sidebar-group {
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}
.sidebar-group:last-child { border-bottom: none; }
.sidebar-cat-btn {
  flex: 1;
  display: block;
  padding: 14px 20px;
  text-align: left;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--graphite);
}
.sidebar-cat-btn.active { color: var(--blue-dark); }
.sidebar-toggle {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--slate);
}
.sidebar-toggle i { transition: transform .3s var(--ease); }
.sidebar-toggle[aria-expanded="true"] i,
.sidebar-toggle.open i { transform: rotate(90deg); color: var(--orange); }
.sidebar-group > .sidebar-sub-list { width: 100%; }
.sidebar-sub-list { padding: 0 20px 16px 20px; }
.sidebar-sub-list[hidden] { display: none; }
.sidebar-sub-list li { margin-bottom: 4px; }
.sidebar-sub-list a {
  display: block;
  padding: 8px 12px;
  font-size: 0.82rem;
  color: var(--slate);
  border-left: 2px solid transparent;
  transition: all .25s var(--ease);
}
.sidebar-sub-list a:hover { color: var(--blue-dark); }
.sidebar-sub-list a.active {
  color: var(--graphite);
  font-weight: 600;
  border-left-color: var(--orange);
  background: var(--white);
}

/* ---------- Category dropdown, touch/mobile only (same breakpoint as the hamburger menu) ---------- */
.category-select-bar {
  display: none;
  align-items: center;
  gap: 16px;
  margin-bottom: clamp(28px, 4vw, 44px);
  flex-wrap: wrap;
}
@media (max-width: 900px) {
  .category-select-bar { display: flex; }
}
.category-select-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--slate);
  flex-shrink: 0;
}
.category-select {
  appearance: none;
  -webkit-appearance: none;
  min-width: 260px;
  padding: 13px 40px 13px 18px;
  border: 1px solid var(--line);
  background: var(--offwhite) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%2322303C" stroke-width="2"><path d="M6 9l6 6 6-6"/></svg>') no-repeat right 14px center / 16px 16px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--graphite);
  cursor: pointer;
  transition: border-color .3s var(--ease);
}
.category-select:hover, .category-select:focus { border-color: var(--blue); }
.category-select:focus:not(:focus-visible) { outline: none; }
@media (max-width: 480px) { .category-select { min-width: 0; width: 100%; } }

/* ---------- Uniform project grid, same card style as the homepage ---------- */
.portfolio-main .gallery-preview-grid {
  grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 1100px) { .portfolio-main .gallery-preview-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .portfolio-main .gallery-preview-grid { grid-template-columns: 1fr; } }
.portfolio-main .gp-item { aspect-ratio: 3/4; }

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: clamp(32px, 4vw, 56px);
}
.page-btn {
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--slate);
  transition: all .3s var(--ease);
}
.page-btn:hover { border-color: var(--blue); color: var(--blue-dark); }
.page-btn.active { background: var(--graphite); border-color: var(--graphite); color: var(--white); }
.page-btn.disabled { pointer-events: none; opacity: 0.4; }
.page-ellipsis {
  min-width: 40px;
  text-align: center;
  color: var(--slate);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

/* ---------- Bottom CTA bar ---------- */
.gallery-cta {
  background: var(--blue);
  color: var(--white);
  position: relative;
  overflow: hidden;
}
.gallery-cta .blueprint-grid {
  background-image:
    linear-gradient(rgba(255,255,255,0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.07) 1px, transparent 1px);
}
.gallery-cta-inner {
  position: relative;
  padding-top: clamp(56px, 8vw, 96px);
  padding-bottom: clamp(56px, 8vw, 96px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
}
.gallery-cta-inner h3 {
  color: var(--white);
  font-size: clamp(1.5rem, 2.8vw, 2.2rem);
  max-width: 20ch;
}
.gallery-cta-inner .eyebrow { color: rgba(255,255,255,1); margin-bottom: 14px; }
.gallery-cta-inner .eyebrow .idx { color: rgba(255,255,255,0.92); }
.gallery-cta .btn-outline { border-color: var(--white); color: var(--white); }
.gallery-cta .btn-outline:hover { border-color: var(--graphite); background: var(--white); color: var(--graphite); }

/* ---------- Zoom button on cards (apre Fancybox) ---------- */
.gp-zoom-btn {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 3;
  width: 34px; height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--line);
  color: var(--graphite);
  font-size: 0.95rem;
  transition: all .3s var(--ease);
}
.gp-zoom-btn:hover { background: var(--orange); border-color: var(--orange); color: var(--white); }

/* ---------- Empty state ---------- */
.gallery-empty {
  padding: 48px 0;
  text-align: center;
  color: var(--slate);
  font-size: 1rem;
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--slate);
  margin-bottom: clamp(28px, 4vw, 44px);
}
.breadcrumb a { color: var(--slate); }
.breadcrumb a:hover { color: var(--blue-dark); }
.breadcrumb .sep { color: var(--line); }
.breadcrumb .current { color: var(--graphite); font-weight: 600; }

/* ---------- Dettaglio progetto ---------- */
.progetto-detail-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: clamp(28px, 4vw, 56px);
  align-items: start;
}
@media (max-width: 900px) { .progetto-detail-grid { grid-template-columns: 1fr; } }

.progetto-gallery-main {
  aspect-ratio: 4/3;
  overflow: hidden;
  border: 1px solid var(--line);
}
.progetto-gallery-main img { width: 100%; height: 100%; object-fit: cover; display: block; }
.progetto-gallery-thumbs {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.progetto-thumb {
  width: 84px;
  height: 63px;
  overflow: hidden;
  border: 2px solid transparent;
  opacity: 0.7;
  transition: all .3s var(--ease);
}
.progetto-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.progetto-thumb:hover, .progetto-thumb.active { opacity: 1; border-color: var(--orange); }

.progetto-info .eyebrow { display: block; margin-bottom: 14px; }
.progetto-info .eyebrow a { color: var(--orange); }
.progetto-info h1 { font-size: clamp(1.8rem, 3.4vw, 2.4rem); margin-bottom: 18px; }
.progetto-desc { font-size: 1.02rem; color: var(--graphite); margin-bottom: 16px; }
.progetto-desc-estesa { color: var(--slate); margin-bottom: 24px; line-height: 1.7; }
.progetto-desc p, .progetto-desc-estesa p { margin-bottom: 0.9em; }
.progetto-desc p:last-child, .progetto-desc-estesa p:last-child { margin-bottom: 0; }
.progetto-scheda {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
  margin-bottom: 28px;
}
.progetto-scheda dt {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--slate);
}
.progetto-scheda dd { margin: 2px 0 14px 0; font-weight: 600; color: var(--graphite); }
.progetto-scheda dd:last-child { margin-bottom: 0; }

.altri-progetti {
  margin-top: clamp(56px, 8vw, 96px);
  padding-top: clamp(32px, 4vw, 48px);
  border-top: 1px solid var(--line);
}
.altri-progetti h2 { font-size: 1.3rem; margin-bottom: 24px; }
