/* ==========================================================================
   Gazzetta Ufficiale — Archivio fotografico
   Identità: "fascicolo ufficiale" — cartelline, timbro protocollo, masthead
   serif da bollettino, numeri di serie in monospace come numeri di registro.
   ========================================================================== */

:root {
  --gu-ink: #1a2340;        /* blu inchiostro — masthead, testi forti */
  --gu-ink-soft: #3c4668;
  --gu-paper: #f6f3ec;      /* carta */
  --gu-paper-2: #efe9da;    /* carta leggermente più scura, per le card */
  --gu-line: #d9d2bf;       /* filo/hairline */
  --gu-stamp: #ac1420;      /* rosso timbro/protocollo — accento unico */
  --gu-text: #22262f;
  --gu-text-muted: #666a72;

  --font-display: 'Source Serif 4', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', monospace;

  --radius: 10px;
  --shadow-card: 0 1px 2px rgba(26,35,64,.06), 0 6px 16px rgba(26,35,64,.08);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text, var(--gu-text));
  background:
    linear-gradient(180deg, rgba(26,35,64,.02), transparent 200px),
    var(--gu-paper);
  background-attachment: fixed;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

img { max-width: 100%; }

a { color: inherit; text-decoration: none; }

/* ---------- Masthead ---------- */
.gu-masthead {
  background: linear-gradient(135deg, var(--gu-ink) 0%, #2a3560 100%);
  color: #fff;
  border-bottom: 3px solid var(--gu-stamp);
  position: sticky;
  top: 0;
  z-index: 60;
  padding-top: env(safe-area-inset-top, 0px);
  transform: translateY(0);
  transition: transform .28s ease;
  will-change: transform;
}
.gu-masthead.gu-masthead--nascosto {
  transform: translateY(-100%);
}
.gu-masthead__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.gu-masthead__brand { display: flex; align-items: center; gap: 12px; }
.gu-masthead__seal {
  width: 42px; height: 42px;
  border: 2px solid rgba(255,255,255,.55);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .5px;
}
.gu-masthead__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 21px;
  line-height: 1.15;
  display: flex; flex-direction: column;
}
.gu-masthead__title small {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: .04em;
  opacity: .7;
  text-transform: uppercase;
}
.gu-nav { display: flex; gap: 4px; }
.gu-nav a {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  opacity: .85;
}
.gu-nav a:hover { background: rgba(255,255,255,.1); opacity: 1; }
.gu-nav a.is-active { background: #fff; color: var(--gu-ink); opacity: 1; }

.gu-main { max-width: 1180px; margin: 0 auto; padding: 28px 20px 60px; min-height: 60vh; }

/* ---------- Section headers ---------- */
.gu-page-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--gu-ink);
  margin: 4px 0 4px;
}
.gu-page-sub { color: var(--gu-text-muted); margin: 0 0 22px; font-size: 14.5px; }

/* ---------- Year tabs ---------- */
.gu-year-tabs {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--gu-line);
  padding-bottom: 14px;
}
.gu-year-tabs a {
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--gu-line);
  background: #fff;
  color: var(--gu-ink-soft);
}
.gu-year-tabs a.is-active {
  background: var(--gu-ink);
  border-color: var(--gu-ink);
  color: #fff;
}

/* ---------- Serie section ---------- */
.gu-serie-block { margin-bottom: 38px; }
.gu-serie-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.gu-serie-swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.gu-serie-head h2 {
  font-family: var(--font-display);
  font-size: 18px;
  margin: 0;
  color: var(--gu-ink);
}
.gu-serie-head .gu-count { color: var(--gu-text-muted); font-size: 13px; }
.gu-serie-vedi-tutte { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--gu-ink); }
.gu-serie-vedi-tutte:hover { text-decoration: underline; }

