:root {
  --bg-sky: #d9e8f2;
  --bg-meadow: #e4efe6;
  --ink: #1a2e28;
  --ink-soft: #3d524a;
  --foam: #f7fbf8;
  --line: rgba(26, 46, 40, 0.12);
  --accent: #1f7a6c;
  --accent-deep: #145a50;
  --accent-soft: #cfe8e2;
  --vote-pop: #e8f6f2;
  --shadow: 0 18px 40px rgba(26, 46, 40, 0.12);
  --radius: 18px;
  --font-brand: "Fraunces", Georgia, serif;
  --font-ui: "Outfit", "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --max: 1120px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-ui);
  font-weight: 400;
  line-height: 1.5;
  background:
    radial-gradient(1200px 600px at 10% -10%, var(--bg-sky), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, var(--bg-meadow), transparent 55%),
    linear-gradient(180deg, #eef5f2 0%, #f5f8f6 40%, #eef3f0 100%);
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--foam);
  border-radius: 999px;
  text-decoration: none;
  transition: top 0.2s var(--ease);
}

.skip-link:focus {
  top: 1rem;
}

/* —— Hero —— */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  align-items: end;
  overflow: hidden;
  color: var(--foam);
}

.hero__media {
  position: absolute;
  inset: 0;
}

.hero__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 28%;
  transform: scale(1.04);
  animation: heroDrift 18s var(--ease) infinite alternate;
}

.hero__wash {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(20, 40, 34, 0.15) 0%, rgba(20, 40, 34, 0.55) 55%, rgba(20, 40, 34, 0.82) 100%),
    linear-gradient(90deg, rgba(20, 40, 34, 0.45) 0%, transparent 55%);
}

.hero__content {
  position: relative;
  z-index: 1;
  width: min(100% - 2.5rem, var(--max));
  margin: 0 auto;
  padding: 4.5rem 0 3.5rem;
  animation: riseIn 0.9s var(--ease) both;
}

.brand {
  margin: 0 0 0.85rem;
  font-family: var(--font-brand);
  font-size: clamp(3.4rem, 10vw, 6.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 0.95;
}

.brand--sm {
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.headline {
  margin: 0 0 0.75rem;
  max-width: 14ch;
  font-family: var(--font-ui);
  font-size: clamp(1.35rem, 3.2vw, 1.85rem);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: rgba(247, 251, 248, 0.95);
}

.lede {
  margin: 0 0 1.75rem;
  max-width: 34ch;
  font-size: 1.05rem;
  color: rgba(247, 251, 248, 0.82);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.85rem;
  padding: 0.7rem 1.25rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.2s var(--ease),
    background 0.2s var(--ease),
    border-color 0.2s var(--ease),
    color 0.2s var(--ease);
}

.btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.btn--primary {
  background: var(--foam);
  color: var(--accent-deep);
}

.btn--primary:hover {
  transform: translateY(-1px);
  background: #ffffff;
}

.btn--ghost {
  background: transparent;
  color: var(--foam);
  border-color: rgba(247, 251, 248, 0.45);
}

.btn--ghost:hover {
  border-color: var(--foam);
  background: rgba(247, 251, 248, 0.08);
}

.btn--vote {
  background: var(--accent);
  color: var(--foam);
  border: none;
  width: 100%;
}

.btn--vote:hover:not(:disabled) {
  background: var(--accent-deep);
  transform: translateY(-1px);
}

.btn--vote:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--vote.is-pop {
  animation: votePop 0.45s var(--ease);
}

/* —— Sections —— */
.section {
  width: min(100% - 2.5rem, var(--max));
  margin: 0 auto;
  padding: 4.5rem 0 2rem;
}

.section--rank {
  padding-bottom: 5rem;
}

.section__intro {
  margin-bottom: 2rem;
  max-width: 36ch;
  animation: riseIn 0.7s var(--ease) both;
}

.section__intro h2 {
  margin: 0 0 0.4rem;
  font-family: var(--font-brand);
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.section__intro p {
  margin: 0;
  color: var(--ink-soft);
}

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

.dog {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  opacity: 0;
  animation: riseIn 0.65s var(--ease) forwards;
}

.dog:nth-child(1) { animation-delay: 0.05s; }
.dog:nth-child(2) { animation-delay: 0.1s; }
.dog:nth-child(3) { animation-delay: 0.15s; }
.dog:nth-child(4) { animation-delay: 0.2s; }
.dog:nth-child(5) { animation-delay: 0.25s; }
.dog:nth-child(6) { animation-delay: 0.3s; }
.dog:nth-child(7) { animation-delay: 0.35s; }
.dog:nth-child(8) { animation-delay: 0.4s; }
.dog:nth-child(9) { animation-delay: 0.45s; }
.dog:nth-child(10) { animation-delay: 0.5s; }
.dog:nth-child(11) { animation-delay: 0.55s; }
.dog:nth-child(12) { animation-delay: 0.6s; }

.dog__frame {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--accent-soft);
  box-shadow: var(--shadow);
}

.dog__frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease);
}

.dog:hover .dog__frame img {
  transform: scale(1.04);
}

.dog__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.dog__name {
  margin: 0;
  font-family: var(--font-brand);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.dog__score {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--accent-deep);
  font-variant-numeric: tabular-nums;
}

.dog__blurb {
  margin: -0.35rem 0 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

/* —— Ranking —— */
.rank-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.rank-item {
  display: grid;
  grid-template-columns: 2.5rem 3.5rem 1fr auto;
  align-items: center;
  gap: 0.9rem;
  padding: 0.55rem 0.75rem 0.55rem 0.55rem;
  border-bottom: 1px solid var(--line);
  transition: background 0.25s var(--ease);
}

.rank-item:hover {
  background: rgba(255, 255, 255, 0.45);
}

.rank-item__place {
  font-family: var(--font-brand);
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  color: var(--accent-deep);
}

.rank-item__thumb {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 12px;
  object-fit: cover;
}

.rank-item__name {
  font-weight: 600;
  letter-spacing: -0.01em;
}

.rank-item__votes {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--ink-soft);
}

.footer {
  width: min(100% - 2.5rem, var(--max));
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 50;
  transform: translateX(-50%) translateY(120%);
  padding: 0.75rem 1.15rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--foam);
  font-size: 0.92rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  transition: transform 0.35s var(--ease);
}

.toast.is-on {
  transform: translateX(-50%) translateY(0);
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes heroDrift {
  from {
    transform: scale(1.04) translate3d(0, 0, 0);
  }
  to {
    transform: scale(1.08) translate3d(-1.5%, -1%, 0);
  }
}

@keyframes votePop {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.04);
    background: #258a7a;
  }
  100% {
    transform: scale(1);
  }
}

@media (max-width: 640px) {
  .hero__content {
    padding-bottom: 2.75rem;
  }

  .rank-item {
    grid-template-columns: 2rem 3rem 1fr auto;
    gap: 0.65rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
