@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;700;800&family=Quicksand:wght@400;500;600;700&display=swap');

:root {
  --parchment: #ecd9ab;
  --parchment-light: #f6ecd0;
  --brown: #5b3a22;
  --brown-dark: #37220f;
  --brown-mid: #7a4f2c;
  --gold: #c9963c;
  --gold-light: #e0b869;
  --red: #a4342a;
  --cream: #faf3e0;
  --shadow: rgba(55, 34, 15, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: 'Quicksand', sans-serif;
  color: var(--brown-dark);
  background-color: var(--parchment);
  background-image: url('parchment.jpg');
  background-repeat: repeat;
}

h1, h2, h3, .brand {
  font-family: 'Baloo 2', cursive;
}

img, .protected-img {
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* allow clicks on wrapper elements even though inner image ignores pointer events */
.thumb, .lightbox-image {
  pointer-events: auto;
}

/* ---------- Lock screen ---------- */
#lock-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lock-card {
  background: var(--cream);
  border: 6px solid var(--brown);
  border-radius: 18px;
  box-shadow: 0 18px 40px var(--shadow), inset 0 0 0 2px var(--gold-light);
  padding: 36px 32px 32px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  position: relative;
}

.lock-logo {
  width: 100%;
  max-width: 260px;
  margin: -70px auto 12px;
  display: block;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,0.35));
}

.lock-card h1 {
  font-size: 1.5rem;
  color: var(--brown);
  margin: 8px 0 4px;
}

.lock-card p.tagline {
  font-size: 0.95rem;
  color: var(--brown-mid);
  margin: 0 0 22px;
}

#password-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#password-input {
  font-family: 'Quicksand', sans-serif;
  font-size: 1.1rem;
  padding: 12px 16px;
  border-radius: 10px;
  border: 2px solid var(--brown-mid);
  background: #fffaf0;
  text-align: center;
  letter-spacing: 1px;
}

#password-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,150,60,0.3);
}

.unlock-btn {
  font-family: 'Baloo 2', cursive;
  font-size: 1.15rem;
  color: var(--cream);
  background: linear-gradient(180deg, var(--brown-mid), var(--brown));
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--brown-dark);
  transition: transform 0.08s ease;
}

.unlock-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--brown-dark);
}

.unlock-btn:hover { filter: brightness(1.08); }

#lock-error {
  color: var(--red);
  font-weight: 600;
  font-size: 0.9rem;
  min-height: 1.2em;
  margin-top: 4px;
}

.privacy-note {
  font-size: 0.8rem;
  color: var(--brown-mid);
  background: rgba(201, 150, 60, 0.15);
  border: 1px solid var(--gold-light);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 18px 0 0;
  line-height: 1.4;
}

main.gallery-wrap .privacy-note {
  margin: 0 0 16px;
  text-align: center;
}

.shake { animation: shake 0.4s; }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-8px); }
  40%, 60% { transform: translateX(8px); }
}

/* ---------- Gallery screen ---------- */
#gallery-screen { display: none; min-height: 100vh; }

header.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: linear-gradient(180deg, var(--brown), var(--brown-dark));
  box-shadow: 0 3px 10px var(--shadow);
  position: sticky;
  top: 0;
  z-index: 20;
}

.site-header .brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-header img.logo-small {
  height: 44px;
  pointer-events: none;
}

.site-header h1 {
  color: var(--cream);
  font-size: 1.15rem;
  margin: 0;
}

.site-header .sub {
  color: var(--gold-light);
  font-size: 0.75rem;
  display: block;
}

.logout-btn {
  font-family: 'Quicksand', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--brown-dark);
  background: var(--gold-light);
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
}
.logout-btn:hover { filter: brightness(1.05); }

main.gallery-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 20px 60px;
}

#photo-count {
  color: var(--brown-mid);
  font-size: 0.9rem;
  margin: 0 0 16px;
  text-align: center;
}

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

.thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  border: 3px solid var(--parchment-light);
  box-shadow: 0 4px 10px var(--shadow);
  background-color: #d8c495;
  background-size: cover;
  background-position: center;
  transition: transform 0.15s ease;
}

.thumb:hover { transform: translateY(-3px) scale(1.02); }

.thumb .wm {
  position: absolute;
  inset: 0;
  background-image: url('logo.png');
  background-repeat: repeat;
  background-size: 90px auto;
  opacity: 0.08;
  mix-blend-mode: multiply;
  pointer-events: none;
}

.empty-state {
  text-align: center;
  color: var(--brown-mid);
  padding: 60px 20px;
  font-size: 1rem;
}

/* ---------- Lightbox ---------- */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 12, 5, 0.92);
  z-index: 50;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 20px;
}

.lightbox-image {
  max-width: min(90vw, 900px);
  max-height: 70vh;
  aspect-ratio: auto;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  position: relative;
  width: 100%;
  height: 65vh;
}

.lightbox-image .wm {
  position: absolute;
  inset: 0;
  background-image: url('logo.png');
  background-repeat: repeat;
  background-size: 130px auto;
  opacity: 0.10;
  mix-blend-mode: screen;
  pointer-events: none;
}

.lightbox-controls {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-top: 18px;
}

.lb-btn {
  background: var(--gold-light);
  border: none;
  color: var(--brown-dark);
  font-family: 'Baloo 2', cursive;
  font-size: 1.4rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-btn:hover { filter: brightness(1.08); }

#lb-counter {
  color: var(--cream);
  font-family: 'Quicksand', sans-serif;
  font-size: 0.9rem;
  min-width: 70px;
  text-align: center;
}

#lb-close {
  position: absolute;
  top: 18px;
  right: 22px;
  background: none;
  border: none;
  color: var(--cream);
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
}
#lb-close:hover { color: var(--gold-light); }

@media print {
  body { display: none !important; }
}

@media (max-width: 480px) {
  .site-header h1 { font-size: 0.95rem; }
  .lock-card { padding: 28px 20px 24px; }
}
