/* ═══════════════════════════════════════════════════════════════
   📰 SAADI MATH ARTICLES
   Article pages (/articles/, /articles/<slug>/) + homepage
   "Latest Article" card. Works in light & dark themes.
   ═══════════════════════════════════════════════════════════════ */

:root {
  --ar-ink: #1b1530;
  --ar-body: #3b3452;
  --ar-muted: #6b6482;
  --ar-surface: #ffffff;
  --ar-surface-2: #f6f2ff;
  --ar-line: #e8e1f5;
  --ar-purple: #7C3AED;
  --ar-purple-deep: #4c1d95;
  --ar-amber: #FBBF24;
  --ar-amber-soft: #fff6e0;
  --ar-amber-line: #f6dfa8;
  --ar-amber-ink: #8a3c0b;
  --ar-mark: rgba(251, 191, 36, 0.38);
  --ar-shadow: 0 18px 44px rgba(36, 18, 88, 0.12);
  --ar-shadow-lg: 0 30px 70px rgba(30, 11, 61, 0.28);
  --ar-hero: radial-gradient(circle at 82% 8%, rgba(251, 191, 36, 0.24), transparent 34%),
             radial-gradient(circle at 8% 92%, rgba(168, 85, 247, 0.5), transparent 42%),
             linear-gradient(135deg, #1a0936 0%, #33126e 55%, #5b21b6 100%);
  --ar-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --ar-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --ar-header-offset: 110px;
}

[data-theme="dark"] {
  --ar-ink: #f5f3ff;
  --ar-body: #d4cfe4;
  --ar-muted: #a59fba;
  --ar-surface: #121226;
  --ar-surface-2: #17142e;
  --ar-line: #2c2650;
  --ar-purple: #b794ff;
  --ar-purple-deep: #d8c7ff;
  --ar-amber-soft: #2a1f0d;
  --ar-amber-line: #4a3612;
  --ar-amber-ink: #fcd38a;
  --ar-mark: rgba(251, 191, 36, 0.22);
  --ar-shadow: 0 18px 44px rgba(0, 0, 0, 0.4), 0 0 24px rgba(168, 85, 247, 0.08);
  --ar-shadow-lg: 0 30px 70px rgba(0, 0, 0, 0.55), 0 0 40px rgba(168, 85, 247, 0.15);
  --ar-hero: radial-gradient(circle at 82% 8%, rgba(251, 191, 36, 0.16), transparent 34%),
             radial-gradient(circle at 8% 92%, rgba(168, 85, 247, 0.38), transparent 42%),
             linear-gradient(135deg, #0b0518 0%, #1d0b42 55%, #3b1580 100%);
}

/* ───────────── Shared bits ───────────── */

.article-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.38rem 0.8rem;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.1);
  border: 1px solid rgba(124, 58, 237, 0.18);
  color: var(--ar-purple);
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.2;
}

.article-chip--hero {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
  color: #ffd98a;
  backdrop-filter: blur(6px);
}

.article-title-accent {
  background: linear-gradient(100deg, #ffd166 0%, #fbbf24 45%, #fb923c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #fbbf24;
}

.article-avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fbbf24, #f97316 45%, #7C3AED);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.02em;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.18);
}

.article-avatar--sm {
  width: 26px;
  height: 26px;
  font-size: 0.62rem;
  box-shadow: none;
}

.article-avatar--lg {
  width: 76px;
  height: 76px;
  font-size: 1.5rem;
  box-shadow: 0 10px 24px rgba(124, 58, 237, 0.3);
}

.article-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.38rem 0.8rem;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.2;
}

.article-badge--new {
  background: #fbbf24;
  color: #3b1d00;
}

.article-badge-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.article-badge-dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: currentColor;
  animation: ar-ping 1.8s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ar-ping {
  75%, 100% { transform: scale(2.4); opacity: 0; }
}

@keyframes ar-rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.article-hero-glow {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 75%);
  pointer-events: none;
}

/* ───────────── Reading progress ───────────── */

.article-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1101;
  height: 4px;
  background: transparent;
  pointer-events: none;
}

.article-progress span {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #7C3AED, #ec4899 55%, #fbbf24);
  transform: scaleX(0);
  transform-origin: left;
  transition: none !important;
}

/* ───────────── Article hero ───────────── */

.article-page {
  background: var(--bg-primary);
}

.article-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(8rem, 14vw, 11rem);
  background: var(--ar-hero);
  color: #fff;
  text-align: center;
}

.article-hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 920px;
  animation: ar-rise 0.7s ease-out both;
}

