/*
 * Ada Article — new template stylesheet (Ada Tech School blog redesign).
 * Loaded ONLY by custom-newdesign.hbs. Never reached by post.hbs / index / tag / page.
 *
 * Scoping discipline (verified by pre-deploy grep):
 *   Every selector starts with one of: .m-ada- / .l-ada- / .js-ada- / :root / @
 *   No bare element selectors. Element styling for article content is scoped
 *   under .l-ada-article-content table { ... }, etc.
 *
 * Reuses --ada-red from the existing global stylesheet (cascades fine since both load).
 */

:root {
  --ada-callout-retenir-bg: #fff5e6;
  --ada-callout-retenir-border: #f5a623;
  --ada-callout-exemple-bg: #e8f4fd;
  --ada-callout-exemple-border: #2196f3;
  --ada-callout-bonasavoir-bg: #e8f8f0;
  --ada-callout-bonasavoir-border: #4caf50;
  --ada-callout-saviezvous-bg: #f3e8fd;
  --ada-callout-saviezvous-border: #9c27b0;
  --ada-callout-attention-bg: #fde8e8;
  --ada-callout-attention-border: #e74c3c;
  --ada-grey-100: #f5f5f5;
  --ada-grey-200: #e5e5e5;
  --ada-grey-400: #999;
  --ada-grey-700: #444;
}

/* ============================================================
   READING PROGRESS BAR (top of viewport)
   ============================================================ */

.m-ada-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  z-index: 9999;
  pointer-events: none;
}
.m-ada-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--ada-red, #e74c3c);
  transition: width 0.05s linear;
}

/* ============================================================
   ARTICLE HEADER (title + meta + feature image, side-by-side on desktop)
   ============================================================ */

.m-ada-header {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin: 24px 0 40px;
}
@media (min-width: 768px) {
  .m-ada-header {
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    align-items: start;
  }
}

