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

:root {
  --primary: #5d4b3e;
  --accent: #c89b6c;
  --bg: #faf7f2;
  --text: #2a2420;
  --muted: #6b6158;
  --heading-font: 'Fraunces', serif;
  --body-font: 'Inter', sans-serif;
  --container: 1100px;
  --radius: 6px;
  --hero-align: center;
}

html { font-size: 16px; }
body {
  font-family: var(--body-font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Hide body until theme is applied to prevent flash of default styling */
body.theme-loading { visibility: hidden; }

h1, h2, h3, h4 { font-family: var(--heading-font); line-height: 1.2; color: var(--primary); font-weight: 700; }
h1 { font-size: 2.5rem; margin-bottom: 1rem; }
h2 { font-size: 1.75rem; margin: 1.5rem 0 0.75rem; }
h3 { font-size: 1.25rem; margin: 1rem 0 0.5rem; }
p { margin-bottom: 1rem; }

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

.container { max-width: var(--container); margin: 0 auto; padding: 0 1.25rem; width: 100%; }
main { flex: 1; display: flex; flex-direction: column; }

/* Section wrappers — every major block of content sits in one */
.section { padding: 3rem 0; }
.section-alt { background: rgba(0, 0, 0, 0.03); }
.section-accent { background: var(--accent); color: var(--text); }
.section-accent h1, .section-accent h2, .section-accent h3 { color: var(--text); }
.section + .section { border-top: 1px solid rgba(0, 0, 0, 0.04); }
/* Remove the border between a hero block and the next section for a cleaner look. */
.block-hero + .block .section { border-top: none; }
.section-heading { margin-bottom: 1.5rem; }
.section-heading h2 { margin-bottom: 0.25rem; }
.section-cta { margin-top: 2rem; text-align: center; }
@media (max-width: 600px) {
  .section { padding: 2rem 0; }
}

.filter-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 1rem 0 1.5rem;
}

/* Header */
header.site-header {
  background: white;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.site-title {
  font-family: var(--heading-font);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
}
.site-title:hover { text-decoration: none; }
.site-logo { height: 56px; width: auto; max-width: 240px; display: block; }
nav.main-nav { display: flex; gap: 1.25rem; flex-wrap: wrap; align-items: center; }
nav.main-nav > .nav-item,
nav.main-nav > .nav-item.has-children > a {
  color: var(--text);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
nav.main-nav .active { color: var(--accent); }
nav.main-nav .has-children { position: relative; }
nav.main-nav .chev { font-size: 0.7rem; opacity: 0.7; }

nav.main-nav .submenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  min-width: 220px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  padding: 0.4rem 0;
  z-index: 20;
  margin-top: 0.4rem;
}
nav.main-nav .has-children:hover .submenu,
nav.main-nav .has-children:focus-within .submenu { display: block; }
nav.main-nav .submenu a {
  display: block;
  padding: 0.55rem 1rem;
  color: var(--text);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.9rem;
}
nav.main-nav .submenu a:hover { background: rgba(0, 0, 0, 0.04); color: var(--accent); text-decoration: none; }
nav.main-nav .submenu a.active { background: rgba(0, 0, 0, 0.04); color: var(--accent); }

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
  border-radius: var(--radius);
  padding: 0.35rem 0.6rem;
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
}
@media (max-width: 820px) {
  .nav-toggle { display: inline-block; }
  nav.main-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 0;
    align-items: stretch;
    padding-top: 0.5rem;
  }
  nav.main-nav.open { display: flex; }
  nav.main-nav > .nav-item,
  nav.main-nav > .nav-item.has-children > a {
    padding: 0.7rem 0.25rem;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    justify-content: space-between;
  }
  nav.main-nav .has-children { position: static; }
  nav.main-nav .submenu {
    position: static;
    display: block;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0 0 0.25rem 0;
    margin-top: 0;
  }
  nav.main-nav .submenu a {
    padding-left: 1.5rem;
    border-bottom: 1px solid rgba(0,0,0,0.04);
  }
}

