/* ---- fonts (self-hosted in /static/fonts) ---- */
@font-face { font-family: "Fira Sans"; src: url("/static/fonts/Fira_Sans/FiraSans-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url("/static/fonts/Fira_Sans/FiraSans-Italic.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url("/static/fonts/Fira_Sans/FiraSans-SemiBold.ttf") format("truetype"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url("/static/fonts/Fira_Sans/FiraSans-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("/static/fonts/Cormorant_Garamond/CormorantGaramond-VariableFont_wght.ttf") format("truetype"); font-weight: 300 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("/static/fonts/Cormorant_Garamond/CormorantGaramond-Italic-VariableFont_wght.ttf") format("truetype"); font-weight: 300 700; font-style: italic; font-display: swap; }
/* The wolf's handwriting: used only for his signature. */
@font-face { font-family: "Playwrite IT Trad"; src: url("/static/fonts/Playwrite_IT_Trad/PlaywriteITTrad-VariableFont_wght.ttf") format("truetype"); font-weight: 100 400; font-display: swap; }

:root {
  /* Palette: navy #36384d, slate lavender #7c7fa2, gray #616161, plus pale lavenders and a pig pink. */
  --paper: #eef0f8;
  --paper-2: #dcdef0;
  --card: #fbfbff;
  --ink: #36384d;
  --ink-soft: #616161;
  --lavender: #7c7fa2;
  --lavender-light: #c3c5f2;
  --forest: #36384d;
  --forest-dark: #36384d;
  --accent: #36384d;  /* primary buttons */
  --heart: #c4566b;   /* hearts and the list count */
  --straw: #f0cf6b;
  --straw-dark: #d4a73c;
  --sticks: #b07a4a;
  --sticks-dark: #7a4f2b;
  --brick: #b4483a;
  --mortar: #e9d3b5;
  --roof: #5b3a2c;
  --door: #6b3f22;
  --window: #ffe9a8;
  --pig: #f6b8c0;
  --pig-dark: #e48d9b;
  --hat: #3d4a5c;
  --clipboard: #e2c290;
  --wind: #9ea1d4;
  --hill: #9cc78a;
  --dust: #d9c8a5;
  --good: #2f7a4a;
  --bad: #b5452f;
  --shadow: 0 2px 6px rgba(54, 56, 77, .12), 0 1px 2px rgba(54, 56, 77, .08); /* soft resting shadow */
  --shadow-lift: 0 10px 20px rgba(54, 56, 77, .18), 0 3px 6px rgba(54, 56, 77, .08); /* hover: rises, shadow spreads */
  --shadow-press: 0 1px 2px rgba(54, 56, 77, .12);
  --radius: 0px;
  --display: "Fira Sans", sans-serif;
  --body: "Fira Sans", sans-serif;
  --script: "Playwrite IT Trad", cursive;   /* signature only */
  --serif: "Cormorant Garamond", Georgia, serif; /* specialty text: his quotes and notes */
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  background-image: radial-gradient(circle at 20% 0%, #ffffff 0, transparent 50%), radial-gradient(circle at 100% 100%, var(--paper-2) 0, transparent 45%);
  color: var(--ink);
  font: 18px/1.5 var(--body);
  min-height: 100vh;
}
.page { max-width: 780px; margin: 0 auto; padding: 24px 16px 40px; }
h1, h2, h3, .btn, .stamp { font-family: var(--display); }
h2 { margin: 0 0 4px; font-size: 1.6rem; line-height: 1.2; }
.sub { color: var(--ink-soft); margin: 0 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---- masthead ---- */
.masthead { text-align: center; margin-bottom: 20px; }
.badge-line {
  display: inline-block; margin: 0 0 8px; padding: 4px 12px; border: 2px solid var(--ink);
  border-radius: 999px; font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  background: var(--card);
}
h1 { margin: 0; font-size: clamp(2rem, 7vw, 3.2rem); line-height: 1.05; color: var(--forest-dark); }
/* Logo: the title image doubles as the "home" link. */
.logo a { display: inline-block; border-radius: 8px; transition: transform .2s ease-out; }
.logo img { display: block; width: min(100%, 620px); height: auto; margin: 0 auto; }
.logo a:hover { transform: scale(1.02) rotate(-.5deg); }
.logo a:focus-visible { outline: 3px solid var(--lavender); outline-offset: 6px; }
.tagline { max-width: 34em; margin: 10px auto 0; color: var(--ink-soft); }

/* ---- buttons ---- */
.btn {
  font-size: 1rem; font-weight: 600; padding: 10px 16px; border: 3px solid var(--ink); border-radius: 8px;
  background: var(--card); color: var(--ink); box-shadow: var(--shadow); cursor: pointer;
  transition: transform .12s, box-shadow .12s; min-height: 44px;
}
.btn:hover { transform: scale(1.05); box-shadow: var(--shadow-lift); }
.btn[disabled]:hover { transform: none; box-shadow: var(--shadow); }
/* These stay put on hover: Compare locations, rent filter Clear buttons, map popup button. */
.list-compare:hover, .rent-filter .btn:hover, .map-popup .btn:hover { transform: none; box-shadow: var(--shadow); }
.btn:active { transform: scale(.97); box-shadow: var(--shadow-press); }
.btn:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid var(--lavender); outline-offset: 2px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn:not(.btn-primary):hover { border-color: var(--lavender); }
.btn-primary:hover { background: #2b2d3f; }
.btn-small { padding: 6px 12px; min-height: 36px; font-size: .9rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---- search ---- */
.search { position: relative; margin-bottom: 16px; }
.search-box { display: flex; gap: 8px; }
.search input {
  flex: 1; min-width: 0; font: 1.1rem var(--body); padding: 12px 14px; border: 3px solid var(--ink);
  border-radius: 8px; background: #fff; color: var(--ink); box-shadow: var(--shadow);
}
.suggestions {
  position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 8px); margin: 0; padding: 6px; list-style: none;
  background: var(--card); border: 3px solid var(--ink); border-radius: 8px; box-shadow: var(--shadow);
}
.suggestions li { padding: 10px 12px; border-radius: 5px; cursor: pointer; }
.suggestions li[aria-selected="true"], .suggestions li:hover { background: var(--paper-2); }
.suggestions small { display: block; color: var(--ink-soft); }

/* ---- panels ---- */
.panel, .result {
  background: var(--card); border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 16px; margin-bottom: 20px;
}
.intro, .loading, .message { text-align: center; }
.wolf-slot { width: 150px; height: 190px; margin: 0 auto; display: flex; justify-content: center; }
.wolf { height: 100%; width: auto; display: block; }
/* Home page: bigger wolf, cropped to his upper body and fading out around the belt. */
.wolf-slot.portrait {
  width: 320px; max-width: 100%; height: 230px; overflow: hidden; align-items: flex-start; justify-content: center;
  -webkit-mask-image: linear-gradient(to bottom, #000 78%, transparent);
  mask-image: linear-gradient(to bottom, #000 78%, transparent);
}
.wolf-slot.portrait .wolf { height: 520px; flex: none; } /* 300px wide: fits inside the 320px frame */
.wolf-says { font-family: var(--display); font-size: 1.25rem; font-weight: 500; margin: 8px 0; }
.wolf-says.big { font-size: 1.4rem; text-align: center; }
.hint { margin: 16px 0 8px; color: var(--ink-soft); }
.quick-picks { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* ---- candidates ---- */
.candidate-list { display: grid; gap: 12px; }
.candidate {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; font: inherit; color: inherit;
  padding: 10px; border: 3px solid var(--ink); border-radius: 8px; background: #fff; cursor: pointer; box-shadow: var(--shadow);
  transition: transform .12s, box-shadow .12s;
}
.candidate:hover { background: var(--paper); transform: scale(1.02); box-shadow: var(--shadow-lift); }
.candidate img, .candidate .thumb-fallback {
  width: 64px; height: 64px; flex: none; border-radius: 5px; object-fit: cover; border: 2px solid var(--ink); background: var(--paper-2);
  display: grid; place-items: center; font-size: 1.8rem;
}
.candidate strong { display: block; font-family: var(--display); font-size: 1.1rem; }
.candidate span { color: var(--ink-soft); font-size: .9rem; }

/* ---- loading ---- */
.dots { display: flex; gap: 8px; justify-content: center; margin-top: 8px; }
.dots span { width: 10px; height: 10px; border-radius: 50%; background: var(--wind); animation: dot 1s infinite ease-in-out; }
.dots span:nth-child(2) { animation-delay: .15s; }
.dots span:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 50% { transform: translateY(-8px); } }

/* Loading wolf: inhale pose, gently swelling as he breathes in. */
.inhaling .wolf { animation: inhale 1.6s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes inhale { 50% { transform: scale(1.04, 1.07); } }

/* ---- result ---- */
.place-head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.place-head img { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; border: 3px solid var(--ink); flex: none; }
.place-head p { margin: 0; }

.scene-wrap { position: relative; margin: 8px -8px 0; }
.scene { width: 100%; height: auto; display: block; overflow: visible; }
.hill { fill: var(--hill); }
.house { transition: opacity .4s, filter .4s; }
.house-body { transform-box: fill-box; transform-origin: 0% 100%; }
.scene.has-target .house:not(.target) { opacity: .4; filter: grayscale(.6); }
.house.target .house-body { filter: drop-shadow(0 0 6px #fff6c2); }
/* The huff: long, faint, blurred air streaks (not droplets) plus breath clouds that swell and fade. */
.wind path { stroke-dasharray: 110 700; stroke-dashoffset: 810; opacity: 0; }
.scene.blowing .wind path { animation: wind 1.5s cubic-bezier(.3, .6, .4, 1) forwards; }
.scene.blowing .wind path:nth-child(2) { animation-delay: .1s; }
.scene.blowing .wind path:nth-child(3) { animation-delay: .22s; }
.scene.blowing .wind path:nth-child(4) { animation-delay: .34s; }
@keyframes wind {
  0% { stroke-dashoffset: 810; opacity: 0; }
  20% { opacity: .55; }
  100% { stroke-dashoffset: -120; opacity: 0; }
}
.breath circle { opacity: 0; transform-box: fill-box; transform-origin: center; }
.scene.blowing .breath circle { animation: breath-puff 1.3s ease-out var(--t) forwards; }
@keyframes breath-puff {
  0% { opacity: 0; transform: translate(0, 0) scale(.4); }
  20% { opacity: .85; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(3.2); }
}
/* Scene wolf: idle by default, inhale pose while .inhaling-scene, blow pose while .blowing. */
.scene-wolf image { display: none; }
.scene-wolf .pose-idle,
.scene.inhaling-scene .scene-wolf .pose-inhale,
.scene.blowing .scene-wolf .pose-blow { display: inline; }
.scene.inhaling-scene .scene-wolf .pose-idle,
.scene.blowing .scene-wolf .pose-idle { display: none; }
.scene.inhaling-scene .scene-wolf { animation: inhale .7s ease-in-out 2; transform-box: fill-box; transform-origin: 50% 100%; }
.scene.blowing .scene-wolf .pose-blow { animation: gust .5s ease-out; transform-box: fill-box; transform-origin: 30% 100%; }
@keyframes gust { 30% { transform: translateX(3px) rotate(2deg); } }

.house.shake .house-body { animation: shake .35s ease-in-out 3; }
@keyframes shake { 25% { transform: rotate(-2deg); } 75% { transform: rotate(2deg); } }
.house.stand .house-body { animation: stand .6s ease-out; }
@keyframes stand { 40% { transform: scale(1.04); } }
.pig { transition: transform .3s; }

.stamp {
  position: absolute; top: 4%; left: 50%; transform: translateX(-50%) rotate(-8deg) scale(.6); opacity: 0;
  margin: 0; padding: 4px 16px; border: 4px solid currentColor; border-radius: 6px; font-size: clamp(1.4rem, 6vw, 2.4rem);
  font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: rgba(251, 251, 255, .92);
  transition: opacity .3s, transform .3s cubic-bezier(.3, 1.6, .5, 1); pointer-events: none;
}
.stamp.show { opacity: 1; transform: translateX(-50%) rotate(-8deg) scale(1); }
.stamp.brick { color: var(--good); }
.stamp.sticks { color: var(--sticks-dark); }
.stamp.straw { color: var(--bad); }

.meter-wrap { margin: 12px 0 4px; }
.meter-labels { display: flex; justify-content: space-between; font-weight: 700; font-size: .85rem; color: var(--ink-soft); }
.meter {
  position: relative; height: 26px; border: 3px solid var(--ink); border-radius: 999px; overflow: hidden;
  /* zone edges in quality terms; set from the scorer's thresholds by applyThresholds() in app.js */
  --straw-end: 40%; --brick-start: 60%;
  background: linear-gradient(90deg, #f4c0b3 0 var(--straw-end), #f6e2b0 var(--straw-end) var(--brick-start), #cfe8c4 var(--brick-start));
}
.meter-fill {
  /* grows left to right: straw (red) -> sticks -> brick (green) */
  height: 100%; width: 0; background: linear-gradient(90deg, var(--bad), #d9a43a 50%, var(--good)); background-position: left center;
  transition: width 1.6s cubic-bezier(.2, .8, .2, 1);
}
.tick { position: absolute; top: 0; bottom: 0; width: 3px; background: var(--ink); opacity: .5; }
.meter-number { margin: 6px 0 0; text-align: center; }
.meter-number strong { font-family: var(--display); font-size: 1.4rem; }

.verdict-line { font-family: var(--display); font-size: 1.2rem; text-align: center; margin: 12px 0 4px; }
.sample { text-align: center; font-size: .9rem; color: var(--ink-soft); margin: 0 0 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 12px 0 20px; }

.section-title { font-size: 1.3rem; margin: 8px 0 12px; }
.themes { display: grid; gap: 12px; }
.theme-card { border: 3px solid var(--ink); border-radius: 8px; padding: 12px 14px; background: #fff; }
.theme-card header { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.theme-card h4 { margin: 0; font-family: var(--display); font-size: 1.15rem; }
.tone { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 999px; border: 2px solid currentColor; }
.tone.bad { color: var(--bad); }
.tone.good { color: var(--good); }
.wolf-comment { margin: 6px 0 10px; font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 1.15rem; line-height: 1.35; }
.snippet { margin: 0 0 8px; padding: 8px 12px; border-left: 5px solid var(--heart); background: var(--paper); border-radius: 0 5px 5px 0; font-size: .95rem; }
.snippet footer { font-size: .8rem; color: var(--ink-soft); margin-top: 4px; }
.empty-themes { color: var(--ink-soft); }

.why { margin: 16px 0; border: 3px dashed var(--ink-soft); border-radius: 8px; padding: 8px 12px; background: var(--paper); }
.why summary { cursor: pointer; font-weight: 700; padding: 6px 0; }
.why table { width: 100%; border-collapse: collapse; font-size: .9rem; margin: 8px 0; }
.why th, .why td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--paper-2); }
.why td.num, .why th.num { text-align: right; font-variant-numeric: tabular-nums; }
.why .pos { color: var(--bad); }
.why .neg { color: var(--good); }
.why p { font-size: .9rem; margin: 8px 0; }

.closing { text-align: center; margin-top: 16px; }
.google-link { display: inline-block; margin-top: 4px; font-weight: 700; color: var(--forest); text-underline-offset: 3px; }
.google-link:hover { color: var(--lavender); }
.google-more { text-align: center; margin: 12px 0 0; }

/* ---- My List ---- */
.list-toggle {
  position: fixed; top: 12px; right: 12px; z-index: 20; width: 58px; height: 58px; padding: 0;
  display: grid; place-items: center; border: 3px solid var(--ink); border-radius: 9px;
  background: var(--card); box-shadow: var(--shadow); cursor: pointer; transition: transform .12s, box-shadow .12s;
}
.list-toggle[hidden] { display: none; }
.list-toggle:hover { transform: scale(1.08); box-shadow: var(--shadow-lift); }
.list-toggle:active { transform: scale(.96); box-shadow: var(--shadow-press); }
.list-toggle[aria-expanded="true"] { background: var(--paper-2); }
.list-toggle svg { width: 40px; height: 40px; }
.list-toggle:focus-visible, .icon-btn:focus-visible { outline: 3px solid var(--lavender); outline-offset: 2px; }
.list-count {
  position: absolute; top: -9px; right: -9px; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 999px;
  background: var(--heart); color: #fff; border: 2px solid var(--ink); font: 700 .8rem/22px var(--body); text-align: center;
}
.list-count.bump { animation: bump .4s ease-out; }
@keyframes bump { 40% { transform: scale(1.35); } }

.my-list {
  position: fixed; top: 12px; right: 12px; z-index: 20; width: min(330px, calc(100vw - 24px));
  max-height: calc(100vh - 24px); overflow-y: auto; padding: 14px;
  background: var(--card); border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow);
  /* Closed: parked off the right edge. visibility keeps it out of tab order and screen readers;
     its delay lets the slide-out finish before it disappears. */
  transform: translateX(calc(100% + 24px)); visibility: hidden;
  transition: transform .32s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .32s;
}
.my-list.open { transform: none; visibility: visible; transition: transform .32s cubic-bezier(.2, .8, .2, 1), visibility 0s; }
.my-list-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.my-list-icon { width: 38px; height: 38px; flex: none; }
.my-list-head h2 { flex: 1; margin: 0; font-size: 1.45rem; }
.icon-btn {
  width: 40px; height: 40px; flex: none; border: 2px solid var(--ink); border-radius: 6px; background: #fff;
  color: var(--ink); font-size: 1.5rem; line-height: 1; cursor: pointer;
  transition: transform .12s, box-shadow .12s;
}
.icon-btn:hover { transform: scale(1.1); box-shadow: var(--shadow-lift); }
.list-empty { text-align: center; color: var(--ink-soft); padding: 4px 4px 12px; }
.list-empty p { margin: 4px 0; }
.list-empty strong { color: var(--ink); font-family: var(--display); font-size: 1.1rem; font-weight: 600; }
.list-items { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.list-item {
  display: flex; align-items: center; border: 2px solid var(--ink); border-radius: 6px; background: #fff;
  transition: transform .12s, box-shadow .12s;
}
/* The row lifts when you hover its "open" button; the × lifts on its own. */
.list-item:has(.open:hover) { transform: scale(1.03); box-shadow: var(--shadow-lift); }
.list-item .open {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px 10px; text-align: left;
  font: inherit; color: inherit; background: none; border: 0; border-radius: 5px; cursor: pointer;
}
.list-item .open:hover { background: var(--paper); }
.house-icon { display: inline-flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 700; }
.house-icon img { width: 100%; height: 100%; object-fit: contain; }
.list-item .house-icon { width: 36px; height: 36px; font-size: 1.4rem; flex: none; }
.list-item .info { min-width: 0; }
.list-item strong { display: block; font-family: var(--display); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item small { color: var(--ink-soft); }
.list-item .remove { flex: none; width: 40px; height: 40px; border: 0; background: none; color: var(--ink-soft); font-size: 1.3rem; cursor: pointer; border-radius: 5px; }
.list-item .remove:hover { color: var(--heart); background: var(--paper); }
.list-compare { width: 100%; }
.list-hint { margin: 8px 0 0; text-align: center; font-size: .85rem; color: var(--ink-soft); }
.list-hint:empty { display: none; }
#btn-list[aria-pressed="true"] { background: #f6dde2; }
/* Heart next to "Add to list": outline when not saved, filled pink when saved. */
#btn-list { display: inline-flex; align-items: center; gap: 6px; }
.btn-heart { width: 18px; height: 15px; flex: none; fill: none; stroke: var(--heart); stroke-width: 2; stroke-linejoin: round; transition: fill .2s, transform .2s; }
#btn-list[aria-pressed="true"] .btn-heart { fill: var(--heart); stroke: var(--ink); stroke-width: 1.5; }
#btn-list:hover .btn-heart { transform: scale(1.15); }

/* Keep the fixed toggle button from covering the masthead on narrower screens. */
@media (max-width: 940px) { .page { padding-top: 84px; } }

/* ---- compare ---- */
.compare-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 16px; }
.compare-card { border: 3px solid var(--ink); border-radius: 8px; padding: 12px; background: #fff; text-align: center; font: inherit; color: inherit; width: 100%; }
button.compare-card { cursor: pointer; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
button.compare-card:hover { transform: scale(1.04); box-shadow: var(--shadow-lift); }
.compare-card.survivor { background: #e7f4df; box-shadow: 0 0 0 4px var(--good), var(--shadow); }
button.compare-card.survivor:hover { box-shadow: 0 0 0 4px var(--good), var(--shadow-lift); }
.compare-card .house-icon { width: 64px; height: 64px; font-size: 2.4rem; line-height: 1; }
.compare-card h4 { margin: 6px 0; font-family: var(--display); }
.compare-card .risk { font-family: var(--display); font-size: 1.5rem; }
.compare-card .rent { font-weight: 700; margin: 4px 0; }
.compare-empty { grid-column: 1 / -1; text-align: center; }
.compare-card .crown { font-weight: 700; color: var(--good); }

/* ---- neighborhood map ---- */
.home-ctas { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: -4px 0 20px; } /* sits just below the home panel */
.home-ctas .btn { background: var(--lavender-light); border-color: var(--lavender); border-radius: 999px; padding: 10px 22px; letter-spacing: .02em; }
.home-ctas .btn:hover { background: #b3b6ec; border-color: var(--ink); }
/* z-index 0 keeps Leaflet's internal layers (z 400+) from covering the list button and toast */
.map-canvas {
  position: relative; z-index: 0; height: min(520px, 65vh); border: 3px solid var(--ink); border-radius: 8px;
  overflow: hidden; background: var(--paper-2);
}
.rent-line { text-align: center; font-weight: 700; margin: -4px 0 12px; }
.rent-filter {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 12px; margin: 0 0 12px;
  padding: 10px 12px; border: 2px solid var(--ink); border-radius: 8px; background: var(--paper);
}
.rent-filter-title { font-family: var(--display); font-weight: 600; }
.rent-filter label { display: inline-flex; align-items: center; gap: 4px; }
.rent-filter input[type="number"] {
  width: 6.5em; min-height: 36px; padding: 4px 8px; border: 2px solid var(--ink); border-radius: 5px;
  font: inherit; background: #fff; color: var(--ink);
}
.rent-filter .rent-unknown { font-size: .9rem; color: var(--ink-soft); }
.rent-filter .rent-unknown input { width: 18px; height: 18px; accent-color: var(--lavender); }
.rent-count { flex-basis: 100%; text-align: center; font-size: .9rem; font-weight: 700; color: var(--ink-soft); }
.rent-count:empty { display: none; }
.map-popup .rent { margin: -4px 0 8px; font-weight: 700; }
.map-status { text-align: center; color: var(--ink-soft); margin: 10px 0 0; }
.house-pin { background: none; border: 0; }
.house-pin svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 2px 3px rgba(54, 56, 77, .25)); transition: transform .12s; }
.house-pin:hover svg, .house-pin:focus svg { transform: scale(1.25); }
/* My List heart, tucked on the top-right of the house */
.house-pin .pin-heart { position: absolute; top: 2px; right: 0px; width: 15px; height: 13px; }
.map-popup { font-family: var(--body); text-align: center; min-width: 160px; }
.map-popup strong { display: block; font-family: var(--display); font-size: 1.05rem; font-weight: 600; }
.map-popup .verdict { margin: 4px 0 8px; color: var(--ink-soft); display: flex; align-items: center; justify-content: center; gap: 4px; }
.map-popup .house-icon { width: 24px; height: 24px; }
.leaflet-popup-content-wrapper { border: 2px solid var(--ink); border-radius: 8px; background: var(--card); box-shadow: var(--shadow-lift); }
.leaflet-popup-tip { box-shadow: var(--shadow); }

/* ---- Meet the Wolf (character select) ---- */
.about { text-align: left; }
.select-label {
  margin: 0 0 12px; text-align: center; font-family: var(--display); font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; font-size: .85rem; color: var(--lavender);
}
.char-stage {
  position: relative; height: 380px; border: 3px solid var(--ink); border-radius: 9px; overflow: hidden;
  background: linear-gradient(180deg, #e6e7f7 0%, var(--lavender-light) 100%);
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 14px;
}
/* Spotlight + stage floor */
.spotlight {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 45% 70% at 50% 35%, rgba(255, 255, 255, .7), transparent 70%),
              radial-gradient(ellipse 40% 6% at 50% 96%, rgba(54, 56, 77, .22), transparent 70%);
}
.char-img { position: relative; height: 340px; width: auto; animation: bob 2.8s ease-in-out infinite; }
.char-img.swap { animation: char-in .45s cubic-bezier(.2, .9, .3, 1.3), bob 2.8s ease-in-out .45s infinite; }
@keyframes char-in { from { opacity: 0; transform: scale(.94); } }

.char-card { margin-top: 16px; border: 3px solid var(--ink); border-radius: 9px; padding: 14px 16px; background: var(--card); }
.char-id { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.char-avatar { width: 84px; height: 84px; flex: none; }
.char-title { margin: 0; color: var(--ink-soft); font-size: .92rem; }
.stats { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.stats li { display: grid; grid-template-columns: 9.5em 1fr 2.2em; gap: 10px; align-items: center; font-size: .9rem; font-weight: 700; }
.stats b { text-align: right; font-family: var(--display); }
.bar { height: 12px; border: 2px solid var(--ink); border-radius: 999px; background: var(--paper-2); overflow: hidden; }
.bar i { display: block; height: 100%; width: var(--v); background: linear-gradient(90deg, var(--lavender), var(--ink)); border-radius: 999px; }
.about .bar i { animation: bar-fill .9s cubic-bezier(.2, .8, .2, 1) .2s both; }
@keyframes bar-fill { from { width: 0; } }
.bio p { margin: 0 0 10px; }
.bio .fine-print { font-size: .85rem; color: var(--ink-soft); font-style: italic; }
.signature { margin: 4px 0 0; text-align: right; font-family: var(--script); font-size: 1.5rem; color: var(--ink); transform: rotate(-3deg); }
.signature::before { content: "~ "; color: var(--lavender); }
.signature.small { font-size: 1.05rem; margin: -2px 0 8px; text-align: center; }
/* Typing line: room for two lines so the panel doesn't jump, plus a blinking cursor. */
#home-quote { min-height: 2.6em; display: flex; align-items: center; justify-content: center; }
#home-quote::after { content: ""; display: inline-block; width: 2px; height: 1em; margin-left: 3px; background: var(--ink); animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
#home .wolf-says { font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 1.5rem; line-height: 1.3; }
@media (max-width: 600px) {
  .char-stage { height: 320px; }
  .char-img { height: 280px; }
  .stats li { grid-template-columns: 8em 1fr 2em; }
}

/* ---- footer + toast ---- */
.footer { margin-top: 24px; font-size: .9rem; color: var(--ink-soft); text-align: center; }
.footer strong { color: var(--ink); }
.credits { font-size: .8rem; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 10px 16px; border-radius: 8px;
  background: var(--ink); color: var(--paper); font-weight: 700; z-index: 10; max-width: calc(100% - 32px);
}

@media (max-width: 480px) {
  body { font-size: 17px; }
  .search-box { flex-direction: column; }
  .wolf-slot { width: 120px; height: 150px; }
  .wolf-slot.portrait { width: 260px; height: 190px; }
  .wolf-slot.portrait .wolf { height: 430px; }
}

/* ---- motion: idle life, entrances, reactions ----
   All of this is switched off by the prefers-reduced-motion rule below. */

/* Idle bob: the wolf breathes, the pigs bounce (each pig offset by its --d). */
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes pig-bob { 0%, 100% { transform: translateY(0) scale(1, 1); } 45% { transform: translateY(-3px) scale(.98, 1.03); } 90% { transform: translateY(0) scale(1.04, .96); } }
.wolf-slot:not(.inhaling) .wolf { animation: bob 2.8s ease-in-out infinite; }
.scene-wolf .pose-idle { animation: bob 2.8s ease-in-out infinite; transform-box: fill-box; }
.pig use { animation: pig-bob 1.8s ease-in-out infinite; animation-delay: var(--d, 0s); transform-box: fill-box; transform-origin: 50% 100%; }

/* Pigs react to the wolf: shiver while he inhales, flinch when he blows, hop when you point at them. */
@keyframes shiver { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-1.5px); } 75% { transform: translateX(1.5px); } }
@keyframes flinch { 20% { transform: translateX(6px) rotate(10deg); } 60% { transform: translateX(2px) rotate(4deg); } }
@keyframes hop { 40% { transform: translateY(-14px) scale(.95, 1.08); } 70% { transform: translateY(0) scale(1.08, .92); } }
.scene.inhaling-scene .pig use { animation: shiver .14s linear infinite; }
.scene.blowing .pig use { animation: flinch .7s ease-out; }
.pig { cursor: pointer; }
.pig:hover use { animation: hop .5s ease-out; }

/* Home wolf: leans in when you hover, huffs when you click him. */
.wolf-slot.portrait .wolf { transition: transform .25s ease-out; transform-origin: 50% 100%; }
.wolf-slot.portrait.huff .wolf { animation: huff .6s ease-out; }
@keyframes huff { 20% { transform: translateX(4px) scale(1.04); } 50% { transform: translateX(-2px); } }
/* ...and the quick-pick buttons get blown about. */
@keyframes gusted { 30% { transform: translateX(6px) rotate(3deg); } 65% { transform: translateX(-2px) rotate(-1deg); } }
.quick-picks.gusted .btn { animation: gusted .55s ease-out; }
.quick-picks.gusted .btn:nth-child(2) { animation-delay: .05s; }
.quick-picks.gusted .btn:nth-child(3) { animation-delay: .1s; }
.quick-picks.gusted .btn:nth-child(4) { animation-delay: .15s; }

/* Entrances: the masthead settles in on load; each view rises in when shown, with its cards staggered. */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.masthead > * { animation: rise .5s ease-out both; }
.masthead > :nth-child(2) { animation-delay: .08s; }
.masthead > :nth-child(3) { animation-delay: .16s; }
.enter { animation: rise .35s ease-out both; }
.enter .candidate, .enter .compare-card, .enter .quick-picks .btn { animation: rise .4s ease-out both; }
.enter :is(.candidate, .compare-card, .quick-picks .btn):nth-child(2) { animation-delay: .06s; }
.enter :is(.candidate, .compare-card, .quick-picks .btn):nth-child(3) { animation-delay: .12s; }
.enter :is(.candidate, .compare-card, .quick-picks .btn):nth-child(4) { animation-delay: .18s; }
.enter :is(.candidate, .compare-card, .quick-picks .btn):nth-child(n+5) { animation-delay: .24s; }

/* Add to list: the button pops. Map pins drop in. */
@keyframes pop { 40% { transform: scale(1.12); } 70% { transform: scale(.97); } }
#btn-list.pop { animation: pop .4s ease-out; }
@keyframes pin-drop { from { transform: translateY(-24px); opacity: 0; } 60% { transform: translateY(2px); opacity: 1; } }
.house-pin svg { animation: pin-drop .45s ease-out backwards; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
