/* Infograf+ UI layer (loaded last): cards, buttons, chips, search, pagination.
   Same identity: Cairo, indigo accent, white surfaces, one color per category. */
:root { --ease-out: cubic-bezier(.23, 1, .32, 1); --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }

/* ---------- buttons ---------- */
.btn { gap: 8px; min-height: 48px; padding: 11px 22px; border-radius: 14px; font-weight: 800; text-decoration: none; transition: transform 160ms var(--ease-out), background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease; }
.btn:hover { transform: none; }
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary { box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 8px 20px rgba(99, 91, 255, .25); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.btn-secondary:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }

/* header icon buttons: one size, one hover */
.header-actions > a, .header-actions > button, .notification-header-button {
  transition: background-color 160ms ease, color 160ms ease, transform 160ms var(--ease-out);
}
.header-actions > a:active, .header-actions > button:active, .notification-header-button:active { transform: scale(.94); }
.header-actions > a:focus-visible, .header-actions > button:focus-visible, .notification-header-button:focus-visible { outline: none; box-shadow: var(--ring); }
.search-button .search-icon { font-size: 0; display: inline-block; width: 18px; height: 18px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") center / contain no-repeat; }

/* ---------- chips (home categories, filters) ---------- */
.category-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 7px 15px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 800; font-size: 13px; cursor: pointer; transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms var(--ease-out); }
.category-chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--cat, var(--accent)); flex-shrink: 0; }
.category-chip[data-category="all"]::before, .category-chip[data-filter="all"]::before { background: conic-gradient(#0043F7 0 25%, #D99A00 0 50%, #22A06B 0 75%, #E74F1B 0); }
.category-chip small { color: var(--text-light); font-size: 11px; font-weight: 800; }
.category-chip:hover { border-color: color-mix(in srgb, var(--cat, var(--accent)) 50%, var(--border)); background: var(--surface); color: var(--text); }
.category-chip:active { transform: scale(.97); }
.category-chip.active, .category-chip.active:hover { background: var(--text); border-color: var(--text); color: var(--surface); }
.category-chip.active small { color: color-mix(in srgb, var(--surface) 70%, transparent); }
.category-chip:focus-visible { outline: none; box-shadow: var(--ring); }
.filter-bar { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 14px; margin-bottom: 10px; scrollbar-width: none; }
.filter-bar::-webkit-scrollbar { display: none; }

/* ---------- cards ---------- */
.infographic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 22px; align-items: stretch; }
.latest-section .infographic-grid, .category-results .infographic-grid { gap: 22px; }
.infographic-card.ip-card {
  --cat: var(--accent);
  position: relative; display: flex; flex-direction: column; height: 100%;
  margin: 0; padding: 0; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: 22px;
  box-shadow: 0 1px 2px rgba(20, 20, 40, .04);
  transition: border-color 200ms ease, box-shadow 200ms ease, transform 200ms var(--ease-out);
}
.infographic-card.ip-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; z-index: 2; background: var(--cat); opacity: 1; }
.ip-card-media { position: relative; aspect-ratio: 4 / 5; overflow: hidden; background: color-mix(in srgb, var(--cat) 8%, var(--surface-soft)); border-bottom: 1px solid var(--border); }
.ip-card-media img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; transition: transform 500ms var(--ease-out); }
.ip-card-media .image-placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: var(--cat); font-weight: 900; font-size: 22px; }
.ip-badge { position: absolute; top: 14px; inset-inline-start: 12px; display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px 5px 11px; border-radius: 999px; background: rgba(17, 17, 27, .78); color: #fff; font-size: 11px; font-weight: 800; backdrop-filter: blur(6px); }
.ip-badge svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ip-card-body { display: flex; flex-direction: column; flex: 1; gap: 8px; padding: 16px 18px 16px; }
.ip-cat { align-self: flex-start; display: inline-flex; align-items: center; gap: 7px; color: color-mix(in oklab, var(--cat) 70%, var(--text)); font-size: 12px; font-weight: 800; }
.ip-cat::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--cat); }
.infographic-card.ip-card .ip-title { margin: 0; font-size: 16.5px; font-weight: 800; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ip-title a { color: var(--text); text-decoration: none; }
.ip-title a::after { content: ""; position: absolute; inset: 0; z-index: 3; border-radius: inherit; }
.ip-title a:focus-visible { outline: none; }
.ip-card:has(.card-link:focus-visible) { box-shadow: var(--ring); border-color: var(--accent); }
.infographic-card.ip-card .ip-desc { margin: 0; color: var(--text-secondary); font-size: 13px; line-height: 1.8; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ip-meta { margin-top: auto; padding-top: 10px; display: flex; align-items: center; justify-content: space-between; color: var(--text-light); font-size: 12px; font-weight: 700; }
.ip-go { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--surface-soft); color: var(--text); transition: background-color 200ms ease, color 200ms ease, transform 200ms var(--ease-out); }
.ip-go svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) and (pointer: fine) {
  .infographic-card.ip-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--cat) 40%, var(--border)); box-shadow: 0 14px 34px rgba(20, 20, 40, .09); }
  .ip-card:hover .ip-card-media img { transform: scale(1.03); }
  .ip-card:hover .ip-go { background: var(--cat); color: #fff; transform: translateX(-3px); }
}
.ip-card:active { transform: scale(.99); }
.infographic-card.is-paged-out { display: none !important; }
.more-wrap { display: flex; justify-content: center; margin-top: 28px; }
.more-wrap[hidden] { display: none; }
.section-count { white-space: nowrap; }

