/* ============================================================
   Archivio Partigiani — Stylesheet condiviso
   ============================================================ */

:root {
  --bg:        #eef1f5;
  --surface:   #ffffff;
  --surface2:  #f5f7fa;
  --primary:   #1a3a5c;
  --primary-d: #122842;
  --accent:    #c0392b;
  --text:      #1c2b3a;
  --muted:     #6b7c8d;
  --border:    #dde3ea;
  --green:     #16a34a;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 4px rgba(0,0,0,.07);
  --shadow-md: 0 4px 16px rgba(0,0,0,.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.14);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 1.5rem 4rem; }
.wrap--narrow { max-width: 900px; }

/* ── SITE HEADER (index) ── */
.site-header {
  position: relative;
  height: 260px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow: hidden;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-lg);
}
.header-bg {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center top;
  filter: brightness(.5) saturate(.65);
}
.header-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(26,58,92,.75) 0%, rgba(192,57,43,.4) 100%);
}
.header-content {
  position: relative; z-index: 2;
  height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 1.5rem; color: #fff;
}
.header-eyebrow {
  font-size: .68rem; font-weight: 600;
  letter-spacing: .18em; text-transform: uppercase;
  color: rgba(255,255,255,.65); margin-bottom: .6rem;
}
.header-title {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 700; letter-spacing: -.02em; line-height: 1.1;
  text-shadow: 0 2px 12px rgba(0,0,0,.35);
}
.header-sub {
  font-size: .83rem; font-weight: 300;
  color: rgba(255,255,255,.7); margin-top: .5rem;
}

/* ── TOP BAR (dettaglio) ── */
.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: 1.2rem 0 1.5rem;
}
.back-link {
  display: inline-flex; align-items: center; gap: .35rem;
  color: var(--muted); text-decoration: none;
  font-size: .82rem; font-weight: 500;
  padding: .4rem .9rem;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  transition: all .15s;
}
.back-link:hover { color: var(--primary); border-color: var(--primary); background: var(--surface); }
.topbar-title {
  font-size: .72rem; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}

/* ── SEARCH BOX ── */
.search-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.8rem 2rem;
  margin-bottom: 1.8rem;
  box-shadow: var(--shadow-sm);
}
.search-box h2 {
  font-size: .7rem; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 1.3rem;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem 1.2rem;
}
.form-group label {
  display: block;
  font-size: .7rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin-bottom: .35rem;
}
.form-group input {
  width: 100%;
  padding: .55rem .85rem;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: .9rem;
  border-radius: var(--radius-sm);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(26,58,92,.1);
}
.date-row { grid-column: 1/-1; display: flex; gap: 1rem; align-items: flex-end; }
.date-row .form-group { flex: 1; }
.form-actions { grid-column: 1/-1; display: flex; gap: .8rem; margin-top: .4rem; align-items: center; }

.guide {
  grid-column: 1/-1;
  background: #eef2f7;
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: .65rem 1rem;
  font-size: .76rem; color: var(--muted); line-height: 1.5;
}

/* ── BUTTONS ── */
.btn {
  padding: .6rem 1.6rem;
  font-family: 'Inter', sans-serif;
  font-size: .85rem; font-weight: 600;
  cursor: pointer; border-radius: var(--radius-sm);
  transition: all .18s;
  display: inline-flex; align-items: center; gap: .4rem;
}
.btn-primary {
  background: var(--primary); color: #fff; border: none;
  box-shadow: 0 2px 8px rgba(26,58,92,.22);
}
.btn-primary:hover { background: var(--primary-d); box-shadow: 0 4px 14px rgba(26,58,92,.3); transform: translateY(-1px); }
.btn-secondary { background: transparent; color: var(--muted); border: 1.5px solid var(--border); }
.btn-secondary:hover { border-color: var(--muted); color: var(--text); }

