/**
 * Blog Archive — News / Posts Archive Styles
 *
 * Targets the WordPress posts archive (/news), category, and tag pages
 * rendered by Astra's blog layout. Overrides Astra defaults to match
 * the #news section design from the RGS mockup.
 *
 * @package RobotGirl Studios
 */

/* ── Section Container ────────────────────────────────────────────
   Dark background with halftone dot overlay (injected via JS using
   the global .halftone-light class). Uses .blog and .archive
   (category/tag) body classes. */
.blog .site-content,
.archive.category .site-content,
.archive.tag .site-content {
  background: var(--ink);
  position: relative;
  overflow: hidden;
}

/* The global .halftone-light::before uses z-index: -1 (behind bg),
   so we override to 0 so dots render above the dark --ink background
   but below positioned content (like .ast-container at z-index: 1). */
.blog .site-content.halftone-light::before,
.archive.category .site-content.halftone-light::before,
.archive.tag .site-content.halftone-light::before {
  z-index: 0;
}

/* Force full width on the container, primary area, and
   site-main so the CSS Grid has room to lay out three columns. */
.blog .ast-container,
.archive.category .ast-container,
.archive.tag .ast-container {
  position: relative;
  z-index: 1;
  max-width: 1320px;
  width: 100%;
}

.blog #primary,
.archive.category #primary,
.archive.tag #primary {
  width: 100%;
  max-width: 100%;
  margin: 1.5rem 0 5rem;
}

.blog .site-main,
.archive.category .site-main,
.archive.tag .site-main {
  width: 100%;
  max-width: 100%;
}

/* ── Breadcrumbs ─────────────────────────────────────────────────
   Astra renders breadcrumbs inside .ast-breadcrumbs-wrapper.
   Default colors (dark text on white) are invisible against the
   dark --ink background — override to light colors. */
.blog .ast-breadcrumbs-wrapper,
.archive.category .ast-breadcrumbs-wrapper,
.archive.tag .ast-breadcrumbs-wrapper {
  margin: 0 0 1em;
  padding: 0;
  color: #777;
}

.blog .ast-breadcrumbs-wrapper .trail-items,
.archive.category .ast-breadcrumbs-wrapper .trail-items,
.archive.tag .ast-breadcrumbs-wrapper .trail-items {
  list-style: none;
  margin: 0;
  padding: 0;
}

.blog .ast-breadcrumbs-wrapper .ast-breadcrumbs {
  margin: 0 0 1em !important;
  font-weight: 600;
}

.blog .ast-breadcrumbs-wrapper .trail-items li,
.archive.category .ast-breadcrumbs-wrapper .trail-items li,
.archive.tag .ast-breadcrumbs-wrapper .trail-items li {
  display: inline-block;
  font-size: 0.92em;
}

.blog .ast-breadcrumbs-wrapper a,
.archive.category .ast-breadcrumbs-wrapper a,
.archive.tag .ast-breadcrumbs-wrapper a {
  font-family: "Montserrat", sans-serif;
  font-weight: 600;
  font-size: 0.92em;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mid-light);
  text-decoration: none;
  transition: color 0.15s;
}

.blog .ast-breadcrumbs-wrapper a:hover,
.archive.category .ast-breadcrumbs-wrapper a:hover,
.archive.tag .ast-breadcrumbs-wrapper a:hover {
  color: var(--accent);
}

.blog .ast-breadcrumbs-wrapper .trail-end,
.archive.category .ast-breadcrumbs-wrapper .trail-end,
.archive.tag .ast-breadcrumbs-wrapper .trail-end {
  font-family: "Montserrat", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
}

.blog .ast-breadcrumbs-wrapper .trail-items li::after,
.archive.category .ast-breadcrumbs-wrapper .trail-items li::after,
.archive.tag .ast-breadcrumbs-wrapper .trail-items li::after {
  content: "/";
  color: var(--mid);
  padding: 0 0.4em;
}

.blog .ast-breadcrumbs-wrapper .trail-items li:last-child::after,
.archive.category .ast-breadcrumbs-wrapper .trail-items li:last-child::after,
.archive.tag .ast-breadcrumbs-wrapper .trail-items li:last-child::after {
  content: none;
}

/* ── Archive Header / Page Title ─────────────────────────────────
   Style the existing archive title area to look like the mockup's
   .section-header (overline + heading).

   Astra uses .ast-archive-title for the heading element (h1),
   wrapped in .ast-archive-description. Some versions emit
   .page-title instead — we target both. */