/* ---------- search (command palette) ---------- */
.search-panel { position: fixed; inset: 0; z-index: 400; display: flex; align-items: flex-start; justify-content: center; padding: 10vh 16px 16px; background: rgba(15, 15, 30, .45); backdrop-filter: blur(6px); }
.search-panel[hidden] { display: none; }
.search-panel-inner { width: min(680px, 100%); max-height: 78vh; display: flex; flex-direction: column; padding: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: 0 30px 80px rgba(15, 15, 40, .28); animation: igSearchIn 200ms var(--ease-out); }
@keyframes igSearchIn { from { opacity: 0; transform: translateY(-8px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { .search-panel-inner { animation: none; } }
.search-bar { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.search-bar-icon { width: 22px; height: 22px; flex-shrink: 0; fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; }
.search-panel #site-search { flex: 1; min-width: 0; height: 44px; margin: 0; padding: 0; border: 0; outline: 0; background: transparent; box-shadow: none; color: var(--text); font: 700 18px/1.4 "Cairo", sans-serif; }
.search-panel #site-search::-webkit-search-cancel-button { display: none; }
.search-kbd, .search-foot kbd { display: inline-grid; place-items: center; min-width: 26px; height: 24px; padding: 0 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 7px; background: var(--surface-soft); color: var(--text-secondary); font: 700 11px/1 system-ui, sans-serif; }
.search-panel .close-search { width: 36px; height: 36px; border-radius: 10px; border: 0; background: var(--surface-soft); color: var(--text); font-size: 22px; line-height: 1; cursor: pointer; }
.search-scopes { display: flex; gap: 6px; overflow-x: auto; padding: 10px 16px; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.search-scopes::-webkit-scrollbar { display: none; }
.search-scope { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 800 12px/1 "Cairo", sans-serif; cursor: pointer; }
.search-scope::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--cat, var(--accent)); }
.search-scope small { color: var(--text-light); font-size: 10px; }
.search-scope.is-on { background: var(--text); border-color: var(--text); color: var(--surface); }
.search-scope:focus-visible { outline: none; box-shadow: var(--ring); }
.search-panel .search-results { flex: 1; overflow-y: auto; padding: 8px; margin: 0; max-height: none; border: 0; }
.search-result-count { padding: 8px 10px 6px; color: var(--text-light); font-size: 12px; font-weight: 800; }
.search-panel .search-result { display: flex; align-items: center; gap: 14px; padding: 10px; margin: 0; border: 0; border-radius: 14px; color: var(--text); text-decoration: none; background: transparent; transition: background-color 120ms ease; }
.search-panel .search-result:hover, .search-panel .search-result.is-active { background: color-mix(in srgb, var(--cat) 9%, var(--surface-soft)); }
.search-panel .search-result.is-active { box-shadow: inset 3px 0 0 var(--cat); }
.search-thumb { width: 52px; height: 66px; flex-shrink: 0; border-radius: 10px; object-fit: cover; object-position: top; background: color-mix(in srgb, var(--cat) 12%, var(--surface-soft)); border: 1px solid var(--border); }
.search-result-text { display: grid; gap: 3px; min-width: 0; }
.search-panel .search-result strong { display: block; font-size: 15px; font-weight: 800; line-height: 1.5; color: var(--text); }
.search-panel .search-result small { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; color: var(--text-secondary); font-size: 12.5px; line-height: 1.7; }
.search-result mark { background: color-mix(in srgb, var(--accent) 18%, transparent); color: inherit; border-radius: 4px; padding: 0 2px; }
.search-result-meta { display: flex; align-items: center; gap: 10px; color: var(--text-light); font-size: 11.5px; font-weight: 700; }
.search-panel .search-cat { display: inline-flex; align-items: center; gap: 5px; padding: 0; background: none; color: color-mix(in oklab, var(--cat) 70%, var(--text)); font-size: 11.5px; font-weight: 800; }
.search-cat::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--cat); }
.search-x { padding: 1px 8px; border-radius: 999px; background: var(--text); color: var(--surface); font-size: 10.5px; font-weight: 800; }
.search-panel .no-results { display: grid; gap: 4px; padding: 34px 16px; text-align: center; color: var(--text-secondary); font-size: 13px; }
.search-panel .no-results strong { color: var(--text); font-size: 15px; }
.search-foot { display: flex; gap: 18px; padding: 10px 16px; border-top: 1px solid var(--border); color: var(--text-light); font-size: 11.5px; font-weight: 700; }
.search-foot span { display: inline-flex; align-items: center; gap: 5px; }
@media (max-width: 700px) {
  .search-panel { padding: 0; align-items: stretch; }
  .search-panel-inner { max-height: none; height: 100%; border-radius: 0; border: 0; }
  .search-kbd, .search-foot { display: none; }
}

/* ---------- small screens ---------- */
@media (max-width: 700px) {
  .infographic-grid, .latest-section .infographic-grid, .category-results .infographic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .infographic-card.ip-card { border-radius: 18px; }
  .ip-card-body { padding: 12px 12px 12px; gap: 6px; }
  .infographic-card.ip-card .ip-title { font-size: 14px; line-height: 1.55; }
  .infographic-card.ip-card .ip-desc { display: none; }
  .ip-meta { font-size: 11px; padding-top: 6px; }
  .ip-go { width: 28px; height: 28px; }
  .ip-badge { top: 12px; padding: 4px 8px; font-size: 10px; }
}

/* dark mode: dark-mode.css paints every chip with the surface color; keep the active one inverted */
html.dark-mode .category-chip.active, html.dark-mode .category-chip.active:hover { background: var(--text); border-color: var(--text); color: var(--background); }
html.dark-mode .infographic-card.ip-card { box-shadow: none; }
html.dark-mode .ip-badge { background: rgba(0, 0, 0, .7); }
html.dark-mode .category-chip::before, html.dark-mode .search-scope::before, html.dark-mode .ip-cat::before { box-shadow: 0 0 0 1px rgba(255, 255, 255, .22); }

/* ---------- home: lead story ---------- */
.lead-section { width: min(var(--max-width), calc(100% - 40px)); margin: 0 auto; padding: 30px 0 40px; }
.lead-intro { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.lead-intro h1 { margin: 0; font-size: clamp(22px, 2.6vw, 30px); font-weight: 900; line-height: 1.4; letter-spacing: -.3px; }
.lead-intro h1 span { color: var(--accent); }
.lead-intro .btn { min-height: 42px; padding: 8px 16px; font-size: 13px; }
.lead-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); gap: 20px; align-items: stretch; }
.lead-story { --cat: var(--accent); position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .82fr); grid-template-areas: "body media"; min-height: 440px; overflow: hidden; border: 1px solid var(--border); border-radius: 24px; background: var(--surface); transition: border-color 200ms ease, box-shadow 200ms ease; }
.lead-story::before { content: ""; position: absolute; z-index: 2; inset: 0 0 auto; height: 4px; background: var(--cat); }
.lead-media { grid-area: media; position: relative; overflow: hidden; background: color-mix(in srgb, var(--cat) 8%, var(--surface-soft)); border-inline-start: 1px solid var(--border); }
.lead-media picture { display: contents; }
.lead-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.lead-media::after { content: ""; position: absolute; inset: auto 0 0; height: 30%; pointer-events: none; background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--cat) 14%, var(--surface))); }
.lead-body { grid-area: body; display: flex; flex-direction: column; justify-content: center; gap: 16px; padding: 44px 40px; min-width: 0; }
.lead-kicker { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--text-light); font-size: 13px; font-weight: 700; }
.lead-kicker time::before { content: ""; display: inline-block; width: 4px; height: 4px; margin-inline-end: 12px; border-radius: 50%; background: currentColor; vertical-align: middle; }
.lead-kicker .ip-new { position: static; box-shadow: none; }
.lead-body h2 { margin: 0; font-size: clamp(25px, 2.5vw, 34px); font-weight: 900; line-height: 1.45; letter-spacing: -.4px; text-wrap: balance; }
.lead-body h2 a { color: var(--text); text-decoration: none; }
.lead-body h2 a::after { content: ""; position: absolute; inset: 0; z-index: 3; }
.lead-body h2 a:focus-visible { outline: none; }
.lead-body p { margin: 0; color: var(--text-secondary); font-size: 15.5px; line-height: 1.95; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.lead-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 10px; padding-top: 18px; border-top: 1px solid var(--border); }
.lead-src { min-width: 0; overflow: hidden; color: var(--text-light); font-size: 12.5px; font-weight: 700; white-space: nowrap; text-overflow: ellipsis; }
.lead-go { display: inline-flex; align-items: center; gap: 10px; margin-inline-start: auto; color: var(--text); font-size: 14px; font-weight: 800; white-space: nowrap; }
.lead-side { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }
.side-story { --cat: var(--accent); position: relative; flex: 1; display: grid; grid-template-columns: 86px minmax(0, 1fr); gap: 14px; align-items: center; padding: 12px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); transition: border-color 200ms ease, box-shadow 200ms ease; }
.side-thumb { display: block; aspect-ratio: 4 / 5; overflow: hidden; border-radius: 12px; background: color-mix(in srgb, var(--cat) 10%, var(--surface-soft)); }
.side-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.side-text { display: grid; gap: 5px; min-width: 0; }
.side-title { color: var(--text); font-size: 15px; font-weight: 800; line-height: 1.6; text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.side-title::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.side-title:focus-visible { outline: none; }
.side-story:has(.side-title:focus-visible), .lead-story:has(h2 a:focus-visible) { box-shadow: var(--ring); }
.side-text time { color: var(--text-light); font-size: 12px; font-weight: 700; }
@media (hover: hover) and (pointer: fine) {
  .lead-story:hover { border-color: color-mix(in srgb, var(--cat) 40%, var(--border)); box-shadow: 0 16px 40px rgba(20, 20, 40, .08); }
  .lead-story:hover .lead-media img { transform: scale(1.02); }
  .lead-story:hover .ip-go { background: var(--cat); color: #fff; transform: translateX(-3px); }
  .side-story:hover { border-color: color-mix(in srgb, var(--cat) 45%, var(--border)); box-shadow: 0 10px 26px rgba(20, 20, 40, .07); }
}
@media (max-width: 950px) {
  .lead-grid { grid-template-columns: 1fr; }
  .lead-side { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .side-story { grid-template-columns: 1fr; align-items: start; }
  .side-thumb { aspect-ratio: 16 / 11; }
}
@media (max-width: 700px) {
  .lead-section { width: calc(100% - 28px); padding: 20px 0 30px; }
  .lead-intro { flex-direction: column; align-items: flex-start; gap: 10px; }
  .lead-intro h1 { font-size: 22px; }
  .lead-intro .btn { min-height: 40px; padding: 6px 12px; font-size: 12px; }
  .lead-story { grid-template-columns: 1fr; grid-template-areas: "media" "body"; min-height: 0; border-radius: 20px; }
  .lead-media { aspect-ratio: 4 / 3.2; border-inline-start: 0; border-bottom: 1px solid var(--border); }
  .lead-body { padding: 18px 18px 16px; gap: 10px; }
  .lead-kicker { font-size: 12px; gap: 10px; }
  .lead-kicker time::before { margin-inline-end: 10px; }
  .lead-body h2 { font-size: 21px; line-height: 1.5; }
  .lead-body p { font-size: 14px; line-height: 1.85; -webkit-line-clamp: 2; }
  .lead-foot { margin-top: 4px; padding-top: 12px; }
  .lead-src { display: none; }
  .lead-go { font-size: 13px; }
  .lead-go .ip-go { width: 30px; height: 30px; }
  .lead-side { grid-template-columns: 1fr; }
  .side-story { grid-template-columns: 74px minmax(0, 1fr); align-items: center; }
  .side-thumb { aspect-ratio: 4 / 5; }
  .side-title { font-size: 14px; }
}
html.dark-mode .lead-story { box-shadow: none; }
html.dark-mode .side-story { box-shadow: none; }

/* ---------- cards: tinted fade, loading shimmer, "new" badge ---------- */
.ip-card-media picture { display: contents; }
.ip-card-media::after { content: ""; position: absolute; inset: auto 0 0; height: 34%; pointer-events: none; background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--cat) 14%, var(--surface))); }
.is-loading { background-image: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--surface) 70%, transparent) 50%, transparent 70%); background-size: 220% 100%; animation: igShimmer 1.3s linear infinite; }
@keyframes igShimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
@media (prefers-reduced-motion: reduce) { .is-loading { animation: none; } }
.ip-card-media img, .lead-media img, .side-thumb img { transition: opacity 300ms ease, transform 500ms var(--ease-out); }
.is-loading img { opacity: 0; }
.ip-new { position: absolute; z-index: 2; top: 14px; inset-inline-start: 12px; padding: 3px 10px; border-radius: 999px; background: var(--cat); color: #fff; font-size: 11px; font-weight: 800; box-shadow: 0 4px 12px rgba(0, 0, 0, .18); }
.ip-new.is-light { color: #14141f; }
.side-text .ip-new { position: static; justify-self: start; box-shadow: none; }

/* ---------- category page banner ---------- */
.category-results .section-heading.cat-banner { --cat: var(--accent); position: relative; overflow: hidden; align-items: center; margin-bottom: 22px; padding: 24px 26px; border: 1px solid color-mix(in srgb, var(--cat) 28%, var(--border)); border-radius: 24px; background: linear-gradient(120deg, color-mix(in srgb, var(--cat) 15%, var(--surface)), var(--surface) 70%); transition: background-color 300ms ease, border-color 300ms ease; }
.cat-banner::before { content: "+"; position: absolute; inset-inline-end: 190px; top: -14px; color: var(--cat); opacity: .18; font-size: 130px; font-weight: 900; line-height: 1; pointer-events: none; }
.cat-banner .section-kicker { display: inline-flex; align-items: center; gap: 7px; color: color-mix(in oklab, var(--cat) 70%, var(--text)); }
.cat-banner .section-kicker::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--cat); }
.cat-banner h2 { font-size: clamp(24px, 3vw, 32px); }
.cat-banner .section-count { position: relative; z-index: 1; padding: 6px 13px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text); font-weight: 800; }
.cat-banner.is-all .section-kicker::before { background: conic-gradient(#0043F7 0 25%, #D99A00 0 50%, #22A06B 0 75%, #E74F1B 0); }

/* ---------- post page ---------- */
.read-progress { position: fixed; z-index: 1000; inset: 0 0 auto; height: 3px; background: var(--cat, var(--accent)); transform: scaleX(0); transform-origin: right; pointer-events: none; }
.infographic-page .infographic-page-category { background: color-mix(in srgb, var(--cat, var(--accent)) 13%, var(--surface)); color: color-mix(in oklab, var(--cat, var(--accent)) 72%, var(--text)); }
.infographic-page .infographic-page-category::before { content: ""; width: 8px; height: 8px; margin-inline-end: 7px; border-radius: 50%; background: var(--cat, var(--accent)); }
.related-section .infographic-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }

/* home: about stats (visitor count from GoatCounter) */
.about-stats { position: relative; z-index: 2; display: flex; gap: 12px; margin: 0; }
.about-stats > div { min-width: 120px; padding: 16px 18px; border-radius: 18px; background: var(--surface-soft); border: 1px solid var(--border); }
.about-stats > div[hidden] { display: none; }
.about-stats dd { order: -1; margin: 0; direction: ltr; text-align: right; color: var(--text); font-size: 30px; font-weight: 900; line-height: 1.15; letter-spacing: -.5px; }
.about-stats > div { display: flex; flex-direction: column; }
.about-stats dt { margin-top: 2px; color: var(--text-secondary); font-size: 12.5px; font-weight: 800; }
.about-visits dd { color: var(--accent); }
@media (max-width: 950px) { .about-section { flex-direction: column; align-items: stretch; gap: 22px; } }
@media (max-width: 700px) { .about-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; } .about-stats > div { min-width: 0; padding: 12px; } .about-stats dd { font-size: 24px; } }
.site-home .about-section::before { display: none; }

