/* ── Family Moments Contest — fridge-door gallery ───────────────────
   Off-white fridge sheen, glossy magnet pins in cherry/sunflower/
   sky, crayon rainbow headline, index-card caption strips. */

:root {
  --fridge: #f4f2ed;
  --fridge-deep: #e7e4dc;
  --cherry: #e04848;
  --sunflower: #f5b32b;
  --sky: #4a9de0;
  --grass: #5cb85c;
  --grape: #9a63c9;
  --ink: #3d3a35;
  --ink-soft: #8a867e;
  --card: #ffffff;
  --line: #e5e1d8;
  --err: #e04848;
  --font-crayon: 'Schoolbell', cursive;
  --font-body: 'Varela Round', sans-serif;
}

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

.hidden { display: none !important; }

body {
  font-family: var(--font-body);
  background:
    linear-gradient(105deg, rgba(255, 255, 255, 0.55) 0%, transparent 22%, transparent 78%, rgba(61, 58, 53, 0.05) 100%),
    var(--fridge);
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

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

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

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

/* ── Hero ─────────────────────────────────────────────────────────── */
.hero { text-align: center; padding: 52px 0 14px; }

.hero-inner { position: relative; }

/* kid-drawn sun */
.sun-doodle {
  position: absolute;
  top: -18px;
  right: 2%;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--sunflower);
  box-shadow:
    0 -64px 0 -23px var(--sunflower), 0 64px 0 -23px var(--sunflower),
    -64px 0 0 -23px var(--sunflower), 64px 0 0 -23px var(--sunflower),
    -46px -46px 0 -23px var(--sunflower), 46px -46px 0 -23px var(--sunflower),
    -46px 46px 0 -23px var(--sunflower), 46px 46px 0 -23px var(--sunflower);
  opacity: 0.9;
}

.badge {
  display: inline-block;
  font-weight: 400;
  font-size: 0.74rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--card);
  background: var(--sky);
  border-radius: 999px;
  padding: 7px 18px;
  margin-bottom: 16px;
}

.hero h1 {
  font-family: var(--font-crayon);
  font-size: clamp(2.6rem, 11vw, 4rem);
  line-height: 1.05;
  letter-spacing: 0.02em;
}

.hero h1 .r1 { color: var(--cherry); }
.hero h1 .r2 { color: var(--sky); }
.hero h1 .r3 { color: var(--sunflower); }
.hero h1 .r4 { color: var(--grass); }
.hero h1 .r5 { color: var(--grape); }
.hero h1 .r6 { color: var(--ink); }

.hero .sub { margin-top: 14px; color: var(--ink-soft); max-width: 480px; margin-left: auto; margin-right: auto; }

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

/* ── Tabs ─────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 8px; margin: 30px 0 20px; }

.tab {
  flex: 1;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1rem;
  padding: 12px 10px;
  background: var(--fridge-deep);
  color: var(--ink-soft);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab:hover { color: var(--ink); }

.tab.is-active {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(61, 58, 53, 0.14), 0 0 0 2px var(--sky);
}

/* ── Cards / notes ────────────────────────────────────────────────── */
.card {
  position: relative;
  background: var(--card);
  border-radius: 14px;
  padding: 32px 26px 30px;
  box-shadow: 0 10px 26px rgba(61, 58, 53, 0.12);
  margin-bottom: 18px;
}

/* magnet on the card */
.card::before {
  content: '';
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #f08a8a, var(--cherry) 65%);
  box-shadow: 0 3px 6px rgba(61, 58, 53, 0.3);
}

.card h2 { font-family: var(--font-crayon); font-size: 1.7rem; margin-bottom: 6px; }

.card-sub { color: var(--ink-soft); font-size: 0.95rem; margin-bottom: 20px; }

.note {
  margin: 18px 0;
  padding: 16px 20px;
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 6px 16px rgba(61, 58, 53, 0.1);
  text-align: center;
}

/* ── Dropzone ─────────────────────────────────────────────────────── */
.drop {
  position: relative;
  border: 3px dashed var(--sky);
  border-radius: 12px;
  background: rgba(74, 157, 224, 0.06);
  min-height: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  overflow: hidden;
  transition: background 0.15s ease;
}

.drop:hover { background: rgba(74, 157, 224, 0.12); }

.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: 400; }

.drop-hint { color: var(--ink-soft); font-size: 0.85rem; margin-top: 4px; }

.preview { width: 100%; max-height: 300px; object-fit: cover; display: block; }

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

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

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

input[type="text"],
input[type="email"] {
  width: 100%;
  padding: 13px 15px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--ink);
  background: var(--fridge);
  border: 2px solid var(--line);
  border-radius: 10px;
  transition: border-color 0.15s ease;
}

input:focus { outline: none; border-color: var(--sky); }
input.error { border-color: var(--err); }
input::placeholder { color: var(--ink-soft); opacity: 0.7; }

.form-error { color: var(--err); text-align: center; margin-top: 12px; }

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 14px 28px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  line-height: 1.2;
}

