/* ── Variables ──────────────────────────────────────────────────────────────── */
:root {
  --green:        #2d6a4f;
  --green-dark:   #1b4332;
  --green-mid:    #40916c;
  --green-light:  #74c69d;
  --green-pale:   #d8f3dc;
  --yellow:       #f4d03f;
  --yellow-dark:  #d4ac0d;
  --orange:       #e8962e;
  --sage:         #b5ccab;
  --cream:        #f5f0e8;
  --white:        #ffffff;
  --gray-50:      #f5f0e8;
  --gray-100:     #f3f4f6;
  --gray-200:     #e5e7eb;
  --gray-400:     #9ca3af;
  --gray-500:     #6b7280;
  --gray-600:     #4b5563;
  --gray-800:     #1f2937;
  --red:          #dc2626;
  --gold:         #f59e0b;
  --amber:        #d97706;
  --color-error-bg:     #fee2e2;
  --color-error-text:   #991b1b;
  --color-error-border: #fca5a5;
  --color-warning-bg:   #fffbeb;
  --amber-pale:         #fef3c7;
  --amber-border:       #fde68a;
  --amber-brown:        #92400e;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.10);
  --shadow:       0 4px 12px rgba(0,0,0,.10);
  --shadow-lg:    0 8px 24px rgba(0,0,0,.12);
  --radius:       10px;
  --radius-sm:    6px;
  --radius-lg:    16px;
  --transition:   .2s ease;
  --font-display:    'Barlow Condensed', system-ui, sans-serif;
  --font-body:       'Outfit', system-ui, sans-serif;
  --ease-out-quart:  cubic-bezier(0.25, 1, 0.5, 1);
  --ease-out-expo:   cubic-bezier(0.16, 1, 0.3, 1);
  /* Real height is measured from the live navbar in main.js; this is just
     the pre-JS/no-JS fallback so the filters-bar still lines up. */
  --navbar-height:   52px;
}