.article-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.6rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
}

.article-breadcrumbs a {
  color: rgba(255, 255, 255, 0.82);
}

.article-breadcrumbs a:hover {
  color: #ffd98a;
}

.article-breadcrumbs [aria-current] {
  color: rgba(255, 255, 255, 0.6);
}

.article-title {
  margin: 1.1rem 0 1rem;
  font-family: var(--ar-display);
  font-weight: 700;
  font-size: clamp(2.6rem, 7vw, 5rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
  color: #fff;
  text-wrap: balance;
}

.article-dek {
  max-width: 640px;
  margin: 0 0 2rem;
  font-family: var(--ar-serif);
  font-size: clamp(1.12rem, 2.2vw, 1.38rem);
  line-height: 1.55;
  color: rgba(247, 240, 255, 0.88);
  text-wrap: balance;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.85rem 1.25rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.78);
}

.article-meta-author {
  display: grid;
  text-align: left;
  line-height: 1.3;
}

.article-meta-author strong {
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
}

.article-meta-author span {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.65);
}

.article-meta-divider {
  width: 1px;
  height: 32px;
  background: rgba(255, 255, 255, 0.22);
}

.article-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.article-meta-item svg {
  color: #ffd98a;
}

/* ───────────── Featured image ───────────── */

.article-featured {
  position: relative;
  z-index: 2;
  max-width: 1100px;
  margin: calc(clamp(8rem, 14vw, 11rem) * -1 + 2.5rem) auto 0;
  border-radius: clamp(16px, 2.5vw, 30px);
  overflow: hidden;
  background: #1a0936;
  box-shadow: var(--ar-shadow-lg);
  outline: 1px solid rgba(255, 255, 255, 0.12);
  outline-offset: -1px;
  animation: ar-rise 0.8s 0.1s ease-out both;
}

.article-featured img {
  width: 100%;
  height: auto;
  aspect-ratio: 1600 / 893;
  object-fit: cover;
}

/* ───────────── Layout ───────────── */

.article-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 720px);
  justify-content: center;
  gap: clamp(2.5rem, 5vw, 4.5rem);
  padding-top: clamp(2.5rem, 5vw, 4rem);
  padding-bottom: clamp(3rem, 6vw, 5rem);
}

.article-aside-inner {
  position: sticky;
  top: var(--ar-header-offset);
  display: grid;
  gap: 2rem;
}

.article-aside-title {
  margin: 0 0 0.8rem;
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ar-muted);
}

.article-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 2px solid var(--ar-line);
}

.article-toc a {
  display: block;
  margin-left: -2px;
  padding: 0.5rem 0 0.5rem 1rem;
  border-left: 2px solid transparent;
  font-family: var(--font-body);
  font-size: 0.92rem;
  line-height: 1.4;
  color: var(--ar-muted);
}

.article-toc a:hover {
  color: var(--ar-ink);
}

.article-toc a.is-active {
  border-left-color: var(--ar-purple);
  color: var(--ar-purple);
  font-weight: 700;
}

.article-toc-mobile {
  display: none;
  margin-bottom: 2rem;
  padding: 0.25rem 1.1rem;
  border: 1px solid var(--ar-line);
  border-radius: 16px;
  background: var(--ar-surface-2);
}

.article-toc-mobile summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ar-ink);
  cursor: pointer;
  list-style: none;
}

.article-toc-mobile summary::-webkit-details-marker {
  display: none;
}

.article-toc-mobile[open] summary span {
  transform: rotate(180deg);
}

.article-toc-mobile ol {
  margin: 0 0 0.9rem;
  padding-left: 1.3rem;
}

.article-toc-mobile li {
  padding: 0.3rem 0;
  color: var(--ar-muted);
}

.article-toc-mobile a {
  color: var(--ar-body);
}

/* ───────────── Share buttons ───────────── */

.article-share {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.article-share-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--ar-line);
  background: var(--ar-surface);
  color: var(--ar-ink);
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease !important;
}

.article-share-btn:hover {
  transform: translateY(-3px);
  color: #fff;
  border-color: transparent;
}

