/* ==========================================================================
   BOLO Texas — base layer
   Reset, typography, layout primitives and utilities. Requires tokens.css.
   Nothing in this file is specific to one component; see components.css.
   ========================================================================== */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--sp-4));
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* Leave room for the fixed bottom tab bar on phones. */
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  overflow-x: hidden;
}

@media (min-width: 900px) {
  body { padding-bottom: 0; }
}

img, picture, video, canvas, svg { display: block; max-width: 100%; }
img, video { height: auto; }
img { background: var(--surface-2); }  /* quiet placeholder while photos load */
svg { fill: currentColor; }

input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
ul[class], ol[class] { list-style: none; padding: 0; }
table { border-collapse: collapse; width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--sp-5) 0; }
[hidden] { display: none !important; }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-text); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

::selection { background: var(--accent); color: var(--accent-ink); }

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--lh-tight);
  letter-spacing: -0.015em;
  text-wrap: balance;
  overflow-wrap: break-word;
}

h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); line-height: var(--lh-snug); }
h4 { font-size: var(--fs-md); line-height: var(--lh-snug); }
p { text-wrap: pretty; }
small { font-size: var(--fs-sm); }

/* Front-page scale headline. */
.display {
  font-family: var(--font-display);
  font-size: var(--fs-display);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
}

/* Small uppercase mono label that sits above a headline. */
.kicker {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: var(--tracking-kicker);
  text-transform: uppercase;
  color: var(--accent-text);
}

.kicker--muted { color: var(--muted); }
.kicker--ok { color: var(--ok-text); }
.kicker--alert { color: var(--alert-text); }

.dek { font-size: var(--fs-md); color: var(--ink-2); line-height: 1.45; }
.meta { font-size: var(--fs-sm); color: var(--muted); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.text-muted { color: var(--muted); }
.text-center { text-align: center; }

/* Text link with an underline, for use outside .prose. */
.link {
  color: var(--accent-text);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.link:hover { text-decoration-thickness: 2px; }

/* ---------- Layout: containers and sections ---------- */
.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container--narrow { max-width: calc(var(--container-narrow) + var(--gutter) * 2); }
.container--wide { max-width: calc(var(--container-wide) + var(--gutter) * 2); }

/* Vertical rhythm between page blocks. */
.section { padding-block: var(--sp-5); }
.section--tint { background: var(--surface-2); }

@media (min-width: 900px) {
  .section { padding-block: var(--sp-6); }
}

/* Section heading row: title on the left, "See all" link on the right. */
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: 2px solid var(--ink);
}

.section-head__title { font-size: var(--fs-lg); }

.section-head__link {
  flex: none;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: var(--tracking-kicker);
  text-transform: uppercase;
  color: var(--accent-text);
}

/* ---------- Layout: bento grid ----------
   Two columns on phones, four from 600px. Children default to one cell;
   .span-2 / .span-3 / .span-4 widen them and .row-2 makes them two rows tall.
   On phones every span collapses to the full two-column width. */
.bento {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(150px, auto);
  grid-auto-flow: dense;
  gap: var(--gap);
}

.bento > * { min-width: 0; height: 100%; }
.bento > .span-2,
.bento > .span-3,
.bento > .span-4 { grid-column: 1 / -1; }
.bento > .row-2 { grid-row: span 2; }

@media (min-width: 600px) {
  .bento { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: minmax(180px, auto); }
  .bento > .span-2 { grid-column: span 2; }
  .bento > .span-3 { grid-column: span 3; }
  .bento > .span-4 { grid-column: 1 / -1; }
}

@media (min-width: 1200px) {
  .bento { grid-auto-rows: minmax(200px, auto); }
}

/* Equal cards that wrap automatically. Set --grid-min to change card width. */
.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(var(--grid-min, 240px), 100%), 1fr));
  gap: var(--gap);
}

/* Two cards per row on phones, useful for photo tiles (classifieds, guide). */
.grid-auto--tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (min-width: 600px) {
  .grid-auto--tiles { grid-template-columns: repeat(auto-fill, minmax(var(--grid-min, 200px), 1fr)); }
}