/* ── Keyframes ──────────────────────────────────────────────────────────────── */
@keyframes heroSlideIn {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes flashSlide {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes gentleFloat {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}

/* ── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  color: var(--gray-800);
  background: var(--cream);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--green); text-decoration: none; }
a:hover { color: var(--green-dark); }
img { max-width: 100%; display: block; }
ul { list-style: none; }

/* ── Layout helpers ─────────────────────────────────────────────────────────── */
.container { max-width: 1140px; margin: 0 auto; padding: 0 1.25rem; }
.flex      { display: flex; }
.items-center { align-items: center; }
.gap-1  { gap: .5rem; }
.gap-2  { gap: 1rem; }
.gap-3  { gap: 1.5rem; }
.mt-1   { margin-top: .5rem; }
.mt-2   { margin-top: 1rem; }
.mt-3   { margin-top: 1.5rem; }
.mb-1   { margin-bottom: .5rem; }
.mb-2   { margin-bottom: 1rem; }
.text-center { text-align: center; }
.text-sm  { font-size: .875rem; }
.text-xs  { font-size: .75rem; }
.text-muted { color: var(--gray-600); }
.fw-bold { font-weight: 700; }
main { flex: 1; }
.font-display { font-family: var(--font-display); }

/* ── Logo bar (above navbar) ───────────────────────────────────────────────── */
.logo-bar {
  background: var(--cream);
  text-align: center;
  padding: 1.25rem 1rem .75rem;
}
.logo-bar img {
  height: 70px;
  margin: 0 auto;
}

/* ── Navbar ─────────────────────────────────────────────────────────────────── */
.navbar {
  background: var(--green-dark);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .65rem 1.25rem;
  max-width: 1140px;
  margin: 0 auto;
}
.navbar-brand {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--white) !important;
  letter-spacing: -.5px;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.navbar-brand span { color: var(--yellow); }

/* Navbar directory links (left) */
.navbar-nav-left {
  display: flex;
  align-items: center;
  gap: .15rem;
}
.navbar-nav-left .nav-link {
  color: var(--yellow) !important;
  font-family: var(--font-body);
  font-weight: 600;
  text-transform: uppercase;
  font-size: .8rem;
  letter-spacing: .8px;
  padding: .45rem .85rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  white-space: nowrap;
}
.navbar-nav-left .nav-link:hover,
.navbar-nav-left .nav-link.active {
  background: rgba(255,255,255,.12);
  color: var(--yellow) !important;
}

/* Navbar auth links (right) */
.navbar-nav-right {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.navbar-nav-right .nav-link {
  color: rgba(255,255,255,.85);
  padding: .45rem .85rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  transition: var(--transition);
}
.navbar-nav-right .nav-link:hover {
  background: rgba(255,255,255,.15);
  color: var(--white);
}

/* Legacy .navbar-nav (kept for mobile menu) */
.navbar-nav {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.nav-link {
  color: rgba(255,255,255,.85);
  padding: .45rem .85rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  transition: var(--transition);
}
.nav-link:hover, .nav-link.active {
  background: rgba(255,255,255,.15);
  color: var(--white);
}
.btn-nav-primary {
  background: var(--yellow);
  color: var(--green-dark) !important;
  font-weight: 700;
  padding: .45rem 1rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.btn-nav-primary:hover { background: var(--yellow-dark); }

/* Add Listing dropdown */
.nav-dropdown { position: relative; }
.nav-dropdown-toggle { border: none; cursor: pointer; font-size: .9rem; font-family: inherit; }
.nav-msg-link { position: relative; display: inline-flex; align-items: center; gap: .35rem; }
.msg-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--red); color: var(--white);
  font-size: .65rem; font-weight: 700; line-height: 1;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px;
}
.nav-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
  list-style: none;
  margin: 0;
  padding: .4rem 0;
  min-width: 140px;
  z-index: 200;
}
.nav-dropdown-menu li a {
  display: block;
  padding: .5rem 1rem;
  color: var(--green-dark);
  font-weight: 600;
  font-size: .88rem;
  white-space: nowrap;
  text-decoration: none;
}
.nav-dropdown-menu li a:hover { background: var(--yellow); }
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu { display: block; }

/* ── Messaging ───────────────────────────────────────────────────────────────── */
.msg-thread-list { display: flex; flex-direction: column; gap: .5rem; }
.msg-thread-item {
  display: flex; align-items: center; gap: 1rem;
  padding: .85rem 1rem; border-radius: var(--radius);
  border: 1px solid var(--gray-200); background: var(--white);
  text-decoration: none; color: inherit;
  transition: var(--transition);
}
.msg-thread-item:hover { border-color: var(--green-light); background: var(--green-pale); }
.msg-thread-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--green); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem; flex-shrink: 0;
}
.msg-thread-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.msg-thread-username { font-weight: 700; font-size: .9rem; color: var(--green-dark); }
.msg-thread-preview { font-size: .82rem; color: var(--gray-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-thread-time { flex-shrink: 0; white-space: nowrap; }

.msg-list { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 2rem; }
.msg-bubble-wrap { display: flex; flex-direction: column; align-items: flex-start; max-width: 85%; }
.msg-bubble-wrap.msg-own { align-self: flex-end; align-items: flex-end; }
.msg-meta { display: flex; align-items: baseline; gap: .5rem; margin-bottom: .25rem; flex-wrap: wrap; }
.msg-own .msg-meta { justify-content: flex-end; }
.msg-sender { font-weight: 700; font-size: .8rem; color: var(--green-dark); }
.msg-time { font-size: .73rem; }
.msg-bubble {
  background: var(--gray-100); color: var(--gray-800);
  padding: .6rem .9rem; border-radius: 14px 14px 14px 4px;
  font-size: .88rem; line-height: 1.55; word-break: break-word;
}
.msg-own .msg-bubble { background: var(--green); color: var(--white); border-radius: 14px 14px 4px 14px; }
.msg-deleted { background: var(--gray-100) !important; color: var(--gray-400) !important; font-style: italic; font-size: .82rem; }
.msg-actions { display: flex; gap: .5rem; margin-top: .2rem; }
.msg-action-btn {
  background: none; border: none; cursor: pointer;
  font-size: .75rem; color: var(--gray-400); padding: 0; text-decoration: underline;
}
.msg-action-btn:hover { color: var(--green-dark); }
.msg-action-delete:hover { color: var(--red); }
.msg-edit-form { width: 100%; min-width: 220px; }
.msg-compose { border-top: 1px solid var(--gray-200); padding-top: 1.5rem; }

/* Mobile hamburger & mobile nav — hidden on desktop */
.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: .4rem; }
.mobile-nav { display: none; }

/* ── Navbar compact search ──────────────────────────────────────────────────── */
.nav-search {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin: 0 .5rem;
  flex-shrink: 0;
}
.nav-search-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--white);
  font-size: .85rem;
  padding: .35rem .6rem;
  width: clamp(100px, 12vw, 180px);
}
.nav-search-input::placeholder { color: rgba(255,255,255,.55); }
.nav-search-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,.7);
  cursor: pointer;
  padding: .35rem .5rem;
  display: flex;
  align-items: center;
}
.nav-search-btn:hover { color: var(--white); }

/* ── Navbar collapse (tablet + phone) ───────────────────────────────────────── */
@media (max-width: 1024px) {
  .navbar-nav-left,
  .navbar-nav-right { display: none; }
  .nav-search { display: none; }
  .nav-toggle { display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 44px; min-width: 44px; padding: .5rem; }
  .navbar { position: relative; }
  .mobile-nav { display: none; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0; background: var(--green-dark); padding: 1rem; gap: .25rem; z-index: 100; }
  .mobile-nav.open { display: flex; }
}
.nav-toggle span {
  display: block; width: 22px; height: 2px;
  background: var(--white); margin: 5px 0;
  transition: var(--transition);
}

/* ── Flash messages ─────────────────────────────────────────────────────────── */
.flash {
  padding: .85rem 1.25rem;
  border-radius: var(--radius-sm);
  margin: 1rem 0;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: .5rem;
  animation: flashSlide 0.3s var(--ease-out-quart) both;
}
.flash-success { background: var(--green-pale); color: var(--green-dark); border-left: 4px solid var(--green); }
.flash-error   { background: var(--color-error-bg); color: var(--color-error-text); border-left: 4px solid var(--red); }

/* ── Status text utilities ──────────────────────────────────────────────────── */
.text-error   { color: var(--red); }
.text-warning { color: var(--amber); }
.text-success { color: var(--green-dark); }

