/* Pets — stylesheet.
   Everything is in this file (and app.js) because the Content-Security-Policy
   forbids inline <style>/<script>: an injected tag simply will not execute. */

@font-face {
  font-family: 'Nunito';
  src: url('/static/fonts/nunito.woff2') format('woff2-variations');
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Baloo';
  src: url('/static/fonts/baloo2.woff2') format('woff2-variations');
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper:      #fdf9f3;
  --card:       #ffffff;
  --ink:        #2c2724;
  --ink-soft:   #6d635b;
  --ink-faint:  #9a8f85;
  --line:       #ece2d6;
  --line-soft:  #f4ece2;

  --brand:      #14795f;   /* deep herb green */
  --brand-dark: #0f5c48;
  --brand-tint: #e6f2ee;
  --accent:     #e4703c;   /* warm terracotta */
  --accent-tint:#fcecdf;
  --gold:       #d9a521;
  --danger:     #b3402c;
  --danger-tint:#fbeae6;

  --radius:     18px;
  --radius-sm:  11px;
  --shadow:     0 1px 2px rgba(60,40,20,.05), 0 8px 24px -12px rgba(60,40,20,.18);
  --shadow-lg:  0 2px 4px rgba(60,40,20,.06), 0 24px 48px -24px rgba(60,40,20,.28);
  --maxw:       1080px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Nunito', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16.5px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  /* Soft paw-print wash, drawn as a data: URI so no external request is made. */
  background-image:
    radial-gradient(900px 420px at 88% -8%, #eef6f2 0%, rgba(253,249,243,0) 70%),
    radial-gradient(700px 380px at 4% 2%, #fdf0e6 0%, rgba(253,249,243,0) 68%);
  background-repeat: no-repeat;
}

h1, h2, h3, h4 {
  font-family: 'Baloo', 'Nunito', ui-rounded, system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -.015em;
  margin: 0 0 .4em;
  color: #221d1a;
}
h1 { font-size: clamp(2rem, 4.6vw, 3.05rem); }
h2 { font-size: clamp(1.4rem, 2.4vw, 1.85rem); }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1rem; }
a { color: var(--brand-dark); text-decoration-color: rgba(20,121,95,.35); text-underline-offset: 3px; }
a:hover { color: var(--brand); }

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

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 660px; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--brand); color: #fff; padding: 10px 16px; z-index: 100;
  border-radius: 0 0 10px 0;
}
.skip:focus { left: 0; }

/* ------------------------------------------------------------------ header */
.site-head {
  position: sticky; top: 0; z-index: 40;
  background: rgba(253,249,243,.88);
  backdrop-filter: saturate(1.5) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-head .bar {
  max-width: var(--maxw); margin: 0 auto; padding: 11px 20px;
  display: flex; align-items: center; gap: 18px;
}
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: 'Baloo', sans-serif; font-weight: 700; font-size: 1.42rem;
  color: var(--brand-dark); text-decoration: none; letter-spacing: -.02em;
  flex: none;
}
.brand svg { width: 27px; height: 27px; display: block; }
.brand span { line-height: 1; }

.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav a {
  padding: 7px 12px; border-radius: 999px; text-decoration: none;
  color: var(--ink-soft); font-weight: 600; font-size: .95rem; white-space: nowrap;
}
.nav a:hover { background: var(--brand-tint); color: var(--brand-dark); }
.nav a.active { background: var(--brand-tint); color: var(--brand-dark); }

/* Buttons inside the nav: `.nav a` is more specific than `.btn`, so without
   these the button labels would inherit the plain link colour and end up
   dark-on-green. */
