/* ============================================
   WORK ITEMS (Elenco Testuale Scorrevole come Bottoni)
   ============================================ */

.personal-works-content {
  position: relative;
  padding-top: 14vh !important;
  padding-bottom: 16vh !important;
  box-sizing: border-box;
}

/* ============================================
   FADE OVERLAYS (top / bottom)
   ============================================ */
#works-textbox::before,
#works-textbox::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 4vh;
  pointer-events: none;
  z-index: 5;
}

#works-textbox::before {
  top: 0;
  background: linear-gradient(to bottom, var(--bg-dark, #eaeaea) 0%, transparent 100%);
}

#works-textbox::after {
  bottom: 0;
  background: linear-gradient(to top, var(--bg-dark, #eaeaea) 0%, transparent 100%);
}

/* ============================================
   WORK ITEMS
   ============================================ */
.personal-work-item {
  display: block !important;
  width: 100%;
  transform-origin: left center !important;
  transition: transform 0.05s ease-out, opacity 0.05s ease-out;
  will-change: transform, opacity, filter;
  margin-bottom: 0.5em;
}

.personal-work-item .work-link {
  display: block !important;
  width: fit-content;
  font-size: 2.4vh;
  margin-bottom: 0.1em;
  font-weight: 300;
  color: var(--text-main, #2e261d);
  letter-spacing: -0.01em;
  cursor: pointer;
  text-decoration: none;
  padding: 0.02em 0.2vw;
  line-height: 1.15;
  background-image: linear-gradient(var(--accent-lime, #b1be4c), var(--accent-lime, #b1be4c));
  background-repeat: no-repeat;
  background-position: left 100%;
  background-size: 0% 1px;
  transition: color 0.3s ease, background-size 0.35s cubic-bezier(0.23, 1, 0.32, 1);
}

.personal-work-item .work-link:hover {
  color: var(--accent-lime, #b1be4c);
  font-style: italic;
  background-size: 100% 1px;
}

.personal-work-item .work-link.active-project {
  color: var(--accent-lime, #b1be4c) !important;
  font-style: italic !important;
  background-size: 100% 1px !important;
  font-weight: 300 !important;
}

/* ============================================
   CONTENITORE PILLOLE (CATEGORIE)
   ============================================ */
.personal-work-item p {
  display: inline-block !important;
  width: auto !important;
  vertical-align: middle !important;
  box-sizing: border-box;
  border: 1px solid var(--text-main, #2e261d);
  border-radius: 999px;
  padding: 0.15em 0.6em;
  font-size: 1.3vh;
  font-weight: 300;
  font-style: italic;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--text-main, #2e261d);
  background-color: transparent;
  margin-top: 0.4em;
  margin-bottom: 0.4em;
  margin-left: 0 !important; 
  margin-right: 6px !important;
  transform: none !important; 
  pointer-events: none; 
  user-select: none;
  cursor: default;
}

/* ============================================
   DESKTOP STYLES (min-width: 769px)
   ============================================ */
@media (min-width: 769px) {
  #works-textbox::before,
  #works-textbox::after {
    height: 12vh;
  }

  .personal-work-item {
    margin-bottom: 0.5em;
  }

  .personal-work-item .work-link {
    font-size: 2vh;
  }

  .personal-work-item p {
    font-size: 1.6vh;
  }
}

/* ============================================
   MOBILE ADJUSTMENTS (max-width: 768px)
   ============================================ */
@media (max-width: 768px) {
  .personal-works-content {
    padding-top: 6vh !important;
    padding-bottom: 8vh !important;
  }

  #works-textbox::before,
  #works-textbox::after {
    height: 4vh;
  }

  #works-textbox .personal-work-item {
    text-align: right;
    transform-origin: right center !important;
    margin-bottom: 1em;
  }

  #works-textbox .personal-work-item .work-link {
    margin-left: auto;
    background-position: right 100%;
    text-align: right;
    font-size: 2vh;
  }

  #works-textbox .personal-work-item p {
    font-size: 1.4vh;
    transform: translateX(-8px) !important;
    margin-right: 4px !important;
    margin-left: 4px !important;
  }

  body.panel-open #works-textbox,
  body.panel-open #works-textbox.active {
    top: calc(env(safe-area-inset-top) + 4vh) !important;
    max-height: 24vh !important;
    left: 48vw !important; 
    width: 48vw !important;
    max-width: 48vw !important;
    text-align: right !important;
  }
}

.project-info-panel {
  display: none;
}

/* ============================================
   WORKS PANEL — CUSTOM SCROLLBAR
   ============================================ */
.works-scrollbar {
  position: fixed;
  left: 0;
  /* top, height e transform vengono calcolati via JS */
  width: 5px;
  border-radius: 3px;
  background: transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 950;
}

body.works-panel-open .works-scrollbar {
  opacity: 1;
}

.works-scrollbar-thumb {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 60px;                  
  border-radius: 3px;
  background: rgba(46, 38, 29, 0.15); 
  transition: background-color 0.2s ease, height 0.15s ease;
  will-change: transform, height;
}

@media (hover: hover) {
  .works-scrollbar:hover .works-scrollbar-thumb {
    background: rgba(46, 38, 29, 0.35);
  }
}

@media (max-width: 1024px) {
  .works-scrollbar {
    width: 4px;
    height: 160px;
    border-radius: 2px;
  }
  .works-scrollbar-thumb {
    border-radius: 2px;
  }
}

@media (max-width: 768px) {
  .works-scrollbar {
    width: 3px;
    height: 120px;
  }
}

/* ============================================
   WORKS LIST — SPINTA VERSO IL BASSO (DESKTOP)
   ============================================ */
@media (min-width: 1025px) {
  #works-textbox .personal-works-content {
    padding-top: calc(14vh + 2vh) !important;
    padding-bottom: 8vh !important;
  }
}