/* ── Alert / banner utilities ────────────────────────────────────────────────── */
.alert-warning {
  background: var(--amber-pale);
  border-bottom: 1px solid var(--amber-border);
}
/* Inline alert boxes (inside page content) */
.alert-box {
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: .9rem;
}
.alert-box-error {
  background: var(--color-error-bg);
  border: 1px solid var(--color-error-border);
  color: var(--color-error-text);
}
.alert-box-warning {
  background: #fff8e1;
  border: 1px solid var(--gold);
  color: var(--amber);
}
/* Amber action button (e.g., report-closed form) */
.btn-amber {
  background: #fff0e0;
  border: 1px solid var(--gold);
  color: var(--amber);
}
.btn-amber:hover { background: #fde8c8; }

/* ── Closed badge ────────────────────────────────────────────────────────────── */
.badge-closed {
  display: inline-flex;
  align-items: center;
  font-size: .7rem;
  font-weight: 700;
  background: var(--color-error-bg);
  color: var(--color-error-text);
  border: 1px solid var(--color-error-border);
  border-radius: 4px;
  padding: .2rem .45rem;
  letter-spacing: .03em;
}
.badge-featured {
  display: inline-flex;
  align-items: center;
  font-size: .7rem;
  font-weight: 700;
  background: var(--amber-pale);
  color: var(--amber-brown);
  border: 1px solid var(--amber-border);
  border-radius: 4px;
  padding: .2rem .45rem;
  letter-spacing: .03em;
}
.listing-card-featured {
  border-color: var(--amber-border);
  box-shadow: 0 0 0 1px var(--amber-border);
}

/* ── Featured section ────────────────────────────────────────────────────────── */
.section-featured {
  background: linear-gradient(135deg, #fef9ee 0%, #fff 100%);
  border-top: 1px solid var(--amber-border);
  border-bottom: 1px solid var(--amber-border);
}

/* ── Tournament row ──────────────────────────────────────────────────────────── */
.tournament-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
}
.tournament-row:hover {
  border-color: var(--green-dark);
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
}

/* ── Hero (two-column split) ───────────────────────────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 340px;
}
.hero-left {
  background: var(--orange);
  color: var(--white);
  padding: 3.5rem 3rem 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  animation: heroSlideIn 0.6s var(--ease-out-quart) both;
}
.hero-left h1 {
  font-family: var(--font-display);
  font-size: clamp(3rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.05;
  margin-bottom: 1.5rem;
  letter-spacing: .5px;
}
.hero-badge {
  display: inline-block;
  background: var(--green-dark);
  color: var(--yellow);
  border-radius: 0;
  padding: .55rem 1.2rem;
  font-family: var(--font-body);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  align-self: flex-start;
}
.hero-right {
  background: var(--sage);
  color: var(--green-dark);
  padding: 3.5rem 3rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  animation: heroSlideIn 0.6s var(--ease-out-quart) 0.12s both;
}
.hero-right p {
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 1.75rem;
  color: var(--green-dark);
  font-weight: 500;
}

/* Hero search */
.hero-search {
  display: flex;
  background: var(--white);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow);
  max-width: 440px;
}
.hero-search input {
  flex: 1;
  border: none;
  padding: .75rem 1rem;
  font-size: .95rem;
  outline: none;
  color: var(--gray-800);
}
.hero-search button {
  background: var(--green-dark);
  border: none;
  padding: .75rem 1.2rem;
  font-weight: 700;
  color: var(--white);
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition);
  display: flex;
  align-items: center;
}
.hero-search button:hover { background: var(--green); }

/* ── Section ────────────────────────────────────────────────────────────────── */
.section { padding: 4rem 1.25rem; }
.section-header { text-align: center; margin-bottom: 3rem; }
.section-header h2 { font-family: var(--font-display); font-size: clamp(2rem, 4vw, 2.4rem); font-weight: 700; color: var(--green-dark); letter-spacing: .5px; }
.section-header p  { color: var(--gray-600); margin-top: .5rem; font-size: 1rem; }

/* ── Category cards ─────────────────────────────────────────────────────────── */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  max-width: 960px;
  margin: 0 auto;
}

/* Base card */
.category-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-align: center;
  border: 1.5px solid var(--gray-200);
  transition: var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  animation: fadeSlideUp 0.5s var(--ease-out-quart) both;
}
.category-card:nth-child(1) { animation-delay: 0.05s; }
.category-card:nth-child(2) { animation-delay: 0.15s; }
.category-card:nth-child(3) { animation-delay: 0.22s; }
.category-card:nth-child(4) { animation-delay: 0.29s; }
.category-card:nth-child(5) { animation-delay: 0.36s; }
.category-card:hover {
  border-color: var(--green);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

/* Featured card: first (Coaches) — spans 2 cols, horizontal */
.category-card:first-child {
  grid-column: span 2;
  flex-direction: row;
  text-align: left;
  padding: 1.75rem 2rem;
  gap: 1.5rem;
  align-items: center;
  background: var(--green-pale);
  border-color: var(--green-light);
}
.category-card:first-child:hover {
  background: var(--green-pale);
  border-color: var(--green);
}
.category-card:first-child .category-icon {
  margin: 0;
  width: 88px;
  height: 88px;
}
.category-card:first-child h3 {
  font-size: 2rem;
  margin-bottom: .15rem;
}
.category-card:first-child .category-tagline {
  display: block;
  font-size: .9rem;
  color: var(--green);
  font-weight: 500;
  margin-bottom: .35rem;
}
.category-card:first-child .category-count {
  background: var(--green-light);
  color: var(--green-dark);
  font-weight: 600;
}

/* Icon container */
.category-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius);
  background: var(--green-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.category-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Category text block */
.category-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
}
.category-card:first-child .category-text {
  align-items: flex-start;
}

.category-card h3 { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; color: var(--green-dark); margin-bottom: 0; letter-spacing: .3px; }