.article-share-btn--whatsapp:hover { background: #25D366; }
.article-share-btn--facebook:hover { background: #1877F2; }
.article-share-btn--x:hover { background: #000; }
.article-share-btn--linkedin:hover { background: #0A66C2; }
.article-share-btn--copy:hover { background: var(--primary-purple); }

.article-copy-toast {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 0.3rem 0.6rem;
  border-radius: 8px;
  background: var(--ar-ink);
  color: var(--ar-surface);
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease !important;
}

.article-copy-toast:not(:empty) {
  opacity: 1;
}

/* ───────────── Article typography ───────────── */

.article-content {
  font-family: var(--ar-serif);
  font-size: clamp(1.08rem, 1.6vw, 1.2rem);
  line-height: 1.8;
  color: var(--ar-body);
}

.article-content p {
  margin: 0 0 1.4em;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
}

.article-content strong {
  color: var(--ar-ink);
  font-weight: 600;
  background: linear-gradient(transparent 62%, var(--ar-mark) 62%);
  padding: 0 0.08em;
}

.article-content a {
  color: var(--ar-purple);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.article-content a:hover {
  text-decoration-thickness: 2px;
}

.article-content h2 {
  position: relative;
  margin: 2.4em 0 0.75em;
  padding-top: 0.9rem;
  font-family: var(--ar-display);
  font-weight: 700;
  font-size: clamp(1.7rem, 3.4vw, 2.35rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ar-ink);
  scroll-margin-top: var(--ar-header-offset);
  text-wrap: balance;
}

.article-content h2::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 48px;
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, #7C3AED, #fbbf24);
}

.article-content :focus-visible,
.article-page :focus-visible {
  outline: 3px solid #f59e0b;
  outline-offset: 3px;
  border-radius: 4px;
}

.ar-intro {
  font-size: 1.18em;
  line-height: 1.7;
  color: var(--ar-ink) !important;
}

.ar-intro::first-letter {
  float: left;
  margin: 0.08em 0.12em 0 0;
  font-family: var(--ar-display);
  font-weight: 700;
  font-size: 3.6em;
  line-height: 0.82;
  color: var(--ar-purple);
}

.ar-ref {
  font-family: var(--font-display);
  font-size: 0.6em;
  font-weight: 700;
  white-space: nowrap;
  line-height: 0;
}

.article-content .ar-ref a {
  text-decoration: none;
  color: var(--ar-purple);
  padding: 0 0.1em;
}

.article-content .ar-ref a:hover {
  text-decoration: underline;
}

/* Stats */
.ar-stat-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 0 0 2.4rem;
}

.ar-stat {
  margin: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.3rem 1.35rem;
  border-radius: 20px;
  background: var(--ar-surface);
  border: 1px solid var(--ar-line);
  box-shadow: var(--ar-shadow);
  font-family: var(--font-body);
}

.ar-stat figcaption {
  display: grid;
  gap: 0.25rem;
}

.ar-stat-label {
  color: var(--ar-ink);
  font-weight: 700;
  font-size: 0.98rem;
  line-height: 1.35;
}

.ar-stat-scope {
  color: var(--ar-muted);
  font-size: 0.82rem;
}

.ar-stat-row {
  display: grid;
  gap: 0.6rem;
}

.article-content .ar-stat-number {
  background: none;
  padding: 0;
  font-family: var(--ar-display);
  font-weight: 700;
  font-size: clamp(2.6rem, 5vw, 3.3rem);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--ar-purple);
}

.article-content .ar-stat--accent .ar-stat-number {
  color: #d97706;
}

[data-theme="dark"] .article-content .ar-stat--accent .ar-stat-number {
  color: #fbbf24;
}

.ar-bar {
  height: 10px;
  border-radius: 99px;
  background: var(--ar-surface-2);
  border: 1px solid var(--ar-line);
  overflow: hidden;
}

.ar-bar span {
  display: block;
  width: var(--ar-fill, 100%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7C3AED, #a855f7);
  transform-origin: left;
  transition: transform 1.1s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

.ar-stat--accent .ar-bar span {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

/* Pull quote */
.ar-pullquote {
  position: relative;
  margin: 2.4rem 0;
  padding: 0.4rem 0 0.4rem 1.8rem;
  border-left: 4px solid;
  border-image: linear-gradient(180deg, #7C3AED, #fbbf24) 1;
}

.article-content .ar-pullquote p {
  margin: 0;
  font-family: var(--ar-display);
  font-weight: 600;
  font-style: italic;
  font-size: clamp(1.4rem, 3vw, 1.85rem);
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--ar-purple-deep);
}

/* Figures */
.ar-figure {
  margin: 2.4rem 0;
}

.ar-figure img {
  width: 100%;
  height: auto;
  border-radius: 22px;
  box-shadow: var(--ar-shadow);
}

.ar-figure figcaption {
  margin-top: 0.8rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--ar-muted);
  text-align: center;
}

/* Callout ring */
.ar-callout {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin: 2rem 0 0.5rem;
  padding: 1.4rem 1.6rem;
  border-radius: 22px;
  background: var(--ar-amber-soft);
  border: 1px solid var(--ar-amber-line);
}

.ar-callout-ring {
  position: relative;
  flex: none;
  width: 108px;
  height: 108px;
  display: grid;
  place-items: center;
}

.ar-callout-ring svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ar-ring-track,
.ar-ring-fill {
  fill: none;
  stroke-width: 11;
}

.ar-ring-track {
  stroke: rgba(217, 119, 6, 0.16);
}

.ar-ring-fill {
  stroke: #f59e0b;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: calc(100 - var(--ar-ring, 0));
  transition: stroke-dashoffset 1.4s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

.ar-callout-ring strong {
  position: relative;
  background: none;
  padding: 0;
  font-family: var(--ar-display);
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ar-amber-ink);
}

.article-content .ar-callout p {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.02rem;
  line-height: 1.55;
  color: var(--ar-ink);
}

.ar-callout-kicker {
  display: block;
  margin-bottom: 0.3rem;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ar-amber-ink);
}

/* Metrics */
.ar-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.2rem 0 1.2rem;
}

.ar-metric {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
  padding: 1.35rem 1.25rem;
  border-radius: 20px;
  background: var(--ar-surface);
  border: 1px solid var(--ar-line);
  box-shadow: var(--ar-shadow);
  font-family: var(--font-body);
  transition: transform 0.3s ease, box-shadow 0.3s ease !important;
}

.ar-metric:hover {
  transform: translateY(-4px);
}

.ar-metric-number {
  font-family: var(--ar-display);
  font-weight: 700;
  font-size: clamp(2.2rem, 4vw, 2.9rem);
  line-height: 1;
  letter-spacing: -0.04em;
  background: linear-gradient(120deg, #7C3AED, #c026d3) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent;
  padding: 0 !important;
}

[data-theme="dark"] .ar-metric-number {
  background: linear-gradient(120deg, #c4b5fd, #f0abfc) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
}

.ar-metric figcaption {
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--ar-ink);
}

.ar-metric-scope {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: var(--ar-muted);
}

.ar-metric--warm {
  background: var(--ar-amber-soft);
  border-color: var(--ar-amber-line);
}

.ar-metric--warm .ar-metric-number,
[data-theme="dark"] .ar-metric--warm .ar-metric-number {
  background: linear-gradient(120deg, #c2410c, #f59e0b) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
}

.ar-dots {
  display: grid;
  grid-template-columns: repeat(20, 1fr);
  gap: 3px;
  max-width: 11rem;
  margin-top: auto;
}

.ar-dots span {
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(194, 65, 12, 0.18);
}

.ar-dots span:first-child {
  background: #c2410c;
  box-shadow: 0 0 0 2px rgba(194, 65, 12, 0.25);
}

[data-theme="dark"] .ar-dots span { background: rgba(251, 191, 36, 0.18); }
[data-theme="dark"] .ar-dots span:first-child { background: #fbbf24; }

.article-content .ar-note {
  font-family: var(--font-body);
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--ar-muted);
  padding-left: 1rem;
  border-left: 2px solid var(--ar-line);
}

/* Opinion */
.ar-opinion {
  position: relative;
  margin: 3rem 0;
  padding: clamp(1.5rem, 4vw, 2.4rem);
  border: 2px solid transparent;
  border-radius: 26px;
  background:
    linear-gradient(var(--ar-surface-2), var(--ar-surface-2)) padding-box,
    linear-gradient(135deg, #7C3AED, #ec4899 50%, #fbbf24) border-box;
  box-shadow: var(--ar-shadow);
}

.ar-opinion::after {
  content: '\201C';
  position: absolute;
  top: -0.1em;
  right: 0.25em;
  font-family: var(--ar-display);
  font-size: 9rem;
  line-height: 1;
  color: var(--ar-purple);
  opacity: 0.12;
  pointer-events: none;
}

.ar-opinion-kicker {
  display: inline-flex;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: var(--primary-purple);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.article-content .ar-opinion h2 {
  margin-top: 0.8rem;
  padding-top: 0;
}

.article-content .ar-opinion h2::before {
  display: none;
}

.article-content .ar-opinion p:last-child {
  margin-bottom: 0;
}

/* Tips */
.ar-tips {
  list-style: none;
  display: grid;
  gap: 0.9rem;
  margin: 0 0 2.4rem;
  padding: 0;
  counter-reset: ar-tip;
}

.ar-tips li {
  counter-increment: ar-tip;
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: start;
  padding: 1.15rem 1.25rem;
  border-radius: 18px;
  background: var(--ar-surface);
  border: 1px solid var(--ar-line);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ar-body);
}

.ar-tips li::after {
  content: '0' counter(ar-tip);
  position: absolute;
  top: 0.9rem;
  right: 1.1rem;
  font-family: var(--ar-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--ar-line);
}

.ar-tip-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--ar-surface-2);
  border: 1px solid var(--ar-line);
  font-size: 1.3rem;
}

.ar-tips li > div {
  padding-right: 1.6rem;
}

.ar-tips strong {
  display: block;
  margin-bottom: 0.15rem;
  background: none !important;
  padding: 0 !important;
  font-family: var(--font-display);
  font-weight: 700;
}

/* Resources */
.ar-resources {
  margin: 3rem 0 2.4rem;
  padding: clamp(1.5rem, 4vw, 2.4rem);
  border-radius: 26px;
  background:
    radial-gradient(circle at 100% 0%, rgba(251, 191, 36, 0.22), transparent 40%),
    linear-gradient(160deg, #f4edff, #fff8eb);
  border: 1px solid var(--ar-line);
}

[data-theme="dark"] .ar-resources {
  background:
    radial-gradient(circle at 100% 0%, rgba(251, 191, 36, 0.12), transparent 40%),
    linear-gradient(160deg, #1b1438, #1a1424);
}

.article-content .ar-resources h2 {
  margin-top: 0;
}

.ar-apps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 1.4rem;
}

.article-content a.ar-app {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.85rem;
  row-gap: 0.2rem;
  padding: 1.1rem 1.15rem;
  border-radius: 18px;
  background: var(--ar-surface);
  border: 1px solid var(--ar-line);
  text-decoration: none;
  font-family: var(--font-body);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease !important;
}

.article-content a.ar-app::after {
  content: '↗';
  position: absolute;
  top: 0.9rem;
  right: 1rem;
  font-family: var(--font-display);
  color: var(--ar-muted);
  transition: transform 0.25s ease !important;
}

.article-content a.ar-app:hover {
  transform: translateY(-4px);
  border-color: rgba(124, 58, 237, 0.4);
  box-shadow: var(--ar-shadow);
}

.article-content a.ar-app:hover::after {
  transform: translate(2px, -2px);
  color: var(--ar-purple);
}

.ar-app-icon {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.14), rgba(251, 191, 36, 0.2));
  font-size: 1.3rem;
}

.ar-app-name {
  padding-right: 1.2rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--ar-ink);
}

.ar-app-desc {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--ar-muted);
}

