:root {
  --blue: #1d75d8;
  --blue-dark: #1458a8;
  --green: #54b77a;
  --orange: #f59b38;
  --ink: #183047;
  --muted: #64748b;
  --line: #dce7f2;
  --soft: #f4f8fb;
  --card: #ffffff;
}

html {
  font-size: 16px;
}

body {
  color: var(--ink);
  background: #fff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: var(--blue-dark);
  text-decoration: none;
}

.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
}

.btn-primary:hover {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
}

.btn-outline-primary {
  color: var(--blue-dark);
  border-color: var(--blue);
}

.site-nav {
  border-bottom: 1px solid rgba(24, 48, 71, .08);
  box-shadow: 0 8px 24px rgba(24, 48, 71, .06);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-weight: 800;
  color: var(--ink);
}

.brand-icon {
  display: grid;
  width: 2.2rem;
  height: 2.2rem;
  place-items: center;
  border-radius: 50%;
  background: #fff1df;
  color: #d35d20;
  font-size: 1.35rem;
}

.hero-section {
  position: relative;
  min-height: calc(100vh - 76px);
  display: flex;
  align-items: center;
  overflow: hidden;
  background: url("/images/hero-adoption.svg") center/cover no-repeat;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255,255,255,.96), rgba(255,255,255,.76) 46%, rgba(255,255,255,.2));
}

.hero-content {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 3rem;
  align-items: center;
  padding-block: 4rem;
}

.hero-copy {
  max-width: 720px;
}

.eyebrow {
  display: block;
  color: var(--green);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  margin-bottom: .6rem;
}

h1, h2, h3 {
  letter-spacing: 0;
}

.hero-copy h1 {
  font-size: clamp(3rem, 8vw, 6.5rem);
  line-height: .94;
  font-weight: 900;
  margin-bottom: 1.25rem;
}

.hero-copy p {
  max-width: 660px;
  color: #344b63;
  font-size: 1.25rem;
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
  margin-top: 1.8rem;
}

.hero-search,
.filter-panel,
.owner-card,
.detail-panel,
.gallery-panel {
  background: rgba(255,255,255,.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(24, 48, 71, .12);
}

.hero-search {
  display: grid;
  gap: .9rem;
  padding: 1.25rem;
}

.hero-search label,
.filter-panel label.form-label {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
}

.content-band {
  padding: 4.5rem 0;
}

.content-band.soft,
.page-header {
  background: var(--soft);
}

.page-header.compact {
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--line);
}

.page-header h1 {
  font-weight: 900;
  font-size: clamp(2.25rem, 5vw, 4.2rem);
}

.page-header p {
  max-width: 720px;
  color: var(--muted);
  font-size: 1.1rem;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1.5rem;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.1rem);
  font-weight: 900;
}

.pet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.2rem;
  align-content: start;
}

.pet-card,
.story-card,
.favorite-row,
.map-list-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(24, 48, 71, .08);
}

.pet-card {
  overflow: hidden;
}

.pet-image-link {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  background: #ecf6ff;
}

.pet-image-link img,
.story-card img,
.favorite-row img,
.map-list-item img,
.owner-card img,
.gallery-panel img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: .32rem .68rem;
  background: #e8f4ff;
  color: var(--blue-dark);
  font-size: .78rem;
  font-weight: 800;
}

.pet-image-link .status-pill {
  position: absolute;
  left: .8rem;
  top: .8rem;
}

.status-pending {
  background: #fff4df;
  color: #9a560c;
}

.status-adopted {
  background: #e7f7ed;
  color: #217246;
}

.pet-card-body {
  padding: 1rem;
}

.pet-card-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
}

.pet-card h3,
.favorite-row h2,
.owner-card h2 {
  margin: 0;
  font-weight: 850;
}

.pet-card p {
  color: var(--muted);
  margin: .35rem 0 .75rem;
}

.heart-button,
.heart-toggle {
  transition: transform .18s ease, background .18s ease;
}

.heart-button {
  width: 2.35rem;
  height: 2.35rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: #d65a73;
  font-size: 1.25rem;
}

.heart-button.active,
.heart-button:hover,
.heart-toggle.active {
  background: #fff0f3;
  transform: translateY(-1px);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}

.tag-row span,
.quick-facts span,
.feature-list span,
.reaction-row span {
  border-radius: 999px;
  background: #eef7f1;
  color: #22623e;
  padding: .32rem .62rem;
  font-size: .82rem;
  font-weight: 700;
}

.tag-row.large span {
  font-size: .92rem;
  padding: .45rem .72rem;
}

.owner-line {
  margin-top: .8rem;
  color: var(--muted);
  font-size: .9rem;
}

.story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.2rem;
}

.story-card {
  display: grid;
  grid-template-columns: 180px 1fr;
  overflow: hidden;
}

.story-card.tall {
  grid-template-columns: 1fr;
}