.nav a.btn              { color: #fff; }
.nav a.btn:hover        { color: #fff; background: var(--brand-dark); }
.nav a.btn.accent       { color: #fff; }
.nav a.btn.accent:hover { color: #fff; background: #cf5f2d; }
.nav a.btn.ghost        { color: var(--ink); }
.nav a.btn.ghost:hover  { color: var(--brand-dark); background: #fff; }

.searchbox { display: flex; align-items: center; }
.searchbox input {
  width: 168px; padding: 8px 13px; font: inherit; font-size: .92rem;
  border: 1px solid var(--line); border-radius: 999px; background: #fff;
  transition: width .18s ease, border-color .18s ease;
}
.searchbox input:focus { width: 210px; border-color: var(--brand); outline: none; }

.avatar-link { display: flex; align-items: center; gap: 8px; text-decoration: none; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 19px; border-radius: 999px; border: 1px solid transparent;
  background: var(--brand); color: #fff; font: inherit; font-weight: 700;
  font-size: .95rem; cursor: pointer; text-decoration: none; line-height: 1.2;
  transition: transform .12s ease, background .16s ease, box-shadow .16s ease;
  box-shadow: 0 1px 2px rgba(20,121,95,.2);
}
.btn:hover { background: var(--brand-dark); color: #fff; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.accent { background: var(--accent); box-shadow: 0 1px 2px rgba(228,112,60,.25); }
.btn.accent:hover { background: #cf5f2d; }
.btn.ghost {
  background: #fff; color: var(--ink); border-color: var(--line);
  box-shadow: var(--shadow);
}
.btn.ghost:hover { background: #fff; border-color: var(--brand); color: var(--brand-dark); }
.btn.small { padding: 6px 13px; font-size: .87rem; }
.btn.danger { background: transparent; color: var(--danger); border-color: #eccfc8; box-shadow: none; }
.btn.danger:hover { background: var(--danger-tint); color: var(--danger); }
.btn.block { width: 100%; }

/* -------------------------------------------------------------------- cards */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.pad { padding: 22px; }

/* --------------------------------------------------------------------- hero */
.hero { padding: 46px 0 10px; }
.hero-grid {
  display: grid; grid-template-columns: 1.05fr .95fr; gap: 44px; align-items: center;
}
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--accent-tint); color: #a8512a; border-radius: 999px;
  padding: 5px 14px; font-size: .82rem; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; margin-bottom: 15px;
}
.hero h1 { margin-bottom: .35em; }
.hero h1 em { font-style: normal; color: var(--brand); }
.hero .lede { font-size: 1.12rem; color: var(--ink-soft); max-width: 34em; }
.hero-actions { display: flex; gap: 11px; flex-wrap: wrap; margin-top: 22px; }

/* Photo mosaic — the pets themselves are the hero image. */
.mosaic {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 92px);
  gap: 11px;
}
.mosaic figure {
  margin: 0; overflow: hidden; border-radius: 15px; background: var(--line-soft);
  box-shadow: var(--shadow); position: relative;
  border: 3px solid #fff;
}
.mosaic img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .5s cubic-bezier(.2,.7,.3,1);
}
.mosaic figure:hover img { transform: scale(1.07); }
.mosaic .tall { grid-row: span 2; }
.mosaic .wide { grid-column: span 2; }

/* ------------------------------------------------------------------- stats */
.stats {
  display: flex; gap: 34px; flex-wrap: wrap;
  margin: 34px 0 8px; padding: 18px 24px;
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.stat b {
  display: block; font-family: 'Baloo', sans-serif; font-size: 1.65rem;
  line-height: 1.1; color: var(--brand-dark);
}
.stat span { font-size: .87rem; color: var(--ink-faint); font-weight: 600; }

/* ----------------------------------------------------------------- sections */
.section { margin: 52px 0; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.section-head h2 { margin: 0; }
.section-head .more { font-weight: 700; font-size: .93rem; text-decoration: none; }

/* --------------------------------------------------------------- pet strip */
.pet-strip {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 16px;
}
.pet-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; text-decoration: none; color: inherit; display: block;
  box-shadow: var(--shadow); transition: transform .16s ease, box-shadow .16s ease;
}
.pet-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); color: inherit; }
.pet-card .ph { aspect-ratio: 1/1; background: var(--line-soft); overflow: hidden; }
.pet-card .ph img { width: 100%; height: 100%; object-fit: cover; }
.pet-card .meta { padding: 11px 13px 13px; }
.pet-card strong { display: block; font-family: 'Baloo', sans-serif; font-size: 1.06rem; }
/* Keep the species/breed line to one row so a long breed name ("Blue-and-gold
   Macaw") does not make one card taller than its neighbours. */
.pet-card small {
  display: block; color: var(--ink-faint); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ------------------------------------------------------------- post cards */
.post-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(292px, 1fr)); gap: 22px;
}
.post-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  box-shadow: var(--shadow); transition: transform .16s ease, box-shadow .16s ease;
}
.post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.post-card .ph { aspect-ratio: 16/10; background: var(--line-soft); overflow: hidden; }
.post-card .ph img { width: 100%; height: 100%; object-fit: cover; }
.post-card .body { padding: 17px 19px 19px; display: flex; flex-direction: column; flex: 1; }
.post-card h3 { margin: 0 0 .35em; font-size: 1.17rem; }
.post-card h3 a { text-decoration: none; color: inherit; }
.post-card h3 a:hover { color: var(--brand-dark); }
.post-card .excerpt { color: var(--ink-soft); font-size: .95rem; margin: 0 0 14px; flex: 1; }

.byline { display: flex; align-items: center; gap: 9px; font-size: .87rem; color: var(--ink-faint); }
.byline a { color: var(--ink-soft); font-weight: 700; text-decoration: none; }
.byline a:hover { color: var(--brand-dark); }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--brand-tint); color: var(--brand-dark);
  padding: 3px 11px; border-radius: 999px;
  font-size: .78rem; font-weight: 700; text-decoration: none;
  letter-spacing: .01em;
}
.chip:hover { background: #d5e9e2; color: var(--brand-dark); }
.chip.pet { background: var(--accent-tint); color: #a8512a; }
.chip.pet:hover { background: #f8ddc9; color: #a8512a; }
.chip-row { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 11px; }

.avatar {
  width: 30px; height: 30px; border-radius: 50%; object-fit: cover;
  background: var(--brand-tint); flex: none; border: 1px solid var(--line);
}
.avatar.lg { width: 76px; height: 76px; }
.avatar.xl { width: 104px; height: 104px; }
.avatar.sm { width: 25px; height: 25px; }
.avatar-fallback {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-tint); color: var(--brand-dark);
  font-family: 'Baloo', sans-serif; font-weight: 700; border: 1px solid var(--line);
  border-radius: 50%; flex: none; line-height: 1;
}

.counts { display: flex; gap: 13px; margin-left: auto; font-size: .85rem; color: var(--ink-faint); }
.counts span { display: inline-flex; align-items: center; gap: 4px; }

/* ------------------------------------------------------------------- likes */
.like-form { display: inline; }
.like-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 12px; font: inherit; font-size: .85rem; font-weight: 700;
  color: var(--ink-soft); cursor: pointer; transition: all .14s ease;
}
.like-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-tint); }
.like-btn.on { background: var(--accent-tint); border-color: #f2c6a8; color: #b8502a; }
.like-btn svg { width: 15px; height: 15px; }

/* ------------------------------------------------------------------ groups */
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 18px; }
.group-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
  transition: transform .16s ease, box-shadow .16s ease;
  display: flex; flex-direction: column;
}
.group-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.group-card h3 { margin: 0 0 .25em; }
.group-card h3 a { text-decoration: none; color: inherit; }
.group-card h3 a:hover { color: var(--brand-dark); }
.group-card p { color: var(--ink-soft); font-size: .93rem; flex: 1; }
.group-card .foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-top: 6px;
}
.group-card .foot small { color: var(--ink-faint); font-weight: 700; }
.group-emoji {
  font-size: 1.6rem; line-height: 1; margin-bottom: 10px; display: block;
}

