/* ---------------------------------------------------------------
   Roomance — campus housing & roommates
   Big type, fat corners, warm color. Nothing sterile.
----------------------------------------------------------------*/

:root {
  --cream: #fff7f2;
  --paper: #ffffff;
  --ink: #241536;
  --ink-soft: #6b5b7d;

  --rose: #ff3d71;
  --rose-dark: #e02458;
  --rose-tint: #ffe8ef;

  --grape: #7c5cff;
  --grape-tint: #efeaff;

  --mint: #00c39a;
  --mint-tint: #dcfaf1;

  --butter: #ffc93c;
  --butter-tint: #fff2cf;

  --line: #f0e6ee;

  --r-sm: 14px;
  --r-md: 22px;
  --r-lg: 32px;
  --r-xl: 44px;
  --pill: 999px;

  --shadow: 0 18px 40px -18px rgba(70, 20, 60, 0.28);
  --shadow-sm: 0 8px 20px -12px rgba(70, 20, 60, 0.25);

  --display: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Type ---------- */

h1, h2, h3, .logo, .display {
  font-family: var(--display);
  letter-spacing: -0.03em;
  line-height: 1.04;
  margin: 0;
}

h1 {
  font-size: clamp(2.4rem, 6.5vw, 4.1rem);
  font-weight: 800;
}

h2 {
  font-size: clamp(1.7rem, 3.6vw, 2.5rem);
  font-weight: 800;
}

h3 {
  font-size: 1.35rem;
  font-weight: 700;
}

p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

.lede {
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  color: var(--ink-soft);
  font-weight: 500;
  max-width: 34ch;
}

.muted { color: var(--ink-soft); font-size: 0.95rem; }
.tiny { font-size: 0.85rem; color: var(--ink-soft); }

.hl-rose  { color: var(--rose); }
.hl-grape { color: var(--grape); }
.hl-mint  { color: var(--mint); }

/* Highlighter swipe behind a word */
.swipe {
  background: linear-gradient(180deg, transparent 58%, var(--butter) 58%);
  padding: 0 0.1em;
}

/* ---------- Layout ---------- */

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 22px;
}

.wrap-narrow {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 22px;
}

.section { padding: 72px 0; }
.section-tight { padding: 40px 0; }

/* ---------- Nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 247, 242, 0.86);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0; /* keep "Roomance" as one unbroken word */
  white-space: nowrap;
}

.logo .logo-mark { margin-right: 9px; }
.logo span { color: var(--rose); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-links a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 9px 15px;
  border-radius: var(--pill);
}

.nav-links a:hover { background: var(--rose-tint); }

/* The primary action on every signed-in page, so it gets to look like one:
   the brand gradient, a shadow tinted to match rather than generic grey, and
   a lift on hover. */
