/* ==========================================================================
   DFW Immigrant Law Center — blog
   Public blog index, single post, prose styles, and the home-page teaser.
   Uses the site's tokens; no new palette.
   ========================================================================== */

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

.blog-hero {
  position: relative;
  padding-block: clamp(48px, 6vw, 84px) clamp(32px, 4vw, 52px);
  background:
    radial-gradient(760px 380px at 82% -10%, rgba(101, 188, 123, 0.13), transparent 62%),
    var(--cream);
  overflow: hidden;
}

.blog-hero .container {
  position: relative;
  z-index: 1;
}

.blog-hero h1 {
  max-width: 18ch;
  margin: 10px 0 0;
}

.blog-hero .lede {
  max-width: 62ch;
  margin-top: 16px;
}

.crumbs {
  margin-bottom: 18px;
  font-size: 0.8125rem;
  color: var(--ink-55);
}

.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.crumbs li {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.crumbs li + li::before {
  content: "/";
  color: var(--ink-12);
}

.crumbs a {
  color: var(--ink-55);
  text-decoration: none;
  padding-block: 3px;
}

.crumbs a:hover {
  color: var(--bridge);
  text-decoration: underline;
}

.crumbs span[aria-current] {
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 40ch;
}

/* --------------------------------------------------------------------------
   Search
   -------------------------------------------------------------------------- */

.blog-search {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 520px;
  margin-top: 26px;
  padding: 6px 6px 6px 14px;
  border: 1px solid var(--ink-12);
  border-radius: var(--r-pill);
  background: var(--white);
  box-shadow: var(--shadow-xs);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.blog-search:focus-within {
  border-color: var(--bridge);
  box-shadow: 0 0 0 3px rgba(42, 122, 75, 0.14);
}

.blog-search > svg {
  flex: none;
  color: var(--ink-55);
}

.blog-search input {
  flex: 1;
  min-width: 0;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.9375rem;
}

.blog-search input:focus {
  outline: none;
}

.blog-search .btn {
  flex: none;
  min-height: 40px;
  padding: 9px 20px;
  border-radius: var(--r-pill);
  font-size: 0.875rem;
}

/* --------------------------------------------------------------------------
   Filters
   -------------------------------------------------------------------------- */

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 clamp(24px, 3vw, 36px);
  padding: 0;
  list-style: none;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 7px 14px;
  border: 1px solid var(--ink-12);
  border-radius: var(--r-pill);
  background: var(--white);
  color: var(--ink-70);
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}

.filter-chip:hover {
  border-color: var(--bridge);
  color: var(--bridge);
}

.filter-chip.is-active {
  border-color: var(--bridge);
  background: var(--bridge);
  color: #fff;
  font-weight: 600;
}

.filter-chip span {
  min-width: 18px;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  background: var(--ink-08);
  color: var(--ink-70);
  font-size: 0.6875rem;
  font-weight: 700;
  text-align: center;
}

.filter-chip.is-active span {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.blog-result-note {
  margin: 0 0 22px;
  padding: 12px 16px;
  border-left: 3px solid var(--bridge);
  border-radius: 0 var(--r) var(--r) 0;
  background: var(--bridge-wash);
  font-size: 0.875rem;
}

.blog-result-note a {
  color: var(--bridge);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Post grid + cards
   -------------------------------------------------------------------------- */

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

.post-grid--compact {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr));
}

.post-card {
  position: relative;
  display: flex;
  border: 1px solid var(--ink-08);
  border-radius: var(--r-md);
  background: var(--white);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: transform 0.24s var(--ease-soft), box-shadow 0.24s ease, border-color 0.24s ease;
}

.post-card:hover {
  transform: translateY(-3px);
  border-color: rgba(42, 122, 75, 0.28);
  box-shadow: var(--shadow-md);
}

.post-card__link {
  display: flex;
  flex-direction: column;
  width: 100%;
  color: inherit;
  text-decoration: none;
}

.post-card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--cream-deep);
  overflow: hidden;
}