/* Main column plus a 300px sidebar (sized for the mrec ad) from 900px. */
.layout-sidebar { display: grid; gap: var(--sp-6); }
.layout-sidebar > * { min-width: 0; }

@media (min-width: 900px) {
  .layout-sidebar { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
  .layout-sidebar__aside { position: sticky; top: calc(var(--header-h) + var(--sp-4)); }
}

/* Vertical flow with consistent gaps. Override with --stack-gap. */
.stack { display: flex; flex-direction: column; gap: var(--stack-gap, var(--sp-4)); }
.stack--sm { --stack-gap: var(--sp-2); }
.stack--lg { --stack-gap: var(--sp-6); }

/* Horizontal group that wraps: chips, buttons, meta items. */
.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--cluster-gap, var(--sp-2));
}

.cluster--between { justify-content: space-between; }
.cluster--nowrap { flex-wrap: nowrap; }

/* ---------- Utilities ---------- */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* First focusable element on every page. */
.skip-link {
  position: fixed;
  top: var(--sp-2);
  left: var(--sp-2);
  z-index: var(--z-toast);
  padding: var(--sp-2) var(--sp-4);
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--r-sm);
  transform: translateY(-200%);
}

.skip-link:focus { transform: none; color: var(--bg); }

/* Applied to <body> while a drawer or modal is open. */
.no-scroll { overflow: hidden; }

@media (max-width: 899.98px) { .hide-mobile { display: none !important; } }
@media (min-width: 900px) { .hide-desktop { display: none !important; } }

/* Clamp text to a number of lines: style="--lines: 3". */
.clamp {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--lines, 2);
  line-clamp: var(--lines, 2);
  overflow: hidden;
}

/* ---------- Prose: article bodies and legal pages ---------- */
.prose {
  max-width: 68ch;
  font-size: var(--fs-md);
  line-height: 1.7;
  color: var(--ink);
}

.prose > * + * { margin-top: 1.1em; }
.prose h2 { margin-top: 1.8em; font-size: var(--fs-xl); }
.prose h3 { margin-top: 1.6em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.4em; }
.prose li::marker { color: var(--accent-text); }
.prose strong { font-weight: 600; }

.prose a {
  color: var(--accent-text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.prose blockquote {
  padding-left: var(--sp-4);
  border-left: 3px solid var(--accent);
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-style: italic;
  line-height: var(--lh-snug);
}

.prose figure img { width: 100%; border-radius: var(--r-md); }
.prose figcaption { margin-top: var(--sp-2); font-size: var(--fs-sm); color: var(--muted); }
.prose th, .prose td { padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--line); text-align: left; }
.prose th { font-size: var(--fs-sm); color: var(--muted); }

/* Opening paragraph treatment for articles. */
.prose--lede > p:first-of-type { font-size: var(--fs-lg); line-height: 1.5; color: var(--ink-2); }

/* Smaller, denser variant for legal copy and disclaimers. */
.prose--small { font-size: var(--fs-sm); line-height: 1.6; color: var(--ink-2); }

/* ---------- Skeleton loading placeholder ----------
   Add .skeleton to any empty box while data loads. Helpers give common
   shapes: .skeleton--text (one line), .skeleton--title, .skeleton--media. */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  color: transparent;
  user-select: none;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--surface) 70%, transparent) 50%, transparent 80%);
  transform: translateX(-100%);
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

.skeleton--text { height: 0.9em; margin-block: 0.35em; }
.skeleton--title { height: 1.5em; width: 70%; }
.skeleton--media { aspect-ratio: 16 / 10; border-radius: var(--r-md); }

@keyframes skeleton-shimmer {
  to { transform: translateX(100%); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Print: drop chrome and ads ---------- */
@media print {
  .site-header, .tab-bar, .footer, .ad-slot, .drawer, .modal, .toast-region { display: none !important; }
  body { background: #fff; color: #000; padding: 0; }
}
