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

:root {
  --bg:        #fdf6ee;
  --card-bg:   #ffffff;
  --accent:    #e07b39;
  --accent2:   #f5a86c;
  --text:      #3a2e28;
  --muted:     #9e8a7c;
  --shadow:    0 4px 20px rgba(0,0,0,0.09);
  --radius:    16px;
  --font:      'Segoe UI', system-ui, sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ──────────────────────────────────────────────
   Header
────────────────────────────────────────────── */
header {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  color: #fff;
  padding: 2.5rem 1rem 2rem;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  position: relative;
}

.paw-left, .paw-right {
  font-size: 2rem;
  animation: sway 3s ease-in-out infinite alternate;
  user-select: none;
}
.paw-right { animation-direction: alternate-reverse; }

@keyframes sway {
  from { transform: rotate(-10deg) scale(1); }
  to   { transform: rotate(10deg)  scale(1.1); }
}

.header-text h1 {
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.subtitle {
  font-size: 0.95rem;
  opacity: 0.9;
  margin-top: 0.3rem;
  letter-spacing: 0.03em;
}

/* ──────────────────────────────────────────────
   Main content
────────────────────────────────────────────── */
main {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.25rem;
}

.intro {
  text-align: center;
  color: var(--muted);
  font-size: 1.05rem;
  margin-bottom: 2rem;
}

/* ──────────────────────────────────────────────
   Grid
────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
}

/* ──────────────────────────────────────────────
   Card
────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  cursor: default;
}

.card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 10px 30px rgba(0,0,0,0.14);
}

/* Image wrapper keeps a square aspect ratio */
.img-wrap {
  position: relative;
  width: 100%;
  padding-top: 100%; /* 1:1 */
  background: #f0e8e0;
  overflow: hidden;
}

.skeleton {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #f0e8e0 25%, #e8dcd4 50%, #f0e8e0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 0;
  transition: opacity 0.3s;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.dog-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.dog-img.loaded {
  opacity: 1;
}

.card-footer {
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.dog-label {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent);
}

.breed {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: capitalize;
  text-align: right;
}

/* ──────────────────────────────────────────────
   Refresh button
────────────────────────────────────────────── */
.refresh-wrap {
  display: flex;
  justify-content: center;
  margin-top: 2rem;
}

#refresh-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.65rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(224,123,57,0.4);
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

#refresh-btn:hover {
  background: #c9672b;
  transform: scale(1.04);
  box-shadow: 0 5px 18px rgba(224,123,57,0.5);
}

#refresh-btn:active {
  transform: scale(0.97);
}

/* spinning animation while loading */
#refresh-btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

/* ──────────────────────────────────────────────
   Footer
────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 1.25rem 1rem;
  font-size: 0.82rem;
  color: var(--muted);
  border-top: 1px solid #ede4da;
}

footer a {
  color: var(--accent);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* ──────────────────────────────────────────────
   Responsive tweaks
────────────────────────────────────────────── */
@media (max-width: 520px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  .card-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

