/* =========================================================
   Listcrawler - styles.css
   Mobile-first. Designed for the Houston (TX) listings page.
   ========================================================= */

/* ---------- Tokens ---------- */
:root {
  --color-header:        #1e2850;
  --color-header-hover:  #2a3568;
  --color-accent:        #ff001a;
  --color-accent-hover:  #cc0015;
  --color-tag:           #6d28d9;
  --color-tag-bg:        #ede9fe;
  --color-tag-alt:       #0e7490;
  --color-tag-alt-bg:    #cffafe;
  --color-online:        #22c55e;

  --color-bg:            #f4f1ea;
  --color-card:          #ffffff;
  --color-text:          #141b3a;
  --color-muted:         #5b6378;
  --color-border:        #e6e3db;
  --color-border-strong: #d6d2c7;

  --radius-sm:  8px;
  --radius:     14px;
  --radius-lg:  20px;

  --shadow-xs: 0 1px 2px rgba(20, 27, 58, 0.05);
  --shadow-sm: 0 2px 6px rgba(20, 27, 58, 0.06);
  --shadow-md: 0 8px 24px rgba(20, 27, 58, 0.10);
  --shadow-lg: 0 16px 40px rgba(20, 27, 58, 0.14);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;

  --header-h: 60px;
  --container-max: 1200px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; cursor: pointer; }

/* ---------- Layout helpers ---------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: 1rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.25rem;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9375rem;
  line-height: 1;
  transition: transform 0.15s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-accent {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}
.btn-accent:hover { background: var(--color-accent-hover); border-color: var(--color-accent-hover); }

.btn-outline {
  background: transparent;
  color: var(--color-header);
  border-color: var(--color-header);
}
.btn-outline:hover { background: var(--color-header); color: #fff; }

.btn-block { width: 100%; }

/* ---------- Header ---------- */
.site-header {
  background: var(--color-header);
  color: #fff;
  padding: 0.875rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  min-height: var(--header-h);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: #fff;
}
.logo img {
  height: 32px;
  width: auto;
  display: block;
}
@media (min-width: 720px) {
  .logo img { height: 36px; }
}

/* Burger */
.burger {
  background: none;
  border: 0;
  padding: 0.5rem;
  width: 44px;
  height: 44px;
  display: grid;
  place-content: center;
  border-radius: 8px;
}
.burger:hover { background: rgba(255,255,255,0.08); }
.burger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.28s ease, opacity 0.2s ease;
}
.burger span + span { margin-top: 5px; }
.burger.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.is-active span:nth-child(2) { opacity: 0; }
.burger.is-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Nav (mobile first: slide-down drawer) */
.main-nav {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  background: var(--color-header);
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 0.75rem 1rem 1.25rem;
  transform: translateY(-120%);
  transition: transform 0.3s ease;
  box-shadow: 0 16px 28px rgba(0,0,0,0.25);
  max-height: calc(100vh - var(--header-h));
  overflow-y: auto;
}
.main-nav.is-open { transform: translateY(0); }

.main-nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.main-nav a {
  display: block;
  color: #fff;
  text-decoration: none;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: background 0.2s ease;
}
.main-nav a:hover { background: var(--color-header-hover); }
.main-nav .btn-accent {
  margin-top: 0.5rem;
  text-align: center;
}
.main-nav .btn-accent:hover {
  background: var(--color-accent-hover);
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  padding: 1rem 0 0.25rem;
  font-size: 0.875rem;
  color: var(--color-muted);
}
.breadcrumb a {
  color: var(--color-header);
  text-decoration: none;
  font-weight: 600;
}
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { margin-inline: 0.4rem; }
.breadcrumb [aria-current="page"] { color: var(--color-muted); font-weight: 500; }

/* ---------- Page header ---------- */
.page-header {
  padding: 1rem 0 1.25rem;
}
.eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-accent);
  margin-bottom: 0.5rem;
}
.page-header h1 {
  font-size: 1.6rem;
  line-height: 1.15;
  color: var(--color-header);
  letter-spacing: -0.015em;
  margin-bottom: 0.6rem;
}
.page-header .tagline {
  color: var(--color-muted);
  font-size: 0.9375rem;
  max-width: 60ch;
}

.filters {
  margin-top: 1.25rem;
}

.filters-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.8rem;
  background: #fff;
  border: 1.5px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--color-header);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.filters-toggle:hover {
  border-color: var(--color-header);
}
.filters-toggle svg {
  flex-shrink: 0;
}
.filters-toggle[aria-expanded="true"] {
  background: var(--color-header);
  color: #fff;
  border-color: var(--color-header);
}

