/* --- 1. RESET GLOBALI --- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  font-family: 'IBM Plex Mono', monospace;
  background-color: #ffffff; color: #000000;
  -ms-overflow-style: none; scrollbar-width: none;  
}
::-webkit-scrollbar { display: none; width: 0px; background: transparent; }
body { padding: 16px; }

.pill, .toggle-btn, .project-card, .footer-link {
  -webkit-tap-highlight-color: transparent; outline: none;
}

button.pill, button.v-ctrl {
  font-family: inherit;
  border: none;
  background: none;
  text-align: left;
}
button.glass-pill {
  background: rgba(247, 247, 247, 0.70);
}

.pill:focus-visible, .menu-link:focus-visible, .project-card:focus-visible, .v-ctrl:focus-visible {
  outline: 1px solid rgba(0, 0, 0, 0.35);
  outline-offset: 2px;
}

/* =========================================================
   2. SISTEMA TIPOGRAFICO
========================================================= */
.pill, .menu-row, .about-text, .about-list li, .hover-pill, 
.info-p, .copyright-pill, .footer-link, .info-row span, .info-row a {
  font-size: 10px; font-weight: 400; line-height: 1.5; color: #000000;
}

.menu-header, .about-heading, .info-header, .info-label {
  font-size: 9px !important; font-weight: 400 !important;
  text-transform: uppercase; color: rgba(0, 0, 0, 0.45) !important; 
}

.arrow, .arrow-left, .arrow-right {
  font-size: 8px; transition: transform 0.3s ease; color: #000000;
}

/* =========================================================
   3. STILE BASE PILLOLE
========================================================= */
.pill { border-radius: 50px; padding: 0 20px; display: flex; align-items: center; height: 30px; }
.glass-pill { background: rgba(247, 247, 247, 0.70); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px); }

/* =========================================================
   4. TOP BAR & AREA STICKY GLOBALE
========================================================= */
.top-bar { width: calc(50% - 5px); position: relative; z-index: 200; }
.large-pill { width: 100%; justify-content: space-between; white-space: nowrap; overflow: hidden; cursor: pointer; }

