/* ==========================================================================
   Moustafa Production - foglio di stile unico
   Palette neutra e calda, tipografia editoriale, pensata per far parlare le foto.
   ========================================================================== */

:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --ink: #17161a;
  --ink-soft: #4b4a4f;
  --muted: #6f6c66;
  --line: #e6e1d9;
  --line-strong: #d5cfc4;
  --accent: #17161a;
  --danger: #a4372c;
  --ok: #2f6b4f;

  --radius: 2px;
  --radius-lg: 4px;
  --shadow: 0 1px 2px rgba(23, 22, 26, .04), 0 12px 32px rgba(23, 22, 26, .06);
  --shadow-lift: 0 2px 6px rgba(23, 22, 26, .06), 0 24px 56px rgba(23, 22, 26, .12);

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: Georgia, "Times New Roman", "Iowan Old Style", serif;

  --wrap: 1180px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; }
a { color: inherit; }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -.01em;
  margin: 0;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

/* ---------- intestazione ---------- */

.site-head {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(250, 248, 245, .88);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.site-head .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: .02em;
}

.brand svg { flex: none; }

.head-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 13px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.head-nav a {
  text-decoration: none;
  color: var(--ink-soft);
  padding: 6px 0;
  border-bottom: 1px solid transparent;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}

.head-nav a:hover,
.head-nav a[aria-current="page"] { color: var(--ink); border-color: var(--ink); }

/* ---------- bottoni ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-size: 13px;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), transform .12s var(--ease);
}

.btn:hover { background: #33313a; border-color: #33313a; }
.btn:active { transform: translateY(1px); }

.btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn--ghost:hover { background: var(--ink); border-color: var(--ink); color: #fff; }

.btn--sm { padding: 8px 14px; font-size: 11px; }

.btn[disabled] { opacity: .4; cursor: not-allowed; }

.btn svg { flex: none; }

/* ---------- hero ---------- */

.hero {
  padding: 96px 0 72px;
  text-align: center;
  border-bottom: 1px solid var(--line);
}

.hero h1 {
  font-size: clamp(34px, 6vw, 62px);
  margin: 18px 0 0;
}

.hero p.lead {
  max-width: 620px;
  margin: 20px auto 0;
  color: var(--ink-soft);
  font-size: 17px;
}

.hero .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 34px;
}

/* ---------- sezioni ---------- */

.section { padding: 72px 0; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 32px;
}

.section-head h2 { font-size: clamp(24px, 3.4vw, 34px); }

/* ---------- griglia gallerie ---------- */

.gallery-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 28px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  transition: box-shadow .25s var(--ease), transform .25s var(--ease), border-color .25s var(--ease);
}

.card:hover {
  box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
  border-color: var(--line-strong);
}

.card-cover {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #efece6;
  overflow: hidden;
}

.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .6s var(--ease);
}

.card:hover .card-cover img { transform: scale(1.04); }

.card-cover-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: repeating-linear-gradient(45deg, #efece6, #efece6 10px, #eae6de 10px, #eae6de 20px);
}

.card-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(23, 22, 26, .72);
  color: #fff;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  border-radius: var(--radius);
  backdrop-filter: blur(6px);
}

.card-body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-body h3 { font-size: 21px; }
.card-meta { font-size: 13px; color: var(--muted); display: flex; gap: 10px; align-items: center; }
.card-foot { margin-top: auto; padding-top: 14px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink); display: inline-flex; align-items: center; gap: 8px; }

/* ---------- accesso cliente ---------- */

.access {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 32px;
  align-items: center;
}

.access form { display: flex; gap: 10px; }
.access input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font: inherit;
  background: var(--bg);
}
.access input:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }

/* ---------- pagina galleria ---------- */

.gallery-hero { padding: 64px 0 34px; border-bottom: 1px solid var(--line); }
.gallery-hero h1 { font-size: clamp(28px, 4.6vw, 46px); margin-top: 14px; }
.gallery-hero .meta { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: 14px; }
.gallery-hero .meta span { display: inline-flex; align-items: center; gap: 7px; }