/* pill list of small group links */
.pill-list { display: flex; flex-wrap: wrap; gap: 8px; }

/* -------------------------------------------------------------------- forms */
.form-page { max-width: 520px; margin: 46px auto; }
.form-page.wide { max-width: 700px; }
.field { margin-bottom: 17px; }
.field label {
  display: block; font-weight: 700; font-size: .92rem;
  margin-bottom: 6px; color: #453d37;
}
.field .hint { font-weight: 500; color: var(--ink-faint); font-size: .85rem; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=search], textarea, select {
  width: 100%; padding: 11px 14px; font: inherit; font-size: .98rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink); transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(20,121,95,.13);
}
textarea { resize: vertical; min-height: 130px; line-height: 1.6; }
select { appearance: none; background-image: none; cursor: pointer; }
input[type=file] {
  width: 100%; font: inherit; font-size: .9rem; padding: 10px;
  border: 1px dashed var(--line); border-radius: var(--radius-sm); background: #fffdfa;
  cursor: pointer;
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.alert {
  padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px;
  font-size: .94rem; font-weight: 600; border: 1px solid;
}
.alert.error { background: var(--danger-tint); color: #8d3324; border-color: #f0cec6; }
.alert.ok    { background: var(--brand-tint); color: var(--brand-dark); border-color: #cae3da; }

.form-foot { margin-top: 22px; font-size: .93rem; color: var(--ink-soft); text-align: center; }

/* ------------------------------------------------------------------ article */
.article { max-width: 720px; margin: 40px auto; }
.article h1 { margin-bottom: .3em; }
.article-meta {
  display: flex; align-items: center; gap: 11px; flex-wrap: wrap;
  color: var(--ink-faint); font-size: .92rem; margin-bottom: 26px;
}
.article-photo { border-radius: var(--radius); overflow: hidden; margin-bottom: 26px; box-shadow: var(--shadow); }
.article-body { font-size: 1.06rem; white-space: pre-wrap; word-wrap: break-word; }
.article-actions {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 28px 0; padding-top: 22px; border-top: 1px solid var(--line);
}

/* ----------------------------------------------------------------- comments */
.comments { max-width: 720px; margin: 0 auto 60px; }
.comment {
  display: flex; gap: 13px; padding: 16px 0; border-bottom: 1px solid var(--line-soft);
}
.comment:last-child { border-bottom: none; }
.comment .c-body { flex: 1; min-width: 0; }
.comment .c-head {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  font-size: .88rem; color: var(--ink-faint); margin-bottom: 3px;
}
.comment .c-head a { font-weight: 700; color: var(--ink-soft); text-decoration: none; }
.comment .c-text { white-space: pre-wrap; word-wrap: break-word; margin: 0; }
.comment form { margin-left: auto; }

/* ------------------------------------------------------------------ profile */
.profile-head {
  display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap;
  padding: 26px; margin-bottom: 34px;
}
.profile-head .who { flex: 1; min-width: 220px; }
.profile-head h1 { margin-bottom: .1em; font-size: 2rem; }
.profile-head .handle { color: var(--ink-faint); font-weight: 700; margin-bottom: .6em; }
.profile-head .bio { color: var(--ink-soft); white-space: pre-wrap; word-wrap: break-word; }

.empty {
  text-align: center; padding: 46px 24px; color: var(--ink-faint);
  border: 1px dashed var(--line); border-radius: var(--radius); background: #fffdfa;
}
.empty p { margin: 0 0 14px; }

/* --------------------------------------------------------------- pagination */
.pager { display: flex; gap: 10px; justify-content: center; margin: 38px 0; }

/* ------------------------------------------------------------------- footer */
.site-foot {
  border-top: 1px solid var(--line); margin-top: 70px;
  padding: 30px 0 44px; color: var(--ink-faint); font-size: .9rem;
  background: rgba(255,255,255,.5);
}
.site-foot .bar {
  display: flex; gap: 18px; align-items: center; flex-wrap: wrap;
  max-width: var(--maxw); margin: 0 auto; padding: 0 20px;
}
.site-foot a { color: var(--ink-soft); text-decoration: none; font-weight: 600; }
.site-foot a:hover { color: var(--brand-dark); }
.site-foot .right { margin-left: auto; }

/* ------------------------------------------------------------------ layouts */
.split { display: grid; grid-template-columns: 1fr 300px; gap: 34px; align-items: start; }
.side .card + .card { margin-top: 18px; }
.side h3 { font-size: 1.05rem; margin-bottom: .6em; }

.error-page { text-align: center; padding: 90px 20px; }
.error-page .code {
  font-family: 'Baloo', sans-serif; font-size: 5rem; line-height: 1;
  color: var(--brand); opacity: .35; margin-bottom: .1em;
}

/* ---------------------------------------------------------------- utilities
   The CSP forbids inline style attributes (an injected style= would be blocked
   just as an injected script would be), so per-element tweaks live here as
   classes instead. */
.page-title    { font-size: 1.8rem; }
.about-title   { font-size: 1.9rem; }
.section-title { font-size: 1.3rem; }
.card-title    { font-size: 1.25rem; }
.error-title   { font-size: 1.6rem; }

.subtle        { color: var(--ink-soft); }
.muted         { color: var(--ink-faint); }
.muted-sm      { color: var(--ink-faint); font-size: .88rem; }
.muted-strong  { color: var(--ink-faint); font-weight: 700; }
.note          { color: var(--ink-soft); font-size: .94rem; }
.about-lede    { color: var(--ink-soft); font-size: 1.05rem; }
.section-intro { color: var(--ink-soft); max-width: 52ch; margin-top: -10px; }

.tight       { margin: 0; }
.mb-tiny     { margin-bottom: .4em; }
.mb-20       { margin-bottom: 20px; }
.mb-22       { margin-bottom: 22px; }
.mb-32       { margin-bottom: 32px; }
.mt-12       { margin-top: 12px; }
.mt-14       { margin: 14px 0 0; }
.mt-22       { margin-top: 22px; }
.mt-24       { margin-top: 24px; }
.mt-44       { margin-top: 44px; }
.hint-pull   { margin: -8px 0 16px; }
.push-right  { margin-left: auto; }
.d-block     { display: block; }
.flex-fill   { flex: 1; min-width: 220px; }

.row-flex    { display: flex; gap: 10px; flex-wrap: wrap; }
.people-row  { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 36px; }
.avatar-row  { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.search-form { max-width: 460px; margin-bottom: 32px; }

.ta-xs textarea, textarea.ta-xs { min-height: 96px; }
.ta-sm textarea, textarea.ta-sm { min-height: 100px; }
.ta-md textarea, textarea.ta-md { min-height: 110px; }

.about-h    { font-size: 1.2rem; margin-top: 28px; }
.about-list { color: var(--ink-soft); padding-left: 1.2em; }

.group-hero       { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.group-hero-emoji { font-size: 2.6rem; line-height: 1; }
.group-hero-title { font-size: 1.9rem; margin-bottom: .15em; }

.person-card {
  display: flex; align-items: center; gap: 11px;
  text-decoration: none; color: inherit; padding: 12px 16px;
}
.person-card:hover { color: inherit; border-color: var(--brand); }
.pet-placeholder {
  display: flex; align-items: center; justify-content: center;
  height: 100%; font-size: 2.4rem;
}

/* -------------------------------------------------------------- responsive */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 30px; }
  .split { grid-template-columns: 1fr; }
  .mosaic { grid-template-rows: repeat(3, 78px); }
}
@media (max-width: 620px) {
  body { font-size: 16px; }
  .site-head .bar { gap: 10px; padding: 10px 16px; }
  .searchbox { display: none; }
  .nav a { padding: 6px 9px; font-size: .9rem; }
  .brand { font-size: 1.22rem; }
  .row { grid-template-columns: 1fr; }
  .stats { gap: 20px; padding: 16px 18px; }
  .hero { padding: 28px 0 4px; }
  .profile-head { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .mosaic figure:hover img { transform: none; }
}