.blog .ast-archive-description,
.archive.category .ast-archive-description,
.archive.tag .ast-archive-description {
  text-align: center;
  margin-bottom: 2.5rem;
  padding: 0;
  background: none;
  border: none;
}

/* Shared heading styles — both .ast-archive-title and .page-title
   are used by different Astra versions/contexts. */
.blog .ast-archive-description .page-title,
.blog .ast-archive-description .ast-archive-title,
.archive.category .ast-archive-description .page-title,
.archive.category .ast-archive-description .ast-archive-title,
.archive.tag .ast-archive-description .page-title,
.archive.tag .ast-archive-description .ast-archive-title {
  font-family: "Montserrat", sans-serif;
  font-weight: 900;
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 0.9;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  margin-bottom: 0;
  padding-bottom: 0;
  color: #fff;
}

/* Decorative accent bar under the heading */
.blog .ast-archive-description .page-title::after,
.blog .ast-archive-description .ast-archive-title::after,
.archive.category .ast-archive-description .page-title::after,
.archive.category .ast-archive-description .ast-archive-title::after,
.archive.tag .ast-archive-description .page-title::after,
.archive.tag .ast-archive-description .ast-archive-title::after {
  content: "";
  display: block;
  width: 60px;
  height: 5px;
  background: var(--accent);
  margin: 0.7rem auto 0;
}

/* ── Grid Layout ─────────────────────────────────────────────────
   Override Astra's flexbox .ast-row with CSS Grid for the 3-column
   card layout matching the mockup's .news-grid. */
.blog .ast-row,
.archive.category .ast-row,
.archive.tag .ast-row {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  position: relative;
  z-index: 2;
  /* Remove Astra's default negative margins that break the grid. */
  margin-left: 0 !important;
  margin-right: 0 !important;
  /* Remove flex fallback. */
  flex-wrap: unset !important;
}

/* ── Post Cards ──────────────────────────────────────────────────
   Transform Astra's .ast-article-inner into the mockup's .news-card. */

/* Reset Astra's article spacing
   ⚠ Astra outputs dynamic inline CSS with:
       .ast-blog-layout-4-grid .ast-article-post { width: 33.33%; }
   We must target the same combined selector with !important. */
.blog .ast-article-post,
.archive.category .ast-article-post,
.archive.tag .ast-article-post,
.ast-blog-layout-4-grid .ast-article-post {
  padding: 0 !important;
  margin-bottom: 0 !important;
  background: none !important;
  border: none !important;
  width: 100% !important;
  max-width: 100%;
}

/* The card inner wrapper */
.blog .ast-article-inner,
.archive.category .ast-article-inner,
.archive.tag .ast-article-inner {
  background: #1a1a1a;
  border: 3px solid #2e2e2e;
  box-shadow: 4px 4px 0 var(--accent);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
  width: 100%;
  height: 100%;
  padding: 0 !important;
  border-radius: 0 !important;
  cursor: pointer;
}

.blog .ast-article-inner:hover,
.archive.category .ast-article-inner:hover,
.archive.tag .ast-article-inner:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--accent);
}

/* The post-content div inside the card
   .ast-grid-common-col adds 20px padding — remove it so content
   spans the full card width. */
.blog .post-content,
.archive.category .post-content,
.archive.tag .post-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0 !important;
  background: none !important;
  width: 100%;
  max-width: 100%;
}

/* ── Featured Image ──────────────────────────────────────────────
   16:9 aspect ratio, overflow hidden, border-bottom, hover scale. */
.blog .ast-blog-featured-section.post-thumb,
.archive.category .ast-blog-featured-section.post-thumb,
.archive.tag .ast-blog-featured-section.post-thumb {
  margin: 0 !important;
  padding: 0 !important;
  width: 100%;
  overflow: hidden;
  border-bottom: 2px solid #2e2e2e;
  display: block;
}

.blog .post-thumb-img-content.post-thumb,
.archive.category .post-thumb-img-content.post-thumb,
.archive.tag .post-thumb-img-content.post-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  margin: 0 !important;
}

.blog .post-thumb-img-content.post-thumb img,
.archive.category .post-thumb-img-content.post-thumb img,
.archive.tag .post-thumb-img-content.post-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: none !important;
}

/* Remove Astra's padding on the featured section link */
.blog .post-thumb-img-content a,
.archive.category .post-thumb-img-content a,
.archive.tag .post-thumb-img-content a {
  display: block;
  width: 100%;
  height: 100%;
  line-height: 0;
}