/* Hero */
.hero {
  position: relative;
  color: white;
  text-align: var(--hero-align, center);
  overflow: hidden;
}
.hero-slide {
  position: relative;
  display: flex;
  align-items: center;
  min-height: inherit;
  background: var(--primary);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: white;
  flex: 0 0 100%;
  width: 100%;
  padding: 3.5rem 1.25rem;
}
.hero-short { min-height: 220px; }
.hero-short .hero-slide { min-height: 220px; padding: 2.5rem 1.25rem; }
.hero-medium { min-height: 420px; }
.hero-medium .hero-slide { min-height: 420px; padding: 3.5rem 1.25rem; }
.hero-tall { min-height: 580px; }
.hero-tall .hero-slide { min-height: 580px; padding: 5rem 1.25rem; }

.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}
/* Hide hero videos on mobile — fall back to image background. */
@media (max-width: 768px) {
  .hero-video { display: none; }
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0.55) 100%);
  z-index: 1;
}
.hero-content {
  position: relative;
  width: 100%;
  z-index: 2;
}

/* Hero carousel — default "slide" transition */
.hero-carousel { --carousel-duration: 600ms; }
.hero-carousel .hero-track {
  display: flex;
  transition: transform var(--carousel-duration) cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: transform;
}
.hero-carousel .hero-slide { flex: 0 0 100%; }

/* Fade transition — all slides stacked, only active is visible */
.hero-carousel[data-transition="fade"] .hero-track,
.hero-carousel[data-transition="zoom"] .hero-track,
.hero-carousel[data-transition="kenburns"] .hero-track {
  position: relative;
  transform: none !important;
  min-height: inherit;
}
.hero-carousel[data-transition="fade"] .hero-slide,
.hero-carousel[data-transition="zoom"] .hero-slide,
.hero-carousel[data-transition="kenburns"] .hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--carousel-duration) ease-in-out, transform var(--carousel-duration) ease-in-out;
}
.hero-carousel[data-transition="fade"] .hero-slide.active,
.hero-carousel[data-transition="zoom"] .hero-slide.active,
.hero-carousel[data-transition="kenburns"] .hero-slide.active {
  opacity: 1;
  pointer-events: auto;
  z-index: 1;
}

/* Zoom transition — non-active slides are scaled down + faded */
.hero-carousel[data-transition="zoom"] .hero-slide { transform: scale(1.08); }
.hero-carousel[data-transition="zoom"] .hero-slide.active { transform: scale(1); }

/* Ken Burns — active slide slowly scales + pans while visible */
.hero-carousel[data-transition="kenburns"] .hero-slide.active {
  animation: kenburns-pan 14s ease-in-out both;
}
@keyframes kenburns-pan {
  0%   { transform: scale(1.02) translate(0, 0); }
  100% { transform: scale(1.15) translate(-1.5%, -1%); }
}

/* Ensure active slide sits above others for stacking contexts. */
.hero-carousel .hero-slide.active { z-index: 1; }

.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.35);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  width: 44px; height: 44px;
  border-radius: 50%;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.carousel-arrow:hover { background: rgba(0, 0, 0, 0.6); }
.carousel-prev { left: 1rem; }
.carousel-next { right: 1rem; }
@media (max-width: 560px) {
  .carousel-arrow { width: 36px; height: 36px; font-size: 1.2rem; }
  .carousel-prev { left: 0.5rem; }
  .carousel-next { right: 0.5rem; }
}

.carousel-dots {
  position: absolute;
  bottom: 1rem;
  left: 0; right: 0;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  z-index: 3;
}
.carousel-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  padding: 0;
}
.carousel-dot.active { background: white; transform: scale(1.2); }

.carousel-pause {
  position: absolute;
  top: 1rem; right: 1rem;
  background: rgba(0, 0, 0, 0.35);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  z-index: 3;
  display: flex; align-items: center; justify-content: center;
}
.carousel-pause:hover { background: rgba(0, 0, 0, 0.6); }

/* Horizontal carousel (dog cards / news cards on scroll-snap rail) */
.h-carousel {
  position: relative;
}
.h-carousel-track {
  display: flex;
  gap: 1.25rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 0.25rem 0.25rem 1rem;
  /* Subtle scrollbar on desktop, hidden on mobile via native UA. */
  scrollbar-width: thin;
}
.h-carousel-track::-webkit-scrollbar { height: 6px; }
.h-carousel-track::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); border-radius: 3px; }
.h-carousel-track .dog-card {
  flex: 0 0 280px;
  scroll-snap-align: start;
}
@media (max-width: 600px) { .h-carousel-track .dog-card { flex: 0 0 82vw; } }

