:root {
  --bg:        #14161b;
  --surface:   #1e2128;
  --surface-2: #262a33;
  --text:      #ECE8E1;
  --text-soft: #9aa0ab;
  --border:    rgba(255,255,255,0.08);
  --ginger:    #E2823B;
  --ginger-d:  #C96A28;
  --plum:      #9b7fb0;
  --sage:      #7FA98C;
  --radius:    14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Nunito Sans", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}
h1, h2, h3 { font-family: "Baloo 2", system-ui, sans-serif; margin: 0; line-height: 1.2; }
a { color: inherit; text-decoration: none; }
img { display: block; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.9rem clamp(1rem, 4vw, 3rem);
  position: sticky; top: 0; z-index: 5;
  background: rgba(20,22,27,0.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { font-family: "Baloo 2", sans-serif; font-weight: 800; font-size: 1.3rem; color: var(--ginger); white-space: nowrap; }
.brand .paw { margin-right: 0.2rem; }
.search { flex: 1; display: flex; justify-content: center; }
.search input {
  width: 100%; max-width: 520px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 0.6rem 1.1rem; font-size: 0.95rem; outline: none;
}
.search input::placeholder { color: var(--text-soft); }
.search input:focus { border-color: var(--ginger); }
.refresh-btn {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  width: 40px; height: 40px; border-radius: 50%; font-size: 1.1rem; cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.refresh-btn:hover { background: var(--ginger); color: #fff; transform: rotate(90deg); }

/* ---------- Greeting + chips ---------- */
.greet-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  flex-wrap: wrap; padding: 1.6rem clamp(1rem, 4vw, 3rem) 0.8rem;
}
.greet { font-size: clamp(1.4rem, 3vw, 1.9rem); font-weight: 700; }
.chips { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.chip {
  background: var(--surface); border: 1px solid var(--border); color: var(--text-soft);
  border-radius: 999px; padding: 0.35rem 0.85rem; font-size: 0.82rem; font-weight: 600;
}
.chip.accent { color: var(--ginger); border-color: rgba(226,130,59,0.4); }

/* ---------- AI banner ---------- */
.ai-banner {
  position: relative; margin: 0.6rem clamp(1rem, 4vw, 3rem) 0;
  border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border);
}
.ai-banner img { width: 100%; height: clamp(120px, 18vw, 240px); object-fit: cover; }
.ai-tag {
  position: absolute; bottom: 10px; right: 12px;
  background: rgba(0,0,0,0.6); color: #fff;
  font-family: "Baloo 2", sans-serif; font-weight: 600; font-size: 0.66rem;
  text-transform: uppercase; letter-spacing: 1px; padding: 0.25rem 0.6rem; border-radius: 999px;
}

main { padding: 1.4rem clamp(1rem, 4vw, 3rem) 2rem; }

/* ---------- Cards (shared) ---------- */
.card-item { transition: transform 0.15s, box-shadow 0.15s; }
.src {
  display: flex; align-items: center; gap: 0.45rem;
  font-size: 0.78rem; color: var(--text-soft); margin-bottom: 0.4rem;
}
.fav {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  background: var(--ginger); color: #fff; font-family: "Baloo 2", sans-serif;
  font-size: 0.66rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}
.play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 52px; height: 52px; border-radius: 50%; background: rgba(0,0,0,0.55);
  border: 2px solid rgba(255,255,255,0.9);
}
.play::after {
  content: ""; position: absolute; top: 50%; left: 54%; transform: translate(-50%,-50%);
  border-style: solid; border-width: 9px 0 9px 15px; border-color: transparent transparent transparent #fff;
}

/* ---------- Hero ---------- */
.hero { display: block; margin-bottom: 1.2rem; }
.hero-img { position: relative; border-radius: var(--radius); overflow: hidden; aspect-ratio: 21 / 9; background: var(--surface); }
.hero-img img { width: 100%; height: 100%; object-fit: cover; }
.hero-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 1.3rem 1.5rem;
  background: linear-gradient(to top, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0.35) 45%, rgba(0,0,0,0) 75%);
}
.hero-overlay h2 { font-size: clamp(1.2rem, 2.6vw, 1.9rem); font-weight: 700; color: #fff; max-width: 30ch; }
.hero-overlay .src { color: rgba(255,255,255,0.85); }
.hero:hover .hero-img img { transform: scale(1.02); transition: transform 0.4s; }

/* ---------- Masonry feed (CSS columns) ---------- */
.feed { columns: 280px; column-gap: 1.1rem; }
.feed .card {
  display: block; break-inside: avoid; margin: 0 0 1.1rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.feed .card:hover { transform: translateY(-3px); box-shadow: 0 12px 26px rgba(0,0,0,0.5); border-color: rgba(255,255,255,0.16); }
.card-img { position: relative; background: var(--surface-2); }
.card-img img { width: 100%; height: auto; }
.card-body { padding: 0.85rem 1rem 1rem; }
.card-body h3 { font-size: 1rem; font-weight: 600; color: var(--text); }

/* ---------- Gallery ---------- */
.gallery-wrap { margin-top: 2.2rem; }
.section-head { font-size: 1.3rem; font-weight: 700; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.4rem; }
.gallery { display: grid; gap: 0.8rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.gallery-item { aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; }
.gallery-item:hover img { transform: scale(1.04); transition: transform 0.3s; }

/* ---------- Empty + footer ---------- */
.empty { text-align: center; padding: 4rem 1rem; color: var(--text-soft); }
footer { padding: 1.6rem; text-align: center; color: var(--text-soft); font-size: 0.82rem; border-top: 1px solid var(--border); }
.visitors { margin-bottom: 0.5rem; font-size: 0.9rem; }
.visitors strong { color: var(--ginger); font-family: "Baloo 2", sans-serif; font-weight: 700; font-size: 1.02rem; }

@media (prefers-reduced-motion: reduce) {
  .card-item, .refresh-btn, .hero-img img, .gallery-item img { transition: none; }
  .card-item:hover { transform: none; }
}
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--ginger); outline-offset: 2px; }

/* ---------- Name editor (per-visitor greeting) ---------- */
.greet { display: inline-flex; align-items: center; }
.name-edit {
  background: none; border: none; color: var(--text-soft); cursor: pointer;
  font-size: 0.85rem; margin-left: 0.5rem; padding: 0.15rem 0.35rem; border-radius: 6px;
}
.name-edit:hover { color: var(--ginger); }
.name-editor { display: flex; gap: 0.5rem; padding: 0 clamp(1rem, 4vw, 3rem) 0.6rem; }
.name-editor input {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 999px; padding: 0.5rem 1rem; font-size: 0.9rem; outline: none; min-width: 220px;
}
.name-editor input:focus { border-color: var(--ginger); }
.name-editor button {
  background: var(--ginger); color: #fff; border: none; border-radius: 999px;
  padding: 0.5rem 1.2rem; font-weight: 700; cursor: pointer; font-family: "Baloo 2", sans-serif;
}
.name-editor button:hover { background: var(--ginger-d); }