.m-ada-header__text {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.m-ada-header__title {
  font-size: 1.875rem;
  line-height: 1.2;
  margin: 0;
  font-weight: 700;
}
@media (min-width: 768px) {
  .m-ada-header__title { font-size: 2.5rem; }
}
.m-ada-header__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--ada-grey-700);
}
.m-ada-header__tag {
  display: inline-block;
  padding: 4px 10px;
  background: var(--ada-red, #e74c3c);
  color: #fff;
  border-radius: 12px;
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.m-ada-header__sep { color: var(--ada-grey-400); }
.m-ada-header__author a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.m-ada-header__updated {
  font-size: 0.8125rem;
  color: var(--ada-grey-400);
  font-style: italic;
}

.m-ada-header__image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 8px;
}
.m-ada-header__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ============================================================
   2-COLUMN BODY GRID (aside + content)
   ============================================================ */

.l-ada-article-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}
@media (min-width: 1024px) {
  .l-ada-article-grid {
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 48px;
  }
}
.l-ada-article-aside {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
@media (min-width: 1024px) {
  .l-ada-article-aside {
    position: sticky;
    top: 100px;
    align-self: start;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
  }
}
.l-ada-article-main { min-width: 0; }

/* ============================================================
   TABLE OF CONTENTS (Sommaire)
   ============================================================ */

.m-ada-toc {
  background: var(--ada-grey-100);
  border-radius: 8px;
  padding: 16px 20px;
  font-size: 0.875rem;
}
.m-ada-toc__title {
  font-weight: 700;
  font-size: 0.9375rem;
  margin: 0;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.m-ada-toc__title::-webkit-details-marker { display: none; }
.m-ada-toc__title::after {
  content: "▾";
  transition: transform 0.2s ease;
  font-size: 0.75rem;
  color: var(--ada-grey-400);
}
.m-ada-toc[open] .m-ada-toc__title::after { transform: rotate(180deg); }
.m-ada-toc__nav { margin-top: 12px; }
.m-ada-toc__list,
.m-ada-toc__list ol {
  list-style: none;
  padding-left: 0;
  margin: 0;
}
.m-ada-toc__list li { margin: 6px 0; }
.m-ada-toc__list ol { padding-left: 16px; }
/* H3 sublist collapsed by default — expanded by JS when its parent H2 is the active section */
.m-ada-toc__list > li > ol {
  max-height: 0;
  margin-top: 0;
  overflow: hidden;
  transition: max-height 0.25s ease, margin-top 0.25s ease;
}
.m-ada-toc__list > li.is-expanded > ol {
  max-height: 1000px;
  margin-top: 4px;
}
.m-ada-toc__list a {
  color: var(--ada-grey-700);
  text-decoration: none;
  display: block;
  padding: 4px 8px;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  line-height: 1.4;
}
.m-ada-toc__list a:hover { color: var(--ada-red, #e74c3c); }
.m-ada-toc__list a.is-active {
  color: var(--ada-red, #e74c3c);
  border-left-color: var(--ada-red, #e74c3c);
  font-weight: 600;
}

/* ============================================================
   STICKY LATERAL CTA (desktop only — hidden on mobile)
   ============================================================ */

.m-ada-sticky-cta {
  display: none;
}
@media (min-width: 1024px) {
  .m-ada-sticky-cta {
    display: block;
    background: var(--ada-red, #e74c3c);
    color: #fff;
    padding: 20px;
    border-radius: 8px;
  }
}
.m-ada-sticky-cta__title {
  margin: 0 0 16px;
  font-size: 1rem;
  line-height: 1.35;
  font-weight: 700;
  color: #fff;
}
.m-ada-sticky-cta__button {
  display: inline-block;
  padding: 10px 18px;
  background: #fff;
  color: var(--ada-red, #e74c3c);
  text-decoration: none;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.875rem;
  transition: opacity 0.15s;
}
.m-ada-sticky-cta__button:hover { opacity: 0.9; }

/* ============================================================
   ARTICLE CONTENT TYPOGRAPHY (scoped under .l-ada-article-content)
   Styles native Koenig output: tables, figures, blockquotes, lists.
   ============================================================ */

.l-ada-article-content { font-size: 1.0625rem; line-height: 1.7; color: var(--ada-grey-700); }
.l-ada-article-content h2 { font-size: 1.625rem; margin: 2em 0 0.6em; line-height: 1.3; scroll-margin-top: 90px; }
.l-ada-article-content h3 { font-size: 1.25rem; margin: 1.6em 0 0.5em; line-height: 1.35; scroll-margin-top: 90px; }
@media (max-width: 767px) {
  .l-ada-article-content h2,
  .l-ada-article-content h3 { scroll-margin-top: 60px; }
}
.l-ada-article-content p { margin: 0 0 1.2em; }
.l-ada-article-content ul,
.l-ada-article-content ol { margin: 0 0 1.2em; padding-left: 1.5em; }
.l-ada-article-content li { margin-bottom: 0.5em; }
.l-ada-article-content a {
  color: var(--ada-red, #e74c3c);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.l-ada-article-content blockquote {
  border-left: 4px solid var(--ada-red, #e74c3c);
  padding: 0.5em 1.5em;
  margin: 1.5em 0;
  font-style: italic;
  color: var(--ada-grey-700);
  background: var(--ada-grey-100);
  border-radius: 0 4px 4px 0;
}
.l-ada-article-content figure { margin: 1.5em 0; }
.l-ada-article-content figure img { max-width: 100%; height: auto; display: block; border-radius: 4px; }
.l-ada-article-content figcaption {
  font-size: 0.875rem;
  color: var(--ada-grey-400);
  margin-top: 0.5em;
  text-align: center;
}
.l-ada-article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.9375rem;
}
.l-ada-article-content table th,
.l-ada-article-content table td {
  padding: 10px 14px;
  border: 1px solid var(--ada-grey-200);
  text-align: left;
}
.l-ada-article-content table th { background: var(--ada-grey-100); font-weight: 600; }
.l-ada-article-content table tbody tr:nth-child(even) { background: #fafafa; }
@media (max-width: 767px) {
  .l-ada-article-content table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}
.l-ada-article-content pre {
  background: #1e1e1e;
  color: #f5f5f5;
  padding: 1em;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 0.875rem;
}
.l-ada-article-content code {
  background: var(--ada-grey-100);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.9375em;
}
.l-ada-article-content pre code { background: transparent; padding: 0; }

/* ============================================================
   CALLOUTS — 5 variants (À retenir, Exemple, Bon à savoir, Le saviez-vous, Attention)
   ============================================================ */

.m-ada-callout {
  border-left: 4px solid;
  border-radius: 4px;
  padding: 16px 20px;
  margin: 1.5em 0;
}
.m-ada-callout h4 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.m-ada-callout p:last-child,
.m-ada-callout ul:last-child,
.m-ada-callout ol:last-child { margin-bottom: 0; }

.m-ada-callout--retenir {
  background: var(--ada-callout-retenir-bg);
  border-left-color: var(--ada-callout-retenir-border);
}
.m-ada-callout--retenir h4 { color: var(--ada-callout-retenir-border); }

.m-ada-callout--exemple {
  background: var(--ada-callout-exemple-bg);
  border-left-color: var(--ada-callout-exemple-border);
}
.m-ada-callout--exemple h4 { color: var(--ada-callout-exemple-border); }

.m-ada-callout--bonasavoir {
  background: var(--ada-callout-bonasavoir-bg);
  border-left-color: var(--ada-callout-bonasavoir-border);
}
.m-ada-callout--bonasavoir h4 { color: var(--ada-callout-bonasavoir-border); }

.m-ada-callout--saviezvous {
  background: var(--ada-callout-saviezvous-bg);
  border-left-color: var(--ada-callout-saviezvous-border);
}
.m-ada-callout--saviezvous h4 { color: var(--ada-callout-saviezvous-border); }

.m-ada-callout--attention {
  background: var(--ada-callout-attention-bg);
  border-left-color: var(--ada-callout-attention-border);
}
.m-ada-callout--attention h4 { color: var(--ada-callout-attention-border); }

/* ============================================================
   FAQ (details / summary)
   ============================================================ */

.m-ada-faq {
  margin: 2em 0;
  border-top: 1px solid var(--ada-grey-200);
}
.m-ada-faq details {
  border-bottom: 1px solid var(--ada-grey-200);
  padding: 16px 0;
}
.m-ada-faq summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 1.0625rem;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}
.m-ada-faq summary::-webkit-details-marker { display: none; }
.m-ada-faq summary::after {
  content: "+";
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--ada-red, #e74c3c);
  transition: transform 0.2s ease;
  margin-left: 16px;
}
.m-ada-faq details[open] summary::after { transform: rotate(45deg); }
.m-ada-faq details > *:not(summary) { margin-top: 12px; line-height: 1.6; }

/* ============================================================
   BUTTON CTA (inline)
   ============================================================ */

.m-ada-button-cta {
  display: inline-block;
  margin: 1em 0;
  padding: 12px 24px;
  background: var(--ada-red, #e74c3c);
  color: #fff !important;
  text-decoration: none !important;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.9375rem;
  text-align: center;
  transition: opacity 0.15s, transform 0.15s;
}
.m-ada-button-cta:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

/* ============================================================
   FORM CTA (HubSpot wrapper, lazy-loaded)
   ============================================================ */

.m-ada-form-cta {
  margin: 2em 0;
  padding: 24px;
  background: var(--ada-grey-100);
  border-radius: 8px;
  border-top: 4px solid var(--ada-red, #e74c3c);
}
.m-ada-form-cta h3 {
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
}
.m-ada-form-cta p {
  margin: 0 0 16px;
  color: var(--ada-grey-700);
  font-size: 0.9375rem;
}
.m-ada-form-cta .js-ada-hs-target { min-height: 80px; }
.m-ada-form-cta .js-ada-hs-target:empty::before {
  content: "Chargement du formulaire…";
  display: block;
  text-align: center;
  color: var(--ada-grey-400);
  font-size: 0.875rem;
  padding: 24px 0;
}

/* ============================================================
   AI SUMMARIZE BLOCK
   ============================================================ */

.m-ada-ai-summarize {
  margin: 3em 0 2em;
  padding: 20px 24px;
  background: var(--ada-grey-100);
  border-radius: 8px;
}
.m-ada-ai-summarize__title {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ada-grey-700);
}
.m-ada-ai-summarize__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.m-ada-ai-summarize__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #fff;
  color: var(--ada-grey-700);
  text-decoration: none;
  border: 1px solid var(--ada-grey-200);
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: border-color 0.15s, transform 0.15s;
}
.m-ada-ai-summarize__link:hover {
  border-color: var(--ada-red, #e74c3c);
  transform: translateY(-1px);
}
.m-ada-ai-summarize__logo {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ============================================================
   AUTHOR BLOCK (end of article)
   ============================================================ */

.m-ada-author-end {
  margin: 3em 0 2em;
  padding: 24px;
  background: var(--ada-grey-100);
  border-radius: 8px;
}
.m-ada-author-end__inner {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.m-ada-author-end__avatar {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  display: block;
}
.m-ada-author-end__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.m-ada-author-end__info { flex: 1; min-width: 0; }
.m-ada-author-end__name {
  margin: 0 0 4px;
  font-size: 1.125rem;
  font-weight: 700;
}
.m-ada-author-end__name a { color: inherit; text-decoration: none; }
.m-ada-author-end__name a:hover { color: var(--ada-red, #e74c3c); }
.m-ada-author-end__coauthors,
.m-ada-author-end__bio {
  margin: 4px 0;
  font-size: 0.9375rem;
  color: var(--ada-grey-700);
  line-height: 1.5;
}
.m-ada-author-end__links {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: flex;
  gap: 12px;
}
.m-ada-author-end__links a {
  color: var(--ada-grey-400);
  display: inline-flex;
  transition: color 0.15s;
}
.m-ada-author-end__links a:hover { color: var(--ada-red, #e74c3c); }

/* ============================================================
   SHARE BOTTOM
   ============================================================ */

.m-ada-share-bottom {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 2em 0;
  padding: 16px 0;
  border-top: 1px solid var(--ada-grey-200);
  border-bottom: 1px solid var(--ada-grey-200);
}
.m-ada-share-bottom__label {
  font-weight: 600;
  font-size: 0.9375rem;
  margin-right: 8px;
}
.m-ada-share-bottom__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--ada-grey-100);
  color: var(--ada-grey-700);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.m-ada-share-bottom__btn:hover {
  background: var(--ada-red, #e74c3c);
  color: #fff;
  transform: translateY(-1px);
}
.m-ada-share-bottom__btn svg { width: 18px; height: 18px; }

/* ============================================================
   RELATED ARTICLES (6, grid)
   ============================================================ */

.m-ada-related {
  margin: 4em 0 2em;
  padding: 32px 0;
  background: var(--ada-grey-100);
}
.m-ada-related__title {
  margin: 0 0 24px;
  font-size: 1.5rem;
  font-weight: 700;
}
.m-ada-related__grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 20px;
}
@media (min-width: 600px) { .m-ada-related__grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .m-ada-related__grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1200px) { .m-ada-related__grid { grid-template-columns: repeat(6, 1fr); } }

.m-ada-related-card { background: #fff; border-radius: 6px; overflow: hidden; }
.m-ada-related-card__link {
  display: block;
  color: inherit;
  text-decoration: none;
  height: 100%;
}
.m-ada-related-card__picture {
  aspect-ratio: 4 / 3;
  overflow: hidden;
}
.m-ada-related-card__picture img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}
.m-ada-related-card__link:hover .m-ada-related-card__picture img { transform: scale(1.05); }
.m-ada-related-card__info { padding: 12px 14px; }
.m-ada-related-card__tag {
  display: inline-block;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ada-red, #e74c3c);
  font-weight: 700;
  margin-bottom: 6px;
}
.m-ada-related-card__title {
  margin: 0 0 8px;
  font-size: 0.9375rem;
  line-height: 1.35;
  font-weight: 600;
}
.m-ada-related-card__link:hover .m-ada-related-card__title { color: var(--ada-red, #e74c3c); }
.m-ada-related-card__meta {
  font-size: 0.75rem;
  color: var(--ada-grey-400);
  display: flex;
  gap: 6px;
}

