/* ── Costume Contest — moonlit haunted night ────────────────────────
   Midnight indigo, glowing full moon, pumpkin-orange accents, gothic
   display serif, framed-portrait gallery cards with candle vignette. */

:root {
  --night: #131024;
  --night-2: #1c1733;
  --card: #221c3d;
  --pumpkin: #ff8c2e;
  --pumpkin-deep: #d96a10;
  --moon: #f4ecd7;
  --bone: #ece7f4;
  --mist: #9a92b5;
  --line: rgba(236, 231, 244, 0.14);
  --err: #ff6259;
  --ok: #6fce8f;
  --font-display: 'Pirata One', serif;
  --font-body: 'Crimson Pro', serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

.hidden { display: none !important; }

body {
  font-family: var(--font-body);
  background: var(--night);
  color: var(--bone);
  line-height: 1.65;
  font-size: 1.05rem;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.page { display: flex; flex-direction: column; min-height: 100vh; }

.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 20px; }

main { flex: 1 0 auto; padding-bottom: 70px; }

/* ── Hero ─────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(45% 40% at 50% 8%, rgba(244, 236, 215, 0.12), transparent 70%),
    linear-gradient(180deg, var(--night-2), var(--night));
  text-align: center;
  padding: 84px 0 60px;
}

.moon {
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, var(--moon), #cfc4a4 75%);
  box-shadow: 0 0 90px rgba(244, 236, 215, 0.4), 0 0 220px rgba(244, 236, 215, 0.18);
  opacity: 0.6;
  pointer-events: none;
}

.hero-inner { position: relative; }

.badge {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--pumpkin);
  border: 1px solid rgba(255, 140, 46, 0.45);
  border-radius: 999px;
  padding: 7px 20px;
  margin-bottom: 22px;
  background: rgba(19, 16, 36, 0.6);
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(3rem, 11vw, 5.4rem);
  line-height: 0.95;
  color: var(--bone);
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.6);
}

.hero .sub {
  max-width: 520px;
  margin: 18px auto 28px;
  color: var(--mist);
  font-size: 1.15rem;
}

.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ── Tabs ─────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 10px;
  margin: 32px 0 24px;
  justify-content: center;
}

.tab {
  font-family: var(--font-display);
  font-size: 1.3rem;
  letter-spacing: 0.04em;
  padding: 10px 30px;
  background: transparent;
  color: var(--mist);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab.is-active {
  background: rgba(255, 140, 46, 0.12);
  color: var(--pumpkin);
  border-color: rgba(255, 140, 46, 0.5);
}

/* ── Cards ────────────────────────────────────────────────────────── */
.card {
  background: linear-gradient(180deg, var(--card), var(--night-2));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 32px 30px 36px;
  max-width: 620px;
  margin: 0 auto;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.45);
}

.card h2 { font-family: var(--font-display); font-weight: 400; font-size: 2.1rem; }

.card-sub { color: var(--mist); margin: 4px 0 24px; }

.note {
  max-width: 620px;
  margin: 18px auto;
  padding: 16px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: center;
}

/* Upload drop zone */
.drop {
  position: relative;
  border: 2px dashed rgba(236, 231, 244, 0.3);
  border-radius: 12px;
  background: rgba(19, 16, 36, 0.5);
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.drop:hover { border-color: var(--pumpkin); }

.drop input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.drop-inner { text-align: center; padding: 22px; }
.drop-icon { font-size: 2.2rem; display: block; margin-bottom: 8px; }
.drop-text { font-weight: 700; color: var(--bone); }
.drop-hint { color: var(--mist); font-size: 0.9rem; margin-top: 4px; }

.preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Fields */
.field { margin-bottom: 16px; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

label {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 6px;
  color: var(--bone);
}

input[type="text"],
input[type="email"] {
  width: 100%;
  padding: 13px 15px;
  font-size: 1.05rem;
  font-family: inherit;
  color: var(--bone);
  background: rgba(19, 16, 36, 0.65);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus {
  outline: none;
  border-color: var(--pumpkin);
  box-shadow: 0 0 0 4px rgba(255, 140, 46, 0.15);
}

input.error { border-color: var(--err); }
input::placeholder { color: var(--mist); opacity: 0.7; }

.form-error { color: var(--err); font-weight: 700; text-align: center; margin-top: 14px; }

/* Post-entry */
.my-photo-wrap { text-align: center; margin-bottom: 20px; }

.my-photo {
  max-width: 260px;
  width: 100%;
  border: 6px solid #3a2f5e;
  border-radius: 4px;
  box-shadow: 0 0 40px rgba(255, 140, 46, 0.2), 0 20px 50px rgba(0, 0, 0, 0.5);
  margin-bottom: 12px;
}

.my-caption { font-weight: 700; font-size: 1.15rem; font-style: italic; }

.share-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: 0.04em;
  padding: 13px 30px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
  line-height: 1.2;
}

.btn:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.1); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:focus-visible { outline: 3px solid var(--pumpkin); outline-offset: 2px; }

.btn-primary {
  background: linear-gradient(120deg, var(--pumpkin), var(--pumpkin-deep));
  color: var(--night);
  box-shadow: 0 0 30px rgba(255, 140, 46, 0.3), 0 14px 34px rgba(0, 0, 0, 0.4);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--bone);
}

