/* ========================================
   Mo's Cat Kingdom — Full Chaos CSS
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@400;700;900&display=swap');

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --cat-orange: #ff9f43;
  --cat-pink: #fd79a8;
  --cat-purple: #a29bfe;
  --cat-yellow: #ffeaa7;
  --cat-teal: #00cec9;
  --bg-dark: #0d0d1a;
  --bg-mid: #16162a;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg-dark);
  background-image:
    radial-gradient(ellipse at 20% 20%, rgba(160,100,255,0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(255,100,100,0.1) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(0,200,200,0.05) 0%, transparent 70%);
  color: #f0f0f0;
  font-family: 'Nunito', sans-serif;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ---- Walking Cats (Animated Emoji) ---- */
.walking-cat {
  position: fixed;
  font-size: 2.5rem;
  z-index: 5;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 0 8px rgba(255,200,0,0.6));
}

.walking-cat-1 {
  bottom: 60px;
  animation: walkRight 18s linear infinite;
  animation-delay: 0s;
}
.walking-cat-2 {
  bottom: 20px;
  animation: walkLeft 22s linear infinite;
  animation-delay: -8s;
}
.walking-cat-3 {
  bottom: 100px;
  animation: walkRight 14s linear infinite;
  animation-delay: -5s;
  font-size: 2rem;
}
.walking-cat-4 {
  bottom: 140px;
  animation: walkLeft 26s linear infinite;
  animation-delay: -12s;
  font-size: 1.8rem;
}
.walking-cat-5 {
  bottom: 40px;
  animation: walkRight 20s linear infinite;
  animation-delay: -3s;
  font-size: 2.2rem;
}

@keyframes walkRight {
  from { transform: translateX(-120px) scaleX(1); }
  49.9% { transform: translateX(calc(100vw + 120px)) scaleX(1); }
  50% { transform: translateX(calc(100vw + 120px)) scaleX(-1); }
  to { transform: translateX(-120px) scaleX(-1); }
}

@keyframes walkLeft {
  from { transform: translateX(calc(100vw + 120px)) scaleX(-1); }
  49.9% { transform: translateX(-120px) scaleX(-1); }
  50% { transform: translateX(-120px) scaleX(1); }
  to { transform: translateX(calc(100vw + 120px)) scaleX(1); }
}

/* ---- CSS Art Cats ---- */
.css-cat {
  position: fixed;
  z-index: 4;
  pointer-events: none;
  animation: catBob 3s ease-in-out infinite;
}
.css-cat-left { left: -10px; top: 40%; animation-delay: 0s; }
.css-cat-right { right: -10px; top: 60%; animation-delay: -1.5s; transform: scaleX(-1); }

@keyframes catBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.css-cat-right {
  animation: catBobRight 3s ease-in-out infinite;
}
@keyframes catBobRight {
  0%, 100% { transform: scaleX(-1) translateY(0); }
  50% { transform: scaleX(-1) translateY(-10px); }
}

.css-cat-body { position: relative; width: 60px; }

.css-cat-head {
  width: 50px;
  height: 40px;
  background: #d4a060;
  border-radius: 50% 50% 45% 45%;
  position: relative;
  margin: 0 auto;
}
.css-cat-ear {
  position: absolute;
  top: -14px;
  width: 0; height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 18px solid #d4a060;
}
.css-cat-ear.left-ear { left: 4px; transform: rotate(-15deg); }
.css-cat-ear.right-ear { right: 4px; transform: rotate(15deg); }

.css-cat-face {
  position: absolute;
  top: 10px; left: 50%;
  transform: translateX(-50%);
  width: 36px;
}
.css-cat-eye {
  width: 8px; height: 8px;
  background: #2d3436;
  border-radius: 50%;
  display: inline-block;
  margin: 0 3px;
  animation: blink 4s infinite;
}
@keyframes blink {
  0%, 90%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(0.1); }
}
.css-cat-nose {
  width: 6px; height: 5px;
  background: #ff7675;
  border-radius: 50%;
  margin: 3px auto;
}