.filter-bar {
  display: none;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}
.filter-bar.is-open {
  display: flex;
}

.filter-chip {
  background: #fff;
  color: var(--color-header);
  border: 1.5px solid var(--color-border-strong);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.filter-chip:hover {
  border-color: var(--color-header);
}
.filter-chip.is-active {
  background: var(--color-header);
  color: #fff;
  border-color: var(--color-header);
}

/* ---------- Layout grid ---------- */
.layout {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas:
    "listings"
    "viewall"
    "info"
    "sidebar";
  gap: 1.25rem;
  padding-bottom: 1.5rem;
}
.listings     { grid-area: listings; }
.view-all     { grid-area: viewall; }
.sidebar      { grid-area: sidebar; }
.info-section { grid-area: info; }

/* ---------- Listing grid ---------- */
.listings {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.listing-card {
  background: var(--color-card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.listing-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-border-strong);
}
.listing-card:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

.listing-image {
  position: relative;
  aspect-ratio: 4 / 4;
  overflow: hidden;
  background: linear-gradient(135deg, #6d28d9, #ec4899);
}
/* Varied gradient placeholders when images are missing */
.listing-card:nth-child(6n+1) .listing-image { background: linear-gradient(135deg, #6d28d9, #ec4899); }
.listing-card:nth-child(6n+2) .listing-image { background: linear-gradient(135deg, #2563eb, #7c3aed); }
.listing-card:nth-child(6n+3) .listing-image { background: linear-gradient(135deg, #ec4899, #f59e0b); }
.listing-card:nth-child(6n+4) .listing-image { background: linear-gradient(135deg, #0891b2, #2563eb); }
.listing-card:nth-child(6n+5) .listing-image { background: linear-gradient(135deg, #f43f5e, #6d28d9); }
.listing-card:nth-child(6n)   .listing-image { background: linear-gradient(135deg, #7c3aed, #0891b2); }

.listing-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.status-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(20, 27, 58, 0.85);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  letter-spacing: 0.01em;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ca3af;
}
.status-badge.online .status-dot {
  background: var(--color-online);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
  animation: pulseDot 2s infinite;
}
.status-badge.recent .status-dot {
  background: #f59e0b;
}
@keyframes pulseDot {
  0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
  70%  { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.posted-time {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  background: rgba(20, 27, 58, 0.75);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
}

.listing-content {
  padding: 1rem 1.1rem 1.1rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.listing-title {
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-header);
  margin-bottom: 0.5rem;
}

.listing-desc {
  color: var(--color-muted);
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 0.85rem;
  flex: 1;

  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tags {
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}

.tag {
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.tag-location {
  background: var(--color-tag-alt-bg);
  color: var(--color-tag-alt);
}
.tag-service {
  background: var(--color-tag-bg);
  color: var(--color-tag);
}

.listing-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 0.25rem;
}

.btn-view {
  display: inline-block;
  background: var(--color-header);
  color: #fff;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 700;
  transition: background 0.2s ease;
  white-space: nowrap;
}
.btn-view::after { content: " \2192"; }
.listing-card:hover .btn-view { background: var(--color-accent); }

.listing-user {
  font-size: 0.75rem;
  color: var(--color-muted);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Sidebar ---------- */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar-card {
  background: var(--color-card);
  border-radius: var(--radius);
  padding: 1.25rem 1.1rem;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-xs);
}

.sidebar-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-header);
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: -0.01em;
}
.sidebar-icon {
  color: var(--color-accent);
  font-size: 1.05rem;
  line-height: 1;
}

.city-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}
.city-list a {
  display: block;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.city-list a:hover {
  background: var(--color-bg);
  color: var(--color-accent);
  transform: translateX(3px);
}

.info-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.info-list li {
  position: relative;
  padding-left: 1.5rem;
  font-size: 0.8125rem;
  color: var(--color-muted);
}
.info-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.35rem;
  width: 14px;
  height: 14px;
  background: var(--color-online);
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px #fff;
}

.sidebar-cta {
  background: var(--color-header);
  color: #fff;
  border-color: var(--color-header);
  text-align: center;
}
.sidebar-cta .sidebar-card-title { color: #fff; justify-content: center; }
.sidebar-cta p {
  font-size: 0.875rem;
  color: rgba(255,255,255,0.75);
  margin-bottom: 0.9rem;
}

/* ---------- View all ---------- */
.view-all {
  text-align: center;
  padding: 0.5rem 0 0.25rem;
}

/* ---------- Info section ---------- */
.info-section {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-xs);
}
.info-section h2 {
  font-size: 1.375rem;
  color: var(--color-header);
  margin-bottom: 0.6rem;
  letter-spacing: -0.01em;
}
.info-lead {
  color: var(--color-muted);
  font-size: 0.9375rem;
  margin-bottom: 1.25rem;
  line-height: 1.6;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.875rem;
  margin-bottom: 1.25rem;
}

.info-card {
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.1rem;
  border: 1px solid var(--color-border);
}
.info-card h3 {
  font-size: 0.95rem;
  color: var(--color-header);
  margin-bottom: 0.7rem;
  font-weight: 700;
}
.info-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.info-card li {
  font-size: 0.8125rem;
  color: var(--color-muted);
  padding-left: 1.1rem;
  position: relative;
  line-height: 1.45;
}
.info-card li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55rem;
  width: 6px;
  height: 6px;
  background: var(--color-accent);
  border-radius: 50%;
}

.safety-notice {
  background: #fef3c7;
  border-left: 4px solid #f59e0b;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  color: #78350f;
  line-height: 1.55;
}
.safety-notice strong { color: #78350f; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--color-header);
  color: #a6b0c5;
  padding: 2.5rem 0 1.5rem;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem 1.25rem;
  margin-bottom: 2rem;
}

.footer-brand {
  grid-column: 1 / -1;
}
.footer-logo {
  display: flex;
  align-items: center;
  margin-bottom: 0.75rem;
}
.footer-logo img {
  height: 32px;
  width: auto;
  display: block;
}

.footer-heading {
  color: #fff;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.9rem;
  font-weight: 700;
}
.footer-col p {
  font-size: 0.875rem;
  line-height: 1.6;
  color: #8e98b3;
}
.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.footer-col a {
  color: #8e98b3;
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.2s ease;
}
.footer-col a:hover { color: #fff; }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 1.25rem;
  text-align: center;
  font-size: 0.8125rem;
  color: #8e98b3;
}
.footer-bottom p + p { margin-top: 0.5rem; }
.footer-bottom .disclaimer {
  font-size: 0.7rem;
  line-height: 1.55;
  color: #6b7490;
  max-width: 75ch;
  margin-inline: auto;
}

/* =========================================================
   Breakpoints
   ========================================================= */

/* ---------- >= 560px: two listing columns ---------- */
@media (min-width: 560px) {
  .listings {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---------- >= 720px: bigger headings + info grid 2col ---------- */
@media (min-width: 720px) {
  .container { padding-inline: 1.5rem; }
  .page-header h1 { font-size: 2.125rem; }
  .info-grid { grid-template-columns: repeat(2, 1fr); }
  .info-section { padding: 2rem 1.75rem; }
  .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem; }
  .footer-brand { grid-column: auto; }
  .breadcrumb { padding: 1.25rem 0 0.5rem; }

  .filters-toggle { display: none; }
  .filter-bar {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    margin-top: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .filter-bar::-webkit-scrollbar { display: none; }
}

/* ---------- >= 980px: desktop - hide burger, show sidebar ---------- */
@media (min-width: 980px) {
  .burger { display: none; }

  .main-nav {
    position: static;
    transform: none;
    background: none;
    border: 0;
    box-shadow: none;
    padding: 0;
    max-height: none;
    overflow: visible;
  }
  .main-nav ul {
    flex-direction: row;
    align-items: center;
    gap: 0.25rem;
  }
  .main-nav a {
    padding: 0.6rem 1rem;
    font-size: 0.9375rem;
  }
  .main-nav a:hover { background: rgba(255,255,255,0.08); }
  .main-nav .btn-accent {
    margin-top: 0;
    margin-left: 0.5rem;
    padding: 0.65rem 1.25rem;
  }
  .main-nav .btn-accent:hover { background: var(--color-accent-hover); }

  .layout {
    grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-areas:
      "listings sidebar"
      "viewall  sidebar"
      "info     sidebar";
    gap: 1.5rem 2rem;
    align-items: start;
    padding-bottom: 2rem;
  }

  .listings { grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
  .listing-image { aspect-ratio: 4 / 5; }

  .page-header { padding: 1rem 0 1.5rem; }
  .page-header h1 { font-size: 2.375rem; }

  .info-grid { grid-template-columns: repeat(3, 1fr); }

  .sidebar {
    position: sticky;
    top: calc(var(--header-h) + 1rem);
    align-self: start;
  }
}

/* ---------- >= 1200px: three listing columns ---------- */
@media (min-width: 1200px) {
  .listings { grid-template-columns: repeat(3, 1fr); }
  .page-header h1 { font-size: 2.625rem; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}
