:root {
  --green: #0b3d24;
  --green-dark: #072b19;
  --red: #b3141c;
  --gold: #d4af37;
  --snow: #fdfdfb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--green-dark), var(--green));
  color: var(--snow);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  position: relative;
  overflow-x: hidden;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: rgba(0, 0, 0, 0.25);
  position: relative;
  z-index: 2;
}

.site-header .brand {
  color: var(--gold);
  font-size: 1.4rem;
  font-weight: bold;
  text-decoration: none;
}

.site-header nav a {
  color: var(--snow);
  margin-left: 1rem;
  text-decoration: none;
}

.site-header nav a:hover { color: var(--gold); }

main {
  position: relative;
  z-index: 2;
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

h1, h2 { color: var(--gold); }

a { color: var(--gold); }

.btn {
  display: inline-block;
  vertical-align: middle;
  background: var(--red);
  color: var(--snow);
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
}

.btn:hover { background: #8f1016; }

.inline-form {
  display: inline-block;
  vertical-align: middle;
  margin: 0;
}

button {
  background: var(--red);
  color: var(--snow);
  border: none;
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
}

button:hover { background: #8f1016; }

input[type="text"],
input[type="number"],
input[type="datetime-local"],
select {
  background: rgba(255, 255, 255, 0.9);
  color: #111;
  border: 1px solid var(--gold);
  border-radius: 4px;
  padding: 0.4rem;
}

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

.center-card {
  max-width: 480px;
  margin: 4rem auto;
  text-align: center;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 2rem;
}

.flashes {
  list-style: none;
  padding: 0.8rem 1rem;
  margin: 0 0 1.5rem;
  background: rgba(212, 175, 55, 0.2);
  border: 1px solid var(--gold);
  border-radius: 8px;
}

.album-list {
  list-style: none;
  padding: 0;
}

.album-list li a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  margin-bottom: 0.6rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--gold);
  border-radius: 8px;
  text-decoration: none;
  color: var(--snow);
}

.album-name { font-weight: bold; }

.badge {
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.85rem;
  background: var(--red);
}

.badge-revealed { background: var(--gold); color: #222; }

.countdown {
  text-align: center;
  margin: 2rem 0;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--gold);
  border-radius: 12px;
}

.countdown-label { font-size: 1.1rem; margin-bottom: 0.5rem; }

.countdown-digits {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
}

.countdown-digits div {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.countdown-digits span {
  font-size: 3rem;
  font-weight: bold;
  color: var(--gold);
  line-height: 1;
}

.countdown-digits small {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.3rem;
}

.photo-month-group {
  margin-bottom: 2rem;
}

.photo-year-header {
  color: var(--snow);
  font-size: 1.6rem;
  margin: 0 0 0.2rem;
  opacity: 0.9;
}

.photo-month-header {
  color: var(--gold);
  margin: 0 0 0.8rem;
}

.photo-grid-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.photo-thumb img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid var(--gold);
  display: block;
}

.photo-thumb {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: block;
  width: 100%;
  position: relative;
}

/* Fullscreen lightbox (photo browser: click to view, swipe/arrows to navigate) */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.lightbox.hidden { display: none; }

.lightbox-media {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  max-width: 90vw;
  max-height: 90vh;
}

.lightbox-media img {
  /* Natural intrinsic sizing (no forced width/height, no object-fit) so this
     element's box is always exactly the visible picture - the border then hugs
     the photo with no letterboxed "gaps", whatever its aspect ratio. */
  display: block;
  max-width: 90vw;
  max-height: 74vh;
  width: auto;
  height: auto;
  border: 2px solid var(--gold);
  border-radius: 6px;
}

/* #id selector needed so this reliably beats the global input[type="text"] rule */
#lightbox-caption {
  width: 100%;
  max-width: 500px;
  text-align: center;
  background: transparent;
  border: none;
  color: var(--snow);
  padding: 0.3rem 0.8rem;
  font-size: 1rem;
  font-family: inherit;
}

#lightbox-caption:focus {
  outline: none;
}

#lightbox-caption.hidden { display: none; }

#lightbox-caption::placeholder { color: rgba(255, 255, 255, 0.75); }

.lightbox-date {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
  text-align: center;
  margin: 0;
}

.lightbox-close, .lightbox-prev, .lightbox-next {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  color: var(--snow);
  border: 1px solid var(--gold);
  border-radius: 50%;
  width: 3rem;
  height: 3rem;
  padding: 0;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close { top: 1rem; right: 1rem; }
.lightbox-prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 1rem; top: 50%; transform: translateY(-50%); }

.lightbox-delete {
  border-radius: 6px;
  padding: 0.6rem 1.2rem;
  background: var(--red);
  color: var(--snow);
  border: none;
  cursor: pointer;
}

.lightbox-delete.hidden { display: none; }

/* Standalone fullscreen page (slideshow / countdown) */
.fullscreen-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--green-dark), var(--green));
  color: var(--snow);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  position: relative;
  overflow: hidden;
}

.fullscreen-body .slideshow-stage {
  min-height: 100vh;
  width: 100%;
  border: none;
  border-radius: 0;
}

.back-link {
  position: absolute;
  top: 1rem;
  left: 1rem;
  color: var(--snow);
  text-decoration: none;
  z-index: 5;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
}

.fullscreen-countdown {
  text-align: center;
  position: relative;
  z-index: 2;
}

.slideshow-settings {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 6;
}

#settings-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--gold);
  color: var(--snow);
  border-radius: 50%;
  width: 3rem;
  height: 3rem;
  padding: 0;
  font-size: 1.3rem;
  line-height: 1;
}

.settings-panel {
  position: absolute;
  top: 3.5rem;
  right: 0;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 1rem;
  min-width: 220px;
}

.settings-panel.hidden { display: none; }

.settings-panel label {
  display: block;
  font-size: 0.9rem;
}

.settings-panel label + label { margin-top: 0.8rem; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.admin-table th, .admin-table td {
  text-align: left;
  padding: 0.6rem;
  border-bottom: 1px solid rgba(212, 175, 55, 0.4);
}

.admin-table .actions form { display: inline-block; margin-left: 0.5rem; }
.admin-table .actions a { margin-right: 0.5rem; }

.copy-link {
  cursor: pointer;
  background: rgba(212, 175, 55, 0.15);
  border: 1px dashed var(--gold);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
}

.copy-link:hover {
  background: rgba(212, 175, 55, 0.3);
}

.slideshow-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  background: #000;
  border: 3px solid var(--gold);
  border-radius: 12px;
  overflow: hidden;
}

.slideshow-media {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  max-width: 90vw;
  max-height: 92vh;
}

.slideshow-stage img {
  display: block;
  max-width: 90vw;
  max-height: 80vh;
  width: auto;
  height: auto;
  transition: opacity 0.3s ease-in-out;
}

.slideshow-caption {
  flex: 0 0 auto;
  color: var(--gold);
  font-size: 1.3rem;
  text-align: center;
  max-width: 80vw;
  min-height: 1.6rem;
  margin: 0;
}

/* Snowfall */
.snowfall {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.snowfall span {
  position: absolute;
  top: -10px;
  width: 6px;
  height: 6px;
  background: var(--snow);
  border-radius: 50%;
  opacity: 0.8;
  animation: fall linear infinite;
}

@keyframes fall {
  to {
    transform: translateY(110vh);
  }
}

.snowfall span:nth-child(3n) { width: 4px; height: 4px; opacity: 0.6; }
.snowfall span:nth-child(5n) { width: 8px; height: 8px; opacity: 0.5; }