/* ---------- Navigazione a settimane (vista per giorno) ---------- */
.gu-week-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 22px; flex-wrap: wrap;
}
.gu-week-nav__center { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.gu-week-nav__label {
  font-family: var(--font-display); font-size: 16px; font-weight: 600; color: var(--gu-ink);
  text-align: center;
}

/* ---------- Grid & cards (il "fascicolo") ---------- */
.gu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
}
.gu-card {
  position: relative;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--gu-line);
  transition: transform .15s ease, box-shadow .15s ease;
}
.gu-card:hover { transform: translateY(-3px); box-shadow: 0 4px 8px rgba(26,35,64,.1), 0 14px 28px rgba(26,35,64,.12); }

.gu-card__tab {
  position: absolute; top: 0; left: 16px;
  padding: 3px 10px 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: #fff;
  border-radius: 0 0 6px 6px;
  letter-spacing: .03em;
  z-index: 2;
}
.gu-card__thumb-link { display: block; aspect-ratio: 16 / 9; background: var(--gu-paper-2); overflow: hidden; }
.gu-card__thumb-link img { width: 100%; height: 100%; object-fit: cover; display: block; }

.gu-card__infografica .gu-card__tab::after { content: " · copertina"; opacity: .85; }

.gu-card__body { padding: 12px 14px 14px; }
.gu-card__protocollo {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  border: 1px dashed var(--gu-line);
  border-radius: 6px;
  padding: 3px 8px;
  color: var(--gu-ink-soft);
  margin-bottom: 8px;
}
.gu-card__protocollo b { color: var(--gu-stamp); font-weight: 700; }
.gu-card__data { font-size: 12px; color: var(--gu-text-muted); margin: -4px 0 8px; }