.h-carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  background: white;
  color: var(--primary);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.h-carousel-arrow:hover { background: var(--primary); color: white; }
.h-carousel-prev { left: -18px; }
.h-carousel-next { right: -18px; }
@media (max-width: 900px) {
  .h-carousel-prev { left: 4px; }
  .h-carousel-next { right: 4px; }
}

/* Gallery slideshow: use hero-carousel mechanics but contain the image. */
.gallery-slideshow { border-radius: var(--radius); min-height: 420px; }
.gallery-slideshow .hero-slide { background: #0b0b0b; justify-content: center; padding: 0; }
.gallery-slide-bg {
  position: absolute; inset: 0;
  background: inherit;
  filter: blur(30px) brightness(0.5);
  z-index: 0;
}
.gallery-slide-img {
  position: relative;
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
  z-index: 1;
}
.hero h1 {
  color: white;
  font-size: clamp(2rem, 5vw, 3.4rem);
  margin-bottom: 0.75rem;
  line-height: 1.1;
}
.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.25rem);
  opacity: 0.95;
  max-width: 720px;
  margin: 0 auto 1.25rem;
  line-height: 1.5;
}
.hero[style*="--hero-align: left"] .hero-subtitle { margin-left: 0; margin-right: auto; }
.hero[style*="--hero-align: right"] .hero-subtitle { margin-right: 0; margin-left: auto; }
.hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 0.5rem;
}
.hero[style*="--hero-align: left"] .hero-actions { justify-content: flex-start; }
.hero[style*="--hero-align: right"] .hero-actions { justify-content: flex-end; }

.btn-outline-on-hero {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: transparent;
  color: white;
  border: 2px solid white;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all 0.2s;
}
.btn-outline-on-hero:hover { background: white; color: var(--primary); text-decoration: none; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: var(--text);
  border-radius: var(--radius);
  font-weight: 700;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  transition: opacity 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.9rem;
}
.btn:hover { opacity: 0.9; text-decoration: none; color: var(--text); }
.btn-outline { background: transparent; border: 2px solid var(--accent); color: var(--text); }
.btn-outline:hover { background: var(--accent); color: var(--text); }

/* Dog grid — responsive auto-fill that stays usable on tiny phones */
.dog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  gap: 1.25rem;
}
@media (min-width: 600px) { .dog-grid { gap: 1.5rem; } }
.dog-card {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s, box-shadow 0.2s;
  color: var(--text);
}
.dog-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  text-decoration: none;
  color: var(--text);
}
.dog-card-img { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: #e8e2d8; display: block; }
.dog-card-body { padding: 1rem 1.25rem 1.25rem; }
.dog-card-body h3 { font-size: 1.3rem; margin: 0 0 0.25rem; }
.dog-card-body .breed { color: var(--muted); font-size: 0.9rem; margin-bottom: 0.5rem; }

.pill {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.pill-available { background: #d4edd9; color: #2d5a3d; }
.pill-reserved { background: #fde5c4; color: #7a5520; }
.pill-rehomed { background: #d4e4f5; color: #2a4e7a; }
.pill-sanctuary { background: #e5d8f0; color: #4a2d6b; }

/* Dog detail */
.dog-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}
@media (max-width: 768px) { .dog-detail-grid { grid-template-columns: 1fr; } }
.dog-gallery { display: flex; flex-direction: column; gap: 0.75rem; }
.dog-gallery-main img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: var(--radius);
  background: #e8e2d8;
}
.dog-gallery-thumbs { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.dog-gallery-thumbs img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius);
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
}
.dog-gallery-thumbs img:hover,
.dog-gallery-thumbs img.active { opacity: 1; }

.dog-facts {
  background: white;
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.dog-facts dl { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 1rem; }
.dog-facts dt { color: var(--muted); font-size: 0.9rem; }
.dog-facts dd { font-weight: 500; }

/* Prose (rendered markdown) */
.prose { max-width: 720px; }
.prose img { max-width: 100%; border-radius: var(--radius); }
.prose ul, .prose ol { margin: 0 0 1rem 1.5rem; }
.prose li { margin-bottom: 0.25rem; }

/* Footer */
footer.site-footer {
  background: var(--primary);
  color: white;
  padding: 2.5rem 1.25rem 1.5rem;
  margin-top: auto;
  font-size: 0.9rem;
}
footer.site-footer a { color: white; opacity: 0.9; }
footer.site-footer a:hover { opacity: 1; text-decoration: underline; }
footer.site-footer h4 {
  color: white;
  font-size: 1rem;
  margin-bottom: 0.75rem;
  font-family: var(--heading-font);
}
.footer-inner {
  max-width: var(--container);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  margin-bottom: 1.5rem;
}
.footer-col p { margin-bottom: 0.5rem; opacity: 0.9; }
.socials { display: flex; gap: 0.75rem; margin-top: 0.5rem; }
.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  opacity: 1;
}
.social-icon:hover { background: var(--accent); color: var(--text); text-decoration: none; }
.footer-copy { text-align: center; opacity: 0.75; margin: 0; }

/* Empty state */
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }

/* Utility */
.hidden { display: none !important; }

/* Gallery block */
.gallery {
  display: grid;
  gap: 0.75rem;
}
.gallery-cols-2 { grid-template-columns: repeat(2, 1fr); }
.gallery-cols-3 { grid-template-columns: repeat(3, 1fr); }
.gallery-cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .gallery-cols-3, .gallery-cols-4 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .gallery-cols-3, .gallery-cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 420px) {
  .gallery { grid-template-columns: 1fr !important; }
}
.gallery-item {
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--radius);
}
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}
.gallery-item:hover img { transform: scale(1.04); }

