/**
 * Blog: blog home, archives, search and single posts. Loaded only on those pages (inc/blog.php),
 * after agency.css. Post text styles (#post-content) stay in base.css.
 *
 * @package AngeloseGlobal
 */

/* Category chips as links */
.ag-chips--links { margin: 0 0 2rem; }
a.ag-chip { display: inline-flex; align-items: center; text-decoration: none; }
a.ag-chip[aria-current="page"] { background: hsl(var(--foreground)); border-color: hsl(var(--foreground)); color: hsl(var(--background)); }

/* Featured post */
.ag-post-feature { display: grid; gap: 1.75rem; margin-bottom: clamp(2.5rem, 5vw, 3.5rem); }
@media (min-width: 960px) { .ag-post-feature { grid-template-columns: 1.35fr 1fr; align-items: center; gap: 3rem; } }
.ag-post-feature__media { display: block; overflow: hidden; border: 1px solid hsl(var(--border)); border-radius: 1.1rem; box-shadow: var(--ag-shadow); }
.ag-post-feature__media img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; transition: transform 0.6s var(--ag-ease); }
.ag-post-feature__media:hover img { transform: scale(1.02); }
.ag-post-feature__body { display: grid; gap: 1rem; justify-items: start; }
.ag-post-feature__title { margin: 0; font-size: clamp(1.6rem, 3.2vw, 2.4rem); font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; }
.ag-post-feature__title a, .ag-post-card__title a { color: hsl(var(--foreground)); text-decoration: none; }
.ag-post-feature__title a:hover, .ag-post-card__title a:hover { color: var(--ag-emph); }
.ag-post-feature__excerpt { margin: 0; line-height: 1.7; color: hsl(var(--muted-foreground)); }

/* Byline (author photo, name, date, reading time) */
.ag-post-byline { display: flex; align-items: center; gap: 0.75rem; }
.ag-post-byline__avatar { width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; }
.ag-post-byline__name { display: block; font-weight: 600; color: hsl(var(--foreground)); }
.ag-post-byline__meta { display: block; font-size: 0.875rem; color: hsl(var(--muted-foreground)); }

/* Card grid */
.ag-post-grid { display: grid; gap: 1.75rem; }
@media (min-width: 700px) { .ag-post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .ag-post-grid { grid-template-columns: repeat(3, 1fr); gap: 2rem; } }
.ag-post-grid__ad { grid-column: 1 / -1; }
.ag-post-card { position: relative; display: flex; flex-direction: column; overflow: hidden; border: 1px solid hsl(var(--border)); border-radius: 1.1rem; background: hsl(var(--card)); transition: transform 0.35s var(--ag-ease), box-shadow 0.35s, border-color 0.35s; }
.ag-post-card:hover { transform: translateY(-4px); box-shadow: var(--ag-shadow); border-color: hsl(var(--primary) / 0.35); }
.ag-post-card__media { display: block; aspect-ratio: 16 / 10; overflow: hidden; border-bottom: 1px solid hsl(var(--border)); background: hsl(var(--muted)); }
.ag-post-card__media img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ag-ease); }
.ag-post-card:hover .ag-post-card__media img { transform: scale(1.03); }
.ag-post-card__body { display: flex; flex: 1; flex-direction: column; gap: 0.6rem; padding: 1.4rem 1.5rem 1.5rem; }
.ag-post-card__cat { margin: 0; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: hsl(var(--muted-foreground)); }
.ag-post-card__title { margin: 0; font-size: 1.2rem; font-weight: 700; line-height: 1.3; letter-spacing: -0.01em; }
/* The title link covers the whole card */
.ag-post-card__title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.ag-post-card:focus-within { outline: 3px solid var(--ag-accent); outline-offset: 3px; }
.ag-post-card__title a:focus-visible { outline: none; }
.ag-post-card__excerpt { margin: 0; font-size: 0.95rem; line-height: 1.6; color: hsl(var(--muted-foreground)); }
.ag-post-card__meta { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: auto 0 0; padding-top: 0.75rem; font-size: 0.85rem; color: hsl(var(--muted-foreground)); }

