:root {
  --color-bg: #f2e9d8;
  --color-bg-secondary: #c9ad8f;
  --color-accent: #8b6f4e;
  --color-heading: #b5462f;
  --color-text: #2b1b12;
  --color-error: #b3261e;
  --font-display: "Cormorant Garamond", serif;
  --font-body: "Lato", sans-serif;
  --max-width: 1100px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 3rem;
}

/* ---------- Hero ---------- */

.hero {
  text-align: center;
  margin-bottom: 2rem;
}

.monogram {
  width: 250px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.hero a {
  display: block;
  width: fit-content;
  margin: 0 auto;
}

/* ---------- Photobooth title ---------- */

.pb-header {
  text-align: center;
  margin-bottom: 2rem;
}

.pb-title {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--color-heading);
  font-size: 2rem;
  margin: 0 0 0.35rem;
}

.pb-subtitle {
  font-size: 1.05rem;
  color: var(--color-accent);
  font-style: italic;
  margin: 0;
}

/* ---------- Loading / error states ---------- */

.state-message {
  text-align: center;
  font-size: 1.05rem;
  padding: 2rem 1rem;
}

.error-state p {
  color: var(--color-error);
  font-weight: 700;
  margin: 0;
}

/* ---------- Grid section ---------- */

.pb-grid-section {
  background-color: var(--color-bg-secondary);
  border-radius: 18px;
  padding: 1.75rem 1.5rem;
  margin-bottom: 2rem;
}

.empty-state {
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.3rem;
  color: var(--color-text);
  padding: 2.5rem 1rem;
  margin: 0;
}

.photo-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 480px) {
  .photo-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 640px) {
  .photo-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---------- Photo card ---------- */

.photo-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background-color: var(--color-bg);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.photo-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(43, 27, 18, 0.2);
}

.photo-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  /* Taupe placeholder while the image loads lazily */
  background-color: var(--color-bg-secondary);
}

/* ---------- Download overlay ---------- */

.photo-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.5rem;
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  /* Dark gradient for icon legibility against any photo */
  background: linear-gradient(to top, rgba(43, 27, 18, 0.6) 0%, transparent 100%);
  /* Desktop: fade in on hover */
  opacity: 0;
  transition: opacity 0.18s ease;
  pointer-events: none;
}

.photo-card:hover .photo-overlay {
  opacity: 1;
  pointer-events: auto;
}

/* Touch devices: always show the icon (there is no hover) */
@media (hover: none) {
  .photo-overlay {
    opacity: 1;
    pointer-events: auto;
  }
}

.photo-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: rgba(242, 233, 216, 0.9);
  color: var(--color-heading);
  text-decoration: none;
  flex-shrink: 0;
  transition: background-color 0.15s ease;
}

.photo-download:hover {
  background-color: #fff;
}

/* ---------- Lightbox ---------- */

.lightbox[hidden] {
  display: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  background-color: rgba(43, 27, 18, 0.93);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem 1.5rem;
  z-index: 1000;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  font-size: 2.2rem;
  line-height: 1;
  color: #fff;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  opacity: 0.8;
  transition: opacity 0.15s ease;
}

.lightbox-close:hover {
  opacity: 1;
}

.lightbox-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  max-width: 100%;
  max-height: 100%;
}

.lightbox-img {
  display: block;
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
}

.lightbox-actions {
  display: flex;
  justify-content: center;
}

.btn-scarica {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  background-color: var(--color-heading);
  border-radius: 999px;
  padding: 0.75rem 2.25rem;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.btn-scarica:hover {
  opacity: 0.9;
}

/* ---------- Footer ---------- */

.pb-footer {
  text-align: center;
}

.back-link {
  font-size: 0.9rem;
  color: var(--color-accent);
  font-style: italic;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}