.toolbar {
  position: sticky;
  top: 68px;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 14px 0;
  background: rgba(250, 248, 245, .92);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
  margin-bottom: 30px;
}

.toolbar .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.toolbar .count { font-size: 13px; color: var(--muted); margin-right: auto; }
.toolbar .spacer { margin-right: auto; }
.toolbar .btn { white-space: nowrap; }

/* griglia foto */
.photo-grid {
  columns: 3 300px;
  column-gap: 14px;
  padding-bottom: 40px;
}

.photo {
  position: relative;
  break-inside: avoid;
  margin: 0 0 14px;
  background: #efece6;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: zoom-in;
}

.photo img { width: 100%; height: auto; transition: transform .5s var(--ease); }
.photo:hover img { transform: scale(1.02); }

.photo-open {
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  font: inherit;
  color: inherit;
}

.photo-open:focus-visible { outline: 2px solid var(--ink); outline-offset: -3px; }

.photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(23, 22, 26, .35), rgba(23, 22, 26, 0) 45%);
  opacity: 0;
  transition: opacity .25s var(--ease);
  pointer-events: none;
}

.photo:hover::after { opacity: 1; }

.photo-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}

.photo:hover .photo-actions,
.photo:focus-within .photo-actions { opacity: 1; transform: none; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .5);
  background: rgba(23, 22, 26, .55);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}

.icon-btn:hover { background: #fff; color: var(--ink); border-color: #fff; }
.icon-btn.is-on { background: #fff; color: var(--danger); border-color: #fff; }

.photo-name {
  position: absolute;
  left: 12px;
  bottom: 10px;
  color: #fff;
  font-size: 12px;
  letter-spacing: .04em;
  opacity: 0;
  transition: opacity .25s var(--ease);
  max-width: calc(100% - 24px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .5);
}

.photo:hover .photo-name { opacity: 1; }

.photo.is-selected { outline: 3px solid var(--ink); outline-offset: -3px; }

/* ---------- cancello password ---------- */

.gate {
  max-width: 460px;
  margin: 80px auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  text-align: center;
  box-shadow: var(--shadow);
}

.gate .lock {
  width: 48px;
  height: 48px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}

.gate h1 { font-size: 26px; margin-bottom: 8px; }
.gate p { color: var(--muted); font-size: 14px; margin: 0 0 24px; }
.gate form { display: flex; flex-direction: column; gap: 12px; }
.gate input {
  padding: 13px 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font: inherit;
  text-align: center;
  letter-spacing: .1em;
  background: var(--bg);
}
.gate input:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.gate .error { color: var(--danger); font-size: 13px; min-height: 18px; }

/* ---------- lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(14, 13, 16, .96);
  display: none;
  grid-template-rows: auto 1fr auto;
  color: #fff;
}

.lightbox.is-open { display: grid; }

.lb-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.lb-bar .title { font-size: 13px; color: rgba(255, 255, 255, .72); margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lb-stage {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 16px;
}

.lb-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}

.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(0, 0, 0, .35);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background .2s var(--ease), color .2s var(--ease);
}

.lb-nav:hover { background: #fff; color: var(--ink); }
.lb-nav.prev { left: 18px; }
.lb-nav.next { right: 18px; }

.lb-foot {
  padding: 14px 20px;
  border-top: 1px solid rgba(255, 255, 255, .1);
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: rgba(255, 255, 255, .72);
}

.lb-foot .counter { margin-right: auto; letter-spacing: .1em; }

.lb-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, .28);
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .2s var(--ease), color .2s var(--ease);
}

.lb-btn:hover { background: #fff; color: var(--ink); border-color: #fff; }
.lb-btn.is-on { background: #fff; color: var(--danger); border-color: #fff; }

/* ---------- barra selezione ---------- */

.selbar {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translate(-50%, 140%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  box-shadow: var(--shadow-lift);
  transition: transform .3s var(--ease);
  font-size: 13px;
}

.selbar.is-visible { transform: translate(-50%, 0); }
.selbar .btn { background: #fff; color: var(--ink); border-color: #fff; }
.selbar .btn--ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .4); }
.selbar .btn--ghost:hover { background: #fff; color: var(--ink); }

/* ---------- stati ---------- */

.empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--muted);
}
.empty h3 { font-size: 24px; color: var(--ink); margin-bottom: 8px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translate(-50%, 20px);
  z-index: 120;
  background: var(--ink);
  color: #fff;
  padding: 11px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

/* ---------- piè di pagina ---------- */

.site-foot {
  border-top: 1px solid var(--line);
  padding: 40px 0;
  margin-top: 40px;
  color: var(--muted);
  font-size: 13px;
}

.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; }
.site-foot a { color: var(--ink-soft); text-decoration: none; border-bottom: 1px solid var(--line-strong); }
.site-foot a:hover { color: var(--ink); }

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .access { grid-template-columns: 1fr; gap: 20px; }
  .hero { padding: 64px 0 48px; }
  .section { padding: 52px 0; }
  .toolbar { top: 68px; }
  .lb-nav { width: 42px; height: 42px; }
  .lb-nav.prev { left: 8px; }
  .lb-nav.next { right: 8px; }
}