.gu-card__title {
  font-size: 14px;
  font-weight: 500;
  margin: 0 0 10px;
  color: var(--gu-text);
  line-height: 1.35;
}
.gu-card__links { display: flex; flex-wrap: wrap; gap: 8px; }
.gu-card__links a {
  font-size: 12.5px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--gu-paper-2);
  color: var(--gu-ink);
  border: 1px solid var(--gu-line);
}
.gu-card__links a:hover { background: var(--gu-ink); color: #fff; border-color: var(--gu-ink); }
.gu-card__share { display: inline-flex; align-items: center; gap: 4px; }
.gu-card__share svg { flex: none; }

/* ---------- Tag ---------- */
.gu-card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.gu-tag-chip {
  font-size: 11.5px; font-weight: 600; color: var(--gu-ink-soft);
  background: var(--gu-paper); border: 1px solid var(--gu-line);
  padding: 3px 9px; border-radius: 999px;
}
.gu-tag-chip:hover { background: var(--gu-ink); color: #fff; border-color: var(--gu-ink); }

.gu-tag-cloud {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 18px;
  background: #fff;
  border: 1px solid var(--gu-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 32px 28px;
  max-width: 900px;
}
.gu-tag-cloud__item {
  font-family: var(--font-display);
  color: var(--gu-ink);
  line-height: 1.3;
  white-space: nowrap;
  transition: transform .15s ease, color .15s ease;
}
.gu-tag-cloud__item:hover {
  color: var(--gu-stamp);
  transform: translateY(-2px);
}

.gu-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--gu-text-muted);
  font-size: 15px;
  border: 1px dashed var(--gu-line);
  border-radius: var(--radius);
  background: #fff;
}

/* ---------- Paginazione ---------- */
.gu-pagination {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  margin-top: 30px;
}
.gu-pagination__info { font-size: 13.5px; color: var(--gu-text-muted); }
.gu-pagination a.is-disabled { pointer-events: none; opacity: .4; }

/* ---------- Search form ---------- */
.gu-filter-form {
  display: flex; flex-wrap: wrap; gap: 12px;
  background: #fff; border: 1px solid var(--gu-line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 26px;
  box-shadow: var(--shadow-card);
}
.gu-filter-form .gu-field { display: flex; flex-direction: column; gap: 5px; }
.gu-filter-form label { font-size: 12px; font-weight: 600; color: var(--gu-text-muted); text-transform: uppercase; letter-spacing: .03em; }
.gu-filter-form select, .gu-filter-form input {
  font-family: var(--font-body);
  padding: 8px 10px;
  border: 1px solid var(--gu-line);
  border-radius: 7px;
  font-size: 14px;
  background: var(--gu-paper);
  min-width: 130px;
}
.gu-filter-form .gu-field--grow { flex: 1; min-width: 200px; }
.gu-filter-form .gu-field--grow input { width: 100%; }
.gu-btn {
  align-self: flex-end;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  padding: 9px 18px;
  border-radius: 7px;
  border: 1px solid var(--gu-ink);
  background: var(--gu-ink);
  color: #fff;
  cursor: pointer;
}
.gu-btn:hover { background: #26315a; }
.gu-btn--ghost { background: transparent; color: var(--gu-ink); }
.gu-btn--ghost:hover { background: var(--gu-paper-2); }
.gu-btn--danger { background: var(--gu-stamp); border-color: var(--gu-stamp); }
.gu-btn--danger:hover { background: #8d0f19; }

/* ---------- Lightbox ---------- */
.gu-lightbox {
  position: fixed; inset: 0; background: rgba(15,18,32,.86);
  display: none; align-items: center; justify-content: center;
  z-index: 100;
}
.gu-lightbox.is-open { display: flex; }
.gu-lightbox__frame { max-width: 1100px; width: 100%; margin: 30px 90px; position: relative; }
.gu-lightbox__frame img { width: 100%; border-radius: 8px; display: block; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.gu-lightbox__caption { color: #fff; margin-top: 12px; font-size: 14px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.gu-lightbox__topbar { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.gu-lightbox__close {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 24px; line-height: 1;
  background: rgba(15,18,32,.7);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 50%;
  cursor: pointer;
}
.gu-lightbox__hint { color: rgba(255,255,255,.7); font-size: 12px; margin: 8px 0 0; text-align: center; }

.gu-lightbox__nav {
  /* Disattivate: il posizionamento non è risultato affidabile tra browser diversi. */
  display: none !important;
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px;
  align-items: center; justify-content: center;
  color: #fff; font-size: 30px; line-height: 1;
  background: rgba(15,18,32,.6);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 50%;
  cursor: pointer;
  z-index: 110;
}
.gu-lightbox__nav:hover { background: rgba(15,18,32,.85); }
.gu-lightbox__nav--prev { left: 14px; }
.gu-lightbox__nav--next { right: 14px; }

/* ---------- Zoom interattivo: rettangolo di selezione durante il trascinamento ---------- */
.gu-zoom-selezione {
  position: absolute;
  border: 2px dashed #fff;
  background: rgba(90,150,255,.22);
  border-radius: 4px;
  pointer-events: none;
  z-index: 45;
  box-shadow: 0 0 0 1px rgba(0,0,0,.25);
}
.gu-zoom-wrapper {
  margin: 0 auto;
  overflow: hidden;
}
.gu-zoom-wrapper--scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.gu-zoom-scroll-hint {
  text-align: center;
  color: rgba(255,255,255,.6);
  font-size: 11.5px;
  margin: 6px 0 0;
}
.gu-zoom-canvas {
  display: block;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  cursor: zoom-out;
}

/* ---------- Admin ---------- */
.gu-admin-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--gu-line); border-radius: var(--radius); overflow: hidden; }
.gu-admin-table th, .gu-admin-table td { padding: 10px 12px; border-bottom: 1px solid var(--gu-line); font-size: 13.5px; text-align: left; vertical-align: middle; }
.gu-admin-table th { background: var(--gu-paper-2); font-weight: 600; color: var(--gu-ink-soft); text-transform: uppercase; font-size: 11.5px; letter-spacing: .03em; }
.gu-admin-table img.gu-thumb-mini { width: 90px; aspect-ratio: 16/9; object-fit: cover; border-radius: 5px; border: 1px solid var(--gu-line); }
.gu-admin-table tr:hover { background: #fbfaf6; }
.gu-badge-serie { font-family: var(--font-mono); font-size: 11.5px; padding: 2px 8px; border-radius: 999px; color: #fff; }

.gu-form-card {
  background: #fff; border: 1px solid var(--gu-line); border-radius: var(--radius);
  padding: 22px; max-width: 640px; box-shadow: var(--shadow-card);
}
.gu-form-row { margin-bottom: 15px; display: flex; flex-direction: column; gap: 6px; }
.gu-form-row label { font-size: 13px; font-weight: 600; color: var(--gu-ink-soft); }
.gu-form-row input[type=text], .gu-form-row input[type=number], .gu-form-row input[type=url], .gu-form-row select, .gu-form-row textarea {
  padding: 9px 11px; border: 1px solid var(--gu-line); border-radius: 7px; font-size: 14px; font-family: var(--font-body);
}
.gu-form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.gu-hint { font-size: 12px; color: var(--gu-text-muted); }
.gu-alert { padding: 11px 14px; border-radius: 7px; font-size: 13.5px; margin-bottom: 16px; }
.gu-alert--error { background: #fbe9e9; color: #7a1620; border: 1px solid #f0c7c9; }
.gu-alert--success { background: #e8f3ea; color: #205a2c; border: 1px solid #c3e0c8; }

.gu-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }

.gu-login-wrap { max-width: 360px; margin: 60px auto; }

/* ---------- Toggle vista (per serie / per giorno) ---------- */
.gu-view-toggle { display: flex; gap: 4px; background: #fff; border: 1px solid var(--gu-line); border-radius: 999px; padding: 3px; }
.gu-view-toggle a { font-size: 13px; font-weight: 500; padding: 6px 14px; border-radius: 999px; color: var(--gu-ink-soft); }
.gu-view-toggle a.is-active { background: var(--gu-ink); color: #fff; }

/* ---------- Vista per giorno ---------- */
.gu-day-block { margin-bottom: 38px; }
.gu-day-block__head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.gu-date-header {
  font-family: var(--font-display);
  font-size: 19px;
  color: var(--gu-ink);
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--gu-stamp);
  display: inline-block;
}

/* ---------- Pagina singola gazzetta (condivisibile) ---------- */
.gu-single {
  position: relative;
  background: #fff; border: 1px solid var(--gu-line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-card); max-width: 720px;
}
.gu-single__tab {
  position: absolute; top: 0; left: 20px;
  padding: 4px 12px 6px; font-family: var(--font-mono); font-size: 12px; font-weight: 500;
  color: #fff; border-radius: 0 0 6px 6px; z-index: 2;
}
.gu-single__img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; cursor: zoom-in; transition: opacity .15s ease; }
.gu-single__img:hover { opacity: .92; }
.gu-single__body { padding: 18px 20px 22px; }

.gu-share-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--gu-line); }
.gu-share-btn {
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--gu-line);
  background: var(--gu-paper-2); color: var(--gu-ink); cursor: pointer;
}
.gu-share-btn:hover { filter: brightness(0.95); }
.gu-share-btn--wa { background: #e7f8ee; color: #1a7d43; border-color: #bfe8cd; }
.gu-share-btn--tg { background: #e6f4fb; color: #0f6fa3; border-color: #bfe0f0; }
.gu-share-btn--fb { background: #e8ecfb; color: #2b4ea3; border-color: #c7d1f2; }
.gu-share-btn--x   { background: #eef0f2; color: #1a1a1a; border-color: #d7dadd; }
.gu-share-btn--mail{ background: #fbeeE9; color: #a3421a; border-color: #f0d2c0; }

/* ---------- Toast ---------- */
.gu-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--gu-ink); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13.5px; opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease;
  z-index: 200;
}
.gu-toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Footer ---------- */
.gu-footer {
  margin-top: 50px;
  background: linear-gradient(135deg, var(--gu-ink) 0%, #2a3560 100%);
  color: rgba(255,255,255,.85);
}
.gu-footer__inner {
  max-width: 1180px; margin: 0 auto; padding: 36px 20px 24px;
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 28px;
}

.gu-footer__brand { display: flex; gap: 12px; align-items: flex-start; max-width: 340px; }
.gu-footer__seal {
  width: 38px; height: 38px; flex: none;
  border: 2px solid rgba(255,255,255,.4); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 700; font-size: 12px;
}
.gu-footer__brand strong { font-family: var(--font-display); font-size: 17px; color: #fff; }
.gu-footer__brand p { margin: 4px 0 0; font-size: 12.5px; color: rgba(255,255,255,.6); line-height: 1.5; }

.gu-footer__links { display: flex; gap: 18px; flex-wrap: wrap; align-self: center; }
.gu-footer__links a { color: rgba(255,255,255,.75); font-size: 13.5px; font-weight: 500; }
.gu-footer__links a:hover { color: #fff; text-decoration: underline; }

.gu-footer__ticronometro {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.2);
  padding: 10px 18px; border-radius: 10px;
  transition: background .15s ease;
}
.gu-footer__ticronometro:hover { background: rgba(255,255,255,.16); }
.gu-footer__ticronometro span { font-size: 10.5px; color: rgba(255,255,255,.55); text-transform: uppercase; letter-spacing: .05em; }
.gu-footer__ticronometro strong { font-family: var(--font-display); font-size: 16px; color: #fff; display: flex; align-items: center; gap: 6px; }

.gu-footer__bottom {
  border-top: 1px solid rgba(255,255,255,.12);
  text-align: center; padding: 14px 20px;
  font-size: 12px; color: rgba(255,255,255,.5);
}

@media (max-width: 640px) {
  .gu-footer__inner { flex-direction: column; align-items: stretch; text-align: center; }
  .gu-footer__brand { flex-direction: column; align-items: center; text-align: center; max-width: none; }
  .gu-footer__links { justify-content: center; }
  .gu-footer__ticronometro { align-items: center; align-self: center; }
}

@media (max-width: 640px) {
  .gu-form-grid { grid-template-columns: repeat(2, 1fr); }
  .gu-filter-form { flex-direction: column; }
  .gu-filter-form select, .gu-filter-form input { min-width: 0; width: 100%; }
  .gu-btn { align-self: stretch; }
}

/* ---------- Mobile: header più compatto e touch-friendly ---------- */
@media (max-width: 560px) {
  .gu-masthead__inner { padding: 10px 14px; gap: 10px; }
  .gu-masthead__seal { width: 34px; height: 34px; font-size: 11px; }
  .gu-masthead__title { font-size: 16px; }
  .gu-masthead__title small { font-size: 10px; }
  .gu-nav { gap: 2px; }
  .gu-nav a { padding: 9px 11px; font-size: 13px; }

  .gu-main { padding: 18px 14px 50px; }
  .gu-page-title { font-size: 22px; }

  /* Su schermi stretti una sola card per riga: le infografiche vanno lette, non rimpicciolite */
  .gu-grid { grid-template-columns: 1fr; gap: 14px; }

  .gu-toolbar { gap: 12px; }
  .gu-year-tabs, .gu-view-toggle { width: 100%; justify-content: center; }

  .gu-share-row { gap: 6px; }
  .gu-share-btn { flex: 1 1 auto; text-align: center; padding: 9px 10px; font-size: 12.5px; }

  .gu-lightbox { align-items: flex-start; overflow-y: auto; }
  .gu-lightbox__frame { margin: 6px 8px; }
  .gu-lightbox__close { width: 42px; height: 42px; font-size: 26px; }
  .gu-lightbox__nav { width: 38px; height: 38px; font-size: 24px; }
  .gu-lightbox__nav--prev { left: 4px; }
  .gu-lightbox__nav--next { right: 4px; }

  .gu-tag-cloud { padding: 22px 18px; gap: 8px 14px; }
}