/* Tagline (hidden on non-featured cards on desktop) */
.category-tagline {
  display: none;
  font-size: .8rem;
  color: var(--gray-600);
}

.category-count {
  font-size: .78rem;
  color: var(--gray-600);
  background: var(--gray-100);
  padding: .15rem .6rem;
  border-radius: 999px;
  display: inline-block;
  font-weight: 500;
}

/* ── Listing cards ──────────────────────────────────────────────────────────── */
.listings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}
.listing-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform .2s var(--ease-out-quart), box-shadow .2s var(--ease-out-quart), opacity .45s var(--ease-out-quart);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(18px);
  contain: layout style paint;
  /* Stretched link: position context for the h3 a::after overlay */
  position: relative;
  cursor: pointer;
}
.listing-card.revealed {
  opacity: 1;
  transform: translateY(0);
}
.listing-card:hover,
.listing-card.revealed:hover { transform: translateY(-3px); box-shadow: var(--shadow); will-change: transform; }
.listing-card-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: var(--green-pale);
}
.listing-card-img-placeholder {
  width: 100%;
  height: 180px;
  background: var(--green-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}
.listing-card-img-placeholder img {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  object-fit: cover;
}
.listing-card-body { padding: 1.25rem; flex: 1; display: flex; flex-direction: column; }
.listing-type-badge {
  display: inline-flex;
  align-items: center;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: .2rem .65rem;
  border-radius: var(--radius-sm);
  background: var(--yellow);
  color: var(--green-dark);
}
.badge-court     { background: var(--green-pale);   color: var(--green-dark); }
.badge-coach     { background: var(--orange);       color: var(--white);      }
.badge-store     { background: var(--yellow);       color: var(--green-dark); }
.badge-open_play { background: var(--sage);         color: var(--green-dark); }
.badge-club      { background: var(--green-light);  color: var(--green-dark); }

.listing-card h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: .3rem; color: var(--gray-800); }
.listing-card h3 a { transition: color var(--transition); }
.listing-card h3 a:hover { color: var(--green); }
/* Stretched link — makes the whole card clickable */
.listing-card h3 a::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
}
.listing-location { font-size: .85rem; color: var(--gray-600); margin-bottom: .6rem; }
.listing-location svg { vertical-align: middle; margin-right: .2rem; }
.listing-desc { font-size: .875rem; color: var(--gray-600); flex: 1; }
.listing-card-footer {
  padding: .75rem 1.25rem;
  border-top: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--gray-100);
}

/* ── Stars ──────────────────────────────────────────────────────────────────── */
.stars { display: inline-flex; gap: 1px; }
.star  { font-size: 1rem; color: var(--gray-200); }
.star.filled { color: var(--gold); }
.star.half   { color: var(--gold); }
.rating-text { font-size: .8rem; color: var(--gray-600); margin-left: .3rem; }

/* Star input */
.star-input { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 4px; }
.star-input input {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
.star-input input:focus-visible + label {
  outline: 2.5px solid var(--green);
  outline-offset: 2px;
  border-radius: 2px;
}
.star-input label {
  font-size: 2rem;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  transition: color .15s;
}
.star-input label:hover,
.star-input label:hover ~ label,
.star-input input:checked ~ label { color: var(--gold); }
.star-input-sm label { font-size: 1.25rem; }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .6rem 1.3rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
  text-decoration: none;
  letter-spacing: .1px;
}
.btn-primary   { background: var(--green); color: var(--white); }
.btn-primary:hover { background: var(--green-dark); color: var(--white); }
.btn-outline   { background: transparent; border-color: var(--green); color: var(--green); }
.btn-outline:hover { background: var(--green); color: var(--white); }
.btn-yellow    { background: var(--yellow); color: var(--green-dark); }
.btn-yellow:hover { background: var(--yellow-dark); }
.btn-danger    { background: var(--red); color: var(--white); border-color: var(--red); }
.btn-danger:hover { background: var(--color-error-text); }
.btn-ghost     { background: transparent; color: var(--gray-600); border-color: var(--gray-200); }
.btn-ghost:hover { background: var(--gray-100); }
.btn-sm { padding: .4rem .9rem; font-size: .8rem; }
.btn-lg { padding: .85rem 1.8rem; font-size: 1rem; }
.btn:active { transform: scale(0.96); }

/* ── Forms ──────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: .4rem; color: var(--gray-800); letter-spacing: .1px; }
.form-label .required { color: var(--red); }
.form-control {
  width: 100%;
  padding: .65rem .9rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  color: var(--gray-800);
  background: var(--white);
  transition: border-color var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(45,106,79,.12); }
.form-control.is-invalid { border-color: var(--red); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(220,38,38,.12); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }
.form-hint { font-size: .78rem; color: var(--gray-600); margin-top: .3rem; }
.field-error { font-size: .78rem; color: var(--red); margin-top: .3rem; display: block; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ── Auth pages ─────────────────────────────────────────────────────────────── */
.auth-wrapper {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  background: linear-gradient(160deg, var(--green-pale) 0%, var(--white) 60%);
}
.auth-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 440px;
}
.auth-card h1 { font-family: var(--font-display); font-size: 2.2rem; font-weight: 700; color: var(--green-dark); margin-bottom: .4rem; letter-spacing: .5px; }
.auth-card p  { color: var(--gray-600); margin-bottom: 2rem; }