/* Coded posts: the auto social image has page margins around the 900px card (1080px wide) - crop them away. */
.is-code img { transform: scale(1.385); transform-origin: top center; }
@media (hover: hover) and (pointer: fine) { .ip-card:hover .is-code img, .lead-story:hover .is-code img { transform: scale(1.41); } }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.site-home .section-footer { flex-wrap: wrap; gap: 10px; }
.lead-section { padding-top: 26px; }

/* ---------- post page: share card ---------- */
.pg-share { --on-cat: #fff; position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "head row main"; align-items: center; gap: 18px 26px; max-width: 900px; margin: 26px auto 0; padding: 22px 24px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--cat, var(--accent)) 30%, var(--border)); border-radius: 26px; background: linear-gradient(120deg, color-mix(in srgb, var(--cat, var(--accent)) 12%, var(--surface)), var(--surface) 65%); }
.pg-share-head { grid-area: head; display: flex; align-items: center; gap: 14px; }
.pg-share-badge { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 16px; background: var(--cat, var(--accent)); color: var(--on-cat); flex-shrink: 0; }
.pg-share-head h2 { margin: 0; font-size: 18px; font-weight: 900; line-height: 1.4; }
.pg-share-head p { margin: 2px 0 0; color: var(--text-secondary); font-size: 13px; font-weight: 700; }
.pg-share svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pg-share svg .fill { fill: currentColor; stroke: none; }
.pg-share-main { grid-area: main; display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 54px; padding: 0 26px; border: 0; border-radius: 16px; background: var(--cat, var(--accent)); color: var(--on-cat); font: 900 16px/1 "Cairo", sans-serif; cursor: pointer; box-shadow: 0 10px 24px color-mix(in srgb, var(--cat, var(--accent)) 35%, transparent); transition: transform 160ms var(--ease-out), box-shadow 200ms ease, filter 200ms ease; }
.pg-share-main:hover { filter: brightness(1.05); box-shadow: 0 14px 30px color-mix(in srgb, var(--cat, var(--accent)) 45%, transparent); }
.pg-share-main:active { transform: scale(.97); }
.pg-share-main:focus-visible, .pg-ic:focus-visible { outline: none; box-shadow: var(--ring); }
.pg-share-row { grid-area: row; display: flex; justify-content: center; gap: 6px; margin: 0; padding: 0; list-style: none; }
.pg-ic { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 62px; padding: 4px 2px; border: 0; border-radius: 14px; background: none; color: var(--text-secondary); font: 800 11.5px/1.2 "Cairo", sans-serif; text-decoration: none; cursor: pointer; transition: color 160ms ease; }
.pg-ic-c { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); color: var(--text); transition: transform 160ms var(--ease-out), background-color 160ms ease, color 160ms ease, border-color 160ms ease; }
.pg-ic-c svg { width: 20px; height: 20px; }
.pg-ic.wa .pg-ic-c { color: #1faa53; } .pg-ic.tg .pg-ic-c { color: #229ED9; } .pg-ic.fb .pg-ic-c { color: #1877F2; }
@media (hover: hover) and (pointer: fine) {
  .pg-ic:hover { color: var(--text); }
  .pg-ic:hover .pg-ic-c { transform: translateY(-2px); border-color: currentColor; }
  .pg-ic.wa:hover .pg-ic-c { background: #25D366; border-color: #25D366; color: #fff; }
  .pg-ic.tg:hover .pg-ic-c { background: #229ED9; border-color: #229ED9; color: #fff; }
  .pg-ic.fb:hover .pg-ic-c { background: #1877F2; border-color: #1877F2; color: #fff; }
  .pg-ic.x:hover .pg-ic-c { background: var(--text); border-color: var(--text); color: var(--surface); }
}
.pg-ic:active .pg-ic-c { transform: scale(.94); }
.pg-ic.is-done { color: #22A06B; }
.pg-ic.is-done .pg-ic-c { background: #22A06B; border-color: #22A06B; color: #fff; }

/* ---------- post page: newer / older ---------- */
.pg-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; max-width: 900px; margin: 18px auto 0; }
.pg-nav-card.older:only-child { grid-column: 2; }
.pg-nav-card { --cat: var(--accent); position: relative; display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 14px; align-items: center; padding: 12px; overflow: hidden; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); color: var(--text); text-decoration: none; transition: border-color 200ms ease, box-shadow 200ms ease, transform 200ms var(--ease-out); }
.pg-nav-card::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px; background: var(--cat); }
.pg-nav-thumb { display: block; aspect-ratio: 4 / 5; overflow: hidden; border-radius: 12px; background: color-mix(in srgb, var(--cat) 10%, var(--surface-soft)); }
.pg-nav-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.pg-nav-text { display: grid; gap: 4px; min-width: 0; }
.pg-nav-label { display: inline-flex; align-items: center; gap: 6px; color: var(--text-light); font-size: 12px; font-weight: 800; }
.pg-nav-label svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.pg-nav-card.older .pg-nav-label svg { transform: scaleX(-1); }
.pg-nav-title { font-size: 15px; font-weight: 800; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (hover: hover) and (pointer: fine) {
  .pg-nav-card:hover { border-color: color-mix(in srgb, var(--cat) 45%, var(--border)); box-shadow: 0 12px 28px rgba(20, 20, 40, .08); transform: translateY(-2px); }
}
.pg-nav-card:focus-visible { outline: none; box-shadow: var(--ring); }
.infographic-page .infographic-source { max-width: 900px; margin-inline: auto; }

@media (max-width: 860px) {
  .pg-share { grid-template-columns: 1fr; grid-template-areas: "head" "main" "row"; gap: 16px; padding: 18px; border-radius: 22px; }
  .pg-share-main { width: 100%; }
  .pg-share-row { justify-content: space-between; gap: 0; }
  .pg-ic { min-width: 0; flex: 1; }
}
@media (max-width: 700px) {
  .pg-nav { grid-template-columns: 1fr; gap: 10px; }
  .pg-nav-card.older:only-child { grid-column: auto; }
  .pg-nav-card { grid-template-columns: 64px minmax(0, 1fr); }
  .pg-nav-title { font-size: 14px; }
  .pg-ic-c { width: 42px; height: 42px; }
  .pg-ic { font-size: 10.5px; }
}
html.dark-mode .pg-ic-c { background: var(--surface-soft); }
html.dark-mode .pg-nav-card { box-shadow: none; }

.footer-credit { display: block; margin-top: 6px; color: var(--text-light); font-size: 12px; font-weight: 700; }
.footer-credit a { color: var(--text); font-weight: 800; text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 50%, transparent); transition: color 160ms ease, border-color 160ms ease; }
.footer-credit a:hover { color: var(--accent); border-color: var(--accent); }
.footer-secondary-links { gap: 18px; }

/* post page: readable text of a coded infographic */
.pg-text { max-width: 900px; margin: 18px auto 0; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); }
.pg-text summary { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 18px; cursor: pointer; list-style: none; font-size: 15px; font-weight: 800; }
.pg-text summary::-webkit-details-marker { display: none; }
.pg-text summary svg { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: var(--cat, var(--accent)); stroke-width: 2.2; stroke-linecap: round; }
.pg-text .pg-text-chev { margin-inline-start: auto; stroke: var(--text-light); transition: transform 200ms var(--ease-out); }
.pg-text[open] .pg-text-chev { transform: rotate(180deg); }
.pg-text summary:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 20px; }
.pg-text-body { padding: 4px 22px 20px; border-top: 1px solid var(--border); }
.pg-text-body h3 { margin: 18px 0 6px; font-size: 17px; font-weight: 900; }
.pg-text-body p { margin: 0 0 8px; color: var(--text-secondary); font-size: 15px; line-height: 1.9; }
.pg-text-body .pg-text-src { margin-top: 14px; color: var(--text-light); font-size: 13px; }

/* ---------- category pages (/category/<slug>/) ---------- */
.category-page { width: min(var(--max-width), calc(100% - 40px)); margin: 0 auto; padding: 28px 0 56px; }
.catp-head { position: relative; overflow: hidden; padding: 26px 30px 24px; margin-bottom: 18px; border: 1px solid color-mix(in srgb, var(--cat) 30%, var(--border)); border-radius: 28px; background: linear-gradient(120deg, color-mix(in srgb, var(--cat) 16%, var(--surface)), var(--surface) 72%); }
.catp-head::before { content: ""; position: absolute; inset: 0 0 auto; height: 5px; background: var(--cat); }
.catp-crumbs { display: flex; gap: 8px; color: var(--text-light); font-size: 12.5px; font-weight: 700; }
.catp-crumbs a { color: inherit; text-decoration: none; }
.catp-crumbs a:hover { color: var(--text); }
.catp-title { display: flex; align-items: center; gap: 18px; margin-top: 14px; }
.catp-mark { display: grid; place-items: center; width: 64px; height: 64px; flex-shrink: 0; border-radius: 20px; background: var(--cat); color: #fff; font-size: 40px; font-weight: 900; line-height: 1; }
.catp-title h1 { margin: 0; font-size: clamp(30px, 4vw, 44px); font-weight: 900; line-height: 1.25; letter-spacing: -.5px; }
.catp-title p { margin: 6px 0 0; max-width: 640px; color: var(--text-secondary); font-size: 15px; line-height: 1.85; }
.catp-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.catp-stats span { padding: 6px 13px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text-secondary); font-size: 12.5px; font-weight: 700; }
.catp-stats b { color: var(--text); font-weight: 900; }
.catp-others { margin-bottom: 18px; }
@media (max-width: 700px) {
  .category-page { width: calc(100% - 28px); padding-top: 18px; }
  .catp-head { padding: 20px 18px; border-radius: 22px; }
  .catp-mark { width: 52px; height: 52px; border-radius: 16px; font-size: 32px; }
  .catp-title { gap: 14px; }
  .catp-title p { font-size: 14px; }
}
.category-page[style*="#D99A00"] .catp-mark, .category-page[style*="#13CBFF"] .catp-mark, .category-page[style*="#FC8FC5"] .catp-mark { color: #14141f; }
a.category-card { text-decoration: none; color: inherit; }

/* ---------- cards: outlined in their section colour ---------- */
.infographic-card.ip-card, .lead-story, .side-story { border: 1.5px solid color-mix(in srgb, var(--cat) 45%, var(--border)); }
html.dark-mode .infographic-card.ip-card, html.dark-mode .lead-story, html.dark-mode .side-story { border-color: color-mix(in srgb, var(--cat) 55%, var(--border)); }
@media (hover: hover) and (pointer: fine) {
  .infographic-card.ip-card:hover, .lead-story:hover, .side-story:hover { border-color: var(--cat); }
}

/* ---------- cards: a readable section of the infographic (card.jpg) instead of a far-away crop ---------- */
.has-card { background: color-mix(in srgb, var(--cat) 10%, var(--surface-soft)); }
.ip-card-media.has-card img, .lead-media.has-card img { object-fit: contain; object-position: center; padding: 16px; transform: none; filter: drop-shadow(0 6px 18px rgba(20, 20, 40, .10)); }
.lead-media.has-card img { padding: 28px; }
.lead-media.has-card::after { display: none; }
.side-thumb.has-card img { object-fit: cover; object-position: center; }
@media (hover: hover) and (pointer: fine) {
  .ip-card:hover .has-card img, .lead-story:hover .lead-media.has-card img { transform: scale(1.02); }
}

/* ---------- cards: zoom to the infographic inside its social image (_data/card_crop.json) ---------- */
.is-cropped { position: relative; overflow: hidden; }
.is-code.is-cropped img { position: absolute; inset: 0 auto auto auto; left: calc(var(--cl) * -100%); width: calc(var(--cw) * 100%); max-width: none; height: auto; object-fit: initial; transform: none; transform-origin: top left; }
@media (hover: hover) and (pointer: fine) {
  .ip-card:hover .is-code.is-cropped img, .lead-story:hover .is-code.is-cropped img { transform: scale(1.02); }
}