.post-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease-soft);
}

.post-card:hover .post-card__media img {
  transform: scale(1.035);
}

.post-card__media--empty {
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(340px 190px at 50% 118%, rgba(233, 168, 62, 0.18), transparent 70%),
    var(--cream-deep);
}

.post-card__media--empty svg {
  width: min(300px, 88%);
  height: auto;
  color: var(--gold-deep);
  opacity: 0.62;
}

.post-card__media--empty .bridge-arc {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.post-card__media--empty .bridge-arc--rail {
  stroke-width: 1.2;
  opacity: 0.55;
}

.post-card__media--empty .bridge-arc--arch {
  stroke-width: 2.6;
}

.post-card__media--empty .bridge-structure {
  fill: none;
  stroke: currentColor;
  stroke-width: 0.9;
  stroke-linecap: round;
  opacity: 0.45;
}

.post-card__media--empty .bridge-abutment {
  stroke-width: 2.2;
  opacity: 0.7;
}

.post-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 18px 20px 20px;
}

.post-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--ink-55);
  font-size: 0.75rem;
}

.post-card__meta time {
  font-weight: 500;
}

.post-card__title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 1rem + 0.35vw, 1.3rem);
  font-weight: 600;
  line-height: 1.28;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

.post-card__excerpt {
  margin: 0 0 16px;
  color: var(--ink-70);
  font-size: 0.9rem;
  line-height: 1.62;
}

.post-card__more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  color: var(--bridge);
  font-size: 0.8125rem;
  font-weight: 600;
}

.post-card__more svg {
  transition: transform 0.2s var(--ease-out);
}

.post-card:hover .post-card__more svg {
  transform: translateX(3px);
}

/* Featured card spans two columns on wide screens */
@media (min-width: 900px) {
  .post-card--featured {
    grid-column: span 2;
  }

  .post-card--featured .post-card__link {
    flex-direction: row;
    align-items: stretch;
  }

  .post-card--featured .post-card__media {
    flex: 0 0 48%;
    /* Fill the card's height so the photo matches the text column beside it.
       A fixed aspect ratio left the featured card shorter than its neighbours. */
    aspect-ratio: auto;
    align-self: stretch;
    min-height: 300px;
  }

  .post-card--featured .post-card__body {
    flex: 1 1 52%;
    justify-content: center;
    padding: 28px 30px;
  }

  .post-card--featured .post-card__title {
    font-size: clamp(1.35rem, 1.1rem + 0.7vw, 1.7rem);
  }

  .post-card--featured .post-card__excerpt {
    font-size: 0.9375rem;
  }
}

/* --------------------------------------------------------------------------
   Pagination
   -------------------------------------------------------------------------- */

.pager {
  margin-top: clamp(30px, 4vw, 48px);
}

.pager ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pager a,
.pager span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--ink-12);
  border-radius: var(--r);
  background: var(--white);
  color: var(--ink-70);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
}

.pager a:hover {
  border-color: var(--bridge);
  color: var(--bridge);
}

.pager span[aria-current] {
  border-color: var(--bridge);
  background: var(--bridge);
  color: #fff;
}

.pager .is-gap {
  border: 0;
  background: none;
  color: var(--ink-55);
}

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

.blog-empty {
  padding: clamp(44px, 6vw, 72px) 24px;
  border: 1px dashed var(--ink-12);
  border-radius: var(--r-md);
  background: var(--white);
  text-align: center;
}

.blog-empty h2 {
  margin: 0 0 8px;
  font-size: clamp(1.2rem, 1rem + 0.6vw, 1.5rem);
}

.blog-empty p {
  margin: 0 auto 18px;
  max-width: 52ch;
  color: var(--ink-70);
}

/* --------------------------------------------------------------------------
   Single post
   -------------------------------------------------------------------------- */

.post-header {
  padding-block: clamp(40px, 5vw, 68px) clamp(24px, 3vw, 36px);
  background: var(--cream);
}