/* ── Listing detail ─────────────────────────────────────────────────────────── */
.listing-detail {
  padding: 2rem 1.25rem 4rem;
  max-width: 1140px;
  margin: 0 auto;
}
.listing-detail-grid { display: grid; grid-template-columns: 1fr 340px; gap: 2rem; align-items: start; }
.listing-detail-img {
  width: 100%;
  /* Reserve space before image loads to prevent CLS */
  aspect-ratio: 16 / 7;
  max-height: 420px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}
.listing-detail-img-placeholder {
  width: 100%;
  height: 280px;
  background: linear-gradient(135deg, var(--green-pale), var(--green-light));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  margin-bottom: 1.5rem;
}
.listing-detail-img-placeholder img { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.listing-detail h1  { font-family: var(--font-display); font-size: clamp(2.2rem, 4vw, 3rem); font-weight: 800; color: var(--green-dark); margin-bottom: .5rem; letter-spacing: .5px; }
.listing-detail-meta { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.5rem; align-items: center; }
.meta-item { display: flex; align-items: center; gap: .35rem; font-size: .875rem; color: var(--gray-600); }
.listing-section { margin-bottom: 2rem; }
.listing-section h3 { font-size: 1rem; font-weight: 700; color: var(--green-dark); border-bottom: 2px solid var(--green-pale); padding-bottom: .5rem; margin-bottom: .85rem; letter-spacing: .2px; }

/* Sidebar */
.sidebar-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--gray-200);
}
.sidebar-card h3 { font-size: 1rem; font-weight: 700; color: var(--green-dark); margin-bottom: 1rem; }
.contact-item { display: flex; align-items: center; gap: .6rem; font-size: .875rem; margin-bottom: .75rem; }
.contact-item svg { color: var(--green); flex-shrink: 0; }
.contact-item a { min-width: 0; overflow-wrap: break-word; word-break: break-all; }
.contact-item .ci-icon { flex-shrink: 0; width: 1.25rem; text-align: center; }

/* ── Reviews ────────────────────────────────────────────────────────────────── */
.review-card {
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.25rem;
  margin-bottom: .85rem;
  border: 1px solid var(--gray-200);
}
.review-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.reviewer-name { font-weight: 700; font-size: .9rem; letter-spacing: .1px; }
.review-date   { font-size: .75rem; color: var(--gray-600); }
.review-comment { font-size: .875rem; color: var(--gray-600); margin-top: .4rem; }

/* ── Filters bar ────────────────────────────────────────────────────────────── */
.filters-bar {
  background: var(--cream);
  border-bottom: 1px solid var(--gray-200);
  padding: .75rem 0;
  position: sticky;
  top: var(--navbar-height);
  z-index: 50;
}
/* Filters-bar only stays sticky while it has a sticky navbar to sit under —
   once the navbar collapses (max-width: 1024px, see navbar collapse rules
   above), unstick it too so it doesn't float mid-page with nothing above it.
   This must come after the base .filters-bar rule above to win the cascade. */
@media (max-width: 1024px) {
  .filters-bar { position: static; }
}
.filters-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  align-items: center;
}
.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .4rem 1rem;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 500;
  border: 1.5px solid var(--gray-200);
  background: var(--white);
  cursor: pointer;
  text-decoration: none;
  color: var(--gray-600);
  white-space: nowrap;
  transition: var(--transition);
}
.filter-pill:hover { border-color: var(--green); color: var(--green); }
.filter-pill.active { background: var(--green); border-color: var(--green); color: var(--white); }
.filter-select {
  padding: .4rem .8rem;
  border: 1.5px solid var(--gray-200);
  border-radius: 999px;
  font-size: .85rem;
  color: var(--gray-600);
  outline: none;
  cursor: pointer;
}
.filter-select:focus { border-color: var(--green); }

/* Filter bar search input */
.filter-search {
  border-radius: 999px;
  padding: .4rem .9rem;
  font-size: .85rem;
  width: min(180px, 100%);
}

/* ── Page header (orange banner) ───────────────────────────────────────────── */
.page-header {
  background: var(--orange);
  color: var(--white);
  padding: 3rem 1.25rem 2.5rem;
  text-align: center;
}
.page-header-inner { max-width: 1140px; margin: 0 auto; }
.page-header-icon { display: none; }  /* Icon replaced by bold typography */
.page-header h1 { font-family: var(--font-display); font-size: clamp(2.4rem, 5vw, 3.2rem); font-weight: 800; letter-spacing: .5px; }
.page-header p  { opacity: .9; margin-top: .4rem; font-size: 1rem; font-weight: 500; }

/* ── Pagination ─────────────────────────────────────────────────────────────── */
.pagination { display: flex; justify-content: center; gap: .5rem; margin-top: 2.5rem; }
.page-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--gray-200);
  font-size: .875rem;
  color: var(--gray-600);
  text-decoration: none;
  transition: var(--transition);
}
.page-btn:hover { border-color: var(--green); color: var(--green); }
.page-btn.active { background: var(--green); border-color: var(--green); color: var(--white); }

/* ── Empty state ────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 1.25rem;
  color: var(--gray-600);
}
.empty-state .empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  display: inline-block;
}
.empty-state h3 { font-size: 1.3rem; font-weight: 700; color: var(--gray-800); margin-bottom: .5rem; }

/* ── Footer ─────────────────────────────────────────────────────────────────── */
footer {
  background: var(--green-dark);
  color: rgba(255,255,255,.75);
  padding: 2.5rem 1.25rem;
  margin-top: auto;
}
.footer-inner {
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.footer-brand img {
  height: 40px;
}
.footer-brand-text {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--white);
}
.footer-brand-text span { color: var(--yellow); }
.footer-links { display: flex; gap: 1.25rem; }
.footer-links a { color: rgba(255,255,255,.65); font-size: .875rem; transition: var(--transition); }
.footer-links a:hover { color: var(--white); }
.footer-copy { font-size: .8rem; color: rgba(255,255,255,.5); margin-top: .5rem; width: 100%; }