/* Sources */
.ar-sources {
  margin-top: 2.4rem;
  border: 1px solid var(--ar-line);
  border-radius: 18px;
  background: var(--ar-surface);
  font-family: var(--font-body);
}

.ar-sources summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  cursor: pointer;
  list-style: none;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ar-ink);
}

.ar-sources summary::-webkit-details-marker {
  display: none;
}

.ar-sources summary::after {
  content: '+';
  font-size: 1.4rem;
  line-height: 1;
  color: var(--ar-purple);
  transition: transform 0.25s ease !important;
}

.ar-sources[open] summary::after {
  transform: rotate(45deg);
}

.ar-sources-count {
  margin-left: auto;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ar-muted);
}

.ar-sources ol {
  margin: 0;
  padding: 0 1.25rem 1.2rem 2.6rem;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--ar-muted);
}

.ar-sources li {
  padding: 0.35rem 0.4rem;
  border-radius: 8px;
  scroll-margin-top: var(--ar-header-offset);
}

.ar-sources li:target {
  background: var(--ar-amber-soft);
}

/* ───────────── Article footer ───────────── */

.article-footer {
  display: grid;
  gap: 1.8rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--ar-line);
}

.article-tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
}

.article-tags li {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: var(--ar-surface-2);
  border: 1px solid var(--ar-line);
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ar-body);
}