.btn-block { width: 100%; }

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2.5px solid rgba(19, 16, 36, 0.35);
  border-top-color: var(--night);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Gallery ──────────────────────────────────────────────────────── */
.gallery-head { text-align: center; margin-bottom: 24px; }

.gallery-head h2 { font-family: var(--font-display); font-weight: 400; font-size: 2.4rem; }

.gallery-sub { color: var(--mist); }

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

.pet-card {
  background: var(--card);
  border: 5px solid #3a2f5e;
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4);
}

.pet-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 0 30px rgba(255, 140, 46, 0.18), 0 20px 44px rgba(0, 0, 0, 0.5);
}

.pet-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  filter: contrast(1.02) saturate(0.95);
}

.pet-caption { font-weight: 700; font-style: italic; padding: 12px 14px 2px; font-size: 1rem; }

.pet-author { color: var(--mist); font-size: 0.85rem; padding: 0 14px; }

.pet-votes {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px 14px;
  gap: 10px;
}

.vote-count { font-weight: 700; color: var(--pumpkin); }

.vote-btn {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.92rem;
  padding: 8px 20px;
  background: rgba(255, 140, 46, 0.14);
  color: var(--pumpkin);
  border: 1px solid rgba(255, 140, 46, 0.45);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.vote-btn:hover:not(:disabled) { background: rgba(255, 140, 46, 0.26); }

.vote-btn.is-voted { background: rgba(111, 206, 143, 0.15); color: var(--ok); border-color: rgba(111, 206, 143, 0.4); cursor: default; }

/* Empty state */
.empty { text-align: center; padding: 50px 20px; }
.empty-icon { font-size: 2.4rem; display: block; margin-bottom: 10px; }
.empty-sub { color: var(--mist); margin: 6px 0 18px; }

.load-wrap { text-align: center; margin-top: 26px; }

/* ── Lightbox ─────────────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(10, 8, 20, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
}

.lb-content { max-width: 860px; width: 100%; text-align: center; }

.lb-img {
  max-width: 100%;
  max-height: 62vh;
  border: 8px solid #3a2f5e;
  border-radius: 4px;
  box-shadow: 0 0 60px rgba(255, 140, 46, 0.2);
}

.lb-meta { margin-top: 18px; }
.lb-caption { font-weight: 700; font-style: italic; font-size: 1.2rem; }
.lb-author { color: var(--mist); font-size: 0.95rem; margin-top: 2px; }
.lb-actions { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }
.lb-votes { font-weight: 700; color: var(--pumpkin); }

.lb-close {
  position: absolute;
  top: 18px;
  right: 22px;
  font-size: 2.2rem;
  background: none;
  border: none;
  color: var(--bone);
  cursor: pointer;
  line-height: 1;
}

.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2.6rem;
  background: rgba(236, 231, 244, 0.1);
  border: none;
  color: var(--bone);
  cursor: pointer;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  line-height: 1;
}

.lb-prev { left: 16px; }
.lb-next { right: 16px; }

/* ── Toast ────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: var(--err);
  color: #fff;
  padding: 14px 26px;
  border-radius: 999px;
  font-weight: 700;
  z-index: 300;
  max-width: 92vw;
  text-align: center;
}

.toast-ok { background: #2c7a4b; }

/* ── Footer ───────────────────────────────────────────────────────── */
.footer {
  flex-shrink: 0;
  text-align: center;
  padding: 26px 20px;
  color: var(--mist);
  font-size: 0.92rem;
  border-top: 1px solid var(--line);
}

#wbx-powered-by-slot { margin-top: 12px; }

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 560px) {
  .field-grid { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .moon { width: 180px; height: 180px; }
}

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