/* ── Fee badge ──────────────────────────────────────────────────────────────── */
.fee-badge {
  display: inline-block;
  background: var(--yellow);
  color: var(--green-dark);
  font-size: .75rem;
  font-weight: 700;
  padding: .25rem .7rem;
  border-radius: 999px;
}

/* ── Divider ────────────────────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--gray-200); margin: 1.5rem 0; }

/* ── 404 / error pages ──────────────────────────────────────────────────────── */
.error-page {
  text-align: center;
  padding: 6rem 1.25rem;
}
.error-page h1 { font-size: 6rem; font-weight: 900; color: var(--green-pale); line-height: 1; }
.error-page h2 { font-family: var(--font-display); font-size: 2rem; font-weight: 700; color: var(--gray-800); margin-bottom: .5rem; letter-spacing: .5px; }
.error-page p  { color: var(--gray-600); margin-bottom: 1.5rem; }

/* ── Site-wide search bar (results page) ────────────────────────────────────── */
.site-search-bar {
  display: flex;
  gap: 0;
  border: 2px solid var(--green);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
.site-search-input {
  flex: 1;
  border: none;
  outline: none;
  padding: .85rem 1rem;
  font-size: 1rem;
  font-family: var(--font-body);
  background: var(--white);
  color: var(--gray-800);
}
.site-search-input::placeholder { color: var(--gray-400); }
.site-search-btn {
  background: var(--green);
  color: var(--white);
  border: none;
  padding: .85rem 1.25rem;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .4rem;
  white-space: nowrap;
  transition: background var(--transition);
}
.site-search-btn:hover { background: var(--green-dark); }

/* ── Search tabs ─────────────────────────────────────────────────────────────── */
.search-tabs {
  display: flex;
  gap: .25rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--gray-200);
  padding-bottom: 0;
}
.search-tab {
  padding: .5rem .9rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--gray-600);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color var(--transition), border-color var(--transition);
  white-space: nowrap;
}
.search-tab:hover { color: var(--green); }
.search-tab.active { color: var(--green-dark); border-bottom-color: var(--green); }
.tab-count {
  font-size: .75rem;
  font-weight: 500;
  color: var(--gray-400);
  margin-left: .2rem;
}
.search-tab.active .tab-count { color: var(--green-mid); }

/* ── Tag filter chips (search results) ──────────────────────────────────────── */
.tag-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  align-items: center;
  margin-bottom: 1rem;
}
.tag-filters-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-right: .2rem;
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: .25rem .7rem;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 500;
  color: var(--gray-600);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  cursor: pointer;
  text-decoration: none;
}
.tag-chip:hover { background: var(--green-pale); color: var(--green-dark); border-color: var(--green-light); }
.tag-chip.active { background: var(--green); color: var(--white); border-color: var(--green); }
.tag-chip-sm { font-size: .72rem; padding: .18rem .55rem; }