.article-share-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  border-radius: 18px;
  background: var(--ar-surface-2);
  border: 1px solid var(--ar-line);
}

.article-share-row p {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--ar-ink);
}

.article-author-card {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  padding: 1.6rem;
  border-radius: 22px;
  background: var(--ar-surface);
  border: 1px solid var(--ar-line);
  box-shadow: var(--ar-shadow);
}

.article-author-card > div {
  display: grid;
  gap: 0.15rem;
}

.article-author-kicker {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ar-muted);
}

.article-author-name {
  font-family: var(--ar-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ar-ink);
}

.article-author-role {
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--ar-purple);
  font-weight: 600;
}

.article-author-card p {
  margin: 0.6rem 0 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--ar-body);
}

/* ───────────── CTA band ───────────── */

.article-cta {
  padding: 0 0 clamp(3rem, 6vw, 5rem);
}

.article-cta-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.75rem 2.5rem;
  padding: clamp(1.75rem, 4vw, 3rem);
  border-radius: 30px;
  background: var(--ar-hero);
  color: #fff;
  box-shadow: var(--ar-shadow-lg);
}

.article-cta-card > div:first-child {
  flex: 1 1 380px;
}

.article-cta-kicker {
  display: block;
  margin-bottom: 0.6rem;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ffd98a;
}