.cta,
.nav-links a.cta {
  background: linear-gradient(135deg, var(--rose) 0%, #ff5c8a 45%, var(--grape) 100%);
  color: #fff;
  /* .nav-new sits outside .nav-links now, so it no longer inherits that
     block's link reset and was rendering underlined. */
  text-decoration: none;
  border-radius: var(--pill);
  white-space: nowrap;
  font-weight: 800;
  letter-spacing: -0.01em;
  padding: 10px 20px;
  box-shadow: 0 6px 16px -6px rgba(255, 61, 113, 0.7);
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.cta:hover,
.nav-links a.cta:hover {
  background: linear-gradient(135deg, var(--rose) 0%, #ff5c8a 45%, var(--grape) 100%);
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px -8px rgba(255, 61, 113, 0.85);
}

.cta:active,
.nav-links a.cta:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px -6px rgba(255, 61, 113, 0.7);
}

/* The "+" carries the meaning; give it room and a little weight. */
.nav-new .plus {
  display: inline-block;
  margin-right: 7px;
  font-weight: 700;
  font-size: 1.05em;
  line-height: 1;
  vertical-align: -1px;
}

@media (prefers-reduced-motion: reduce) {
  .cta, .nav-links a.cta { transition: none; }
  .cta:hover, .nav-links a.cta:hover { transform: none; }
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: 84px 0 96px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.18fr 0.82fr;
  gap: 48px;
  align-items: center;
}

/* Slightly tighter than the global h1 so "Then find your place." holds one line */
.hero h1 {
  font-size: clamp(2.3rem, 5vw, 3.5rem);
  margin-bottom: 20px;
}

.hero .lede { margin-bottom: 30px; }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

/* floating blobs */
.blob {
  position: absolute;
  z-index: 0;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.5;
  pointer-events: none;
}

/* Without this the blobs paint over the headline: they come later in source
   order, and an un-positioned .wrap has no stacking context to sit above. */
.hero .wrap {
  position: relative;
  z-index: 1;
}

.blob-1 { width: 260px; height: 260px; background: var(--grape-tint); top: -70px; right: -60px; }
.blob-2 { width: 180px; height: 180px; background: var(--mint-tint); bottom: -50px; left: -50px; }
.blob-3 { width: 130px; height: 130px; background: var(--butter-tint); top: 40%; right: 42%; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  padding: 15px 28px;
  border-radius: var(--pill);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
  background: var(--rose);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn:hover { background: var(--rose-dark); transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 2px solid var(--line);
  box-shadow: none;
}

.btn-ghost:hover { background: var(--paper); border-color: var(--rose); color: var(--rose); }

.btn-ink { background: var(--ink); }
.btn-ink:hover { background: #3a2352; }

.btn-block { width: 100%; }

.btn-lg { font-size: 1.15rem; padding: 18px 34px; }

.btn-sm {
  font-size: 0.92rem;
  padding: 11px 16px;
  white-space: nowrap;
}

/* ---------- Cards ---------- */

.card {
  background: var(--paper);
  border-radius: var(--r-lg);
  padding: 34px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.card-flat {
  background: var(--paper);
  border-radius: var(--r-lg);
  padding: 30px;
  border: 1px solid var(--line);
  box-shadow: none;
}

/* min(280px, 100%) rather than a bare 280px: a fixed track floor cannot
   shrink below itself, so on a container narrower than the floor the grid
   overflows the page instead of collapsing to one column. */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 22px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--display);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 7px 15px;
  border-radius: var(--pill);
  margin-bottom: 16px;
  background: var(--rose-tint);
  color: var(--rose-dark);
}

/* Emoji glyphs have almost no right side-bearing, so a plain space reads as
   none at all. Any emoji sitting before a label gets this. */
.ico {
  margin-right: 0.45em;
  font-style: normal;
}

.eyebrow.grape { background: var(--grape-tint); color: var(--grape); }
.eyebrow.mint  { background: var(--mint-tint);  color: #068a6d; }
.eyebrow.butter{ background: var(--butter-tint); color: #a3760a; }

/* ---------- Scattered lifestyle pills (hero art) ---------- */

.pill-cloud {
  position: relative;
  min-height: 330px;
}

.pill-cloud .pill {
  position: absolute;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1rem;
  padding: 12px 22px;
  border-radius: var(--pill);
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.pill-cloud .pill:nth-child(1) { background: var(--rose-tint);  color: var(--rose-dark); top: 4%;  left: 4%;  transform: rotate(-7deg); }
.pill-cloud .pill:nth-child(2) { background: var(--grape-tint); color: var(--grape);     top: 20%; right: 2%; transform: rotate(6deg); }
.pill-cloud .pill:nth-child(3) { background: var(--mint-tint);  color: #068a6d;          top: 38%; left: 12%; transform: rotate(3deg); }
.pill-cloud .pill:nth-child(4) { background: var(--butter-tint);color: #a3760a;          top: 55%; right: 8%; transform: rotate(-5deg); }
.pill-cloud .pill:nth-child(5) { background: var(--paper);      color: var(--ink);       top: 72%; left: 6%;  transform: rotate(4deg); }
.pill-cloud .pill:nth-child(6) { background: var(--rose);       color: #fff;             top: 88%; right: 18%;transform: rotate(-3deg); }

/* ---------- Forms ---------- */

.field { margin-bottom: 20px; }

label {
  display: block;
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.field .hint {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 6px 0 0;
}

input, select, textarea {
  width: 100%;
  font-family: var(--body);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--ink);
  padding: 16px 18px;
  border: 2px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input::placeholder, textarea::placeholder { color: #b8a9c6; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--rose);
  box-shadow: 0 0 0 4px var(--rose-tint);
}

textarea { resize: vertical; min-height: 120px; line-height: 1.5; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* Big centered code input */
.code-input {
  font-family: var(--display);
  font-size: 2.4rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  padding: 20px 12px;
}

/* ---------- Messages ---------- */

.msg {
  margin-top: 16px;
  font-size: 0.98rem;
  font-weight: 600;
  padding: 14px 18px;
  border-radius: var(--r-md);
  display: none;
}

.msg.show { display: block; }
.msg.error   { background: var(--rose-tint); color: var(--rose-dark); }
.msg.success { background: var(--mint-tint);  color: #068a6d; }
.msg.info    { background: var(--grape-tint); color: var(--grape); }

/* ---------- Stepper ---------- */

.stepper { margin-bottom: 32px; }

.stepper-bars {
  display: flex;
  gap: 7px;
  margin-bottom: 14px;
}

.stepper-bars i {
  flex: 1;
  height: 7px;
  border-radius: var(--pill);
  background: var(--line);
}

.stepper-bars i.done   { background: var(--mint); }
.stepper-bars i.active { background: var(--rose); }

.stepper-label {
  font-family: var(--display);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ---------- School match card ---------- */

.school-match {
  display: none;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-radius: var(--r-md);
  margin-top: 14px;
  background: var(--mint-tint);
  border: 2px solid rgba(0, 195, 154, 0.3);
}

.school-match.show { display: flex; }
.school-match.miss { background: var(--rose-tint); border-color: rgba(255, 61, 113, 0.3); }

.school-match .emoji { font-size: 1.9rem; line-height: 1; }
.school-match .name { font-family: var(--display); font-weight: 800; font-size: 1.1rem; }
.school-match .sub  { font-size: 0.86rem; color: var(--ink-soft); }

/* ---------- Typeahead ---------- */

.typeahead { position: relative; }

.typeahead-results {
  margin-top: 10px;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 2px solid var(--line);
  background: var(--paper);
  max-height: 260px;
  overflow-y: auto;
}

.typeahead-results:empty { display: none; }

.typeahead-results div {
  padding: 14px 18px;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
}

.typeahead-results div:last-child { border-bottom: none; }
.typeahead-results div.hit:hover { background: var(--rose-tint); cursor: default; }
.typeahead-results div.empty { color: var(--ink-soft); font-weight: 500; }

/* ---------- Tabs ---------- */

.tabs {
  display: inline-flex;
  gap: 6px;
  padding: 6px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--pill);
  margin-bottom: 28px;
}

.tabs a {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.98rem;
  padding: 11px 22px;
  border-radius: var(--pill);
  text-decoration: none;
  color: var(--ink-soft);
  white-space: nowrap;
}

.tabs a.active { background: var(--ink); color: #fff; }
.tabs a:not(.active):hover { background: var(--rose-tint); color: var(--rose-dark); }

/* ---------- Post cards ---------- */

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 20px;
}

.post {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 26px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.post:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.post-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.15rem;
  color: #fff;
  background: var(--grape);
  flex-shrink: 0;
}

.post-who { font-family: var(--display); font-weight: 800; font-size: 1.05rem; }

.post-price {
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 800;
  margin: 4px 0 10px;
}

.post-price small { font-size: 0.85rem; font-weight: 600; color: var(--ink-soft); }

.post-bio { font-size: 0.98rem; margin-bottom: 14px; }

.tags { display: flex; flex-wrap: wrap; gap: 7px; }

.tags span {
  font-family: var(--display);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 13px;
  border-radius: var(--pill);
  background: var(--grape-tint);
  color: var(--grape);
}

.tags span:nth-child(3n+2) { background: var(--mint-tint);   color: #068a6d; }
.tags span:nth-child(3n+3) { background: var(--butter-tint); color: #a3760a; }

/* ---------- Empty state ---------- */

.empty {
  text-align: center;
  padding: 64px 28px;
  background: var(--paper);
  border: 2px dashed var(--line);
  border-radius: var(--r-lg);
}

.empty .emoji { font-size: 3.2rem; display: block; margin-bottom: 14px; }

/* ---------- Choice cards (post type picker) ---------- */

.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 26px;
}

.choice {
  text-align: left;
  padding: 24px;
  border-radius: var(--r-lg);
  border: 3px solid var(--line);
  background: var(--paper);
  cursor: pointer;
  font-family: var(--body);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.choice:hover { transform: translateY(-2px); border-color: var(--rose); }
.choice.selected { border-color: var(--rose); background: var(--rose-tint); }

.choice .emoji { font-size: 2rem; display: block; margin-bottom: 10px; }
.choice .t { font-family: var(--display); font-weight: 800; font-size: 1.15rem; margin-bottom: 4px; }
.choice .d { font-size: 0.88rem; color: var(--ink-soft); line-height: 1.4; }

/* ---------- Chip multi-select ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 9px; }

.chip {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.92rem;
  padding: 11px 19px;
  border-radius: var(--pill);
  border: 2px solid var(--line);
  background: var(--paper);
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.14s ease;
}

.chip:hover { border-color: var(--rose); color: var(--rose); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- Avatars ---------- */

.avatar img,
.avatar-lg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.avatar-lg {
  width: 116px;
  height: 116px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: 2.6rem;
  color: #fff;
  background: var(--grape);
  flex-shrink: 0;
  overflow: hidden;
}

.avatar { overflow: hidden; }

.profile-head {
  display: flex;
  gap: 26px;
  align-items: center;
  flex-wrap: wrap;
}

.avatar-edit {
  position: relative;
  display: inline-block;
}

.avatar-edit .change {
  position: absolute;
  right: -2px;
  bottom: -2px;
  background: var(--ink);
  color: #fff;
  border: 3px solid var(--cream);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 1rem;
  margin: 0;
  padding: 0;
}

.avatar-edit .change:hover { background: var(--rose); }

/* ---------- Modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(36, 21, 54, 0.55);
  backdrop-filter: blur(3px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.show { display: flex; }

.modal {
  background: var(--paper);
  border-radius: var(--r-lg);
  padding: 34px;
  max-width: 540px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 30px 70px -20px rgba(36, 21, 54, 0.5);
}

.modal h2 { margin-bottom: 10px; }

/* ---------- Chat ---------- */

.chat-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  align-items: start;
}

.convo-list {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  max-height: 70vh;
  overflow-y: auto;
}

.convo {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
  width: 100%;
  text-align: left;
  font-family: var(--body);
  margin: 0;
}

.convo:last-child { border-bottom: none; }
.convo:hover { background: var(--rose-tint); }
.convo.active { background: var(--rose-tint); }

.convo .who { font-family: var(--display); font-weight: 800; font-size: 1rem; }
.convo .preview {
  font-size: 0.86rem;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 190px;
}

.thread {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  height: 70vh;
}

.thread-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.thread-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bubble {
  max-width: 74%;
  padding: 12px 17px;
  border-radius: 20px;
  font-size: 0.98rem;
  line-height: 1.45;
  word-wrap: break-word;
}

.bubble.them {
  background: #f4f0f7;
  color: var(--ink);
  border-bottom-left-radius: 6px;
  align-self: flex-start;
}

.bubble.me {
  background: var(--rose);
  color: #fff;
  border-bottom-right-radius: 6px;
  align-self: flex-end;
}

.bubble-time {
  font-size: 0.72rem;
  opacity: 0.75;
  margin-top: 4px;
  display: block;
}

.thread-foot {
  display: flex;
  gap: 10px;
  padding: 16px 18px;
  border-top: 1px solid var(--line);
}

.thread-foot input { border-radius: var(--pill); }
.thread-foot .btn { margin-top: 0; flex-shrink: 0; }

.thread-empty {
  flex: 1;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--ink-soft);
  padding: 30px;
}

/* ---------- Area chips ---------- */

.area-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.area-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.88rem;
  padding: 8px 8px 8px 15px;
  border-radius: var(--pill);
  background: var(--grape-tint);
  color: var(--grape);
}

.area-chip button {
  background: rgba(124, 92, 255, 0.18);
  color: var(--grape);
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.area-chip button:hover { background: var(--grape); color: #fff; }

/* Autocomplete dropdown sits under its input */
.geo-field { position: relative; }

.geo-field .typeahead-results {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  box-shadow: var(--shadow);
}

/* ---------- Rating badges ---------- */

.rating-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.82rem;
  padding: 4px 11px;
  border-radius: var(--pill);
  background: var(--butter-tint);
  color: #8a6300;
  white-space: nowrap;
}

.rating-badge.none {
  background: #f2f0f4;
  color: var(--ink-soft);
  font-weight: 700;
}

.rating-badge .count { font-weight: 600; opacity: 0.8; }

/* ---------- Place score (higher is better) ---------- */

.score-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.85rem;
  padding: 6px 14px;
  border-radius: var(--pill);
  white-space: nowrap;
}

.score-badge .score { opacity: 0.72; font-weight: 700; }

.score-badge.great   { background: var(--mint-tint);   color: #06795f; }
.score-badge.good    { background: var(--mint-tint);   color: #06795f; }
.score-badge.mixed   { background: var(--butter-tint); color: #8a6300; }
.score-badge.poor    { background: var(--rose-tint);   color: var(--rose-dark); }
.score-badge.unknown { background: #f2f0f4;            color: var(--ink-soft); }

.distance-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.82rem;
  padding: 5px 12px;
  border-radius: var(--pill);
  background: var(--grape-tint);
  color: var(--grape);
  white-space: nowrap;
}

/* Meter runs bad -> good now that higher is better. */
.score-meter {
  height: 10px;
  border-radius: var(--pill);
  background: linear-gradient(90deg, var(--rose) 0%, var(--butter) 50%, var(--mint) 100%);
  position: relative;
  margin: 18px 0 8px;
}

.score-meter .pin {
  position: absolute;
  top: -5px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--paper);
  border: 4px solid var(--ink);
  transform: translateX(-50%);
}

/* ---------- Listing card hero ---------- */

.post.has-hero { padding: 0; overflow: hidden; }

.post-hero {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: #efe9f2;
  overflow: hidden;
}

.post-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.post:hover .post-hero img { transform: scale(1.04); }

.post-hero .hero-empty {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 2.2rem;
  color: var(--ink-soft);
}

/* Score sits on the image so it reads before anything else. */
.post-hero .hero-score {
  position: absolute;
  top: 12px;
  left: 12px;
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow-sm);
}

.post-hero .hero-price {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(36, 21, 54, 0.86);
  color: #fff;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.05rem;
  padding: 7px 14px;
  border-radius: var(--pill);
  backdrop-filter: blur(6px);
}

.post-hero .hero-price small { font-weight: 600; opacity: 0.75; font-size: 0.75rem; }

.post-body { padding: 20px 22px 22px; }

/* The address is the headline, not the host's name. */
.post-address {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 8px;
}

/* Avatar + "Hosted by X" + rating badge + presence chip is more than fits on
   one line on a phone, so the row wraps rather than pushing the card wide. */
.post-byline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-bottom: 12px;
}

.post-byline .avatar {
  width: 22px;
  height: 22px;
  font-size: 0.7rem;
}

.risk-panel {
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 26px;
  margin-top: 22px;
}

.risk-panel .risk-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.risk-meter {
  height: 10px;
  border-radius: var(--pill);
  background: linear-gradient(90deg, var(--mint) 0%, var(--butter) 50%, var(--rose) 100%);
  position: relative;
  margin: 18px 0 8px;
}

.risk-meter .pin {
  position: absolute;
  top: -5px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--paper);
  border: 4px solid var(--ink);
  transform: translateX(-50%);
}

.risk-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--ink-soft);
  font-weight: 600;
  margin-bottom: 18px;
}

.risk-rows { display: flex; flex-direction: column; gap: 10px; }

.risk-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--cream);
}

.risk-row .rl { font-weight: 700; font-size: 0.93rem; }
.risk-row .rd { font-size: 0.8rem; color: var(--ink-soft); }

.risk-impact {
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.86rem;
  padding: 3px 10px;
  border-radius: var(--pill);
  white-space: nowrap;
}

/* Positive impact raises the score, so it reads green. */
.risk-impact.good { background: var(--mint-tint); color: #06795f; }
.risk-impact.bad  { background: var(--rose-tint); color: var(--rose-dark); }

/* ---------- Star picker ---------- */

.stars { display: inline-flex; gap: 3px; }

.stars button {
  background: none;
  border: none;
  font-size: 1.7rem;
  line-height: 1;
  padding: 2px;
  margin: 0;
  cursor: pointer;
  filter: grayscale(1) opacity(0.35);
  transition: filter 0.12s ease, transform 0.12s ease;
}

.stars button:hover { transform: scale(1.15); }
.stars button.on { filter: none; }

.star-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.star-row:last-child { border-bottom: none; }
.star-row .sr-label { font-weight: 700; font-size: 0.95rem; }

.review-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.review-item:last-child { border-bottom: none; }

.review-item .rv-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.review-item .rv-who {
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.self-signal {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-radius: var(--r-md);
  background: var(--mint-tint);
  margin-top: 16px;
}

.self-signal .emoji { font-size: 1.7rem; }

/* ---------- Street View ---------- */

.streetview {
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #f4f0f7;
  margin-bottom: 22px;
  position: relative;
  min-height: 200px;
}

.streetview img { width: 100%; display: block; }

.streetview .sv-fallback {
  padding: 54px 24px;
  text-align: center;
  color: var(--ink-soft);
}

.streetview .sv-fallback .emoji { font-size: 2.6rem; display: block; margin-bottom: 10px; }

.sv-caption {
  font-size: 0.8rem;
  color: var(--ink-soft);
  padding: 10px 16px;
  background: var(--paper);
  border-top: 1px solid var(--line);
}

/* ---------- Footer ---------- */

.footer {
  padding: 44px 0;
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

/* ---------- Auth page shell ---------- */

.auth-page { padding: 52px 0 90px; }
.auth-page h1 { margin-bottom: 12px; }
.auth-page .lede { margin-bottom: 30px; max-width: none; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 18px;
}

.back-link:hover { color: var(--rose); }

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

.form-foot a { color: var(--rose); font-weight: 700; text-decoration: none; }
.form-foot a:hover { text-decoration: underline; }

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 34px; }
  .pill-cloud { min-height: 260px; }
  .hero { padding: 52px 0 64px; }
  .section { padding: 52px 0; }
}

@media (max-width: 860px) {
  .chat-layout { grid-template-columns: 1fr; }
  .convo-list { max-height: 300px; }
  .thread { height: 60vh; }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .modal { padding: 24px; }
  .profile-head { gap: 18px; }
  .bubble { max-width: 84%; }
  .card { padding: 24px; border-radius: var(--r-md); }
  .choice-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .nav-links a { padding: 8px 12px; font-size: 0.9rem; }
  .code-input { font-size: 1.9rem; letter-spacing: 0.3em; text-indent: 0.3em; }
  /* Two tabs fit and should fill the width; four (the admin panel) do not.
     flex-grow with no shrink lets both happen — fill when there's room,
     scroll sideways when there isn't, rather than squashing labels to
     unreadable or blowing out the page width. */
  .tabs {
    display: flex;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a {
    flex: 1 0 auto;
    text-align: center;
    white-space: nowrap;
    padding: 11px 14px;
    font-size: 0.9rem;
  }
}

/* ---- Moderation: report & block affordances ---- */

.card-mod {
  display: flex;
  gap: 14px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.card-mod button {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-soft);
  padding: 2px 0;
  border-radius: 6px;
  transition: color 0.15s;
}

.card-mod button:hover { color: var(--rose-dark); }

/* Sits inside a chat bubble, revealed on hover so it isn't visual noise. */
.bubble { position: relative; }

.bubble-report {
  position: absolute;
  top: 50%;
  right: -30px;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  opacity: 0;
  transition: opacity 0.15s;
  padding: 4px;
  line-height: 1;
}

.bubble:hover .bubble-report,
.bubble-report:focus-visible { opacity: 0.75; }
.bubble-report:hover { opacity: 1; }

.thread-menu { position: relative; flex-shrink: 0; }

.thread-menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--ink-soft);
  padding: 4px 10px;
  border-radius: var(--pill);
}

.thread-menu-btn:hover { background: var(--rose-tint); color: var(--rose-dark); }

.thread-menu-list {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  min-width: 190px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 12px 34px rgba(30, 20, 40, 0.14);
  overflow: hidden;
}

.thread-menu-list.open { display: block; }

.thread-menu-list button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 12px 16px;
  color: var(--ink);
}

.thread-menu-list button:hover { background: var(--rose-tint); color: var(--rose-dark); }

.blocked-banner {
  display: none;
  padding: 18px 22px;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
  color: var(--ink-soft);
  text-align: center;
}

.blocked-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.blocked-row:last-child { border-bottom: none; }

/* ---- Avatar cropper ---- */

.cropper {
  position: relative;
  width: 320px;
  max-width: 100%;
  margin: 0 auto;
  border-radius: 20px;
  overflow: hidden;
  background: #efecf2;
}

.cropper canvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: grab;
  touch-action: none;
}

.cropper canvas:active { cursor: grabbing; }

/* Circular guide showing exactly what will be visible as an avatar. */
/* The circular guide showing exactly what survives as an avatar.
 *
 * `closest-side` matters: a bare `radial-gradient(circle ...)` defaults to
 * farthest-corner, so in a 320px square the radius came out at
 * sqrt(160² + 160²) ≈ 226px and the "50%" stop drew a circle only ~222px
 * across — leaving a 50px dead margin either side that you couldn't crop into.
 * closest-side pins the radius to half the box, so the circle is exactly
 * inscribed and reaches all four edges, which is what actually gets shown
 * once the square image is rendered with border-radius:50%.
 */
.crop-ring {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 20px;
  box-shadow: inset 0 0 0 2000px rgba(255, 255, 255, 0.45);
  -webkit-mask: radial-gradient(circle closest-side at 50% 50%, transparent 99.5%, #000 100%);
  mask: radial-gradient(circle closest-side at 50% 50%, transparent 99.5%, #000 100%);
}

.crop-zoom {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.crop-zoom input { flex: 1; accent-color: var(--rose); }

/* ---- Admin panel ---- */

.admin-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px 22px;
  margin-top: 16px;
}

.admin-card.open { border-color: var(--rose); }

.admin-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.admin-pill {
  display: inline-block;
  padding: 4px 11px;
  border-radius: var(--pill);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: #f2f0f4;
  color: var(--ink-soft);
  margin-right: 6px;
}

.admin-pill.reason { background: var(--butter-tint); color: #8a6300; }
.admin-pill.status.open { background: var(--rose-tint); color: var(--rose-dark); }
.admin-pill.status.actioned { background: var(--mint-tint); color: #06795f; }
.admin-pill.status.dismissed { background: #f2f0f4; color: var(--ink-soft); }

.admin-flag {
  display: inline-block;
  padding: 4px 11px;
  border-radius: var(--pill);
  font-size: 0.72rem;
  font-weight: 800;
  background: var(--rose);
  color: #fff;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: 14px;
  margin-bottom: 12px;
}

.admin-quote {
  font-size: 0.9rem;
  background: var(--paper);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 10px;
  line-height: 1.5;
}

.admin-quote.evidence { border-left: 3px solid var(--line); }

.admin-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.admin-actions a {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--rose-dark);
  text-decoration: none;
}

.admin-actions a:hover { text-decoration: underline; }

@media (max-width: 560px) {
  .bubble-report {
    position: static;
    transform: none;
    opacity: 0.5;
    display: block;
    margin-top: 4px;
  }
}

/* ---- Block dialog ---- */

.block-who {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.block-who .avatar-lg {
  width: 62px;
  height: 62px;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.block-effects {
  list-style: none;
  margin: 0 0 24px;
  padding: 18px 20px;
  background: var(--cream);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.block-effects li {
  display: flex;
  align-items: center;
  font-size: 0.92rem;
  color: var(--ink-soft);
  line-height: 1.4;
}

/* ---- Property facts (ATTOM) ---- */

.property-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 22px 24px;
  margin-top: 22px;
}

.fact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
  gap: 14px 22px;
  margin-top: 16px;
}

.fact {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.fact-label {
  font-size: 0.85rem;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
}

.fact-value {
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.98rem;
  text-align: right;
}

/* A recorded contradiction between the listing and the county. Loud on
   purpose — this is the one thing on the page that is checkable fact. */
.listing-flag {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-top: 22px;
  padding: 18px 20px;
  border-radius: var(--r-md);
  background: var(--rose-tint);
  border: 1.5px solid var(--rose);
}

.listing-flag .emoji { font-size: 1.5rem; line-height: 1; }
.listing-flag strong {
  font-family: var(--display);
  font-size: 1.02rem;
  color: var(--rose-dark);
}
.listing-flag p {
  margin: 4px 0 0;
  font-size: 0.92rem;
  line-height: 1.5;
}

/* ---- "Your posts" ---- */

.mine-row {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px 20px;
  margin-bottom: 14px;
}

/* A closed post stays legible but visibly steps back. */
.mine-row.is-closed { opacity: 0.62; }
.mine-row.is-closed .mine-thumb { filter: grayscale(1); }

.mine-thumb {
  width: 92px;
  height: 68px;
  border-radius: 14px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--grape-tint);
}

.mine-thumb.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
}

.mine-body { flex: 1; min-width: 0; }

.mine-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.mine-title {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.12rem;
  color: var(--ink);
  text-decoration: none;
}

.mine-title:hover { color: var(--rose-dark); }

.mine-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.status-pill {
  padding: 3px 11px;
  border-radius: var(--pill);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.status-pill.active { background: var(--mint-tint); color: #06795f; }
.status-pill.closed,
.status-pill.filled,
.status-pill.expired { background: #f2f0f4; color: var(--ink-soft); }

@media (max-width: 640px) {
  .mine-row { flex-wrap: wrap; }
  .mine-actions { width: 100%; }
  .mine-actions .btn { flex: 1; }
}

/* Live validation feedback on the listing description. */
.hint.warn { color: var(--rose-dark); font-weight: 600; }
.hint.ok { color: #06795f; font-weight: 600; }

/* Destructive admin action — visually distinct from ordinary ghost buttons. */
.btn.danger { color: var(--rose-dark); border-color: var(--rose); }
.btn.danger:hover { background: var(--rose); color: #fff; }

/* ---- Presence ---- */

.last-seen {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--pill);
  background: #f2f0f4;
  color: var(--ink-soft);
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}

.last-seen .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
}

/* Only "active now" earns colour — otherwise every card is a sea of green. */
.last-seen.fresh { background: var(--mint-tint); color: #06795f; }
.last-seen.fresh .dot { background: var(--mint); opacity: 1; }

/* Listing status in the admin table — live reads mint, closed reads muted.
   Reusing the report-status colours here made "active" look like a warning. */
.admin-pill.status.live { background: var(--mint-tint); color: #06795f; }
.admin-pill.status.closed { background: #f2f0f4; color: var(--ink-soft); }

/* ---- Shared dialogs (replacing native alert/confirm) ---- */

.modal.dialog { max-width: 460px; }

.modal.dialog h2 { font-size: 1.6rem; }

.dialog-body { margin-top: 10px; }

.dialog-body p { margin: 0; line-height: 1.55; }

/* Preformatted detail — e.g. the result summary after a rescore. */
.dialog-body dl {
  margin: 16px 0 0;
  padding: 14px 16px;
  background: var(--cream);
  border-radius: 16px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  font-size: 0.9rem;
}

.dialog-body dt { color: var(--ink-soft); }
.dialog-body dd { margin: 0; font-weight: 700; text-align: right; }

.dialog-actions { margin-top: 24px; }
.dialog-actions .btn + .btn { margin-top: 10px; }

/* ---- Campus ticker (landing page) ---- */

.campus-ticker {
  padding-top: 34px;
  /* Generous gap below: the school-check heading needs to read as its own
     section, not as a caption for the scrolling names. */
  padding-bottom: 56px;
  overflow: hidden;
}

/* Scoped to .campus-ticker purely for specificity: the label is the last
   child of its wrap, and the global `p:last-child { margin-bottom: 0 }`
   (0,1,1) outranks a bare `.ticker-label` (0,1,0) and eats the spacing. */
.campus-ticker .ticker-label {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 40px;
}

.ticker-track {
  display: flex;
  width: max-content;
}

.ticker-track + .ticker-track { margin-top: 12px; }

.ticker-row {
  display: flex;
  gap: 12px;
  padding-right: 12px;
  animation: ticker-scroll var(--ticker-duration, 60s) linear infinite;
}

/* The middle row runs the other way, so the block reads as texture rather
   than as one wide thing sliding off the page. */
.ticker-row.reverse { animation-direction: reverse; }

@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}

.ticker-item {
  white-space: nowrap;
  padding: 11px 20px;
  border-radius: var(--pill);
  background: var(--paper);
  border: 1px solid var(--line);
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--ink);
}

/* Motion for its own sake is exactly what this preference is about: keep the
   names, drop the scroll, and let them wrap instead of running off-screen. */
@media (prefers-reduced-motion: reduce) {
  .ticker-track { width: auto; }
  .ticker-row { animation: none; flex-wrap: wrap; justify-content: center; }
  .ticker-row[aria-hidden="true"] { display: none; }
}

/* ---- In-page anchors ---- */

html {
  scroll-behavior: smooth;
  /* The nav is sticky, so an un-padded anchor jump parks the target underneath
     it. The extra ~40px keeps the section's eyebrow tag in frame rather than
     landing flush on the heading. */
  scroll-padding-top: 112px;
}

/* Honour the same preference the ticker does — a forced smooth scroll is a
   vestibular trigger, not a nicety. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ---- Navigation: top bar on desktop, tab bar on phones ---- */

.nav-links a.on { background: var(--rose-tint); color: var(--rose-dark); }

.nav-ico,
.nav-short { display: none; }

.nav-new { margin-left: auto; }

@media (max-width: 760px) {
  /* `backdrop-filter` makes an element the containing block for any
     position:fixed descendant, so with it on .nav the tab bar below anchored
     to the *nav's* bottom edge and sat at the top of the screen. The blur is
     cosmetic; the tab bar being in the right place is not. */
  .app-nav {
    backdrop-filter: none;
    background: var(--cream);
  }

  /* Five text links can't fit across a phone. The links become a fixed bottom
     tab bar — the native pattern, and a far bigger tap target than a
     14px-tall text link squeezed into a header. */
  .nav-inner {
    gap: 12px;
    padding: 12px 16px;
  }

  .nav-new {
    padding: 10px 16px;
    font-size: 0.9rem;
  }

  .app-nav .nav-links {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    display: flex;
    gap: 0;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: rgba(255, 247, 242, 0.94);
    backdrop-filter: saturate(180%) blur(14px);
    border-top: 1px solid var(--line);
  }

  .app-nav .nav-links a,
  .app-nav .nav-links > span > a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 2px;
    border-radius: 14px;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
  }

  .app-nav .nav-ico { display: block; font-size: 1.15rem; line-height: 1; }
  .app-nav .nav-label { display: none; }
  .app-nav .nav-short { display: block; }

  /* The bar is fixed, so signed-in pages need room underneath it. */
  body.has-app-nav { padding-bottom: 76px; }
  .footer { margin-bottom: 8px; }
}

/* The marketing header keeps inline links (no tab bar), so it has to fit on
   its own: the roomier gradient CTA was pushing "Get started" off-screen and
   wrapping "Log in" onto two lines. */
@media (max-width: 700px) {
  .nav-inner { padding: 12px 16px; }
  .nav-links a { white-space: nowrap; padding: 8px 12px; font-size: 0.9rem; }
  .nav-links a.cta { padding: 9px 15px; }
}

/* Very narrow phones: keep the wordmark from crowding the CTA. */
@media (max-width: 420px) {
  .logo { font-size: 1.2rem; }
  .logo .logo-mark { margin-right: 6px; }
  .nav-links { gap: 2px; }
  .nav-links a { padding: 8px 9px; font-size: 0.85rem; }
  .nav-links a.cta { padding: 9px 13px; font-size: 0.85rem; }
  .nav-new { padding: 9px 13px; font-size: 0.85rem; }
}

/* Below ~340px (narrower than any current phone, but cheap to support) the
   header runs out of room, so the CTA drops to just "+ New" / "Join". */
@media (max-width: 340px) {
  .logo { font-size: 1.05rem; }
  .nav-links a { padding: 7px 7px; font-size: 0.8rem; }
  .nav-links a.cta, .nav-new { padding: 8px 11px; font-size: 0.8rem; }
  .nav-new .plus { margin-right: 4px; }
}

/* ---- Mobile refinements ---- */

@media (max-width: 760px) {
  /* Chat: size the thread to the viewport rather than a fixed 60vh, so the
     composer sits just above the tab bar instead of somewhere down the page.
     dvh (not vh) so it tracks the browser chrome collapsing on scroll. */
  .chat-layout { gap: 16px; }
  .convo-list { max-height: 34vh; }
  .thread { height: min(62dvh, 560px); }
  .thread-foot { padding: 14px 16px; }
  .thread-foot input { font-size: 16px; } /* <16px makes iOS zoom on focus */

  /* Emails and addresses in the admin queue are long and unbreakable. */
  .admin-grid { grid-template-columns: 1fr; }
  .admin-card { padding: 18px; border-radius: 18px; }
  .admin-quote { overflow-wrap: anywhere; }
  .admin-actions { gap: 8px; }
  .admin-actions .btn { flex: 1 0 auto; }

  /* The cropper is a fixed 320px canvas; let it shrink on narrow screens. */
  .cropper { width: 100%; max-width: 320px; }

  .dialog-actions .btn { font-size: 1rem; }

  /* "Your posts" rows stack rather than squeezing the thumb + actions. */
  .mine-row { gap: 14px; }
  .mine-thumb { width: 72px; height: 56px; }

  .hero-actions { display: flex; flex-direction: column; gap: 10px; }
  .hero-actions .btn { width: 100%; text-align: center; }
}

@media (max-width: 560px) {
  /* iOS zooms the page when a focused input's text is under 16px. Every text
     input therefore has to clear that bar, not just the chat composer. */
  input, select, textarea { font-size: 16px; }

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

  /* Chips and badges wrap instead of forcing their container wider. */
  .post-head,
  .post-head > div,
  .mine-head,
  .thread-head { flex-wrap: wrap; min-width: 0; }
  .rating-badge,
  .score-badge,
  .distance-chip,
  .last-seen { max-width: 100%; }

  .card-mod { gap: 18px; }
  .card-mod button { padding: 8px 0; }  /* bigger tap target than the text alone */

  /* Paired action buttons must be allowed to shrink past their content. */
  .post .btn,
  .mine-actions .btn,
  .admin-actions .btn { min-width: 0; }
  /* No height override here: .post-hero has aspect-ratio 16/9, and giving it
     a definite height makes the ratio derive the *width* from it (190px tall
     became 338px wide inside a 248px card). Let width lead. */
  .ticker-item { font-size: 0.86rem; padding: 9px 15px; }
  .streetview img { border-radius: 14px; }
}

/* ---- Admin: viewing another community ---- */

.view-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 22px;
  background: var(--ink);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 600;
  text-align: center;
}

.view-banner strong { color: var(--butter); }

.view-banner a {
  color: #fff;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}

.admin-pill.school { background: var(--grape-tint); color: #5b3fd6; }

/* A closed community reads as inactive in the list. */
.admin-card.closed { opacity: 0.72; }

.waitlist-status { margin-top: 24px; }

.waitlist-school {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 14px 20px;
  border-radius: var(--pill);
  background: var(--cream);
  border: 1px solid var(--line);
}

/* ---- Review invite ---- */

.confirm-row {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--cream);
  border: 1px solid var(--line);
  font-size: 0.93rem;
  cursor: pointer;
}

.confirm-row input {
  width: 20px;
  height: 20px;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--rose);
  cursor: pointer;
}

/* The shareable link itself, on the profile page. */
.invite-link {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.invite-link input {
  flex: 1;
  min-width: 0;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.82rem;
}

/* Unread marker in the conversation list. */
.convo.unread .who { font-weight: 900; }
.convo.unread .preview { color: var(--ink); font-weight: 600; }

.unread-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--rose);
  flex-shrink: 0;
  margin-left: auto;
  align-self: center;
}