/* ── Tag picker (listing forms) ─────────────────────────────────────────────── */
.tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .5rem;
}
.tag-picker-item { position: relative; display: flex; align-items: center; }
.tag-picker-item input[type="checkbox"] {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
.tag-picker-item input[type="checkbox"]:focus-visible + .tag-chip-label {
  outline: 2.5px solid var(--green);
  outline-offset: 2px;
}
.tag-chip-label {
  display: inline-flex;
  align-items: center;
  padding: .3rem .8rem;
  background: var(--gray-100);
  border: 1.5px solid var(--gray-200);
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  user-select: none;
}
.tag-picker-item input:checked + .tag-chip-label {
  background: var(--green);
  color: var(--white);
  border-color: var(--green);
}
.tag-chip-label:hover { background: var(--green-pale); color: var(--green-dark); border-color: var(--green-light); }

/* ── Ads ─────────────────────────────────────────────────────────────────────── */
.ad-slot {
  position: relative;
  text-align: center;
  padding: .75rem 1.25rem;
  max-width: 1140px;
  margin: 0 auto;
}
.ad-label {
  position: absolute;
  top: .5rem;
  right: 1.25rem;
  font-size: .6rem;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.ad-img {
  max-width: 100%;
  height: auto;
  object-fit: contain;
  object-position: center;
  border-radius: var(--radius-sm);
  display: block;
  margin: 0 auto;
}
.ad-leaderboard {
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
}
.ad-leaderboard .ad-img { max-height: 90px; }
.ad-footer {
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
}
.ad-footer .ad-img { max-height: 90px; }
.ad-sidebar { padding: 1rem; }
.ad-sidebar .ad-img { max-width: 300px; border-radius: var(--radius); }
.ad-card {
  border: 1px dashed var(--gray-300) !important;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.ad-card:hover { color: inherit; }
.ad-card-img-wrap {
  position: relative;
  width: 100%;
  height: 180px;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.ad-card-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}
.ad-label-infeed { position: static; font-size: .7rem; color: var(--gray-400); display: inline-block; }
.ad-label-infeed-badge {
  position: absolute;
  top: .5rem;
  left: .5rem;
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-500);
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(4px);
  padding: .15rem .4rem;
  border-radius: 3px;
  pointer-events: none;
  z-index: 1;
}

/* ── Search results ─────────────────────────────────────────────────────────── */
.search-empty { text-align: center; padding: 3rem 1rem; color: var(--gray-600); }
.search-empty h3 { font-size: 1.3rem; font-weight: 700; margin-bottom: .5rem; color: var(--gray-800); }
.search-empty p { font-size: .95rem; }
.search-meta { font-size: .85rem; color: var(--gray-600); margin-bottom: 1rem; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .listing-detail-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }

  /* Touch targets — 44px minimum (WCAG 2.5.5) */
  .btn        { min-height: 44px; }
  .btn-sm     { min-height: 44px; padding: .5rem 1rem; font-size: .85rem; }
  .page-btn   { width: 44px; height: 44px; }
  .filter-pill  { min-height: 44px; padding: .6rem 1.1rem; }
  .filter-select { min-height: 44px; padding: .6rem .9rem; }
  .mobile-nav .nav-link { min-height: 44px; display: flex; align-items: center; }

  /* Tighter spacing */
  .section { padding: 2.25rem 1rem; }
  .section-header { margin-bottom: 1.75rem; }
  .page-header { padding: 1.75rem 1rem 1.5rem; }
  .listing-detail { padding: 1.25rem 1rem 2.5rem; }
  .sidebar-card { padding: 1.1rem; }
  .auth-card { padding: 1.75rem 1.25rem; }

  /* Logo bar compact */
  .logo-bar { padding: .6rem 1rem .5rem; }
  .logo-bar img { height: 46px; }

  /* Hero stacks vertically */
  .hero { grid-template-columns: 1fr; }
  .hero-left { padding: 2.25rem 1.25rem 1.75rem; }
  .hero-right { padding: 1.75rem 1.25rem 2rem; }

  .hero-search { flex-direction: column; border-radius: var(--radius-sm); }
  .hero-search input { border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
  .hero-search button { border-radius: 0 0 var(--radius-sm) var(--radius-sm); justify-content: center; }

  /* Categories: 2-column on mobile, featured card full-width */
  .categories-grid { grid-template-columns: 1fr 1fr; gap: .75rem; }
  .category-card:first-child {
    grid-column: span 2;
    flex-direction: row;
    padding: 1.25rem 1.5rem;
    gap: 1rem;
  }
  .category-card:first-child .category-icon { width: 64px; height: 64px; }
  .category-card:first-child h3 { font-size: 1.6rem; }
  .category-icon { width: 52px; height: 52px; }
  /* Hide taglines on mobile except for the featured first card */
  .category-tagline { display: none; }
  .category-card:first-child .category-tagline { display: block; font-size: .8rem; }

  /* Filters: full-width search (not-sticky already handled at the 1024px
     breakpoint where the navbar itself stops being sticky) */
  .filters-inner { gap: .5rem; }
  .filters-inner form { width: 100%; margin-left: 0 !important; }
  .filters-inner form input[type="text"],
  .filters-inner .filter-search { flex: 1; min-width: 0; width: 100%; }

  /* Mobile nav link styles */
  .mobile-nav .nav-link { color: var(--yellow) !important; font-weight: 700; text-transform: uppercase; font-size: .85rem; padding: .6rem .85rem; }
  .mobile-nav .nav-link-auth { color: rgba(255,255,255,.85) !important; font-weight: 400; text-transform: none; font-size: .9rem; }

  /* Footer */
  .footer-inner { flex-direction: column; text-align: center; }
  .footer-copy { text-align: center; }
  .footer-brand { justify-content: center; }
  .footer-links { flex-wrap: wrap; gap: .6rem 1rem; justify-content: center; }
}

/* ── Small phones (< 480px) ──────────────────────────────────────────────────── */
@media (max-width: 480px) {
  /* Even tighter spacing */
  .container { padding: 0 .85rem; }
  .section { padding: 1.75rem .85rem; }
  .page-header { padding: 1.5rem .85rem 1.25rem; }
  .listing-detail { padding: 1rem .85rem 2rem; }

  /* Card spacing */
  .listing-card-body { padding: 1rem; }
  .listing-card-footer { padding: .6rem 1rem; }
  .auth-card { padding: 1.25rem 1rem; }
  .sidebar-card { padding: 1rem; }

  /* Filter pills scroll horizontally instead of wrapping */
  .filters-inner { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: .25rem; }
  .filters-inner form { flex-shrink: 0; width: auto; min-width: 200px; }
  .filters-bar { overflow: visible; }

  /* Footer links more compact */
  .footer-links { gap: .5rem .75rem; font-size: .82rem; }
}

/* ── Skip to content (WCAG 2.4.1) ──────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: 0; left: 0;
  background: var(--green-dark);
  color: var(--yellow);
  padding: .6rem 1.25rem;
  font-weight: 700;
  font-size: .9rem;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 9999;
  transform: translateY(-100%);
  transition: transform .15s var(--ease-out-quart);
  text-decoration: none;
}
.skip-link:focus { transform: translateY(0); }
.skip-link:focus-visible { outline: 2.5px solid var(--yellow); outline-offset: -3px; }

/* ── Focus indicators (WCAG 2.4.7) ─────────────────────────────────────────── */
:focus-visible {
  outline: 2.5px solid var(--green);
  outline-offset: 2px;
}
/* Invert focus ring on dark backgrounds */
.navbar :focus-visible,
footer :focus-visible,
.mobile-nav :focus-visible,
.listing-card-img-placeholder :focus-visible {
  outline-color: var(--yellow);
}
/* Buttons and interactive elements */
.btn:focus-visible,
.filter-pill:focus-visible,
.page-btn:focus-visible,
.tag-chip:focus-visible,
.nav-link:focus-visible,
.nav-dropdown-toggle:focus-visible {
  outline: 2.5px solid var(--green);
  outline-offset: 2px;
}
.navbar .nav-link:focus-visible,
.mobile-nav .nav-link:focus-visible {
  outline-color: var(--yellow);
}
/* Form controls already have box-shadow focus — keep consistent */
.form-control:focus-visible {
  outline: none; /* handled by border + box-shadow */
}

/* ── Text overflow hardening ─────────────────────────────────────────────────── */
/* Prevent very long words/URLs from breaking layouts */
.listing-card h3,
.listing-desc,
.listing-location,
.review-comment,
.sidebar-card p,
.listing-detail h1 {
  overflow-wrap: break-word;
  word-break: break-word;
}

/* ── Reduced motion ─────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .listing-card {
    opacity: 1;
    transform: none;
  }
}

/* ── Gamification: rank chips, badges, leaderboard ─────────────────────────── */
.rank-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .8rem;
  font-weight: 600;
  padding: .2rem .65rem;
  border-radius: 999px;
  background: var(--green-pale);
  color: var(--green-dark);
  white-space: nowrap;
}
.rank-chip-sm {
  font-size: .7rem;
  padding: .1rem .5rem;
  margin-left: .4rem;
  vertical-align: middle;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.badge-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .75rem;
  font-weight: 600;
  padding: .2rem .6rem;
  border-radius: var(--radius-sm);
  background: var(--gray-100);
  color: var(--gray-600);
  border: 1px solid var(--gray-200);
  cursor: default;
}
.badge-chip-sm {
  font-size: .85rem;
  padding: 0 .2rem;
  margin-left: .2rem;
  border: none;
  background: none;
  vertical-align: middle;
}

.leaderboard-table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}
.leaderboard-table th,
.leaderboard-table td {
  padding: .7rem 1rem;
  text-align: left;
  font-size: .9rem;
  border-bottom: 1px solid var(--gray-200);
}
.leaderboard-table th {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gray-500);
  background: var(--gray-50);
}
.leaderboard-table tr:last-child td { border-bottom: none; }
.leaderboard-position {
  font-weight: 700;
  color: var(--gray-600);
  width: 2.5rem;
}
.leaderboard-top3 { background: var(--amber-pale); }
.leaderboard-top3 .leaderboard-position { font-size: 1.2rem; }
.leaderboard-row-you { background: var(--green-pale); }