/* ── AUTOCOMPLETE ── */
.autocomplete-wrap { position: relative; }
.autocomplete-list {
  position: absolute; top: calc(100% + 2px); left: 0; right: 0; z-index: 200;
  background: var(--surface);
  border: 1.5px solid var(--primary); border-radius: var(--radius-sm);
  max-height: 210px; overflow-y: auto;
  box-shadow: var(--shadow-md); display: none;
}
.autocomplete-list.open { display: block; }
.autocomplete-item {
  padding: .45rem .85rem; cursor: pointer;
  font-size: .88rem;
  border-bottom: 1px solid var(--border); transition: background .1s;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover, .autocomplete-item.active { background: #eef2f7; color: var(--primary); }

/* ── ALERTS ── */
.alert-error {
  background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b;
  padding: .8rem 1.2rem; margin-bottom: 1.5rem;
  font-size: .88rem; border-radius: var(--radius-sm);
}

/* ── RESULTS HEADER ── */
.results-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 1rem; }
.results-header h3 { font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.results-count { font-size: .78rem; color: var(--muted); }

/* ── CARDS (index) ── */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
  display: flex; gap: .9rem; padding: 1rem 1.1rem;
  text-decoration: none; color: inherit;
  transition: box-shadow .2s, transform .15s, border-color .2s;
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: #b8c7d6; }
.card-photo { width: 60px; height: 76px; object-fit: cover; border-radius: 6px; flex-shrink: 0; border: 1px solid var(--border); }
.card-photo-placeholder { width: 60px; height: 76px; background: #eef2f7; border-radius: 6px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #b8c7d6; }
.card-body { flex: 1; min-width: 0; }
.card-name { font-size: .92rem; font-weight: 700; color: var(--primary); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-nome_batt { font-style: italic; font-size: .76rem; color: var(--accent); margin-top: .05rem; }
.card-meta { font-size: .72rem; color: var(--muted); margin-top: .35rem; line-height: 1.55; }
.card-meta span { display: block; }
.badge-caduto { display: inline-block; background: var(--accent); color: #fff; font-size: .6rem; font-weight: 700; padding: .1rem .45rem; border-radius: 4px; letter-spacing: .07em; text-transform: uppercase; margin-top: .3rem; }

/* ── PAGINATION ── */
.pagination { display: flex; gap: .3rem; justify-content: center; margin-top: 2rem; flex-wrap: wrap; }
.pagination a, .pagination span { padding: .38rem .8rem; font-size: .82rem; font-weight: 500; border: 1.5px solid var(--border); border-radius: var(--radius-sm); color: var(--muted); text-decoration: none; transition: all .15s; }
.pagination a:hover { background: var(--surface); color: var(--primary); border-color: var(--primary); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled { opacity: .35; pointer-events: none; }

.empty { text-align: center; padding: 3rem; color: var(--muted); font-size: .92rem; }

/* ── PROFILE CARD (dettaglio) ── */
.profile-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); overflow: hidden; margin-bottom: 1.5rem; }
.profile-card-top { background: linear-gradient(135deg, var(--primary) 0%, #2a5a8c 100%); padding: 2rem 2rem 1.5rem; display: flex; gap: 1.5rem; align-items: flex-end; }
.profile-photo { width: 110px; height: 140px; object-fit: cover; border-radius: var(--radius-sm); border: 3px solid rgba(255,255,255,.25); flex-shrink: 0; box-shadow: 0 4px 16px rgba(0,0,0,.3); }
.profile-photo-placeholder { width: 110px; height: 140px; background: rgba(255,255,255,.1); border-radius: var(--radius-sm); border: 2px solid rgba(255,255,255,.2); flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.3); }
.profile-info { flex: 1; color: #fff; }
.profile-name { font-size: clamp(1.3rem, 3.5vw, 2rem); font-weight: 700; letter-spacing: -.01em; line-height: 1.15; }
.profile-nomebatt { font-style: italic; font-size: .9rem; color: rgba(255,255,255,.7); margin-top: .2rem; }
.profile-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .9rem; }

/* ── TAGS ── */
.tag { display: inline-block; font-size: .65rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; padding: .2rem .6rem; border-radius: 4px; }
.tag-default { background: rgba(255,255,255,.15); color: rgba(255,255,255,.9); }
.tag-red { background: var(--accent); color: #fff; }
.tag-gold { background: rgba(255,200,80,.25); color: #ffd580; border: 1px solid rgba(255,200,80,.35); }

/* ── SECTIONS (dettaglio) ── */
.section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); margin-bottom: 1rem; box-shadow: var(--shadow-sm); overflow: hidden; }
.section-title { font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: .75rem 1.4rem; background: var(--surface2); border-bottom: 1px solid var(--border); }
.section-body { padding: 1.2rem 1.4rem; }

.dl { display: grid; grid-template-columns: minmax(150px, 28%) 1fr; gap: .55rem 1rem; }
.dl dt { font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding-top: .05rem; }
.dl dd { font-size: .9rem; color: var(--text); }
.yes { color: var(--green); font-weight: 600; }
.no  { color: var(--muted); }

.notes-box { background: #f0f4f8; border-left: 3px solid var(--primary); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: .8rem 1rem; font-size: .88rem; color: var(--muted); white-space: pre-line; line-height: 1.65; }

/* ── GALLERY ── */
.gallery { display: flex; flex-wrap: wrap; gap: .8rem; }
.gallery-item { display: flex; flex-direction: column; align-items: center; gap: .35rem; }
.gallery-item img { max-width: 160px; max-height: 200px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); box-shadow: var(--shadow-sm); cursor: zoom-in; transition: transform .2s, box-shadow .2s; }
.gallery-item img:hover { transform: scale(1.04); box-shadow: var(--shadow-md); }
.gallery-caption { font-size: .68rem; color: var(--muted); text-align: center; max-width: 160px; }

/* ── LIGHTBOX ── */
#lightbox { display: none; position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.88); align-items: center; justify-content: center; }
#lightbox.open { display: flex; }
#lightbox img { max-width: 90vw; max-height: 90vh; border-radius: var(--radius-sm); box-shadow: 0 0 60px rgba(0,0,0,.5); }
.lb-close { position: absolute; top: 1.5rem; right: 2rem; color: #fff; font-size: 1.8rem; cursor: pointer; background: rgba(255,255,255,.1); border: none; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: background .15s; }
.lb-close:hover { background: rgba(255,255,255,.2); }

/* ── FOOTER ── */
footer { text-align: center; padding: 1.5rem; margin-top: 3rem; font-size: .74rem; color: var(--muted); border-top: 1px solid var(--border); }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .site-header { height: 190px; border-radius: 0; }
  .search-box { padding: 1.2rem 1rem; }
  .date-row { flex-direction: column; }
  .profile-card-top { flex-direction: column; align-items: center; text-align: center; }
  .profile-tags { justify-content: center; }
  .dl { grid-template-columns: 1fr; }
  .dl dt { margin-bottom: -.2rem; }
}