.vsn-logo {
  font-weight: 700; font-size: 11px; color: #000000; cursor: pointer;
  transition: opacity 0.2s ease;
  display: inline-flex; align-items: center; gap: 6px;
}
.vsn-star {
  width: 12px; height: 12px; display: block; flex-shrink: 0;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.large-pill:hover .vsn-logo, .vsn-logo:hover { opacity: 0.6; }
.large-pill:hover .vsn-star { transform: rotate(90deg); }
.vsn-desc { text-overflow: ellipsis; overflow: hidden; font-weight: 400; }

.sticky-area { margin-top: -30px; position: relative; }

.small-pills-container {
  position: sticky; top: 16px; z-index: 100;
  width: calc(50% - 5px); margin-left: calc(50% + 5px);
  display: flex; gap: 10px; transition: width 0.3s ease, margin 0.3s ease;
}

.small-pill { flex: 1; justify-content: flex-start; }
.toggle-btn { cursor: pointer; justify-content: space-between; user-select: none; }
.toggle-btn.active .arrow { transform: rotate(180deg); }

/* =========================================================
   5. MENU A TENDINA & ORDINAMENTO TABELLARE (PUNTO C)
========================================================= */
.dropdown-menu {
  position: absolute; top: calc(100% + 10px); left: 0; width: 100%; 
  background: rgba(247, 247, 247, 0.70); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
  border-radius: 24px; padding: 16px 20px;
  opacity: 0; visibility: hidden; transform: translateY(-10px); transition: all 0.3s ease;
}
.dropdown-menu.active { opacity: 1; visibility: visible; transform: translateY(0); }

.menu-row { display: grid; grid-template-columns: 34px 55px 2fr 2fr 1.1fr; gap: 15px; padding: 12px 0; border-bottom: 1px solid rgba(0, 0, 0, 0.05); align-items: center; text-decoration: none; }
.menu-row:last-child { border-bottom: none; }
.menu-header { padding-bottom: 8px; user-select: none; }

.sort-col {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s ease;
}
.sort-col:hover, .sort-col.active-sort {
  color: #000000 !important;
}
.sort-indicator {
  font-size: 7px;
  line-height: 1;
}

.menu-link { cursor: pointer; transition: opacity 0.2s ease; }
.menu-link:hover { opacity: 0.5; }
.menu-link.current-project .col-id,
.menu-link.current-project .col-title {
  font-weight: 700;
}

.about-section { margin-bottom: 24px; }
.about-section:last-child { margin-bottom: 0; }
.about-heading { padding-bottom: 8px; margin-bottom: 12px; border-bottom: 1px solid rgba(0, 0, 0, 0.05); }
.about-list { list-style: none; }
.about-list li { padding: 3px 0; }
.about-list a { color: inherit; text-decoration: none; transition: opacity 0.2s ease; }
.about-list a:hover { opacity: 0.5; }

/* =========================================================
   6. VISTA OVERVIEW (GRID & INDEX - PUNTO F) E DETTAGLIO
========================================================= */
#view-overview { opacity: 1; transition: opacity 0.3s ease; margin-top: 30vh; }

.overview-controls {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.view-mode-pill {
  gap: 8px;
  user-select: none;
}

.view-mode-btn {
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.2s ease;
}
.view-mode-btn:hover { opacity: 0.75; }
.view-mode-btn.active { opacity: 1; font-weight: 700; }
.view-mode-sep { opacity: 0.25; }

.project-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.project-card { width: 100%; aspect-ratio: 4 / 5; border-radius: 40px; background-color: #eeeeee; position: relative; overflow: hidden; cursor: pointer; }
.card-bg {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background-size: cover; background-position: center;
  object-fit: cover; object-position: center;
  display: block;
  transition: transform 0.5s ease;
}
.hover-pill {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(247, 247, 247, 0.80); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  padding: 8px 16px; border-radius: 50px; white-space: nowrap; opacity: 0; transition: opacity 0.3s ease; z-index: 2;
  pointer-events: none;
  display: inline-flex; align-items: center; gap: 6px;
}
.hover-pill-meta { color: rgba(0, 0, 0, 0.45); }
.project-card:hover .card-bg { transform: scale(1.06); }
.project-card:hover .hover-pill { opacity: 1; }

/* VISTA INDEX A TUTTA PAGINA (PUNTO F) */
.archive-index-view {
  display: none;
  background-color: #F7F7F7;
  border-radius: 24px;
  padding: 16px 24px;
  position: relative;
}
.archive-index-view.active {
  display: block;
}
.index-table-row {
  display: grid;
  grid-template-columns: 40px 70px 1.6fr 1.6fr 1.4fr 1.2fr 1.3fr;
  gap: 15px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  align-items: center;
  font-size: 10px;
}
.index-table-row:last-child { border-bottom: none; }
.index-table-header {
  padding-bottom: 10px;
  font-size: 9px !important;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.45) !important;
  user-select: none;
}
.index-table-link {
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.index-table-link:hover {
  opacity: 0.55;
}

.index-hover-preview {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 220px;
  aspect-ratio: 4 / 5;
  border-radius: 28px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 150;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
  background: #eeeeee;
}
.index-hover-preview.visible {
  opacity: 1;
  transform: translateY(0);
}
.index-hover-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* DETTAGLIO PROGETTO */
.project-detail { 
  display: none; 
  opacity: 0; 
  transition: opacity 0.3s ease; 
  grid-template-columns: repeat(4, 1fr);
  grid-template-areas:
    "title back . ."
    "info . images images"
    ". . seqnav seqnav";
  gap: 10px; margin-top: 30vh;
}

.sticky-mobile { position: sticky; top: 16px; z-index: 90; }
.title-pill { justify-content: flex-start; }
.back-btn { cursor: pointer; justify-content: flex-start; gap: 8px; transition: opacity 0.2s ease; }
.back-btn:hover { opacity: 0.7; }

.info-box {
  background-color: #F7F7F7; border-radius: 20px; padding: 24px;
  display: flex; flex-direction: column; gap: 32px;
  position: sticky; top: 56px; align-self: start; 
}
.info-section { display: flex; flex-direction: column; gap: 8px; }
.info-header { padding-bottom: 8px; border-bottom: 1px solid rgba(0,0,0,0.05); margin-bottom: 4px; }
.info-row { display: grid; grid-template-columns: 80px 1fr; align-items: start; }
.coord-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  transition: opacity 0.2s ease, border-color 0.2s ease;
}
.coord-link:hover {
  opacity: 0.6;
  border-color: rgba(0, 0, 0, 0.6);
}

.detail-images-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.detail-images-grid .project-card { cursor: pointer; }
.detail-images-grid .project-card:hover .card-bg { transform: scale(1); }

/* NAVIGAZIONE SEQUENZIALE TRA FASCICOLI (PUNTO D) */
.project-seq-nav {
  grid-area: seqnav;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 10px;
}
.seq-pill {
  width: 100%;
  cursor: pointer;
  justify-content: space-between;
  transition: opacity 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
}
.seq-pill:hover {
  opacity: 0.65;
}
.seq-meta {
  color: rgba(0, 0, 0, 0.45);
  margin: 0 4px;
}
.seq-title {
  text-overflow: ellipsis;
  overflow: hidden;
}

/* =========================================================
   7. FOOTER GLOBALE
========================================================= */
.footer-container { display: flex; width: 100%; gap: 10px; margin-top: 30vh; padding-bottom: 16px; }
.footer-large-wrap { width: calc(50% - 5px); }
.footer-small-wrap { width: calc(50% - 5px); display: flex; gap: 10px; }
.copyright-pill { width: 100%; justify-content: center; }
.footer-link { cursor: pointer; justify-content: space-between; text-decoration: none; color: inherit; overflow: hidden; white-space: nowrap; }
.footer-link .text-hover { display: none; text-overflow: ellipsis; overflow: hidden; }
.footer-link:hover .text-default { display: none; }
.footer-link:hover .text-hover { display: inline; }

/* =========================================================
   8. MOBILE RESPONSIVE & TOUCH DEVICES
========================================================= */
@media (hover: none) {
  .project-grid .hover-pill {
    opacity: 1;
    top: auto;
    bottom: 16px;
    transform: translateX(-50%);
  }
  .index-hover-preview {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .top-bar { width: 100%; }
  .sticky-area { margin-top: 10px; }
  .small-pills-container { width: 100%; margin-left: 0; }
  .menu-row { grid-template-columns: 24px 38px 1.8fr 1.4fr 1fr; gap: 8px; }
  .dropdown-menu { padding: 16px 12px; }
  #view-overview { margin-top: 25vh; }
  .project-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .project-card { border-radius: 30px; }
  .index-table-row {
    grid-template-columns: 26px 45px 1.6fr 1.3fr 1fr;
    gap: 8px;
  }
  .index-col-hide-mobile { display: none; }
  .project-detail {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "title back"
      "info info"
      "images images"
      "seqnav seqnav";
    margin-top: 25vh;
  }
  .sticky-mobile { top: 56px; } 
  .info-box { padding: 20px; gap: 24px; position: static; }
  .detail-images-grid { grid-template-columns: repeat(2, 1fr); }
  .project-seq-nav { grid-template-columns: 1fr; }
  .footer-container { flex-direction: column-reverse; margin-top: 25vh; }
  .footer-large-wrap, .footer-small-wrap { width: 100%; }
}

/* =========================================================
   9. VIDEO PLAYER CUSTOM
========================================================= */
.project-card.horizontal { grid-column: 1 / -1; aspect-ratio: 16 / 9; }
.video-card { position: relative; cursor: default !important; }
.video-card video { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.video-controls { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); gap: 24px; z-index: 10; padding: 0 24px; }
.v-ctrl { cursor: pointer; display: flex; align-items: center; justify-content: center; opacity: 0.5; transition: opacity 0.2s ease; color: #000000; }
.v-ctrl:hover { opacity: 1; }

/* =========================================================
   10. LIGHTBOX CUSTOM
========================================================= */
.lightbox-overlay {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(247, 247, 247, 0.95);
  backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  user-select: none;
}

.lightbox-overlay.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-counter {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 1001;
  pointer-events: none;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  cursor: pointer;
  gap: 8px;
  z-index: 1001;
  transition: opacity 0.2s ease;
}
.lightbox-close:hover { opacity: 0.7; }

.lightbox-nav {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 1001;
}

.lightbox-btn {
  cursor: pointer;
  gap: 8px;
  transition: opacity 0.2s ease;
}
.lightbox-btn:hover { opacity: 0.7; }

#lightbox-img {
  max-width: 90vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 0;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
}
