/* =========================================================
   Annual ESG - Blog collection page
   Loads after header.css
   ========================================================= */

:root {
  --ink: #111827;        /* gray-900 */
  --ink-2: #1f2937;      /* gray-800 */
  --text: #374151;       /* gray-700 */
  --muted: #6b7280;      /* gray-500 */
  --line: #e5e7eb;       /* gray-200 */
  --soft: #f3f4f6;       /* gray-100 */
  --white: #ffffff;
  --radius: 16px;
  --shadow: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.06);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.08);
}

body {
  font-family: "Montserrat", Arial, Helvetica, sans-serif;
  background: var(--white);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* active nav link */
.nav-link.is-active::after { width: 100%; }

/* ===== Reveal on load ===== */
.reveal { opacity: 0; transform: translateY(16px); animation: rise .6s ease-out forwards; }
.reveal:nth-child(2) { animation-delay: .1s; }
.reveal:nth-child(3) { animation-delay: .2s; }
.reveal:nth-child(4) { animation-delay: .3s; }
@keyframes rise { to { opacity: 1; transform: translateY(0); } }

/* ===== Hero ===== */
.blog-hero {
  background: var(--soft);
  padding: 140px 0 72px;
  text-align: center;
}

.eyebrow {
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 9999px;
  background: var(--white);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text);
}

.blog-hero h1 {
  margin: 20px 0 16px;
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink);
}

.hero-sub {
  max-width: 640px;
  margin: 0 auto 36px;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text);
}

/* ===== Search ===== */
.search-box {
  position: relative;
  max-width: 620px;
  margin: 0 auto;
}

.search-box input {
  width: 100%;
  height: 58px;
  padding: 0 52px 0 54px;
  border: 1px solid var(--line);
  border-radius: 9999px;
  background: var(--white);
  font: inherit;
  font-size: .95rem;
  color: var(--ink);
  box-shadow: var(--shadow);
  transition: border-color .2s, box-shadow .2s;
}
.search-box input::placeholder { color: var(--muted); }
.search-box input:focus {
  outline: none;
  border-color: var(--ink-2);
  box-shadow: 0 0 0 4px rgba(31,41,55,.08), var(--shadow);
}
.search-box input::-webkit-search-cancel-button { display: none; }

.search-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search-clear {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--muted);
  transition: background-color .2s, color .2s;
}
.search-clear:hover { background: var(--soft); color: var(--ink); }
.search-box.has-value .search-clear { display: inline-flex; }

/* ===== Category chips ===== */
.filter-bar {
  position: sticky;
  top: 64px;
  z-index: 30;
  background: rgba(255,255,255,.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.chips {
  display: flex;
  gap: 10px;
  padding: 16px 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }

@media (min-width: 1024px) { .chips { justify-content: center; flex-wrap: wrap; } }

.chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border: 1px solid var(--line);
  border-radius: 9999px;
  background: var(--white);
  font-size: .875rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  transition: background-color .2s, color .2s, border-color .2s;
}
.chip:hover { border-color: var(--ink-2); color: var(--ink); }
.chip .count {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 9999px;
  background: var(--soft);
  font-size: .72rem;
  font-weight: 600;
  text-align: center;
}
.chip.is-active { background: var(--ink-2); border-color: var(--ink-2); color: var(--white); }
.chip.is-active .count { background: rgba(255,255,255,.18); color: var(--white); }

/* ===== Shared: thumbnail ===== */
.thumb {
  position: relative;
  overflow: hidden;
  background: var(--soft);
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .6s ease;
}
.thumb-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
}

.tag {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 9999px;
  background: var(--white);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--ink-2);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: .8rem;
  color: var(--muted);
}
.meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; }

.read-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .875rem;
  font-weight: 600;
  color: var(--ink-2);
}
.read-more svg { transition: transform .3s; }

/* ===== Featured post ===== */
.featured-section { padding: 56px 0 8px; }
.featured-section[hidden] { display: none; }

.featured-card {
  display: grid;
  grid-template-columns: 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--white);
  box-shadow: var(--shadow);
  transition: box-shadow .3s, transform .3s;
}
.featured-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-4px); }
.featured-card:hover .thumb img { transform: scale(1.04); }
.featured-card:hover .read-more svg { transform: translateX(4px); }

.featured-card .thumb { aspect-ratio: 16 / 10; }
.featured-card .tag { position: absolute; top: 18px; left: 18px; }

.featured-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.featured-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 28px 24px 32px;
}
.featured-body h2 {
  margin: 0 0 14px;
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
}
.featured-body p {
  margin: 0 0 22px;
  line-height: 1.75;
  color: var(--text);
}
.featured-body .meta { margin-bottom: 24px; }

