/* ============================================
   WORKS FILTER SYSTEM
   ============================================ */

.works-filter-toggle,
.works-filter-panel {
  display: none;
}

/* ============================================
   LENTE DI INGRANDIMENTO
   ============================================ */
.works-filter-toggle {
  display: flex !important;
  align-items: center;
  justify-content: center;
  position: fixed;
  transform: translateY(-50%) !important; 
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  z-index: 1000;
  /* La transizione anima la proprietà left (o right) */
  transition: left 0.3s ease, right 0.3s ease, background 0.3s ease !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  color: #2e261d;
  padding: 0;
}

body.works-panel-visible .works-filter-toggle {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.works-filter-toggle:hover {
  background: rgba(46, 38, 29, 0.08);
}

.works-filter-toggle.is-active .icon-search { display: none; }
.works-filter-toggle .icon-close { display: none; }
.works-filter-toggle.is-active .icon-close { display: block; }

/* ============================================
   PANNELLO FILTRI E INPUT
   ============================================ */
.works-filter-panel {
  display: flex !important;
  flex-direction: column;
  gap: 16px;
  position: fixed;
  top: 50%;
  transform: translateY(-60%);
  width: 170px !important;
  max-height: 60vh;
  background: transparent;
  border: none;
  padding: 0;
  box-sizing: border-box;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
  overflow-y: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
  box-shadow: none;
}

.works-filter-panel::-webkit-scrollbar { display: none; }

body.works-panel-visible .works-filter-panel.is-active {
  opacity: 1;
  visibility: visible;
  transform: translateY(-60%) translateX(0);
}

.works-search-input {
  width: 100% !important;
  max-width: 170px !important;
  padding: 4px 0 !important;
  border: none !important;
  border-bottom: 1px solid #2e261d !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #2e261d !important;
  font-family: inherit !important;
  font-size: 13px !important;
  outline: none !important;
  box-sizing: border-box !important;
  transition: border-color 0.2s ease !important;
  margin: 4px 0 0 0 !important;
  box-shadow: none !important;
  -webkit-appearance: none !important;
}

.works-search-input:focus { border-bottom-color: #2e261d !important; }
.works-search-input::placeholder { color: rgba(46, 38, 29, 0.6) !important; }

.works-category-filters {
  display: flex !important;
  flex-direction: column !important; 
  align-items: flex-start !important; 
  gap: 8px !important; 
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

.works-cat-btn {
  background: transparent !important;
  border: 1px solid #2e261d !important;
  border-radius: 999px !important;
  padding: 4px 10px !important;
  font-size: 1.6vh !important;
  font-weight: 300 !important;
  font-style: italic !important;
  line-height: 1 !important;
  letter-spacing: -0.01em !important;
  color: #2e261d !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  font-family: inherit !important;
  white-space: nowrap !important;
  width: auto !important;
  display: inline-block !important;
  box-shadow: none !important;
  text-transform: lowercase !important;
  margin: 0 !important;
  outline: none !important;
}

.works-cat-btn:hover, .works-cat-btn.active { 
  background: #a64b18 !important;
  border-color: #a64b18 !important;
  color: #ffffff !important;
}

.works-filter-reset {
  background: transparent !important;
  border: none !important;
  color: rgba(46, 38, 29, 0.6) !important;
  font-size: 11px !important;
  cursor: pointer !important;
  text-decoration: underline !important;
  text-underline-offset: 3px !important;
  margin-top: -6px !important;
  padding: 0 !important;
  text-align: left !important;
  font-family: inherit !important;
  transition: color 0.2s ease !important;
  box-shadow: none !important;
  outline: none !important;
  width: auto !important;
}

.works-filter-reset:hover { color: var(--accent-lime, #b1be4c) !important; }

/* ============================================
   COMPORTAMENTO FILTRI
   ============================================ */
body.works-filtered #works-textbox .personal-work-item.filtered-out { display: none !important; }

body.works-filtered #works-textbox .personal-work-item:not(.filtered-out) {
  margin-top: 0 !important;
  margin-bottom: 0.5em !important; 
  padding: 0 !important;
}

body.works-filtered #works-textbox .personal-work-item:first-child:not(.filtered-out),
body.works-filtered #works-textbox .personal-work-item:last-child:not(.filtered-out) {
  margin-top: 0 !important;
  margin-bottom: 0.5em !important;
}

#dynamic-works-list .personal-work-item.filtered-out { display: none !important; }

body.works-filtered #works-textbox .personal-works-content {
  overflow-y: auto !important;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

#works-textbox .personal-works-content {
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}

/* ============================================
   TABLET E MOBILE SPECIFIC
   ============================================ */
@media (max-width: 1024px) {
  .works-filter-panel {
    width: 180px !important;
    max-height: 60vh;
    /* Il top e il left vengono calcolati via JS */
  }

.works-filter-toggle {
    transform: none !important; 
  }
  
}

@media (hover: hover) and (pointer: fine) {
  .works-filter-toggle:hover {
    background: rgba(46, 38, 29, 0.08);
  }
}

/* Forza la rimozione totale di qualsiasi sfondo o ombra su qualsiasi stato */
.works-filter-toggle,
.works-filter-toggle:hover,
.works-filter-toggle:focus,
.works-filter-toggle:active,
.works-filter-toggle.is-active,
.works-filter-toggle.is-active:hover,
.works-filter-toggle.is-active:focus,
.works-filter-toggle.is-active:active {
  background: transparent !important;
  background-color: transparent !important;
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
  -webkit-tap-highlight-color: transparent !important;
}