@media (max-width: 560px) {
  .head-nav { gap: 14px; font-size: 11px; }
  .photo-grid { columns: 2 160px; column-gap: 10px; }
  .photo { margin-bottom: 10px; }
  .access form { flex-direction: column; }
  .lb-bar { padding: 12px 14px; }
}

/* ---------- area fotografo ---------- */

.wrap--narrow { max-width: 620px; }
.admin-title { font-size: clamp(28px, 4.6vw, 44px); margin-top: 14px; }
.admin-lead { color: var(--ink-soft); margin: 14px 0 26px; }

.admin-gate { display: flex; gap: 10px; }
.admin-gate input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font: inherit;
  background: var(--surface);
}
.admin-gate input:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.admin-note { margin-top: 14px; color: var(--danger); font-size: 14px; }

.admin-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 22px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.field input {
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font: inherit;
  background: var(--bg);
  min-width: 0;
}
.field input:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.field small { color: var(--muted); font-size: 12px; line-height: 1.5; }

.drop {
  margin-top: 22px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 30px 22px;
  text-align: center;
  background: var(--bg);
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.drop.is-over { border-color: var(--ink); background: #fff; }
.drop-title { margin: 0 0 12px; color: var(--ink-soft); }
.drop-hint { margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.drop-count { margin: 12px 0 0; color: var(--ok); font-size: 14px; }

.admin-actions { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 10px; }

.progress { margin-top: 20px; }
.progress-bar {
  height: 4px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--ink);
  transition: width .25s var(--ease);
}
.progress-text { margin: 10px 0 0; color: var(--ink-soft); font-size: 13px; }

.admin-list { display: grid; gap: 16px; }
.admin-empty { color: var(--muted); }

.admin-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
}
.admin-item-head { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; }
.admin-item-head h3 { margin: 0; font-family: var(--serif); font-size: 22px; font-weight: 500; }
.admin-item-meta { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

.badge {
  flex: none;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border: 1px solid var(--line-strong);
  border-radius: 99px;
  padding: 4px 10px;
}

.admin-link {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.admin-link code {
  flex: 1;
  min-width: 200px;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.admin-item-actions { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.admin-item-actions label.btn { cursor: pointer; }
.admin-danger { color: var(--danger); border-color: var(--danger); }
.admin-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

@media (max-width: 700px) {
  .admin-grid { grid-template-columns: 1fr; }
  .admin-card { padding: 20px; }
  .admin-gate { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