/* Lightbox */
.lightbox-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  padding: 2rem;
}
.lightbox-img { max-width: 100%; max-height: 90vh; object-fit: contain; border-radius: 4px; }
.lightbox-close {
  position: absolute; top: 1rem; right: 1rem;
  background: transparent; border: none; color: white; font-size: 2.5rem;
  cursor: pointer; line-height: 1; padding: 0.25rem 0.75rem;
}
.lightbox-nav {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  font-size: 2.5rem;
  cursor: pointer;
  width: 56px; height: 56px;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center;
}
.lightbox-nav:hover { background: rgba(255, 255, 255, 0.2); }
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }

/* Two-column block */
.two-col {
  display: grid;
  align-items: center;
}
.two-col-item img {
  width: 100%;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
@media (max-width: 768px) {
  .two-col { grid-template-columns: 1fr !important; gap: 1.5rem !important; }
}

/* CTA card block */
.cta-card {
  position: relative;
  padding: 3rem 2rem;
  border-radius: var(--radius);
  overflow: hidden;
  background-size: cover;
  background-position: center;
}
.cta-card-primary { background-color: var(--primary); color: white; }
.cta-card-primary h1, .cta-card-primary h2, .cta-card-primary h3 { color: white; }
.cta-card-accent { background-color: var(--accent); color: var(--text); }
.cta-card-accent h1, .cta-card-accent h2, .cta-card-accent h3 { color: var(--text); }
.cta-card-light { background-color: rgba(0, 0, 0, 0.04); color: var(--text); border: 1px solid rgba(0,0,0,0.06); }
.cta-card-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.55) 100%);
}
.cta-card-inner {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
}
.cta-card.cta-has-image .cta-card-inner { color: white; }
.cta-card.cta-has-image h2 { color: white; }
.cta-card[style*="text-align: left"] .cta-card-inner { margin-left: 0; }
.cta-card-inner h2 { margin-bottom: 0.5rem; }
.cta-card-inner p { margin-bottom: 1rem; font-size: 1.05rem; }
.cta-card-inner .btn { margin-top: 0.25rem; }

/* Block wrapper — needed for the >first-section-after-hero styling trick */
.block { display: block; }

/* Prose — wrap any user-authored HTML so images, videos, tables don't break the layout */
.prose { max-width: 800px; }
.prose img, .prose video, .prose iframe { max-width: 100%; height: auto; }
.prose table { width: 100%; border-collapse: collapse; }
.prose table, .prose th, .prose td { border: 1px solid rgba(0,0,0,0.1); }
.prose th, .prose td { padding: 0.5rem 0.75rem; text-align: left; }
.prose blockquote { border-left: 4px solid var(--accent); padding: 0.25rem 1rem; color: var(--muted); font-style: italic; margin: 1rem 0; }
.prose pre { background: rgba(0,0,0,0.04); padding: 1rem; border-radius: var(--radius); overflow-x: auto; }
.prose hr { border: none; border-top: 1px solid rgba(0,0,0,0.1); margin: 2rem 0; }
