/* Archivio — si appoggia a style.css (variabili, header, footer, .archive, .eyebrow). */

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

.page-archivio main { padding-top: 76px; }

/* Apertura: riprende la sezione Archivio della home, ma come titolo di pagina */
.archive-hero {
  min-height: 0;
  padding-top: clamp(48px, 7vw, 110px);
  padding-bottom: clamp(48px, 6vw, 90px);
}
.archive-hero h1 {
  font: 500 clamp(80px, 17vw, 250px)/1 Manrope, sans-serif;
  letter-spacing: -.09em;
  margin: 35px 0;
}

/* Indice degli anni, resta sotto l'header durante lo scroll */
.year-nav {
  position: sticky;
  top: 76px;
  z-index: 15;
  display: flex;
  gap: clamp(18px, 3vw, 44px);
  padding: 16px clamp(22px, 8vw, 140px);
  background: rgba(245, 245, 242, .94);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  letter-spacing: .13em;
  text-transform: uppercase;
  overflow-x: auto;
  scrollbar-width: none;
}
.year-nav::-webkit-scrollbar { display: none; }
.year-nav a {
  flex: none;
  color: var(--muted);
  padding-bottom: 3px;
  border-bottom: 1px solid transparent;
  transition: color .2s, border-color .2s;
}
.year-nav a:hover,
.year-nav a.is-current {
  color: var(--ink);
  border-bottom-color: currentColor;
}

/* Capitoli per anno: numero grande fisso a sinistra, opere a destra */
.year {
  display: grid;
  grid-template-columns: minmax(170px, 22%) 1fr;
  gap: clamp(24px, 4vw, 70px);
  padding: clamp(60px, 8vw, 120px) clamp(22px, 8vw, 140px);
  border-bottom: 1px solid var(--line);
  scroll-margin-top: calc(76px + 50px);
}
.year-head {
  align-self: start;
  position: sticky;
  top: calc(76px + 50px + 40px);
}
.year-number {
  margin: 0;
  font: 500 clamp(64px, 9vw, 140px)/.9 Manrope, sans-serif;
  letter-spacing: -.085em;
}
.year-number--text {
  font-size: clamp(40px, 5vw, 72px);
  letter-spacing: -.06em;
  line-height: 1;
}
.year-count {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.works {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: clamp(28px, 3vw, 48px) clamp(18px, 2vw, 32px);
}
.work--wide { grid-column: span 2; }

.work-link {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.work-link:focus-visible { outline: none; }
.work-link:focus-visible .work-frame { outline: 2px solid var(--ink); outline-offset: 4px; }

/* La "parete": ogni tela appesa su un fondo neutro, proporzioni originali */
.work-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 5;
  padding: 11%;
  background: #e9eae6;
  overflow: hidden;
}
.work--wide .work-frame { aspect-ratio: 8 / 5; padding: 7%; }
.work-frame img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 14px 36px rgba(0, 0, 0, .12);
  transition: transform .45s cubic-bezier(.2, .7, .2, 1), box-shadow .45s;
}
@media (hover: hover) {
  .work-link:hover .work-frame img {
    transform: scale(1.04);
    box-shadow: 0 22px 48px rgba(0, 0, 0, .16);
  }
}

.work-caption {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.work-title {
  font: 500 18px/1.2 Manrope, sans-serif;
  letter-spacing: -.03em;
}
.work-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.page-archivio footer { background: var(--bg); }

/* Vista a schermo intero: stessa cornice delle opere 2026 in home */
.viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--ink);
  color: #fff;
  overflow: hidden;
}
.viewer::backdrop { background: var(--ink); }
.viewer[open] { display: block; animation: viewer-in .35s ease-out; }
@keyframes viewer-in { from { opacity: 0; } to { opacity: 1; } }

.viewer-top,
.viewer-footer {
  position: absolute;
  left: clamp(22px, 5vw, 90px);
  right: clamp(22px, 5vw, 90px);
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: .16em;
  z-index: 3;
}
.viewer-top { top: 28px; padding-right: 56px; }
.viewer-footer { bottom: 28px; }

.viewer-close {
  position: absolute;
  top: 16px;
  right: clamp(14px, 2vw, 28px);
  z-index: 4;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, .4);
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}

.viewer-stage {
  position: absolute;
  inset: 70px clamp(70px, 9vw, 140px) clamp(150px, 20vh, 200px);
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.viewer-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 25px 70px rgba(0, 0, 0, .45);
  transition: opacity .25s;
}
.viewer-img.is-loading { opacity: 0; }

.viewer-nav {
  position: absolute;
  top: 50%;
  z-index: 3;
  transform: translateY(-50%);
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.viewer-prev { left: clamp(14px, 2vw, 28px); }
.viewer-next { right: clamp(14px, 2vw, 28px); }

.viewer-details {
  position: absolute;
  left: clamp(22px, 5vw, 90px);
  right: clamp(22px, 5vw, 90px);
  bottom: clamp(62px, 8vh, 90px);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  z-index: 3;
}
.viewer-title {
  margin: 0;
  font: 500 clamp(32px, 4.6vw, 72px)/.99 Manrope, sans-serif;
  letter-spacing: -.07em;
}
.viewer-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  letter-spacing: .03em;
  text-align: right;
  flex: none;
}

.viewer button:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }

@media (max-width: 900px) {
  .year { grid-template-columns: 1fr; gap: 28px; }
  .year-head {
    position: static;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
  }
  .year-count { margin: 0; }
}

@media (max-width: 700px) {
  .page-archivio main { padding-top: 68px; }
  .year-nav { top: 68px; padding: 14px 22px; font-size: 11px; }
  .year { padding: 56px 22px; scroll-margin-top: calc(68px + 46px); }
  .works { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px 14px; }
  .work-frame { padding: 9%; }
  .work-title { font-size: 15px; }
  .work-meta { font-size: 11px; }

  .viewer-top { top: 22px; }
  .viewer-close { top: 12px; }
  .viewer-stage { inset: 64px 12px 190px; }
  .viewer-nav { top: auto; bottom: max(18px, env(safe-area-inset-bottom)); transform: none; }
  .viewer-prev { left: calc(50% - 50px); }
  .viewer-next { right: calc(50% - 50px); }
  .viewer-footer { display: none; }
  .viewer-details { bottom: 74px; gap: 12px; }
  .viewer-title { font-size: clamp(28px, 8vw, 44px); }
  .viewer-meta { font-size: 11px; gap: 3px; max-width: 45%; }
  .guided-circle { width: 34px; height: 34px; font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .viewer[open] { animation: none; }
  .work-frame img, .viewer-img { transition: none; }
}
