/* =========================================================
   AI Article layout (uses template CSS variables)
   Variables: --main-bg-color, --font-color, --page-color1, --maxwidth
   ========================================================= */

/* =========================================================
   Config
   - Set sticky top offset once (matches fixed header height)
   ========================================================= */
:root {
  --ai-sticky-top: 20px;
}

/* =========================================================
   Override global `section { display:flex; overflow:hidden; ... }`
   Only inside the AI article page scope.
   ========================================================= */
section {
  display: block;     /* Reset global flex */
  overflow: visible !important;  /* Prevent clipping */
}

ul li {
    line-height: 150%;
}

/* =========================================================
   Sticky prerequisites
   - Sticky fails if any ancestor has overflow != visible or transform/filter/contain
   ========================================================= */
.ai-article,
.ai-article .container,
.ai-article .content-grid,
.ai-article .toc {
  overflow: visible !important;
  transform: none !important;
  filter: none !important;
  perspective: none !important;
  contain: none !important;
}

/* =========================================================
   Base wrapper spacing
   ========================================================= */
.ai-article {
  padding-top: clamp(26px, 4vw, 64px);
  padding-bottom: clamp(40px, 5vw, 90px);
  color: var(--font-color);
}

/* Ensure grid wrappers behave correctly even if something forced flex */
.ai-article .expert-grid,
.ai-article .content-grid {
  display: grid !important;
}

/* Prevent overflow issues in grids */
.ai-article section > * {
  min-width: 0;
}

/* Optional container helper (remove if your template already has it) */
.container {
  max-width: var(--maxwidth);
  margin: 0 auto;
  padding: 0 20px;
}

/* =========================================================
   Typography: headings weight + proportional spacing
   ========================================================= */
.ai-article h1,
.ai-article h2,
.ai-article h3,
.ai-article h4,
.ai-article h5,
.ai-article h6,
.ai-article__title,
.expert-card__name,
.toc__title,
.toc__why-title,
.callout__title,
.faq__title {
  font-weight: 600;
}

/* Breadcrumbs */
.ai-article__breadcrumbs {
  font-size: 14px;
  opacity: 0.7;
  margin: 0 0 10px;
}
.ai-article__breadcrumbs a {
  color: inherit;
  text-decoration: none;
}
.ai-article__breadcrumbs a:hover {
  text-decoration: underline;
}
.ai-article__breadcrumbs span {
  margin: 0 6px;
  opacity: 0.6;
}

/* Title */
.ai-article__title {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.15;
  margin: 0 0 clamp(18px, 2vw, 28px);
}
.ai-article__subtitle {
  font-size: 18px;
  opacity: 0.75;
  margin: 0 0 clamp(18px, 2vw, 28px);
}

/* =========================================================
   Top cards: expert + summary
   ========================================================= */
.expert-grid {
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: stretch;
  margin-bottom: clamp(34px, 5vw, 80px);
  padding-bottom: clamp(18px, 3vw, 30px);
  position: relative; /* Required for ::after */
}

/* Full-width divider under expert section (true viewport width) */
.expert-grid::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 100%;
  height: 1px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.08);
}

/* Card base */
.expert-card,
.stat-card,
.toc__box {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  padding: clamp(18px, 4vw, 24px);
}

/* Kicker */
.expert-card__kicker,
.stat-card__title {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.6;
  margin-bottom: 12px;
}

/* Expert layout */
.expert-card__body {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 14px;
  align-items: start;
}
.expert-card__avatar img {
  border-radius: 999px;
  display: block;
  width: 72px;
  height: 72px;
  object-fit: cover;
  background: rgba(0, 0, 0, 0.04);
}
.expert-card__name {
  font-size: 18px;
  margin: 0 0 2px;
}
.expert-card__role {
  font-size: 14px;
  color: var(--page-color1);
  margin: 0 0 10px;
}
.expert-card__bio {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.55;
  opacity: 0.92;
}
.expert-card__links {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}
.expert-card__link {
  display: inline-flex;   
  align-items: center;
  gap: 8px;
  line-height: 1.2;
  color: var(--page-color1);
  opacity: 0.4;
  transition: opacity 0.2s ease, transform 0.2s ease, text-decoration-color 0.2s ease;
  font-size: 80%;
  border-bottom: 1px solid var(--page-color1);
  text-decoration: none;
}

/* Arrow like in mockup */
.expert-card__link::after {
  content: "→";
  display: inline-block;
}
/* Hover state */
.expert-card__link:hover {
  opacity: 1;
}


.expert-card__updated {
  font-size: 13px;
  opacity: 0.65;
}

/* Summary list */
.stat-card__list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
}
.stat-card__list li {
  line-height: 1.45;
}

/* =========================================================
   Two-column content: TOC + content
   ========================================================= */
.content-grid {
  grid-template-columns: 320px 1fr;
  gap: 28px;
  align-items: start;
}

/* No-TOC mode: one column */
.ai-article--no-toc .content-grid,
.content-grid--single {
  grid-template-columns: 1fr;
}
.ai-article--no-toc .toc,
.ai-article--no-toc .toc__box {
  display: none !important;
}