@media (min-width: 900px) {
  .featured-card { grid-template-columns: 1.15fr 1fr; }
  .featured-card .thumb { aspect-ratio: auto; min-height: 400px; }
  .featured-body { padding: 48px; }
}

/* ===== Post grid ===== */
.posts-section { padding: 56px 0 72px; }

.posts-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  margin-bottom: 28px;
}
.posts-head h2 { margin: 0; font-size: 1.6rem; font-weight: 700; color: var(--ink); }
.result-count { margin: 0; font-size: .9rem; color: var(--muted); }

.posts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
}
@media (min-width: 640px)  { .posts-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .posts-grid { grid-template-columns: repeat(3, 1fr); } }

.post-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  opacity: 0;
  transform: translateY(20px);
  animation: rise .5s ease-out forwards;
  animation-delay: calc(var(--d, 0) * 70ms);
  transition: box-shadow .3s, transform .3s, border-color .3s;
}
.post-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-6px); border-color: transparent; }
.post-card:hover .thumb img { transform: scale(1.06); }
.post-card:hover .read-more svg { transform: translateX(4px); }
.post-card:focus-visible { outline: 2px solid var(--ink-2); outline-offset: 3px; }

.post-card .thumb { aspect-ratio: 16 / 10; }
.post-card .tag { position: absolute; top: 14px; left: 14px; }