.post-header__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin: 0 0 14px;
  color: var(--ink-55);
  font-size: 0.8125rem;
}

.post-header h1 {
  margin: 0;
  font-size: clamp(1.9rem, 1.4rem + 2vw, 3rem);
  line-height: 1.12;
  letter-spacing: -0.022em;
  text-wrap: balance;
  max-width: 24ch;
}

.post-header__excerpt {
  max-width: 62ch;
  margin: 18px 0 0;
  color: var(--ink-70);
  font-size: var(--fs-lead);
  line-height: 1.6;
}

.post-header__byline {
  margin: 18px 0 0;
  color: var(--ink-55);
  font-size: 0.8125rem;
  font-weight: 500;
}

.post-cover {
  margin: 0;
  padding-block: clamp(20px, 3vw, 32px) 0;
  background: var(--cream);
}

.post-cover img {
  width: 100%;
  max-height: 520px;
  object-fit: cover;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.post-layout {
  display: grid;
  gap: clamp(28px, 4vw, 56px);
  grid-template-columns: 210px minmax(0, 1fr);
  align-items: start;
  padding-block: clamp(32px, 4vw, 52px) clamp(40px, 5vw, 64px);
}

.post-layout--plain {
  grid-template-columns: minmax(0, 1fr);
  max-width: 760px;
  margin-inline: auto;
}

.post-aside {
  position: sticky;
  top: calc(var(--header-h-stuck) + 24px);
}

.post-toc {
  padding: 16px 18px;
  border: 1px solid var(--ink-08);
  border-radius: var(--r-md);
  background: var(--white);
}

.post-toc h2 {
  margin: 0 0 10px;
  color: var(--ink-55);
  font-family: var(--font-body);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.post-toc ol {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: toc;
}

.post-toc li {
  counter-increment: toc;
  font-size: 0.8125rem;
  line-height: 1.45;
}

.post-toc__l3 {
  padding-left: 14px;
}

.post-toc a {
  display: block;
  padding-block: 3px;
  color: var(--ink-70);
  text-decoration: none;
}

.post-toc a:hover {
  color: var(--bridge);
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Prose
   -------------------------------------------------------------------------- */

.prose {
  max-width: 68ch;
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--ink-80);
}

.prose > *:first-child {
  margin-top: 0;
}

.prose h2 {
  margin: 2.1em 0 0.6em;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 1.15rem + 0.8vw, 1.75rem);
  font-weight: 600;
  line-height: 1.24;
  letter-spacing: -0.015em;
  color: var(--ink);
  scroll-margin-top: calc(var(--header-h-stuck) + 28px);
}

.prose h3 {
  margin: 1.8em 0 0.5em;
  font-family: var(--font-display);
  font-size: clamp(1.12rem, 1rem + 0.45vw, 1.3rem);
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  scroll-margin-top: calc(var(--header-h-stuck) + 28px);
}

.prose h4 {
  margin: 1.6em 0 0.4em;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

.prose p {
  margin: 0 0 1.15em;
}

.prose a {
  color: var(--bridge);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

.prose a:hover {
  color: var(--bridge-dark);
  text-decoration-thickness: 2px;
}

.prose strong {
  color: var(--ink);
  font-weight: 600;
}

.prose ul,
.prose ol {
  margin: 0 0 1.2em;
  padding-left: 1.35em;
}

.prose li {
  margin-bottom: 0.45em;
  padding-left: 0.2em;
}

.prose li::marker {
  color: var(--bridge);
}

.prose blockquote {
  margin: 1.6em 0;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--gold);
  color: var(--ink-70);
  font-family: var(--font-display);
  font-size: 1.1em;
  font-style: italic;
  line-height: 1.55;
}

.prose blockquote p:last-child {
  margin-bottom: 0;
}

.prose hr {
  margin: 2.2em 0;
  border: 0;
  border-top: 1px solid var(--ink-12);
}

.prose img {
  width: 100%;
  height: auto;
  margin: 1.6em 0;
  border-radius: var(--r-md);
}

.prose figure {
  margin: 1.8em 0;
}

.prose figcaption {
  margin-top: 8px;
  color: var(--ink-55);
  font-size: 0.8125rem;
  text-align: center;
}

.prose code {
  padding: 2px 5px;
  border-radius: var(--r-sm);
  background: var(--ink-04);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.875em;
}

.prose pre {
  margin: 1.5em 0;
  padding: 16px 18px;
  border-radius: var(--r-md);
  background: var(--ink);
  color: var(--cream);
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.6;
}

.prose pre code {
  padding: 0;
  background: none;
  color: inherit;
}

.prose table {
  width: 100%;
  margin: 1.6em 0;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.prose th,
.prose td {
  padding: 10px 12px;
  border: 1px solid var(--ink-12);
  text-align: left;
  vertical-align: top;
}

.prose th {
  background: var(--cream-deep);
  font-weight: 600;
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   Post footer bits
   -------------------------------------------------------------------------- */

.post-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 2.2em;
  padding-top: 1.4em;
  border-top: 1px solid var(--ink-08);
  font-size: 0.8125rem;
  color: var(--ink-55);
}

.post-disclaimer {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  margin-top: 1.8em;
  padding: 15px 17px;
  border: 1px solid var(--ink-08);
  border-radius: var(--r-md);
  background: var(--cream);
  color: var(--ink-70);
  font-size: 0.875rem;
  line-height: 1.6;
}

.post-disclaimer svg {
  flex: none;
  margin-top: 2px;
  color: var(--bridge);
}

.post-disclaimer p {
  margin: 0;
}

.post-disclaimer a {
  color: var(--bridge);
  font-weight: 600;
}

.post-back {
  margin-top: 1.8em;
}

/* --------------------------------------------------------------------------
   CTA band
   -------------------------------------------------------------------------- */

.blog-cta__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: clamp(24px, 4vw, 48px);
}

.blog-cta__inner > div:first-child {
  flex: 1 1 380px;
  max-width: 620px;
}

.blog-cta h2 {
  color: var(--cream);
  margin-top: 8px;
}

.blog-cta .lede {
  color: rgba(251, 247, 240, 0.8);
  margin-top: 10px;
}

.blog-cta__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex: none;
}

/* --------------------------------------------------------------------------
   Home teaser
   -------------------------------------------------------------------------- */

.section-head--split {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  max-width: none;
}

.section-head--split h2 {
  margin-top: 6px;
}

.blog-teaser .post-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
}

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