/* TOC */
.toc {
  height: 100%;
}
.toc__box {
  position: sticky;
  top: var(--ai-sticky-top);
  max-height: calc(100vh - var(--ai-sticky-top) - 24px);
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.toc__title {
  font-size: 130%;
  margin: 0 0 clamp(14px, 1.2vw, 22px);
}

.toc__list {
  list-style: none;
  margin: 0;
  padding-left: 0;
  display: grid;
  gap: 8px;
}
.toc__list a {
  color: inherit;
  text-decoration: none;
  font-size: 14px;
  opacity: 0.85;
}
.toc__list a:hover {
  opacity: 1;
  text-decoration: underline;
}
.toc__list a.is-active {
  font-weight: 600;
  color: var(--page-color1);
  opacity: 1;
}

/* Why us block */
.toc__why {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}
.toc__why-title {
  margin: 0 0 clamp(14px, 1.2vw, 22px);
}
.toc__why-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 6px;
  font-size: 14px;
  opacity: 0.85;
}

/* Content */
.content h2 {
  font-size: 26px;
  line-height: 1.2;
  position: relative;
  padding-left: 14px;
  margin: 0 0 clamp(14px, 1.2vw, 22px);
}
.content h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  width: 4px;
  height: 26px;
  background: var(--page-color1);
  border-radius: 999px;
}

.content p {
  margin: 0 0 clamp(14px, 1.8vw, 18px);
  line-height: 1.7;
  opacity: 0.95;
}

/* Section spacing + anchor offset */
.content-section {
  padding: clamp(10px, 1.6vw, 14px) 0 clamp(22px, 2.8vw, 34px);
  scroll-margin-top: calc(var(--ai-sticky-top) + 20px);
}

/* Callout */
.callout {
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(0, 0, 0, 0.03);
  border-left: 4px solid var(--page-color1);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 14px 0 0;
}
.callout__title {
  margin: 0 0 6px;
}
.callout__text {
  opacity: 0.95;
}

/* Sources (simple grid links) */
.ai-article__sources {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 10px;
}
.ai-article__source {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  padding: 12px 14px;
  text-decoration: none;
  color: inherit;
  font-weight: 600;
  opacity: 0.92;
}
.ai-article__source:hover {
  opacity: 1;
  border-color: rgba(0, 0, 0, 0.14);
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 980px) {
  .expert-grid {
    grid-template-columns: 1fr;
    margin-bottom: 40px;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  /* Mobile: disable sticky to avoid taking too much space */
  .toc__box {
    position: relative;
    top: auto;
    max-height: none;
    overflow: visible;
  }

  .ai-article__sources {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   Expert profile page (inherits existing AI styles)
   Scope: .ai-expert
   - Safe overrides allowed (previous CSS is already present)
   ========================================================= */

.ai-expert {
  padding-top: clamp(26px, 4vw, 64px);
  padding-bottom: clamp(40px, 5vw, 90px);
  color: var(--font-color);
}

/* Prevent global section flex/overflow issues (same reason as ai-article) */
.ai-expert section {
  display: block;
  overflow: visible;
}

/* Hero */
.ai-expert__hero {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 28px;
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  padding: clamp(18px, 4vw, 32px);
  margin-bottom: clamp(26px, 4vw, 44px);
}

.ai-expert__img {
  width: 240px;
  height: 240px;
  border-radius: 999px;
  object-fit: cover;
  display: block;
  background: rgba(0, 0, 0, 0.04);
  border: 4px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.ai-expert__name {
  margin: 0 0 6px;
  font-size: clamp(26px, 3.6vw, 40px);
  line-height: 1.15;
  font-weight: 700;
}
.ai-expert__title {
  color: var(--page-color1);
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 12px;
}

.ai-expert__quote {
  margin: 0 0 14px;
  font-size: 16px;
  line-height: 1.65;
  opacity: 0.95;
}

/* Timeline */
.ai-expert__timeline {
  border-left: 2px solid rgba(0, 0, 0, 0.08);
  padding-left: 22px;
  margin-left: 10px;
}
.ai-expert__titem {
  position: relative;
  padding: 4px 0 14px;
  margin-bottom: 12px;
}
.ai-expert__titem::before {
  content: "";
  position: absolute;
  left: -30px;
  top: 10px;
  width: 12px;
  height: 12px;
  background: var(--page-color1);
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.95);
}
.ai-expert__year {
  font-weight: 800;
  margin-bottom: 2px;
}
.ai-expert__role {
  font-weight: 700;
  opacity: 0.92;
}
.ai-expert__desc {
  font-size: 14px;
  opacity: 0.75;
  margin-top: 4px;
}

/* Grid cards */
.ai-expert__grid {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.ai-expert__card-title {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 700;
}

.ai-expert__list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}
.ai-expert__list li {
  line-height: 1.55;
  opacity: 0.92;
}

/* Badges */
.ai-expert__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.ai-expert__badge {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 13px;
  font-weight: 600;
  color: var(--page-color1);
}

/* Responsive */
@media (max-width: 900px) {
  .ai-expert__hero {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .ai-expert__img {
    width: 170px;
    height: 170px;
    margin: 0 auto;
  }
  .ai-expert__cta {
    justify-content: center;
  }
  .ai-expert__grid {
    grid-template-columns: 1fr;
  }
  .ai-expert__timeline {
    margin-left: 6px;
    padding-left: 18px;
  }
  .ai-expert__titem::before {
    left: -26px;
  }
}