.leaderboard-you-line {
  margin-top: 1.25rem;
  padding: .85rem 1.25rem;
  background: var(--green-pale);
  border: 1px solid var(--green-light);
  border-radius: var(--radius);
  font-size: .9rem;
  color: var(--green-dark);
}

/* ── Community forum ─── */

/* Sort tabs (hot/new/top) — compact pills, sits under the .search-tabs
   category row. */
.forum-tabs {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.forum-tab {
  padding: .35rem .8rem;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--gray-600);
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  transition: var(--transition);
}
.forum-tab:hover { border-color: var(--green); color: var(--green); }
.forum-tab.active { background: var(--green); border-color: var(--green); color: var(--white); }

/* Post row (index list) */
.forum-post-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: .75rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.forum-post-row:hover { border-color: var(--green-light); box-shadow: var(--shadow-sm); }
.forum-post-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .15rem;
  min-width: 2.75rem;
  text-align: center;
  color: var(--gray-600);
  font-size: .9rem;
}
.forum-post-main { flex: 1; min-width: 0; }
.forum-post-title {
  display: block;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--gray-800);
  margin-bottom: .3rem;
}
.forum-post-title:hover { color: var(--green-dark); }
.forum-post-meta {
  font-size: .8rem;
  color: var(--gray-500);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .3rem;
}
.forum-post-body { font-size: .95rem; color: var(--gray-800); line-height: 1.6; }

/* Upvote button — shared by posts and comments */
.forum-vote-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  padding: .3rem .6rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-500);
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}
.forum-vote-btn:hover { border-color: var(--green); color: var(--green); }
.forum-vote-btn.active { background: var(--green-pale); border-color: var(--green-light); color: var(--green-dark); }
.forum-vote-btn:disabled { cursor: default; opacity: .5; }
span.forum-vote-btn { cursor: default; background: none; border-color: transparent; padding: .3rem .2rem; }

/* Comments (recursive) */
.forum-comment {
  padding: .85rem 0;
  border-bottom: 1px solid var(--gray-200);
}
.forum-comment:last-child { border-bottom: none; }
.forum-comment-meta {
  font-size: .8rem;
  color: var(--gray-500);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .3rem;
  margin-bottom: .35rem;
}
.forum-comment-body { font-size: .9rem; color: var(--gray-800); line-height: 1.55; }
.forum-comment-actions {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  margin-top: .5rem;
}
.forum-comment-children {
  margin-left: 1.25rem;
  border-left: 2px solid var(--gray-200);
  padding-left: .75rem;
}

@media (max-width: 768px) {
  .forum-post-row { padding: .85rem 1rem; gap: .75rem; }
  .forum-comment-children { margin-left: .6rem; padding-left: .5rem; }
}