.btn:hover:not(:disabled) { transform: translateY(-2px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus-visible { outline: 3px solid var(--sunflower); outline-offset: 2px; }

.btn-primary {
  background: var(--cherry);
  color: #fff;
  box-shadow: 0 6px 16px rgba(224, 72, 72, 0.4);
}

.btn-ghost {
  background: var(--card);
  color: var(--ink);
  border: 2px solid var(--line);
  font-size: 0.9rem;
  padding: 11px 20px;
}

.btn-ghost:hover:not(:disabled) { border-color: var(--sky); color: var(--sky); }

.btn-block { width: 100%; }

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ── My entry ─────────────────────────────────────────────────────── */
.my-photo-wrap { text-align: center; margin-bottom: 18px; }

.my-photo {
  max-width: 240px;
  width: 100%;
  border: 6px solid #fff;
  box-shadow: 0 8px 22px rgba(61, 58, 53, 0.2);
  transform: rotate(1.5deg);
  margin-bottom: 12px;
}

.my-caption { font-family: var(--font-crayon); font-size: 1.25rem; }

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

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

.gallery-head h2 { font-family: var(--font-crayon); font-size: 1.9rem; }

.gallery-sub { color: var(--ink-soft); margin-top: 4px; }

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 26px;
}

.pet-card {
  position: relative;
  background: var(--card);
  padding: 10px 10px 14px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 6px 16px rgba(61, 58, 53, 0.14);
}

.pet-card:nth-child(3n+1) { transform: rotate(-1.6deg); }
.pet-card:nth-child(3n+2) { transform: rotate(1.2deg); }
.pet-card:nth-child(3n) { transform: rotate(-0.6deg); }

.pet-card:hover { transform: rotate(0deg) translateY(-4px); box-shadow: 0 12px 26px rgba(61, 58, 53, 0.22); }

/* magnet pin — color cycles */
.pet-card::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  box-shadow: 0 3px 6px rgba(61, 58, 53, 0.3);
  background: radial-gradient(circle at 34% 28%, #f08a8a, var(--cherry) 65%);
  z-index: 2;
}

.pet-card:nth-child(3n+2)::before { background: radial-gradient(circle at 34% 28%, #f8d075, var(--sunflower) 65%); }
.pet-card:nth-child(3n)::before { background: radial-gradient(circle at 34% 28%, #8cc2ee, var(--sky) 65%); }

.pet-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  margin-bottom: 10px;
}

/* index-card caption strip */
.pet-caption {
  font-size: 0.9rem;
  line-height: 1.5;
  background:
    repeating-linear-gradient(0deg, transparent 0 20px, rgba(74, 157, 224, 0.22) 20px 21px),
    #fffef8;
  padding: 6px 8px;
  border-radius: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pet-author { font-family: var(--font-crayon); color: var(--ink-soft); font-size: 1rem; margin-top: 6px; }

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

.vote-count { color: var(--sky); font-size: 0.9rem; }

.vote-btn {
  font-family: inherit;
  font-size: 0.85rem;
  padding: 8px 18px;
  background: var(--sky);
  color: #fff;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.vote-btn:hover:not(:disabled) { background: #3580bf; }
.vote-btn.is-voted { background: var(--fridge-deep); color: var(--ink-soft); cursor: default; }

/* ── Empty / load more ────────────────────────────────────────────── */
.empty { text-align: center; padding: 44px 20px; }

.empty-icon { font-size: 2.4rem; display: block; margin-bottom: 10px; }

.empty-sub { color: var(--ink-soft); margin: 6px 0 18px; }

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

/* ── Lightbox ─────────────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(61, 58, 53, 0.9);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lb-content {
  background: var(--card);
  border-radius: 14px;
  max-width: 520px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
}

.lb-img { width: 100%; max-height: 55vh; object-fit: contain; display: block; background: var(--fridge-deep); }

.lb-meta { padding: 18px 22px 22px; }

.lb-caption { line-height: 1.5; }

.lb-author { font-family: var(--font-crayon); color: var(--ink-soft); font-size: 1.1rem; margin-top: 6px; }

.lb-actions { display: flex; align-items: center; gap: 14px; margin-top: 14px; flex-wrap: wrap; }

.lb-votes { color: var(--sky); }

.lb-close {
  position: absolute;
  top: 14px;
  right: 18px;
  font-size: 2rem;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  z-index: 2;
}

.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2.6rem;
  background: rgba(255, 255, 255, 0.14);
  border: none;
  color: #fff;
  cursor: pointer;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  line-height: 1;
}

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

/* ── Toast ────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 13px 24px;
  border-radius: 999px;
  z-index: 200;
  box-shadow: 0 10px 26px rgba(61, 58, 53, 0.4);
}

.toast-ok { background: var(--grass); }

/* ── Footer ───────────────────────────────────────────────────────── */
.footer {
  flex-shrink: 0;
  text-align: center;
  padding: 24px 20px;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

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

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 560px) {
  .field-grid { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .lb-nav { display: none; }
  .sun-doodle { display: none; }
}