.card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 22px;
}
.card-body .meta { margin-bottom: 12px; }
.card-body h3 {
  margin: 0 0 10px;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-body p {
  margin: 0 0 20px;
  font-size: .92rem;
  line-height: 1.7;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-body .read-more { margin-top: auto; }

mark {
  background: #fde68a;
  color: inherit;
  padding: 0 2px;
  border-radius: 3px;
}

/* ===== Empty state ===== */
.empty-state {
  padding: 64px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
  color: var(--muted);
}
.empty-state h3 { margin: 16px 0 8px; font-size: 1.2rem; color: var(--ink); }
.empty-state p { margin: 0 0 20px; }

/* ===== Buttons ===== */
.btn-dark,
.btn-outline,
.btn-light {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 9999px;
  font-size: .9rem;
  font-weight: 600;
  transition: background-color .3s, color .3s, box-shadow .3s, border-color .3s;
}
.btn-dark { background: var(--ink-2); color: var(--white); }
.btn-dark:hover { background: var(--ink); box-shadow: var(--shadow); }
.btn-outline { border: 1px solid var(--ink-2); color: var(--ink-2); }
.btn-outline:hover { background: var(--ink-2); color: var(--white); }
.btn-light { background: var(--white); color: var(--ink); }
.btn-light:hover { background: var(--soft); }

.load-more-wrap { display: flex; justify-content: center; margin-top: 44px; }
.load-more-wrap[hidden] { display: none; }

/* ===== Newsletter CTA ===== */
.newsletter-cta { padding: 0 0 80px; }

.cta-box {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 40px 28px;
  border-radius: 24px;
  background: var(--ink-2);
  color: var(--white);
}
.cta-box h2 { margin: 0 0 8px; font-size: clamp(1.35rem, 2.5vw, 1.75rem); font-weight: 700; }
.cta-box p  { margin: 0; color: #d1d5db; line-height: 1.7; }

.cta-form { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.cta-form input {
  flex: 1;
  height: 50px;
  padding: 0 20px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 9999px;
  background: rgba(255,255,255,.06);
  font: inherit;
  font-size: .9rem;
  color: var(--white);
}
.cta-form input::placeholder { color: #9ca3af; }
.cta-form input:focus { outline: none; border-color: var(--white); }

@media (min-width: 640px) { .cta-form { flex-direction: row; } }
@media (min-width: 1024px) {
  .cta-box { flex-direction: row; align-items: center; justify-content: space-between; padding: 56px; }
  .cta-form { max-width: 460px; }
}

/* ===== Footer ===== */
.site-footer {
  background: var(--ink);
  color: #d1d5db;
  padding: 64px 0 0;
  font-size: .9rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  padding-bottom: 48px;
}
@media (min-width: 768px)  { .footer-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .footer-grid { grid-template-columns: 1.4fr 1fr 1.2fr 1fr; } }

.site-footer h3 { margin: 0 0 14px; font-size: 1.25rem; color: var(--white); }
.site-footer h4 { margin: 0 0 16px; font-size: 1rem; color: var(--white); }
.site-footer p  { margin: 0 0 20px; line-height: 1.7; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; line-height: 1.6; }
.site-footer a:hover { color: var(--white); }

.footer-btn {
  display: inline-block;
  padding: 11px 22px;
  border: 1px solid #4b5563;
  border-radius: 9999px;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--white);
  transition: background-color .3s, color .3s;
}
.footer-btn:hover { background: var(--white); color: var(--ink) !important; }

.socials { display: flex; gap: 10px; }
.socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid #374151;
  border-radius: 50%;
  transition: background-color .3s, color .3s;
}
.socials a:hover { background: var(--white); color: var(--ink); }

.footer-bottom {
  padding-top: 22px;
  padding-bottom: 22px;
  border-top: 1px solid #1f2937;
  font-size: .8rem;
  color: #9ca3af;
  text-align: center;
}
.footer-bottom p { margin: 0; }
/* =========================================================
   v2 additions: filters toolbar, active filters, loading,
   newsletter states, accessibility helpers
   ========================================================= */

.skip-link:focus {
  position: fixed; top: 12px; left: 12px; z-index: 100;
  width: auto; height: auto; clip: auto; margin: 0; padding: 10px 16px;
  background: var(--ink); color: var(--white); border-radius: 8px;
}

/* Search icon: keep original look when output by PHP */
.search-box .search-icon { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }

/* Chips are links in v2 */
a.chip { text-decoration: none; }
.chip:focus-visible { outline: 2px solid var(--ink-2); outline-offset: 2px; }

/* Results header + toolbar */
.posts-section { scroll-margin-top: 150px; }
.posts-head { align-items: center; }
.posts-head-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.select-wrap select {
  -webkit-appearance: none;
  appearance: none;
  height: 42px;
  min-width: 140px;
  max-width: 230px;
  padding: 0 38px 0 16px;
  border: 1px solid var(--line);
  border-radius: 9999px;
  background: var(--white);
  font: inherit;
  font-size: .85rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-overflow: ellipsis;
  transition: border-color .2s, box-shadow .2s;
}
.select-wrap select:hover { border-color: var(--ink-2); color: var(--ink); }
.select-wrap select:focus { outline: none; border-color: var(--ink-2); box-shadow: 0 0 0 4px rgba(31,41,55,.08); }
.select-wrap svg {
  position: absolute;
  right: 14px;
  pointer-events: none;
  color: var(--muted);
}

.btn-sm { padding: 10px 18px; font-size: .82rem; }

@media (max-width: 639px) {
  .posts-head { flex-direction: column; align-items: stretch; }
  .toolbar { display: grid; grid-template-columns: 1fr 1fr; }
  .select-wrap, .select-wrap select { width: 100%; max-width: none; min-width: 0; }
  .select-sort { grid-column: 1 / -1; }
}

/* Active filter pills */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: -8px 0 24px;
}
.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 6px 14px;
  border-radius: 9999px;
  background: var(--soft);
  font-size: .8rem;
  font-weight: 600;
  color: var(--ink-2);
  transition: background-color .2s, color .2s;
}
.filter-pill:hover { background: var(--ink-2); color: var(--white); }
.filter-clear-all {
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.filter-clear-all:hover { color: var(--ink); }

/* Loading state */
.aesg-results, #aesgFeatured, #aesgHead { transition: opacity .2s; }
.blog-page.is-loading .aesg-results,
.blog-page.is-loading #aesgFeatured { opacity: .45; pointer-events: none; }
.blog-page.is-loading .search-box::after {
  content: "";
  position: absolute;
  right: 56px;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border: 2px solid var(--line);
  border-top-color: var(--ink-2);
  border-radius: 50%;
  animation: aesg-spin .7s linear infinite;
}
@keyframes aesg-spin { to { transform: rotate(360deg); } }

#loadMore.is-loading { opacity: .6; pointer-events: none; }
#loadMore.is-loading::after {
  content: "";
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: aesg-spin .7s linear infinite;
}

/* Empty state link button */
.empty-state .btn-outline { text-decoration: none; }

/* Newsletter */
.cta-form { flex-wrap: wrap; }
.cta-message {
  flex-basis: 100%;
  margin: 0;
  min-height: 1.2em;
  font-size: .85rem;
  color: #d1d5db;
}
.cta-message:empty { display: none; }
.cta-message.is-success { color: #86efac; }
.cta-message.is-error { color: #fca5a5; }
.hp-field { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.cta-box form { position: relative; }
.btn-light:disabled { opacity: .7; cursor: default; }

/* Thumbnails from WordPress (featured images) */
.thumb img { position: relative; z-index: 1; height: 100%; }
.featured-card .thumb img { position: absolute; inset: 0; }
.post-card .thumb img { position: absolute; inset: 0; }
.thumb .tag { z-index: 2; }

/* Simple footer (until the Next.js footer is pasted in) */
.site-footer--simple { padding: 0; }
.site-footer--simple .footer-bottom { border-top: 0; padding-top: 28px; padding-bottom: 28px; }