/* Pagination */
.ag-pagination { margin-top: clamp(2.5rem, 5vw, 3.5rem); }
.ag-pagination ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.ag-pagination .page-numbers { display: inline-flex; align-items: center; justify-content: center; min-width: 2.75rem; height: 2.75rem; padding: 0 1rem; border: 1px solid hsl(var(--border)); border-radius: 999px; color: hsl(var(--foreground)); font-weight: 500; text-decoration: none; transition: background-color 0.2s, border-color 0.2s; }
.ag-pagination a.page-numbers:hover { border-color: hsl(var(--foreground) / 0.4); }
.ag-pagination .page-numbers.current { background: hsl(var(--foreground)); border-color: hsl(var(--foreground)); color: hsl(var(--background)); }
.ag-pagination .page-numbers.dots { border-color: transparent; }

/* Empty state */
.ag-empty { display: grid; justify-items: center; gap: 1rem; padding: 3rem 1rem; text-align: center; color: hsl(var(--muted-foreground)); }
.ag-empty__title { margin: 0; font-size: 1.6rem; font-weight: 700; color: hsl(var(--foreground)); }
.ag-empty p { margin: 0; }

/* Newsletter band */
.ag-news { margin-top: var(--ag-space-section); padding-block: clamp(2.5rem, 5vw, 3.5rem); background: hsl(var(--muted) / 0.45); border-block: 1px solid hsl(var(--border)); }
.ag-news__inner { display: grid; gap: 1.5rem; align-items: center; }
@media (min-width: 900px) { .ag-news__inner { grid-template-columns: 1fr 1.2fr; gap: 3rem; } }
.ag-news__title { margin: 0 0 0.5rem; font-size: clamp(1.4rem, 2.6vw, 1.9rem); font-weight: 700; letter-spacing: -0.02em; color: hsl(var(--foreground)); }
.ag-news__text p { margin: 0; color: hsl(var(--muted-foreground)); line-height: 1.6; }
.ag-news__row { display: grid; gap: 0.6rem; }
@media (min-width: 560px) { .ag-news__row { grid-template-columns: 1fr 1.4fr auto; } }
.ag-news__row input { min-width: 0; padding: 0.8rem 1rem; border: 1px solid hsl(var(--border)); border-radius: var(--ag-field-radius); background: hsl(var(--background)); color: hsl(var(--foreground)); font-size: 1rem; }
.ag-news__row input:focus { outline: 3px solid var(--ag-accent); outline-offset: 1px; }
.ag-news .g-recaptcha { margin-top: 0.75rem; }
.ag-news__msg { margin: 0 0 0.75rem; padding: 0.75rem 1rem; border-radius: 0.6rem; font-weight: 500; }
.ag-news__msg--ok { background: hsl(142 70% 40% / 0.12); color: hsl(142 60% 28%); }
.ag-news__msg--err { background: hsl(0 80% 50% / 0.1); color: hsl(0 65% 40%); }
html.dark .ag-news__msg--ok { color: hsl(142 60% 70%); }
html.dark .ag-news__msg--err { color: hsl(0 80% 75%); }
.ag-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Single post */
.ag-article__head { max-width: 52rem; padding-top: clamp(2rem, 5vw, 3.5rem); padding-bottom: 2rem; }
.ag-article__head .ag-eyebrow a { color: inherit; text-decoration: none; }
.ag-article__head .ag-eyebrow a:hover { color: hsl(var(--foreground)); }
.ag-article__title { margin: 0 0 1.5rem; font-size: clamp(2rem, 5vw, 3.25rem); font-weight: 700; line-height: 1.1; letter-spacing: -0.03em; color: hsl(var(--foreground)); }
.ag-article__cover { max-width: 1100px; margin: 0 auto clamp(2rem, 5vw, 3rem); }
.ag-article__cover img { display: block; width: 100%; height: auto; border-radius: 1.1rem; border: 1px solid hsl(var(--border)); }
.ag-article__layout { display: grid; gap: 2rem; }
.ag-article__main { min-width: 0; max-width: 46rem; }
@media (min-width: 1200px) {
    .ag-article__layout { grid-template-columns: minmax(0, 46rem) 17rem; justify-content: center; gap: 4rem; }
    .ag-article__rail { order: 2; }
    .ag-article__rail-inner { position: sticky; top: 100px; }
}
@media (max-width: 1199px) {
    .ag-article__layout { justify-items: center; }
    .ag-article__rail, .ag-article__main { width: 100%; max-width: 46rem; }
    .ag-ad--sidebar-sticky { display: none !important; }
}
.ag-article__rail-inner { display: grid; gap: 1.5rem; align-content: start; }