.css-cat-torso {
  width: 44px;
  height: 36px;
  background: #d4a060;
  border-radius: 8px 8px 16px 16px;
  margin: 2px auto 0;
}
.css-cat-tail {
  width: 12px; height: 40px;
  background: #d4a060;
  border-radius: 6px;
  position: absolute;
  bottom: 0; right: 0;
  transform-origin: bottom center;
  animation: tailSwing 2s ease-in-out infinite;
}
@keyframes tailSwing {
  0%, 100% { transform: rotate(20deg); }
  50% { transform: rotate(-20deg); }
}

/* ---- Site Header ---- */
.site-header {
  text-align: center;
  padding: 40px 20px 20px;
  position: relative;
  z-index: 10;
}

.header-stars {
  font-size: 1.2rem;
  margin-bottom: 10px;
  animation: sparkle 2s ease-in-out infinite;
}
@keyframes sparkle {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.crown-container {
  display: flex;
  justify-content: center;
  margin-bottom: -10px;
}
.crown {
  font-size: 4rem;
  animation: crownBounce 2s ease-in-out infinite;
  display: block;
}
@keyframes crownBounce {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50% { transform: translateY(-12px) rotate(5deg); }
}

.site-title {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(2.5rem, 8vw, 5rem);
  background: linear-gradient(135deg, #ffcc00, #ff9f43, #ff6b6b, #fd79a8, #a29bfe);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
  margin-bottom: 8px;
  text-shadow: none;
  filter: drop-shadow(0 0 20px rgba(255,200,0,0.3));
}

.subtitle {
  color: var(--cat-pink);
  font-size: clamp(0.85rem, 2.5vw, 1.1rem);
  font-style: italic;
  opacity: 0.9;
  margin-bottom: 20px;
}

.paw-divider {
  font-size: 1.2rem;
  margin: 16px 0;
  opacity: 0.7;
  letter-spacing: 4px;
}

/* ---- Mo's Featured Section ---- */
.mo-feature-container {
  display: flex;
  justify-content: center;
  padding: 10px 20px 20px;
}

.mo-card {
  position: relative;
  background: linear-gradient(135deg, rgba(255,200,0,0.15), rgba(255,100,150,0.15));
  border: 3px solid rgba(255,200,0,0.5);
  border-radius: 20px;
  padding: 24px;
  max-width: 340px;
  width: 100%;
  box-shadow:
    0 0 40px rgba(255,200,0,0.25),
    0 0 80px rgba(255,100,0,0.1),
    inset 0 0 30px rgba(255,200,0,0.05);
  animation: moGlow 3s ease-in-out infinite;
}

@keyframes moGlow {
  0%, 100% { box-shadow: 0 0 40px rgba(255,200,0,0.25), 0 0 80px rgba(255,100,0,0.1); }
  50% { box-shadow: 0 0 60px rgba(255,200,0,0.45), 0 0 120px rgba(255,100,0,0.2); }
}

.mo-photo-frame {
  width: 200px;
  height: 200px;
  margin: 0 auto 16px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid #ffcc00;
  box-shadow: 0 0 30px rgba(255,200,0,0.4);
  background: rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mo-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mo-placeholder {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: rgba(255,255,255,0.5);
  font-size: 0.85rem;
}
.mo-placeholder-cat { font-size: 4rem; }

.mo-crown-badge {
  position: absolute;
  top: -10px;
  right: 50%;
  transform: translateX(50%);
  font-size: 2rem;
  animation: crownBounce 2s ease-in-out infinite;
}

.mo-name {
  font-family: 'Fredoka One', cursive;
  font-size: 2.5rem;
  color: #ffcc00;
  line-height: 1;
  margin-bottom: 6px;
}

.mo-title {
  color: rgba(255,255,255,0.75);
  font-size: 0.9rem;
  line-height: 1.5;
}

.cat-count-banner {
  margin-top: 10px;
  font-size: 1.1rem;
  color: var(--cat-teal);
  font-weight: 700;
}

/* ---- Gallery ---- */
.gallery-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px 16px 100px;
  position: relative;
  z-index: 10;
}

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

@media (max-width: 600px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
  }
}

.cat-card {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  background: rgba(255,255,255,0.05);
  border: 2px solid transparent;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.cat-card:hover {
  transform: scale(1.06) rotate(var(--tilt, 1deg));
  border-color: var(--cat-orange);
  box-shadow: 0 8px 30px rgba(255,150,0,0.4);
  z-index: 2;
}

.cat-card:nth-child(3n) { --tilt: -2deg; }
.cat-card:nth-child(3n+1) { --tilt: 1.5deg; }
.cat-card:nth-child(3n+2) { --tilt: -1deg; }

.cat-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.3s;
}

.cat-card-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  animation: pulse 1.5s ease-in-out infinite;
  background: rgba(255,255,255,0.03);
}
@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.cat-card-meow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-size: 1.2rem;
  font-weight: 900;
  color: #ffcc00;
  text-shadow: 0 0 10px rgba(255,200,0,0.8);
  pointer-events: none;
  white-space: nowrap;
  font-family: 'Fredoka One', cursive;
  z-index: 10;
}