.article-cta-card h2 {
  margin: 0 0 0.6rem;
  font-family: var(--ar-display);
  font-size: clamp(1.6rem, 3.4vw, 2.3rem);
  line-height: 1.15;
  color: #fff;
}

.article-cta-card p {
  margin: 0;
  color: rgba(247, 240, 255, 0.84);
}

.article-cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.btn-article-ghost {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-article-ghost:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  transform: translateY(-2px);
}

/* ───────────── More articles ───────────── */

.article-more {
  padding: clamp(2.5rem, 5vw, 4rem) 0;
  background: var(--ar-surface-2);
  border-top: 1px solid var(--ar-line);
  margin-bottom: clamp(3rem, 6vw, 5rem);
}

.article-more-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.article-more-head h2 {
  margin: 0;
  font-family: var(--ar-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  color: var(--ar-ink);
}

.article-more-head a {
  font-family: var(--font-display);
  font-weight: 700;
}

/* ═══════════════════════════════════════════════════════════════
   /articles/ index
   ═══════════════════════════════════════════════════════════════ */

.articles-index {
  background: var(--bg-primary);
}

.articles-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(3rem, 7vw, 5.5rem) 0 clamp(7rem, 12vw, 9rem);
  background: var(--ar-hero);
  color: #fff;
  text-align: center;
}

.articles-hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 860px;
  animation: ar-rise 0.7s ease-out both;
}

.articles-hero h1 {
  margin: 1.1rem 0 0.9rem;
  font-family: var(--ar-display);
  font-weight: 700;
  font-size: clamp(2.8rem, 7vw, 5rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
  color: #fff;
}

.articles-hero p {
  max-width: 600px;
  margin: 0 0 1.8rem;
  font-family: var(--ar-serif);
  font-size: clamp(1.1rem, 2.2vw, 1.3rem);
  line-height: 1.55;
  color: rgba(247, 240, 255, 0.86);
}

.articles-hero-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
}

.articles-hero-stats span {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.78);
}

.articles-hero-stats strong {
  color: #ffd98a;
  font-family: var(--font-display);
}

.articles-hero-shapes .shape {
  position: absolute;
  font-family: var(--ar-display);
  font-weight: 700;
  color: rgba(255, 255, 255, 0.07);
  line-height: 1;
  pointer-events: none;
  animation: ar-float 9s ease-in-out infinite;
}

.shape-pi { top: 12%; left: 7%; font-size: 9rem; }
.shape-sigma { top: 18%; right: 8%; font-size: 7rem; animation-delay: -3s !important; }
.shape-root { bottom: 22%; left: 16%; font-size: 6rem; animation-delay: -5s !important; }
.shape-plus { bottom: 30%; right: 18%; font-size: 5rem; color: rgba(251, 191, 36, 0.14) !important; animation-delay: -1.5s !important; }

@keyframes ar-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-14px) rotate(4deg); }
}

.articles-body {
  position: relative;
  z-index: 2;
  margin-top: calc(clamp(7rem, 12vw, 9rem) * -1 + 2.5rem);
  padding-bottom: clamp(3rem, 6vw, 5rem);
}

/* Cards */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 1.5rem;
  margin-top: 1.75rem;
}

.article-card {
  min-width: 0;
}

.article-card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border-radius: 24px;
  background: var(--ar-surface);
  border: 1px solid var(--ar-line);
  box-shadow: var(--ar-shadow);
  color: inherit;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s ease, border-color 0.35s ease !important;
}

.article-card-link:hover {
  transform: translateY(-6px);
  border-color: rgba(124, 58, 237, 0.35);
  box-shadow: var(--ar-shadow-lg);
  color: inherit;
}