.story-card img {
  min-height: 220px;
}

.story-card div {
  padding: 1.25rem;
}

.story-card h2,
.story-card h3 {
  font-weight: 850;
}

.story-card p {
  color: var(--muted);
}

.story-date {
  color: var(--orange);
  font-weight: 800;
  font-size: .82rem;
}

.listing-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.filter-panel {
  position: sticky;
  top: 92px;
  padding: 1rem;
}

.filter-panel form {
  display: grid;
  gap: .75rem;
}

.filter-title {
  font-weight: 900;
  font-size: 1.35rem;
}

.check-stack {
  display: grid;
  gap: .45rem;
  color: #40576c;
}

.pet-detail-hero {
  background: var(--soft);
  padding: 3.5rem 0;
}

.detail-grid,
.detail-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 1.5rem;
}

.gallery-panel {
  overflow: hidden;
  aspect-ratio: 4 / 3;
}

.detail-panel,
.owner-card {
  padding: 1.5rem;
}

.detail-panel h1 {
  margin-top: .8rem;
  font-size: clamp(2.3rem, 5vw, 4.6rem);
  font-weight: 900;
}

.lead {
  color: var(--muted);
}

.quick-facts,
.feature-list,
.reaction-row {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  margin: 1rem 0;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
  margin-top: 1.2rem;
}

.mini-map,
.map-board {
  position: relative;
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(30deg, rgba(84,183,122,.20), transparent 40%),
    linear-gradient(150deg, rgba(29,117,216,.16), transparent 42%),
    #eef6fb;
}

.mini-map::before,
.map-board::before {
  content: "";
  position: absolute;
  inset: 10%;
  border: 2px dashed rgba(29,117,216,.18);
  border-radius: 40% 55% 45% 50%;
  transform: rotate(-8deg);
}

.map-pin,
.map-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 2;
  border: 0;
  border-radius: 999px;
  background: var(--orange);
  color: #fff;
  padding: .38rem .7rem;
  font-size: .82rem;
  font-weight: 800;
  box-shadow: 0 10px 20px rgba(123, 72, 13, .2);
}

.map-marker.active,
.map-marker:hover {
  background: #df7e20;
}

.map-pin {
  left: var(--x);
  top: var(--y);
}

.map-marker span {
  white-space: nowrap;
}

.owner-card {
  position: sticky;
  top: 92px;
}

.owner-card img {
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.owner-meta {
  color: var(--muted);
  margin-bottom: 1rem;
}

.account-layout,
.dashboard-layout {
  display: grid;
  gap: 1.2rem;
}

.account-layout {
  grid-template-columns: minmax(0, 520px) minmax(280px, 1fr);
  align-items: start;
}

.account-panel,
.account-note,
.dashboard-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: 0 12px 30px rgba(24, 48, 71, .08);
}

.account-panel,
.account-note {
  display: grid;
  gap: .9rem;
  padding: 1.2rem;
}

.pet-edit-form {
  display: grid;
  gap: 1rem;
  max-width: 980px;
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: 0 12px 30px rgba(24, 48, 71, .08);
}

.pet-edit-form label {
  display: grid;
  gap: .4rem;
  color: var(--muted);
  font-weight: 700;
}

.form-grid,
.check-grid {
  display: grid;
  gap: .9rem;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.check-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  color: #40576c;
}

.check-grid label {
  display: flex;
  align-items: center;
  gap: .45rem;
}

.account-note h2 {
  margin: 0;
  font-weight: 850;
}

.profile-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.dashboard-layout {
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
  align-items: start;
}

.dashboard-section {
  padding: 1rem;
}

.dashboard-section:first-child {
  grid-row: span 2;
}

.compact-heading {
  margin-bottom: 1rem;
  align-items: center;
}

.compact-heading h2 {
  font-size: 1.35rem;
}

.compact-heading span {
  color: var(--muted);
  font-weight: 800;
}

.application-list,
.pet-table {
  display: grid;
  gap: .75rem;
}

.application-row,
.pet-table-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.application-row {
  display: grid;
  gap: .6rem;
  padding: .9rem;
}

.application-row div,
.pet-table-row {
  display: flex;
  gap: .8rem;
  align-items: center;
  justify-content: space-between;
}

.application-row strong,
.application-row span,
.pet-table-row strong,
.pet-table-row small {
  display: block;
}

.application-row p {
  margin: 0;
  color: var(--muted);
}

.application-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: start;
}

.pet-table-row {
  justify-content: start;
  padding: .6rem;
  color: var(--ink);
}

.pet-table-row > span {
  min-width: 0;
  flex: 1;
}

.pet-table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  justify-content: end;
}

.pet-table-row img {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
}

.pet-table-row small,
.empty-state {
  color: var(--muted);
}