@media (max-width: 899px) {
  .post-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .post-aside {
    position: static;
    order: -1;
  }

  .post-toc ol {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

@media (max-width: 767px) {
  .blog-hero {
    padding-block: 36px 28px;
  }

  .blog-hero h1 {
    max-width: none;
  }

  .blog-search {
    max-width: none;
  }

  .post-card--featured .post-card__link {
    flex-direction: column;
  }

  .post-header h1 {
    max-width: none;
  }

  .post-cover img {
    border-radius: var(--r-md);
  }

  .blog-cta__actions {
    width: 100%;
  }

  .blog-cta__actions .btn {
    flex: 1 1 auto;
  }
}

@media (max-width: 479px) {
  .blog-search {
    flex-wrap: wrap;
    padding: 10px;
    border-radius: var(--r-md);
  }

  .blog-search > svg {
    display: none;
  }

  .blog-search input {
    flex: 1 1 100%;
    padding: 4px 6px;
  }

  .blog-search .btn {
    flex: 1 1 100%;
    border-radius: var(--r-sm);
  }

  .filter-chip {
    font-size: 0.75rem;
    padding: 6px 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .post-card,
  .post-card__media img,
  .post-card__more svg {
    transition: none;
  }

  .post-card:hover {
    transform: none;
  }

  .post-card:hover .post-card__media img {
    transform: none;
  }
}
