/* Storico · Past Dates + Prossimi · Upcoming modal — dossier-style overlay */

/* ============================ Modal ============================ */
.archive {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 3vw, 40px);
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255, 245, 215, 0.55) 0%, transparent 55%),
    radial-gradient(ellipse at 70% 80%, rgba(180, 145, 90, 0.35) 0%, transparent 55%),
    rgba(28, 22, 14, 0.62);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  animation: archive-fade 220ms var(--ease);
}
.archive.is-open { display: flex; }

@keyframes archive-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Container — looks like a folded-open paper dossier */
.archive__dialog {
  position: relative;
  width: min(820px, 100%);
  max-height: min(86vh, 880px);
  background: var(--cream-light);
  background-image:
    url("../../assets/textures/paper-grain.svg"),
    radial-gradient(ellipse at 20% 0%, rgba(255, 245, 215, 0.7) 0%, transparent 60%),
    radial-gradient(ellipse at 100% 100%, rgba(220, 195, 140, 0.4) 0%, transparent 55%);
  background-repeat: repeat, no-repeat, no-repeat;
  background-size: 280px 280px, auto, auto;
  border-radius: var(--radius-md);
  box-shadow:
    0 10px 30px rgba(40, 25, 10, 0.45),
    0 30px 80px rgba(40, 25, 10, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: archive-pop 260ms var(--ease);
}

@keyframes archive-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Diagonal stamp watermark behind everything.
   Past modal renders EFFETTUATO (done), upcoming renders PROSSIMI (next up). */
.archive__dialog::before {
  content: "EFFETTUATO";
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-14deg);
  font-family: var(--f-type);
  font-size: clamp(56px, 11vw, 132px);
  letter-spacing: 0.18em;
  color: var(--red);
  opacity: 0.08;
  pointer-events: none;
  white-space: nowrap;
  font-weight: 700;
  text-transform: uppercase;
  text-shadow: 0 0 1px var(--red);
  z-index: 0;
}
.archive--upcoming .archive__dialog::before {
  content: "PROSSIMI";
  color: var(--navy);
  text-shadow: 0 0 1px var(--navy);
}

/* ============================ Header ============================ */
.archive__header {
  position: relative;
  z-index: 2;
  padding: 22px 28px 14px;
  background: linear-gradient(180deg, var(--cream-light) 0%, var(--cream-light) 75%, rgba(246, 236, 210, 0) 100%);
  border-bottom: 2px solid var(--red);
}
.archive__eyebrow {
  font-family: var(--f-type);
  font-size: 10.5px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--red);
  display: flex;
  align-items: center;
  gap: 8px;
}
.archive__eyebrow::before,
.archive__eyebrow::after { content: "★"; }
.archive__title {
  font-family: var(--f-display);
  font-style: italic;
  font-weight: 700;
  font-size: clamp(28px, 4.4vw, 40px);
  color: var(--navy);
  line-height: 1.05;
  margin-top: 2px;
}
.archive__subtitle {
  font-family: var(--f-type);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: 6px;
}
.archive__subtitle b {
  color: var(--red);
  font-weight: 400;
}

/* Close button — paper-stamped X */
.archive__close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--ink-soft);
  background: var(--cream);
  color: var(--ink);
  font-family: var(--f-type);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background var(--hover-ms) var(--ease),
    color var(--hover-ms) var(--ease),
    transform var(--hover-ms) var(--ease);
  z-index: 3;
}
.archive__close:hover,
.archive__close:focus-visible {
  background: var(--red);
  color: var(--cream-light);
  border-color: var(--red);
  transform: rotate(90deg);
}

/* ============================ Search ============================ */
.archive__search {
  position: relative;
  z-index: 2;
  padding: 12px 28px 14px;
  background: var(--cream-light);
  border-bottom: 1px dashed var(--ink-faint);
}
.archive__search-input {
  width: 100%;
  font-family: var(--f-mono);
  font-size: 13px;
  color: var(--ink);
  background: var(--cream);
  border: 1px solid var(--ink-faint);
  border-radius: 2px;
  padding: 9px 14px 9px 36px;
  letter-spacing: 0.02em;
  outline: none;
  transition: border-color var(--hover-ms) var(--ease);
}
.archive__search-input:focus {
  border-color: var(--red);
}
.archive__search-input::placeholder {
  color: var(--ink-faint);
  font-style: italic;
}
.archive__search::before {
  content: "⌕";
  position: absolute;
  left: 40px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-faint);
  font-size: 18px;
  pointer-events: none;
}

/* ============================ Body ============================ */
.archive__body {
  position: relative;
  z-index: 2;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 28px 28px;
  scrollbar-width: thin;
  scrollbar-color: var(--tan) transparent;
}
.archive__body::-webkit-scrollbar {
  width: 8px;
}
.archive__body::-webkit-scrollbar-thumb {
  background: var(--tan);
  border-radius: 4px;
}

.archive__year {
  margin-top: 18px;
}
.archive__year:first-child { margin-top: 8px; }

.archive__year-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px dashed var(--ink-faint);
  position: sticky;
  top: 0;
  background: var(--cream-light);
  z-index: 1;
}
.archive__year-num {
  font-family: var(--f-display);
  font-style: italic;
  font-weight: 700;
  font-size: 22px;
  color: var(--navy);
  letter-spacing: 0;
}
.archive__year-roman {
  font-family: var(--f-type);
  font-size: 10.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--red);
}
.archive__year-count {
  font-family: var(--f-type);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-left: auto;
}

.archive__list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.archive__row {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 14px;
  align-items: baseline;
  padding: 7px 4px;
  border-bottom: 1px dotted var(--paper-shadow);
  transition: background var(--hover-ms) var(--ease);
}
.archive__row:hover {
  background: rgba(196, 56, 48, 0.06);
}
.archive__row:last-child { border-bottom: none; }
.archive__row .date {
  font-family: var(--f-display);
  font-style: italic;
  font-weight: 700;
  color: var(--ink-soft);
  font-size: 14px;
  white-space: nowrap;
}
.archive__row .venue {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 15px;
  color: var(--ink);
}
.archive__row .detail {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
  text-align: right;
}

/* Empty state when search yields no hits */
.archive__empty {
  padding: 40px 12px;
  text-align: center;
  font-family: var(--f-hand);
  font-size: 22px;
  color: var(--ink-faint);
  transform: rotate(-1.5deg);
}
.archive__empty::before { content: "// "; color: var(--red); }

/* Lock body scroll while open */
body.archive-open {
  overflow: hidden;
}

/* ============================ Responsive ============================ */
@media (max-width: 640px) {
  .archive {
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
  }
  .archive__dialog {
    width: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
  }
  .archive__header { padding: 18px 18px 12px; }
  .archive__search { padding: 10px 18px 12px; }
  .archive__search::before { left: 30px; }
  .archive__body  { padding: 4px 18px 22px; }
  .archive__row {
    grid-template-columns: 86px 1fr;
    grid-template-rows: auto auto;
    gap: 4px 12px;
  }
  .archive__row .detail {
    grid-column: 2 / 3;
    text-align: left;
  }
  .archive__close { top: 12px; right: 12px; }
  .archive__dialog::before { font-size: 64px; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .archive,
  .archive__dialog,
  .archive__close { animation: none; transition: none; }
}