/* ── Post Body (content area below thumbnail) ───────────────────
   All text content spans get consistent padding. */
.blog .ast-blog-single-element,
.archive.category .ast-blog-single-element,
.archive.tag .ast-blog-single-element {
  margin: 0 !important;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

/* First text element below thumbnail gets top padding. */
.blog .cat-links,
.archive.category .cat-links,
.archive.tag .cat-links {
  padding-top: 1.1rem;
}

/* ── Category Tags ───────────────────────────────────────────────
   Style like the mockup's inline category appearance. */
.blog .cat-links a,
.archive.category .cat-links a,
.archive.tag .cat-links a {
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
}

.blog .cat-links a:hover,
.archive.category .cat-links a:hover,
.archive.tag .cat-links a:hover {
  color: var(--accent);
  filter: brightness(1.2);
}

/* ── Post Title ──────────────────────────────────────────────────
   White, bigger, with a link styled to match the mockup's .news-title. */
.blog .entry-title,
.archive.category .entry-title,
.archive.tag .entry-title {
  font-family: "Montserrat", sans-serif;
  font-weight: 900;
  font-size: 1.15rem;
  line-height: 1.1;
  color: #fff;
  margin: 0.4rem 0 0.5rem !important;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.blog .entry-title a,
.archive.category .entry-title a,
.archive.tag .entry-title a {
  color: #fff;
  text-decoration: none;
  transition: color 0.15s;
}

.blog .entry-title a:hover,
.archive.category .entry-title a:hover,
.archive.tag .entry-title a:hover {
  color: var(--accent);
}

/* ── Post Meta ───────────────────────────────────────────────────
   Author + date row, styled like the mockup's .news-date. */
.blog .entry-header.ast-blog-single-element,
.archive.category .entry-header.ast-blog-single-element,
.archive.tag .entry-header.ast-blog-single-element {
  padding-left: 1.25rem;
  padding-right: 1.25rem;
  margin-bottom: 0 !important;
}

.blog .entry-meta,
.archive.category .entry-meta,
.archive.tag .entry-meta {
  font-family: "Montserrat", sans-serif;
  font-weight: 600;
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--mid);
  margin: 0 !important;
}

.blog .entry-meta a,
.archive.category .entry-meta a,
.archive.tag .entry-meta a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
}

.blog .entry-meta a:hover,
.archive.category .entry-meta a:hover,
.archive.tag .entry-meta a:hover {
  filter: brightness(1.2);
}

.blog .entry-meta .posted-on .published,
.archive.category .entry-meta .posted-on .published,
.archive.tag .entry-meta .posted-on .published {
  color: var(--accent);
}

.blog .entry-meta .posted-by .author-name,
.archive.category .entry-meta .posted-by .author-name,
.archive.tag .entry-meta .posted-by .author-name {
  color: var(--mid-light);
}

/* ── Excerpt ─────────────────────────────────────────────────────
   Montserrat body copy in mid-light, matching .news-excerpt. */
.blog .ast-excerpt-container,
.archive.category .ast-excerpt-container,
.archive.tag .ast-excerpt-container {
  font-family: "Montserrat", sans-serif;
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--mid-light);
  line-height: 1.65;
  margin: 0.5rem 0 0 !important;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
  flex: 1;
}

.blog .ast-excerpt-container p,
.archive.category .ast-excerpt-container p,
.archive.tag .ast-excerpt-container p {
  margin: 0 !important;
}

/* ── Read More Link ──────────────────────────────────────────────
   A real "Read Post →" <a> link is appended to the excerpt via the
   `the_excerpt` filter in functions.php (rgs_append_read_post_link).
   This replaces the old CSS ::after pseudo-element with a genuine,
   keyboard-accessible link. Styled below via .rgs-read-post-link. */

/* Hide the empty .entry-content.clear that Astra outputs after excerpt. */
.blog .entry-content.clear,
.archive.category .entry-content.clear,
.archive.tag .entry-content.clear {
  display: none !important;
}

/* Pad the bottom of the post content to make room */
.blog .post-content,
.archive.category .post-content,
.archive.tag .post-content {
  padding-bottom: 1.25rem !important;
}

/* Style the real "Read Post →" link injected via the_excerpt filter. */
.blog .rgs-read-post-link,
.archive.category .rgs-read-post-link,
.archive.tag .rgs-read-post-link {
  display: inline-block;
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
  margin-top: 0.9rem;
  transition: color 0.15s;
  cursor: pointer;
}

