/* ===========================================================================
   BLOG LISTING  ·  /blog.html
   ---------------------------------------------------------------------------
   This is the CANONICAL, indexed listing — the one in sitemap.xml and the one
   crawlers that do not execute JavaScript can actually read (the in-app /blogs
   route renders from an empty <div id="root">). So the good design belongs
   here, not only in the React listing.

   Ported from src/Pages/Blog/styles.js so the two listings read as one product:
   the app's "Temple at Dawn" palette — royal violet and sacred gold on warm
   sandalwood — with a serif display face for headlines.

   Chrome, tokens and both themes come from site-pages.css; this file is only
   the listing's own layout.
   =========================================================================== */

/* Tokens alias the site-wide ones from site-pages.css, so the listing follows
   the same light / aurora switch as every other page. The names below are
   kept because the rules under them were written against them. */
.blogs-page {
  --ink: var(--text-color);
  --ink-muted: var(--text-muted);
  --ink-faint: var(--text-faint);
  --violet: var(--primary-color);
  --violet-strong: var(--card-title);
  --twilight: #2e2160;
  --gold: var(--accent-gold);
  --gold-bright: #f4c95b;
  --surface: var(--card-bg);
  --edge: var(--card-border);
  --edge-strong: var(--card-border-strong);
  --elev-1: var(--card-shadow);
  --elev-2: var(--card-shadow);
  --elev-3: var(--card-shadow);
  --serif: var(--font-display);
  --hero-fade: 250, 245, 236;
  --chip-bg: rgba(255, 255, 255, 0.7);
  --field-bg: rgba(255, 255, 255, 0.9);
  --pill-bg: rgba(232, 163, 61, 0.2);
  --pill-edge: rgba(232, 163, 61, 0.38);

  color: var(--ink);
}
:root[data-theme="aurora"] .blogs-page {
  --twilight: #141225;
  --hero-fade: 20, 22, 36;
  --chip-bg: rgba(255, 255, 255, 0.06);
  --field-bg: rgba(255, 255, 255, 0.06);
  --pill-bg: rgba(255, 212, 154, 0.16);
  --pill-edge: rgba(255, 212, 154, 0.35);
}

main.blogs-page {
  padding-top: clamp(24px, 3.5vw, 40px);
  display: flex;
  flex-direction: column;
  gap: clamp(24px, 3.5vw, 38px);
}

/* ---- Masthead ----------------------------------------------------------- */

.blogs-masthead {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 8px;
}

.blogs-masthead__eyebrow {
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.blogs-masthead__title {
  font-family: var(--serif);
  font-size: clamp(30px, 4.4vw, 52px);
  line-height: 1.1;
  font-weight: 600;
  margin: 0 auto;
  max-width: 22ch;
  /* Evens the two lines instead of leaving one word stranded. Ignored by
     browsers that do not support it, which just get the default wrap. */
  text-wrap: balance;
  color: var(--violet-strong);
  text-transform: none;
}

.blogs-masthead__subtitle {
  margin: 0 auto;
  max-width: 60ch;
  font-size: clamp(15px, 1.6vw, 18px);
  line-height: 1.65;
  color: var(--ink-muted);
}

/* ---- Featured hero ------------------------------------------------------ */

.hero-card.blogs-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: stretch;
  padding: 0;
  overflow: hidden;
  border-radius: 28px;
  border: 1px solid var(--edge);
  box-shadow: var(--elev-2);
  background: var(--surface);
  color: var(--ink);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.hero-card.blogs-hero:hover {
  transform: translateY(-3px);
  box-shadow: var(--elev-3);
}

.blogs-hero__inner {
  position: relative;
  z-index: 2;
  padding: clamp(24px, 4vw, 52px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
}

/* The post artwork, dissolved into the copy panel. It is a real element rather
   than a pseudo-element because the generator owns everything between the
   <section> tags but not the tag itself, so the image URL has to be emitted
   as part of the replaced content. */
.blogs-hero__art {
  position: relative;
  min-height: 260px;
  background-size: cover;
  background-position: center;
  background-color: var(--twilight);
}

/* Must start fully opaque — anything less leaves a hard vertical seam. */
.blogs-hero__art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(var(--hero-fade), 1) 0%,
    rgba(var(--hero-fade), 0.72) 18%,
    rgba(var(--hero-fade), 0) 58%
  );
}

.blogs-hero__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--ink-muted);
}

.meta-label {
  font-size: 14px;
}