.donation-box {
  display: grid;
  gap: .35rem;
  background: #fff8ed;
  border: 1px solid #ffe0b5;
  border-radius: 8px;
  padding: 1rem;
}

.story-link {
  display: block;
  margin-top: 1rem;
  font-weight: 800;
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 1.2rem;
}

.map-board {
  min-height: 640px;
}

.real-map {
  background: #dbe9f1;
  cursor: grab;
  isolation: isolate;
  touch-action: none;
}

.real-map.is-dragging {
  cursor: grabbing;
}

.real-map::before {
  content: none;
}

.map-tiles,
.map-markers {
  position: absolute;
  inset: 0;
}

.map-tiles {
  z-index: 0;
  background: #dbe9f1;
  transform-origin: center;
  transition: transform .18s ease;
  will-change: transform;
}

.map-tiles img {
  position: absolute;
  width: 256px;
  height: 256px;
  max-width: none;
  user-select: none;
}

.map-markers {
  z-index: 2;
  pointer-events: none;
  transform-origin: center;
  transition: transform .18s ease;
  will-change: transform;
}

.map-markers .map-marker {
  pointer-events: auto;
}

.map-popup {
  position: absolute;
  z-index: 4;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: .8rem;
  width: min(320px, calc(100% - 2rem));
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 18px 44px rgba(24, 48, 71, .24);
  transform: translate(-50%, calc(-100% - 1rem));
}

.map-popup[hidden] {
  display: none;
}

.map-popup img {
  width: 92px;
  height: 92px;
  border-radius: 8px;
  object-fit: cover;
}

.map-popup strong,
.map-popup span,
.map-popup small,
.map-popup a {
  display: block;
}

.map-popup strong {
  font-size: 1.05rem;
  font-weight: 850;
}

.map-popup span,
.map-popup small {
  color: var(--muted);
}

.map-popup a {
  margin-top: .45rem;
  font-weight: 800;
}

.map-popup-close,
.app-modal-close {
  position: absolute;
  top: .45rem;
  right: .45rem;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 50%;
  background: #eef6fb;
  color: var(--ink);
  font-weight: 900;
  line-height: 1;
}

.app-modal[hidden] {
  display: none;
}

.app-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.app-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 48, 71, .46);
}

.app-modal-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: .8rem;
  width: min(520px, 100%);
  padding: 1.4rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(24, 48, 71, .32);
}

.app-modal-panel h2 {
  margin: 0;
  padding-right: 2rem;
  font-weight: 850;
}

.app-modal-status {
  min-height: 1.4rem;
  color: #217246;
  font-weight: 700;
}

.app-modal-status.is-error {
  color: #a52a2a;
}

.has-open-modal {
  overflow: hidden;
}

.map-controls {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 3;
  display: grid;
  overflow: hidden;
  border: 1px solid rgba(24, 48, 71, .18);
  border-radius: 8px;
  box-shadow: 0 12px 26px rgba(24, 48, 71, .18);
}

.map-controls button {
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1;
}

.map-controls button:last-child {
  border-bottom: 0;
}

.map-controls button:hover {
  background: #eef6fb;
}

.map-fallback {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  transform: translate(-50%, -50%);
  border-radius: 8px;
  background: rgba(255, 255, 255, .95);
  padding: 1rem 1.2rem;
  box-shadow: 0 12px 28px rgba(24, 48, 71, .16);
}

.map-list {
  display: grid;
  gap: .8rem;
  align-content: start;
}

.map-list-item {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: .8rem;
  align-items: center;
  padding: .65rem;
}

.map-list-item img {
  aspect-ratio: 1;
  border-radius: 8px;
}

.map-list-item small {
  display: block;
  color: var(--muted);
}

.favorites-list {
  display: grid;
  gap: .9rem;
}

.favorite-row {
  display: grid;
  grid-template-columns: 120px 1fr auto auto;
  gap: 1rem;
  align-items: center;
  padding: .8rem;
}

.favorite-row img {
  aspect-ratio: 1;
  border-radius: 8px;
}

.favorite-row p {
  margin: .2rem 0;
  color: var(--muted);
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 2rem 0;
  background: #fff;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

@media (max-width: 991px) {
  .hero-section {
    min-height: auto;
  }

  .hero-content,
  .listing-layout,
  .detail-grid,
  .detail-columns,
  .map-layout,
  .account-layout,
  .dashboard-layout {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-section:first-child {
    grid-row: auto;
  }

  .filter-panel,
  .owner-card {
    position: static;
  }
}

@media (max-width: 640px) {
  .section-heading,
  .favorite-row {
    align-items: start;
    grid-template-columns: 1fr;
  }

  .section-heading {
    flex-direction: column;
  }

  .story-card {
    grid-template-columns: 1fr;
  }

  .hero-copy h1 {
    font-size: 3.2rem;
  }

  .content-band {
    padding: 3rem 0;
  }
}