.article-card-media {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #1a0936;
}

.article-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

.article-card-link:hover .article-card-media img {
  transform: scale(1.05);
}

.article-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  flex: 1;
  padding: 1.4rem 1.5rem 1.6rem;
}

.article-card-top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.article-card-title {
  margin: 0;
  font-family: var(--ar-display);
  font-weight: 700;
  font-size: clamp(1.35rem, 2.2vw, 1.6rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--ar-ink);
}

.article-card-excerpt {
  margin: 0;
  font-family: var(--ar-serif);
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--ar-body);
}

.article-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: auto;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--ar-muted);
}

.article-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ar-purple);
}

.article-card-cta span {
  transition: transform 0.25s ease !important;
}

.article-card-link:hover .article-card-cta span {
  transform: translateX(5px);
}

/* Featured (latest) card */
.article-card--featured .article-card-link {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  border-radius: 30px;
  box-shadow: var(--ar-shadow-lg);
}

.article-card--featured .article-card-link:hover {
  transform: translateY(-4px);
}

.article-card--featured .article-card-media {
  aspect-ratio: auto;
  min-height: 100%;
}

.article-card--featured .article-card-media img {
  position: absolute;
  inset: 0;
}

.article-card--featured .article-card-body {
  justify-content: center;
  gap: 1rem;
  padding: clamp(1.6rem, 3.5vw, 2.8rem);
}

.article-card--featured .article-card-title {
  font-size: clamp(1.9rem, 3.6vw, 2.8rem);
  line-height: 1.08;
}

.article-card--featured .article-card-excerpt {
  font-size: 1.12rem;
}

.article-card--featured .article-card-meta {
  margin-top: 0.4rem;
}

.article-card--featured .article-card-cta {
  margin-top: 0.4rem;
  align-self: flex-start;
  padding: 0.85rem 1.4rem;
  border-radius: 14px;
  background: linear-gradient(135deg, #7C3AED, #6D28D9);
  color: #fff;
  box-shadow: var(--shadow-purple);
}

.article-coming-soon {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 1.8rem;
  border-radius: 24px;
  border: 2px dashed var(--ar-line);
  background: var(--ar-surface-2);
}

.article-coming-icon {
  font-size: 2rem;
}

.article-coming-soon h3 {
  margin: 0;
  font-family: var(--ar-display);
  font-size: 1.4rem;
  color: var(--ar-ink);
}

.article-coming-soon p {
  margin: 0;
  font-size: 0.98rem;
  color: var(--ar-body);
}

.article-coming-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.article-coming-links a {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: var(--ar-surface);
  border: 1px solid var(--ar-line);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
}

.article-coming-links a:hover {
  border-color: var(--ar-purple);
}

/* ═══════════════════════════════════════════════════════════════
   Homepage: "Latest Article" card inside Our Services Highlights
   ═══════════════════════════════════════════════════════════════ */

.service-card-article .service-highlight-link {
  border: 2px solid transparent;
  background:
    linear-gradient(rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.96)) padding-box,
    linear-gradient(135deg, #7C3AED, #ec4899 50%, #fbbf24) border-box;
}

[data-theme="dark"] .service-card-article .service-highlight-link {
  border-color: transparent;
  background:
    linear-gradient(rgba(14, 12, 28, 0.96), rgba(14, 12, 28, 0.96)) padding-box,
    linear-gradient(135deg, #a855f7, #ec4899 50%, #fbbf24) border-box;
}

.service-card-article .service-highlight-media {
  background: #1a0936;
}

.service-card-article .service-highlight-media::after {
  background: linear-gradient(180deg, transparent 55%, rgba(4, 8, 22, 0.35) 100%);
}

.service-highlight-pill--new {
  /* bottom-right so it never covers the headline printed on the featured image */
  top: auto;
  left: auto;
  right: 1rem;
  bottom: 1rem;
  gap: 0.45rem;
  background: #fbbf24;
  border-color: rgba(255, 255, 255, 0.5);
  color: #3b1d00;
  box-shadow: 0 6px 18px rgba(251, 191, 36, 0.45);
}

.service-card-article .service-highlight-copy {
  align-content: start;
}

.service-article-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(124, 58, 237, 0.12);
  font-family: var(--font-body);
  font-size: 0.86rem;
  color: var(--text-muted);
}

[data-theme="dark"] .service-article-meta {
  border-top-color: rgba(168, 85, 247, 0.2);
}

.service-article-cta {
  margin-left: auto;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--primary-purple);
  white-space: nowrap;
}