.meta-label--accent {
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  letter-spacing: 0.04em;
  background: var(--pill-bg);
  border: 1px solid var(--pill-edge);
  color: var(--ink);
}

.meta-dot {
  color: var(--ink-faint);
}

.blogs-hero__title {
  font-family: var(--serif);
  font-size: clamp(26px, 3.4vw, 42px);
  font-weight: 600;
  line-height: 1.14;
  margin: 0;
  color: var(--ink);
  text-transform: none;
}

/* Scoped with .blogs-page for specificity over the shared card rules. */
.blogs-page .blogs-hero__subtitle {
  font-size: clamp(15px, 1.6vw, 18px);
  line-height: 1.65;
  margin: 0;
  color: var(--ink-muted);
  max-width: 52ch;
}

.blogs-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
}

.btn-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 12px 26px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.btn-pill:hover {
  transform: translateY(-2px);
}

.btn-pill:focus-visible {
  outline: 3px solid var(--violet);
  outline-offset: 3px;
}

.btn-pill--primary {
  background: var(--grad-brand);
  color: var(--on-accent);
  box-shadow: var(--glow);
}

.btn-pill--ghost {
  background: var(--chip-bg);
  border-color: var(--edge-strong);
  color: var(--ink);
}

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

.topics-panel {
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 28px;
  box-shadow: var(--elev-1);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.topics-panel__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.topic-chip {
  border-radius: 999px;
  border: 1px solid var(--edge);
  padding: 7px 16px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  background: var(--chip-bg);
  color: var(--ink);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.topic-chip:hover {
  border-color: var(--edge-strong);
}

.topic-chip:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 2px;
}

.topic-chip--active {
  background: var(--grad-brand);
  border-color: transparent;
  color: var(--on-accent);
  font-weight: 600;
}

.topics-panel__search {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.search-field {
  flex: 1;
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-radius: 20px;
  border: 1px solid var(--edge);
  background: var(--field-bg);
}

.search-field:focus-within {
  border-color: var(--edge-strong);
}

.search-field__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

/* Magnifier drawn in CSS — no extra request for one 18px glyph. */
.search-lens {
  position: relative;
  display: block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--ink-faint);
  border-radius: 50%;
}

.search-lens::after {
  content: "";
  position: absolute;
  right: -5px;
  bottom: -4px;
  width: 7px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink-faint);
  transform: rotate(45deg);
}

.search-field__input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
}

.search-field__input::placeholder {
  color: var(--ink-faint);
}

.blogs-count {
  margin: 0;
  font-size: 14px;
  color: var(--ink-muted);
  white-space: nowrap;
}

/* ---- Card grid ---------------------------------------------------------- */

.blogs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 24px;
}

.blog-card {
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--elev-1);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.blog-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--elev-3);
}

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

.blog-card__link:focus-visible {
  outline: 3px solid var(--violet);
  outline-offset: -3px;
  border-radius: 28px;
}

.blog-card__art {
  position: relative;
  height: 172px;
  background-color: var(--twilight);
}

.blog-card__art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(26, 19, 64, 0) 45%, rgba(26, 19, 64, 0.45) 100%);
}

.blog-card__content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.blog-card__pill {
  align-self: flex-start;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  letter-spacing: 0.04em;
  background: var(--pill-bg);
  border: 1px solid var(--pill-edge);
  color: var(--ink);
}

.blog-card__title {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
  color: var(--ink);
  text-transform: none;
}

.blog-card__excerpt {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink-muted);
  flex: 1;
}

.blog-card__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--ink-muted);
  border-top: 1px solid var(--divider);
  padding-top: 12px;
}

.blogs-empty {
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 28px;
  padding: 40px;
  text-align: center;
  color: var(--ink-muted);
}

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

@media (max-width: 860px) {
  .hero-card.blogs-hero {
    grid-template-columns: 1fr;
  }

  /* Art moves above the copy and the fade turns vertical. */
  .blogs-hero__art {
    order: -1;
    min-height: 200px;
  }

  .blogs-hero__art::after {
    background: linear-gradient(
      180deg,
      rgba(var(--hero-fade), 0) 35%,
      rgba(var(--hero-fade), 1) 100%
    );
  }
}

@media (max-width: 720px) {
  .blogs-grid {
    grid-template-columns: 1fr;
  }

  .topics-panel {
    padding: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-card.blogs-hero,
  .blog-card,
  .btn-pill {
    transition: none;
  }

  .hero-card.blogs-hero:hover,
  .blog-card:hover,
  .btn-pill:hover {
    transform: none;
  }
}