.cat-card-meow.pop {
  animation: meowPop 0.8s forwards;
}
@keyframes meowPop {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
  30% { transform: translate(-50%, -60%) scale(1.4); opacity: 1; }
  100% { transform: translate(-50%, -80%) scale(1) ; opacity: 0; }
}

/* ---- Lightbox ---- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
.lightbox.open {
  pointer-events: all;
  opacity: 1;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.88);
  cursor: pointer;
}

.lightbox-content {
  position: relative;
  z-index: 1;
  max-width: min(90vw, 90vh);
  max-height: min(90vw, 90vh);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: lightboxPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lightbox.open .lightbox-content {
  animation: lightboxPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes lightboxPop {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.lightbox-img {
  max-width: min(85vw, 85vh);
  max-height: min(85vw, 85vh);
  border-radius: 16px;
  border: 3px solid rgba(255,200,0,0.4);
  box-shadow:
    0 0 60px rgba(255,150,0,0.3),
    0 20px 60px rgba(0,0,0,0.6);
  display: block;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: -18px;
  right: -18px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ff6b6b;
  color: white;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  transition: transform 0.2s, background 0.2s;
  box-shadow: 0 4px 15px rgba(255,50,50,0.4);
}
.lightbox-close:hover {
  transform: scale(1.2) rotate(90deg);
  background: #ff4757;
}

.lightbox-meow {
  position: absolute;
  bottom: -50px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2rem;
  animation: bounceMeow 0.5s ease-in-out infinite alternate;
}
@keyframes bounceMeow {
  from { transform: translateX(-50%) translateY(0); }
  to { transform: translateX(-50%) translateY(-8px); }
}

/* ---- Loading More ---- */
.loading-more {
  text-align: center;
  padding: 30px;
  color: var(--cat-orange);
  font-size: 1.2rem;
  animation: pulse 1.5s ease-in-out infinite;
}

/* ---- Footer ---- */
.site-footer {
  text-align: center;
  padding: 30px 20px 120px;
  color: rgba(255,255,255,0.4);
  font-size: 0.9rem;
  position: relative;
  z-index: 10;
  line-height: 2;
}

.footer-cats {
  font-size: 1.5rem;
  letter-spacing: 4px;
  margin: 8px 0;
}

.admin-link {
  color: rgba(255,255,255,0.2);
  text-decoration: none;
  font-size: 0.75rem;
}
.admin-link:hover { color: rgba(255,255,255,0.5); }

/* ---- Shake animation (for wrong password) ---- */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-8px); }
  80% { transform: translateX(8px); }
}
.shake { animation: shake 0.4s ease-in-out; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--cat-orange), var(--cat-pink));
  border-radius: 4px;
}
