:root {
  --bg: #fbf7f2;
  --surface: #ffffff;
  --surface-2: #f4ede4;
  --text: #2a2420;
  --muted: #6b5f55;
  --line: #e6dcd0;
  --brand: #b4531a;
  --brand-ink: #ffffff;
  --brand-soft: #fbe6d6;
  --ok: #2f7a4a;
  --ok-soft: #e1f2e6;
  --urgent: #b42318;
  --urgent-soft: #fde7e4;
  --warn-soft: #fff4d6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 4px 16px rgba(60, 40, 20, .06);
  color-scheme: light;
}

.poster-canvas { display: block; width: 100%; max-width: 600px; height: auto; max-height: none; object-fit: contain; object-position: center; margin: 24px auto; }
.poster-canvas[hidden] { display: none; }
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1714;
    --surface: #24201c;
    --surface-2: #2e2924;
    --text: #f2ebe4;
    --muted: #b8aa9c;
    --line: #3d3630;
    --brand: #e8834a;
    --brand-ink: #1a1714;
    --brand-soft: #3b2a1f;
    --ok: #6cc28a;
    --ok-soft: #1f3226;
    --urgent: #f2776a;
    --urgent-soft: #3d201d;
    --warn-soft: #3a3220;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; padding-bottom: 48px; }
.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 560px; }
h1, h2, h3 { line-height: 1.2; margin: 1.2em 0 .5em; }
h1 { font-size: clamp(1.6rem, 4.5vw, 2.3rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.08rem; }
p { margin: .5em 0 1em; }
a { color: var(--brand); }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.hidden { display: none !important; }

/* ---------- header ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.site-header .bar { display: flex; align-items: center; gap: 12px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; margin-right: auto; }
.menu-btn { display: none; }
#main-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
#main-nav a, #main-nav .linklike { padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: .95rem; }
#main-nav a[aria-current="page"] { background: var(--brand-soft); }
#main-nav a.btn { color: var(--brand-ink); }
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-left: 6px; }
.lang-switch button { border: 0; background: transparent; color: var(--muted); padding: 6px 9px; font: inherit; font-size: .85rem; cursor: pointer; }
.lang-switch button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }
@media (max-width: 760px) {
  .menu-btn { display: inline-block; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 8px 12px; font: inherit; }
  #main-nav { display: none; width: 100%; flex-direction: column; align-items: stretch; padding-bottom: 12px; }
  .site-header.open #main-nav { display: flex; }
  #main-nav a, #main-nav .linklike { padding: 12px; text-align: left; }
  .lang-switch { align-self: flex-start; margin: 8px 0 0 12px; }
}

.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; padding: 18px 0; }

/* ---------- buttons & forms ---------- */
.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--brand); color: var(--brand-ink); border: 0; border-radius: 10px;
  padding: 11px 18px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  min-height: 44px;
}
.btn.small { padding: 6px 12px; min-height: 34px; font-size: .9rem; }
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
.btn.danger { background: var(--urgent); color: #fff; }
.btn.big { font-size: 1.1rem; padding: 16px 24px; min-height: 56px; }
.btn:disabled, .btn.busy { opacity: .6; cursor: progress; }
.linklike { background: none; border: 0; color: var(--brand); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0; }

form .field { margin-bottom: 16px; }
label, .label { display: block; font-weight: 600; margin-bottom: 6px; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: .88rem; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible, button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px;
}
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin-bottom: 8px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--brand); }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.choice-grid .check { background: var(--surface-2); border-radius: 10px; padding: 10px; margin: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .row2 { grid-template-columns: 1fr; } }
fieldset { border: 0; padding: 0; margin: 0 0 16px; }
legend { font-weight: 600; margin-bottom: 6px; padding: 0; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.pet { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.pet .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.pet h3 { margin: 0; }
.pet-photo { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--surface-2); display: block; }
.pet-photo.placeholder { display: grid; place-items: center; font-size: 3rem; }
.thumb { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; flex: none; }
.thumb.placeholder { display: grid; place-items: center; font-size: 1.6rem; background: var(--surface-2); }
.list { list-style: none; padding: 0; margin: 0; }
.list > li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.badge { display: inline-block; font-size: .78rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.badge.home { background: var(--ok-soft); color: var(--ok); }
.badge.needs_home { background: var(--urgent-soft); color: var(--urgent); }
.badge.placed { background: var(--brand-soft); color: var(--brand); }
.badge.pledges { background: var(--ok-soft); color: var(--ok); }

.banner { border-radius: var(--radius); padding: 16px 18px; margin: 16px 0; border: 1px solid var(--line); }
.banner.urgent { background: var(--urgent-soft); border-color: var(--urgent); }
.banner.info { background: var(--warn-soft); }
.banner.ok { background: var(--ok-soft); }
.banner h2, .banner h3 { margin-top: 0; }

.empty { text-align: center; color: var(--muted); padding: 28px 12px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }

/* ---------- landing ---------- */
.hero { padding-top: 40px; padding-bottom: 16px; text-align: center; }
.hero h1 { font-size: clamp(1.9rem, 6vw, 3rem); max-width: 18ch; margin: 0 auto .5em; }
.hero p.lead { font-size: 1.15rem; color: var(--muted); max-width: 52ch; margin-left: auto; margin-right: auto; }
.hero .actions { justify-content: center; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 24px 0; }
.step .num { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-weight: 700; margin-bottom: 6px; }

/* ---------- dialogs ---------- */
dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(560px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(20, 12, 6, .5); }
dialog .dlg { padding: 20px; max-height: calc(100vh - 64px); overflow: auto; }
dialog h2 { margin-top: 0; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(30px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 10px; max-width: calc(100vw - 32px); transition: .2s; z-index: 50; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.error { background: var(--urgent); color: #fff; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 16px; }
.tabs button { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px; padding: 7px 14px; font: inherit; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.loading { color: var(--muted); padding: 20px 0; }
.contact-lines { font-size: .92rem; word-break: break-word; }

/* Photo placeholder that is swapped for the real photo once it loads */
.photo-slot { display: contents; }

/* Continue with Google */
.google-box { margin: 0 0 1rem; }
.google-btn { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: .6rem; }
.or-line { text-align: center; color: var(--muted, #6b6b6b); margin: .9rem 0 0; font-size: .95rem; }

/* Logo */
.hero-logo { display: block; width: min(260px, 70vw); height: auto; margin: 0 auto 1.25rem; filter: drop-shadow(0 6px 18px rgba(80, 40, 10, .25)); }
.brand img { border-radius: 50%; }