/* Table of contents */
.ag-toc { padding: 1.25rem 1.4rem; border: 1px solid hsl(var(--border)); border-radius: 1rem; background: hsl(var(--card)); }
.ag-toc summary { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: hsl(var(--muted-foreground)); cursor: pointer; }
.ag-toc ol { display: grid; gap: 0.5rem; margin: 1rem 0 0; padding: 0; list-style: none; max-height: calc(100vh - 220px); overflow-y: auto; }
.ag-toc a { color: hsl(var(--foreground) / 0.8); font-size: 0.925rem; line-height: 1.4; text-decoration: none; }
.ag-toc a:hover, .ag-toc a.is-active { color: var(--ag-emph); }
.ag-toc a.is-active { font-weight: 600; }
.ag-toc__l3 { padding-left: 0.9rem; }
#post-content h2[id], #post-content h3[id] { scroll-margin-top: 100px; }

/* Tags, share, author box */
.ag-article__tags { margin-top: 2.5rem; }
.ag-article__tags a { color: inherit; text-decoration: none; }
.ag-article__tags li:hover { border-color: hsl(var(--foreground) / 0.4); }
.ag-article__main .ag-share { padding-top: 1.5rem; border-top: 1px solid hsl(var(--border)); }
.ag-author { display: flex; gap: 1.25rem; align-items: flex-start; margin-top: 2.5rem; padding: 1.5rem; border: 1px solid hsl(var(--border)); border-radius: 1.1rem; background: hsl(var(--card)); }
.ag-author__avatar { width: 72px; height: 72px; border-radius: 50%; flex-shrink: 0; }
.ag-author p { margin: 0; }
.ag-author__label { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: hsl(var(--muted-foreground)); }
.ag-author__name { margin: 0.2rem 0 0.4rem !important; font-size: 1.15rem; font-weight: 700; }
.ag-author__name a { color: hsl(var(--foreground)); text-decoration: none; }
.ag-author__bio { line-height: 1.6; color: hsl(var(--muted-foreground)); }
.ag-article-page .ag-related { margin-top: clamp(3rem, 6vw, 4.5rem); }

/* Ad slots: labelled, and space reserved so the page does not jump when an ad loads */
.ag-ad { margin: 2rem 0; text-align: center; }
.ag-ad__label { display: block; margin-bottom: 0.4rem; font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: hsl(var(--muted-foreground)); }
.ag-ad__box { display: flex; align-items: center; justify-content: center; min-height: 250px; overflow: hidden; border-radius: 0.75rem; background: hsl(var(--muted) / 0.4); }
.ag-ad--blog-top .ag-ad__box, .ag-ad--between-cards .ag-ad__box { min-height: 120px; }
@media (min-width: 768px) { .ag-ad--blog-top .ag-ad__box, .ag-ad--between-cards .ag-ad__box { min-height: 100px; } }
.ag-ad--sidebar-sticky { margin: 0; }
.ag-ad--sidebar-sticky .ag-ad__box { min-height: 600px; }
