/* Confiance Group — Insights listing + article (Figma: Insights · Desktop 1440, Insights Article · Desktop 1440) */

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

/* ---------- shared: date • division line ---------- */

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--text-body);
}
.article-meta a {
  text-decoration: underline;
  text-underline-offset: 2px;
}
.article-meta a:hover { color: var(--text-link); }

/* ---------- shared: article card ---------- */

.article-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.article-thumb {
  position: relative;
  aspect-ratio: 400 / 300;
  overflow: hidden;
  border-radius: 20px;
  background: var(--bg-mist);
}
.article-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--pos, 50% 50%);
  transition: scale 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
a.article-card:hover .article-thumb img { scale: 1.04; }
.article-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 22px 8px;
}
.article-card-title {
  color: var(--text-link);
  /* long titles stop at three lines, as in the mockup */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-decoration-line: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 5px;
  transition: text-decoration-color 0.2s ease;
}
a.article-card:hover .article-card-title { text-decoration-color: currentColor; }

/* insights page + related insights: grey dates, smaller card titles */
.page-insights .article-meta, .related .article-meta { color: #6c6c6c; } /* date, bullet and division tag */
.page-insights .article-card-title, .related .article-card-title { font-size: 22px; }

/* ---------- insights: featured ---------- */

.featured { padding: 180px calc(120px + var(--edge)) 0; }
.featured-card {
  display: flex;
  align-items: flex-start;
  gap: 48px;
}
.featured-copy {
  flex: 1 0 0;
  min-width: 1px;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 32px;
  padding-top: 20px;
}
.featured-head { display: flex; flex-direction: column; gap: 8px; }
.featured-title { color: var(--text-heading); }
.featured-photo {
  flex: none;
  width: 560px;
  height: 360px;
  overflow: hidden;
  border-radius: 20px;
}
.featured-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: scale 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
/* only the button is interactive (hover + click); the photo stays still */

/* ---------- insights: latest grid ---------- */

.latest { padding: 56px calc(120px + var(--edge)) 96px; }
.latest-inner {
  display: flex;
  flex-direction: column;
  gap: 32px;
  scroll-margin-top: 40px;
}
.latest-title { color: var(--text-heading); }

.division-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.division-chip {
  padding: 8px 16px;
  border-radius: 18px;
  border: 1px solid var(--divider);
  background: var(--bg-base);
  color: var(--bg-ink);
  font-weight: 600;
  font-size: 14px;
  line-height: 1.4;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.division-chip:hover { border-color: var(--text-link); }
.division-chip[aria-pressed="true"] { background: var(--bg-ink); border-color: var(--bg-ink); color: #ffffff; }

.article-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.article-grid-empty { grid-column: 1 / -1; padding: 40px 0; color: var(--text-muted); }

/* cards arriving after a filter or page change */
.article-grid .article-card.is-entering {
  animation: card-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--i, 0) * 60ms);
}
@keyframes card-in {
  from { opacity: 0; translate: 0 24px; }
  to { opacity: 1; translate: 0 0; }
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding-top: 16px;
}
.pagination[hidden] { display: none; }
.page-btn {
  width: 40px;
  height: 40px;
  border-radius: 20px;
  border: 1px solid var(--divider);
  background: var(--bg-base);
  color: var(--bg-ink);
  font-size: 17px;
  line-height: 1.3;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.page-btn:hover { border-color: var(--text-link); }
.page-btn[aria-current="page"] { background: var(--bg-accent); border-color: var(--bg-accent); color: #ffffff; }
.division-chip:focus-visible,
.page-btn:focus-visible { outline: 2px solid var(--bg-accent); outline-offset: 3px; }

/* ---------- article page ---------- */

.article-wrap {
  width: 840px;
  max-width: calc(100% - 2 * var(--gutter));
  margin: 0 auto;
}
.article-title { padding-top: 150px; }
.article-title-copy { display: flex; flex-direction: column; gap: 16px; }
.article-title h1 { max-width: 820px; color: var(--bg-deep); }

.article-hero { padding-top: 40px; }
.article-hero img {
  width: 100%;
  height: 480px;
  object-fit: cover;
  border-radius: 20px;
}

.article-main {
  display: flex;
  flex-direction: column;
  gap: 64px;
  padding: 64px 0 96px;
}
.article-body { display: flex; flex-direction: column; gap: 28px; }
.article-body section { display: flex; flex-direction: column; gap: 16px; }
.article-body h2 { max-width: 720px; color: var(--bg-deep); }
.article-body ul { display: flex; flex-direction: column; gap: 8px; max-width: 698px; }
.article-body li { display: flex; gap: 10px; }
.article-body li::before { content: "•"; flex: none; color: var(--text-muted); }

.pull-quote {
  max-width: 720px;
  margin: 0;
  padding: 24px 28px;
  border-radius: 4px;
  background: var(--bg-mist);
  color: var(--bg-ink);
}
.article-figure { margin: 0; }
.article-figure img {
  width: 100%;
  aspect-ratio: 420 / 280;
  object-fit: cover;
  border-radius: 12px;
}
.article-end { height: 1px; border: 0; margin: 0; background: var(--divider); }

.related { padding: 0 calc(120px + var(--edge)) 96px; }
.related-inner { display: flex; flex-direction: column; gap: 32px; }
.related h2 { color: var(--bg-deep); }
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

/* ---------- smaller screens ---------- */

@media (max-width: 1024px) {
  .featured { padding: 150px var(--gutter) 0; }
  .featured-card { flex-direction: column-reverse; gap: 32px; }
  .featured-copy { padding-top: 0; }
  .featured-photo { width: 100%; height: auto; aspect-ratio: 560 / 360; }
  .latest { padding: 56px var(--gutter) 80px; }
  .article-grid, .related-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .related { padding: 0 var(--gutter) 80px; }
  .related-grid > :nth-child(3) { display: none; }
  .article-title { padding-top: 130px; }
  .article-hero img { height: auto; aspect-ratio: 840 / 480; }
}

@media (max-width: 640px) {
  .featured-title, .latest-title, .article-title h1 { font-size: 34px; }
  .article-grid, .related-grid { grid-template-columns: 1fr; }
  .related-grid > :nth-child(3) { display: flex; }
  .article-main { padding: 48px 0 72px; gap: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  .article-grid .article-card.is-entering { animation: none; }
}

/* ---------- dark mode ---------- */

@media (prefers-color-scheme: dark) {
  .division-chip, .page-btn { color: var(--text-body); }
  .division-chip[aria-pressed="true"] { background: var(--text-heading); border-color: var(--text-heading); color: var(--bg-ink); }
  .article-card-title { color: var(--text-heading); }
  .article-title h1, .article-body h2, .related h2 { color: var(--text-heading); }
  .pull-quote { color: var(--text-body); }
  .featured-photo img, .article-thumb img, .article-hero img, .article-figure img { filter: brightness(0.92); }
}

/* ---------- phones: division dropdown (same pill + menu card as Client stories) ---------- */
.division-dd { display: none; }
@media (max-width: 640px) {
  body .division-chips { display: none !important; }
  body .division-dd { display: block; position: relative; width: max-content; z-index: 6; }
  body .division-dd-btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px;
    border: 1.5px solid var(--text-link); border-radius: 999px; background: var(--bg-base);
    color: var(--text-link); font-size: 13px; line-height: 1.3; white-space: nowrap;
  }
  body .division-dd-btn img { width: 16px; height: 16px; transition: rotate 0.2s ease; }
  body .division-dd-btn[aria-expanded="true"] img { rotate: 180deg; }
  body .division-dd-list {
    position: absolute; top: calc(100% + 8px); left: 0; z-index: 6;
    width: max-content; min-width: 100%; max-width: calc(100vw - 2 * var(--gutter));
    padding: 8px; background: #ffffff; border-radius: 16px;
    box-shadow: 0 0 0 1px var(--border-subtle), 0 24px 48px rgba(8, 49, 42, 0.16);
    display: flex; flex-direction: column;
  }
  body .division-dd-list[hidden] { display: none; }
  body .division-dd-option { padding: 8px 16px; border-radius: 10px; color: var(--bg-ink); font-size: 13px; line-height: 1.3; text-align: left; white-space: nowrap; }
  body .division-dd-option:hover, body .division-dd-option:focus-visible { background: var(--bg-mist); outline: none; }
  body .division-dd-option[aria-selected="true"] { background: var(--bg-soft); }
  @media (prefers-color-scheme: dark) {
    body .division-dd-btn { background: transparent; border-color: #ffffff; color: #ffffff; }
    body .division-dd-btn img { filter: brightness(0) invert(1); }
    body .division-dd-option { color: var(--text-body); }
  }
}

/* ---------- phones: insights listing + article spacing ---------- */
@media (max-width: 640px) {
  /* featured: photo → copy 24, caption → title 8, title → button 24, 40 below */
  html body section.featured { padding-bottom: 40px; }
  html body .featured-card { gap: 24px; }
  html body .featured-copy { gap: 24px; }
  html body .featured-head { gap: 8px; }

  /* latest: title → dropdown 32 (section rhythm), cards 40 apart */
  html body .latest-inner { gap: 32px; }
  html body .article-grid { row-gap: 40px; column-gap: 0; }
  /* card: photo → date 16, date → title 8, no side inset */
  html body .article-card-body { padding: 16px 0 0; gap: 8px; }
  html body .pagination { margin-top: 8px; }

  /* article: 40 between hero and copy, between copy and the end rule, and above related */
  html body .article-wrap.article-main { padding-top: 40px; padding-bottom: 0; gap: 40px; }
  html body .related-grid { row-gap: 40px; column-gap: 0; }
}

/* ---------- country filter (same pill + menu as the Client stories filters) ---------- */
.latest-filters { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.filter-dd { position: relative; }
.story-filter {
  display: inline-flex; align-items: center; gap: 12px; height: 47px; padding: 10px 24px;
  border: 1.5px solid var(--text-link); border-radius: 999px; background: var(--bg-base);
  color: var(--text-link); font-size: 17px; line-height: 1.3; white-space: nowrap;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.story-filter:focus-visible { outline: 2px solid var(--bg-accent); outline-offset: 3px; }
.story-filter img { width: 24px; height: 24px; transition: rotate 0.2s ease; }
.story-filter[aria-expanded="true"] img { rotate: 180deg; }
.filter-listbox {
  position: absolute; top: calc(100% + 12px); right: 0; z-index: 6; min-width: max(100%, 220px);
  padding: 8px; background: #ffffff; border-radius: 16px;
  box-shadow: 0 0 0 1px var(--border-subtle), 0 24px 48px rgba(8, 49, 42, 0.16);
  display: flex; flex-direction: column;
}
.filter-listbox[hidden] { display: none; }
.filter-option { padding: 12px 16px; border-radius: 10px; color: var(--bg-ink); font-size: 17px; line-height: 1.3; text-align: left; white-space: nowrap; }
.filter-option:hover, .filter-option:focus-visible { background: var(--bg-mist); outline: none; }
.filter-option[aria-selected="true"] { background: var(--bg-soft); }
@media (hover: hover) and (pointer: fine) {
  .story-filter:hover { background-color: var(--bg-deep); border-color: var(--bg-deep); color: #ffffff; }
}
@media (prefers-color-scheme: dark) {
  .story-filter { border-color: var(--text-heading); color: var(--text-heading); background: transparent; }
  .story-filter img { filter: brightness(0) invert(1); opacity: 0.85; }
  .filter-listbox { background: #000000; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14), 0 24px 48px rgba(0, 0, 0, 0.6); }
  .filter-option { color: var(--text-body); }
  .filter-option:hover, .filter-option:focus-visible { background: rgba(255, 255, 255, 0.06); }
  .filter-option[aria-selected="true"] { background: rgba(143, 224, 198, 0.16); }
}
@media (prefers-color-scheme: dark) and (hover: hover) and (pointer: fine) {
  .story-filter:hover { background-color: var(--text-heading); border-color: var(--text-heading); color: var(--bg-ink); }
  .story-filter:hover img { filter: brightness(0); }
}
@media (max-width: 640px) {
  .latest-filters { gap: 10px; justify-content: flex-start; }
  body .story-filter { height: auto; padding: 6px 14px; font-size: 13px; gap: 6px; }
  body .story-filter img { width: 16px; height: 16px; }
  body .filter-listbox { left: 0; right: auto; width: max-content; max-width: calc(100vw - 2 * var(--gutter)); }
  body .filter-option { font-size: 13px; padding: 8px 16px; }
}
/* Insights filters: both are dropdowns (no chips), left-aligned like Client stories */
html body .latest-filters { justify-content: flex-start; }
html body .latest-filters .division-chips, html body .division-dd { display: none !important; }
.latest-filters .story-filters { display: flex; flex-wrap: wrap; gap: 16px; }
.latest-filters .filter-listbox { left: 0; right: auto; }
@media (max-width: 640px) { .latest-filters .story-filters { gap: 10px; } }