.blog .rgs-read-post-link:hover,
.archive.category .rgs-read-post-link:hover,
.archive.tag .rgs-read-post-link:hover {
  color: var(--accent);
  filter: brightness(1.2);
}

.blog .rgs-read-post-link:focus-visible,
.archive.category .rgs-read-post-link:focus-visible,
.archive.tag .rgs-read-post-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Pagination ──────────────────────────────────────────────────
   Dark-themed pagination consistent with the site design. */

.blog .ast-pagination,
.archive.category .ast-pagination,
.archive.tag .ast-pagination {
  position: relative;
  z-index: 2;
  padding-top: 2.5rem;
}

/* Override Astra's pagination link styles */
.blog .ast-pagination .page-numbers,
.archive.category .ast-pagination .page-numbers,
.archive.tag .ast-pagination .page-numbers {
  font-family: "Montserrat", sans-serif;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mid-light);
  background: transparent;
  border: 2px solid #2e2e2e;
  padding: 0.5em 1.2em;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s;
  border-radius: 0;
  line-height: inherit;
}

.blog .ast-pagination .page-numbers:hover,
.archive.category .ast-pagination .page-numbers:hover,
.archive.tag .ast-pagination .page-numbers:hover {
  background: transparent;
  color: var(--paper-light);
  border-color: var(--mid-light);
}

.blog .ast-pagination .page-numbers.current,
.archive.category .ast-pagination .page-numbers.current,
.archive.tag .ast-pagination .page-numbers.current {
  background: var(--accent);
  color: var(--ink);
  border-color: var(--accent);
}

.blog .ast-pagination .page-numbers.current:hover,
.archive.category .ast-pagination .page-numbers.current:hover,
.archive.tag .ast-pagination .page-numbers.current:hover {
  background: var(--accent);
  color: var(--ink);
  border-color: var(--accent);
}

.blog .ast-pagination .prev.page-numbers,
.blog .ast-pagination .next.page-numbers,
.archive.category .ast-pagination .prev.page-numbers,
.archive.category .ast-pagination .next.page-numbers,
.archive.tag .ast-pagination .prev.page-numbers,
.archive.tag .ast-pagination .next.page-numbers {
  border: 2px solid #2e2e2e;
}

.blog .ast-pagination .prev.page-numbers:hover,
.blog .ast-pagination .next.page-numbers:hover,
.archive.category .ast-pagination .prev.page-numbers:hover,
.archive.category .ast-pagination .next.page-numbers:hover,
.archive.tag .ast-pagination .prev.page-numbers:hover,
.archive.tag .ast-pagination .next.page-numbers:hover {
  border-color: var(--accent);
}

/* ── No Featured Image Fallback ──────────────────────────────────
   When a post lacks a featured image, the thumbnail area is simply
   absent. Ensure the card still looks correct without it. */
.blog .ast-blog-featured-section.post-thumb:empty,
.archive.category .ast-blog-featured-section.post-thumb:empty,
.archive.tag .ast-blog-featured-section.post-thumb:empty {
  display: none;
}

/* ── Sticky Posts ────────────────────────────────────────────────
   Give sticky posts a subtle visual cue. */
.blog .sticky .ast-article-inner,
.archive.category .sticky .ast-article-inner,
.archive.tag .sticky .ast-article-inner {
  border-color: var(--accent);
  border-width: 2px;
}

/* ── Responsive: ≤ 900px — 2 columns ─────────────────────────── */
@media (max-width: 900px) {
  .blog .ast-row,
  .archive.category .ast-row,
  .archive.tag .ast-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Responsive: ≤ 768px — 1 column ──────────────────────────── */
@media (max-width: 768px) {
  .blog .ast-row,
  .archive.category .ast-row,
  .archive.tag .ast-row {
    grid-template-columns: 1fr;
  }

  .blog .ast-archive-description .page-title,
  .blog .ast-archive-description .ast-archive-title,
  .archive.category .ast-archive-description .page-title,
  .archive.category .ast-archive-description .ast-archive-title,
  .archive.tag .ast-archive-description .page-title,
  .archive.tag .ast-archive-description .ast-archive-title {
    font-size: clamp(1.4rem, 5vw, 2rem);
  }
}

@media (max-width: 480px) {
  .blog .ast-archive-description,
  .archive.category .ast-archive-description,
  .archive.tag .ast-archive-description {
    margin-bottom: 0.85rem;
  }
}