.service-article-cta span {
  display: inline-block;
  transition: transform 0.25s ease !important;
}

.service-card-article .service-highlight-link:hover .service-article-cta span {
  transform: translateX(4px);
}

[data-theme="dark"] .service-article-cta {
  color: #c4b5fd;
}

/* ───────────── Scroll animations (enabled by articles.js) ───────────── */

.ar-js .ar-bar span { transform: scaleX(0); }
.ar-js .ar-bar.is-in span { transform: scaleX(1); }
.ar-js .ar-ring-fill { stroke-dashoffset: 100; }
.ar-js .ar-callout-ring.is-in .ar-ring-fill { stroke-dashoffset: calc(100 - var(--ar-ring, 0)); }

/* ───────────── Responsive ───────────── */

@media (max-width: 1100px) {
  .article-layout {
    grid-template-columns: minmax(0, 720px);
  }

  .article-aside {
    display: none;
  }

  .article-toc-mobile {
    display: block;
  }
}

@media (max-width: 900px) {
  .article-card--featured .article-card-link {
    grid-template-columns: 1fr;
  }

  .article-card--featured .article-card-media {
    aspect-ratio: 1600 / 893;
    min-height: 0;
  }
}

@media (max-width: 968px) {
  :root { --ar-header-offset: 90px; }
}

@media (max-width: 640px) {
  .article-hero {
    text-align: left;
  }

  .article-hero-inner,
  .articles-hero-inner {
    align-items: flex-start;
  }

  .articles-hero {
    text-align: left;
  }

  .article-breadcrumbs,
  .article-meta,
  .articles-hero-stats {
    justify-content: flex-start;
  }

  .article-meta-divider {
    display: none;
  }

  .article-meta-author {
    flex: 1 1 calc(100% - 64px);
  }

  .article-featured {
    border-radius: 16px;
  }

  .ar-stat-pair,
  .ar-metrics,
  .ar-apps {
    grid-template-columns: 1fr;
  }

  .ar-metric {
    display: grid;
    grid-template-columns: 6.5rem 1fr;
    align-items: start;
    gap: 0.4rem 1rem;
  }

  .ar-metric .ar-dots {
    grid-column: 2;
  }

  .ar-callout {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .ar-opinion::after {
    font-size: 6rem;
  }

  .article-author-card {
    flex-direction: column;
  }

  .article-share-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .article-cta-actions,
  .article-cta-actions .btn {
    width: 100%;
  }

  .articles-hero-shapes .shape {
    opacity: 0.6;
  }

  .shape-pi { font-size: 6rem; }
  .shape-sigma { font-size: 5rem; }
  .shape-root,
  .shape-plus { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .article-hero-inner,
  .articles-hero-inner,
  .article-featured,
  .articles-hero-shapes .shape,
  .article-badge-dot::after {
    animation: none !important;
  }

  .ar-bar span,
  .ar-ring-fill,
  .article-card-link,
  .article-card-media img {
    transition: none !important;
  }
}

@media print {
  .article-progress,
  .article-aside,
  .article-toc-mobile,
  .article-share-row,
  .article-cta,
  .article-more,
  .site-header,
  .site-footer,
  .mobile-whatsapp-sticky,
  .floating-particles {
    display: none !important;
  }

  .article-hero {
    background: none;
    color: #111;
    padding: 0 0 1rem;
  }

  .article-title,
  .article-dek,
  .article-meta,
  .article-meta-author strong {
    color: #111;
  }

  .article-featured {
    margin-top: 0;
    box-shadow: none;
  }

  .article-layout {
    display: block;
  }

  .ar-sources ol {
    display: block !important;
  }
}

/* Keep long-form reading calm: no floating emoji over the article text */
.saadimath-article-single .floating-particles {
  display: none !important;
}

/* While "More articles on the way" is the only grid item, show it as a full-width banner */
.articles-grid > .article-coming-soon:only-child {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.4rem 1.5rem;
}

.articles-grid > .article-coming-soon:only-child .article-coming-icon {
  grid-row: span 2;
  font-size: 2.4rem;
}

.articles-grid > .article-coming-soon:only-child .article-coming-links {
  grid-column: 3;
  grid-row: 1 / span 2;
  margin: 0;
}

@media (max-width: 760px) {
  .articles-grid > .article-coming-soon:only-child {
    grid-template-columns: auto 1fr;
  }

  .articles-grid > .article-coming-soon:only-child .article-coming-links {
    grid-column: 1 / -1;
    grid-row: auto;
    margin-top: 0.4rem;
  }
}
