/* Anteprime nella lista disegni */
.files .thumb { width: 112px; height: 84px; flex-shrink: 0; position: relative; border: 1px solid var(--line); background: #faf9f7; cursor: zoom-in; overflow: hidden; display: flex; align-items: center; justify-content: center; transition: border-color .3s, box-shadow .3s; }
.files .thumb canvas { width: 100%; height: 100%; display: block; transition: transform .5s var(--ease); }
.files .thumb em { font-style: normal; font-size: 10px; letter-spacing: 1.5px; color: var(--gold-dark); font-weight: 600; }
.files .thumb.loaded em { position: absolute; left: 0; bottom: 0; background: rgba(20,20,20,.85); color: #fff; padding: 2px 6px; font-size: 9px; }
.files .thumb[data-pages]::after { content: attr(data-pages); position: absolute; right: 0; bottom: 0; background: var(--gold); color: #fff; font-size: 9px; padding: 2px 6px; letter-spacing: 1px; }
.files .thumb::before { content: ""; position: absolute; inset: 0; z-index: 1; background: rgba(20,20,20,.0); transition: background .3s; }
.files li:hover .thumb { border-color: var(--gold); box-shadow: 0 8px 20px -10px rgba(0,0,0,.3); }
.files li:hover .thumb canvas { transform: scale(1.06); }

/* Visore disegni tecnici */
.dv { position: fixed; inset: 0; z-index: 40; background: #1c1c1c; display: flex; flex-direction: column; color: #e8e6e1; opacity: 0; transition: opacity .3s var(--ease, ease); font-family: var(--body); }
.dv.ready { opacity: 1; }
.dv.closing { opacity: 0; }
.dv svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* Barra strumenti */
.dv-bar { height: 64px; flex-shrink: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 0 14px; background: #121212; border-bottom: 1px solid #2a2a2a; position: relative; z-index: 3; }
.dv-left, .dv-right, .dv-center { display: flex; align-items: center; gap: 4px; min-width: 0; }
.dv-right { justify-content: flex-end; }
.dv-title { min-width: 0; margin-left: 8px; line-height: 1.25; }
.dv-title small { display: block; font-size: 9.5px; letter-spacing: 2px; text-transform: uppercase; color: var(--gold, #ceb829); }
.dv-title span { display: block; font-family: var(--head); font-size: 14px; letter-spacing: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
.dv-btn, .dv-zoom { all: unset; box-sizing: border-box; height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; color: #cfccc6; cursor: pointer; border-radius: 2px; transition: background .2s, color .2s; position: relative; }
.dv-btn:hover, .dv-zoom:hover { background: #262626; color: #fff; }
.dv-btn:active { background: #303030; }
.dv-btn:focus-visible, .dv-zoom:focus-visible { outline: 1px solid var(--gold, #ceb829); }
.with-thumbs .dv-btn[data-a=thumbs] { color: var(--gold, #ceb829); }
.dv-zoom { min-width: 70px; font-size: 13px; letter-spacing: 1px; font-variant-numeric: tabular-nums; border: 1px solid #333; height: 36px; }
.dv-close:hover { background: #a33a2c; color: #fff; }
.dv-sep { width: 1px; height: 26px; background: #333; margin: 0 8px; }
.dv-pager { display: flex; align-items: center; gap: 2px; }
.dv-pg { all: unset; width: 40px; height: 34px; text-align: center; border: 1px solid #333; font-size: 13px; color: #fff; font-variant-numeric: tabular-nums; }
.dv-pg:focus { border-color: var(--gold, #ceb829); }
.dv-pgn { font-size: 13px; color: #8d8a85; margin: 0 6px 0 8px; font-variant-numeric: tabular-nums; }

/* Menu zoom */
.dv-zmenu { position: absolute; top: 64px; left: 50%; transform: translate(-50%, -8px); background: #141414; border: 1px solid #2f2f2f; z-index: 4; display: flex; flex-direction: column; min-width: 190px; padding: 6px 0; opacity: 0; pointer-events: none; transition: all .2s var(--ease, ease); box-shadow: 0 20px 40px rgba(0,0,0,.4); }
.zmenu-open .dv-zmenu { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.dv-zmenu button { all: unset; padding: 12px 20px; font-size: 13px; cursor: pointer; color: #cfccc6; letter-spacing: .5px; }
.dv-zmenu button:hover { background: #222; color: var(--gold, #ceb829); }
.dv-zmenu button:nth-child(2) { border-bottom: 1px solid #2a2a2a; }

/* Corpo */
.dv-body { flex: 1; display: flex; min-height: 0; position: relative; }
.dv-thumbs { width: 0; flex-shrink: 0; overflow-y: auto; overflow-x: hidden; background: #161616; border-right: 1px solid #262626; transition: width .25s var(--ease, ease); display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 0; }
.with-thumbs .dv-thumbs { width: 200px; padding: 20px 0; }
.dv-th { all: unset; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 11px; color: #8d8a85; letter-spacing: 1px; }
.dv-th canvas { width: 150px; height: auto; max-height: 150px; object-fit: contain; display: block; border: 2px solid transparent; outline: 1px solid #333; transition: border-color .2s, transform .2s; background: #fff; }
.dv-th:hover canvas { transform: translateY(-2px); }
.dv-th.on canvas { border-color: var(--gold, #ceb829); outline-color: var(--gold, #ceb829); }
.dv-th.on { color: var(--gold, #ceb829); }

.dv-scroll { flex: 1; overflow: auto; position: relative; touch-action: pan-x pan-y; cursor: grab; overscroll-behavior: contain;
  background: #262626 radial-gradient(circle, #2f2f2f 1px, transparent 1px) 0 0 / 22px 22px; }
.grabbing .dv-scroll { cursor: grabbing; }
.dv-scroll::-webkit-scrollbar { width: 12px; height: 12px; }
.dv-scroll::-webkit-scrollbar-track { background: transparent; }
.dv-scroll::-webkit-scrollbar-thumb { background: #444; border: 3px solid #262626; border-radius: 10px; }
.dv-scroll::-webkit-scrollbar-thumb:hover { background: var(--gold, #ceb829); }
.dv-scroll::-webkit-scrollbar-corner { background: transparent; }

.dv-pages { display: flex; flex-direction: column; align-items: center; gap: 24px; padding: 32px; width: max-content; min-width: 100%; box-sizing: border-box; }
.dv-pages.flash .dv-page { animation: dvFlash .4s var(--ease, ease); }
@keyframes dvFlash { from { opacity: .3; transform: scale(.98); } }
.dv-page { position: relative; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.25), 0 18px 40px rgba(0,0,0,.35); flex-shrink: 0; user-select: none; }
.dv-page::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #f3f3f3 0, #fafafa 50%, #f3f3f3 100%) 0 0 / 600px 100%; animation: dvShimmer 1.2s linear infinite; transition: opacity .3s; }
.dv-page.ready::before { opacity: 0; animation: none; }
@keyframes dvShimmer { from { background-position: -300px 0; } to { background-position: 300px 0; } }
.dv-page canvas { position: relative; width: 100%; height: 100%; display: block; }
.dv-pnum { position: absolute; left: 100%; top: 0; margin-left: 10px; font-size: 11px; color: #7a7772; letter-spacing: 1px; font-variant-numeric: tabular-nums; }

/* Caricamento e suggerimento */
.dv-loading { position: absolute; inset: 64px 0 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: #8d8a85; background: #1c1c1c; z-index: 2; transition: opacity .35s; }
.dv-loading.done { opacity: 0; pointer-events: none; }
.dv-spin { width: 38px; height: 38px; border: 1px solid #333; border-top-color: var(--gold, #ceb829); border-radius: 50%; animation: dvSpin .9s linear infinite; }
@keyframes dvSpin { to { transform: rotate(360deg); } }
.dv-link { color: var(--gold, #ceb829); border: 1px solid var(--gold, #ceb829); padding: 12px 22px; text-decoration: none; }
.dv-hint { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); background: rgba(10,10,10,.85); backdrop-filter: blur(6px); padding: 12px 22px; font-size: 12px; color: #cfccc6; border-left: 2px solid var(--gold, #ceb829); white-space: nowrap; transition: opacity .6s, transform .6s; z-index: 2; pointer-events: none; }
.dv-hint.gone { opacity: 0; transform: translate(-50%, 10px); }

/* Tablet e telefono */
@media (max-width: 900px) {
  .dv-bar { grid-template-columns: 1fr auto; height: auto; padding: 8px 10px; row-gap: 6px; }
  .dv-center { grid-column: 1 / -1; grid-row: 2; justify-content: center; overflow-x: auto; }
  .dv-zmenu { top: 112px; }
  .dv-loading { inset: 112px 0 0; }
  .with-thumbs .dv-thumbs { width: 130px; }
  .dv-th canvas { width: 96px; }
  .dv-pages { padding: 16px; gap: 16px; }
  .dv-hint { white-space: normal; width: calc(100% - 32px); text-align: center; }
  .dv-pnum { display: none; }
}
@media (max-width: 520px) {
  .dv-btn[data-a=full], .dv-btn[data-a=print], .dv-center .dv-btn[data-a=fitw], .dv-sep { display: none; }
  .dv-title small { display: none; }
}
