/* ================================================================
   post.css — enbi
   Template article (post.hbs) — Codex rebuild.
   Depends on theme.css (Codex section) and post-sections.css.
================================================================ */

/* ────────────────────────────────────────────────────────────────
   LOCAL TOKEN
──────────────────────────────────────────────────────────────── */
:root {
  --measure-article: 58ch;
}

/* ────────────────────────────────────────────────────────────────
   POST HERO — dark, 2-col (copy + cognitive summary)
──────────────────────────────────────────────────────────────── */
.post-hero {
  position: relative;
  background: var(--frame-deep);
  color: var(--white);
  overflow: clip;
}
.post-hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 6px;
  background: linear-gradient(90deg,
    var(--method-bright) 0 28%,
    var(--resolve) 28% 46%,
    var(--method-pale) 46% 68%,
    var(--resolve) 68% 100%
  );
}
.post-hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: end;
  padding-block: clamp(78px, 10vw, 142px);
}
.post-hero-layout.has-summary {
  grid-template-columns: minmax(0, 1fr) minmax(320px, .42fr);
  gap: clamp(44px, 7vw, 112px);
}
.hero-copy,
.cognitive-summary {
  min-width: 0;
}

/* ────────────────────────────────────────────────────────────────
   ARTICLE META — eyebrow (tag · date · time · author)
──────────────────────────────────────────────────────────────── */
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-bottom: 28px;
  color: var(--method-pale);
  font-size: 14px;
  font-weight: 780;
}
.article-meta .meta-tag {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.article-meta .meta-tag::before {
  content: "";
  width: 42px;
  height: 2px;
  background: var(--resolve);
  flex-shrink: 0;
}

/* ────────────────────────────────────────────────────────────────
   HERO H1 — Inria Serif, looser tracking than pages
──────────────────────────────────────────────────────────────── */
.post-hero h1 {
  width: min(100%, 17ch);
  max-width: 100%;
  font-family: var(--serif);
  font-size: clamp(48px, 5.4vw, 82px);
  line-height: 1.02;
  letter-spacing: -.025em;
  font-weight: 700;
  margin: 0;
  overflow-wrap: break-word;
  hyphens: manual;
  text-wrap: balance;
}

/* ────────────────────────────────────────────────────────────────
   HERO DECK — italic serif standfirst
──────────────────────────────────────────────────────────────── */
.hero-deck {
  max-width: 56ch;
  margin: 30px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--line-dark);
  color: var(--on-dark);
  font: italic 400 clamp(20px, 1.7vw, 27px)/1.48 var(--serif);
  overflow-wrap: break-word;
  text-wrap: pretty;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 30px;
}
.hero-actions[hidden],
.hero-actions:empty {
  display: none;
}
.hero-actions .btn,
.hero-actions a {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 13px 20px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 760;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}
.hero-actions .btn--primary,
.hero-actions a:first-child {
  background: var(--resolve);
  color: var(--white);
}
.hero-actions .btn--secondary,
.hero-actions a + a {
  color: var(--white);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.34);
}

.review-rating-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  margin: 24px 0 0;
  padding: 9px 13px;
  border: 1px solid rgba(255,255,255,.28);
  background: rgba(255,255,255,.1);
  color: var(--method-pale);
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
}

.review-rating-badge span {
  color: var(--white);
  font-size: 13px;
}

/* ────────────────────────────────────────────────────────────────
   COGNITIVE SUMMARY — right aside in hero
──────────────────────────────────────────────────────────────── */
.cognitive-summary {
  align-self: stretch;
  display: grid;
  align-content: start;
  gap: 1px;
  background: rgba(255, 255, 255, .08);
  border-top: 3px solid var(--resolve);
}
.cognitive-summary[hidden],
.cognitive-summary:empty { display: none; }
.summary-item {
  padding: 22px;
  background: var(--frame);
}
.summary-item strong {
  display: block;
  margin-bottom: 10px;
  color: var(--on-dark);
  font-size: 14px;
}
.summary-item p {
  margin: 0;
  color: var(--on-dark-2);
  font: 400 15px/1.55 var(--serif);
  overflow-wrap: break-word;
  text-wrap: pretty;
}

/* Hidden in article body until JS moves it to hero */
.post-summary { display: none; }

/* ────────────────────────────────────────────────────────────────
   READER BAR — open-blue navigation strip
──────────────────────────────────────────────────────────────── */
.reader-bar {
  background: var(--open-blue);
  border-bottom: 1px solid var(--line-light);
}
.reader-bar[hidden] { display: none; }
.reader-grid {
  display: grid;
  grid-template-columns: .65fr 1fr;
  gap: clamp(32px, 6vw, 86px);
  padding-block: clamp(34px, 5vw, 58px);
  align-items: start;
}
.reader-title {
  font-size: clamp(28px, 3.1vw, 44px);
  line-height: 1;
  letter-spacing: -.035em;
  margin: 0;
  max-width: 16ch;
  overflow-wrap: anywhere;
  hyphens: auto;
  text-wrap: balance;
}
.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.toc a {
  min-height: 44px;
  padding: 10px 12px;
  background: var(--white);
  color: var(--ink);
  font-size: 13px;
  font-weight: 760;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  overflow-wrap: anywhere;
}
.toc a:hover { color: var(--resolve-deep); }
.toc a:active { color: var(--cadre); }
.toc a:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 3px;
}
.toc:empty { display: none; }

/* ────────────────────────────────────────────────────────────────
   ARTICLE SHELL — 3-col layout (rail + body + side)
──────────────────────────────────────────────────────────────── */
.article-shell {
  display: grid;
  grid-template-columns: minmax(180px, .28fr) minmax(0, var(--measure-article));
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
  padding-block: clamp(72px, 9vw, 126px);
  justify-content: center;
}
.article-shell.has-side {
  grid-template-columns: minmax(180px, .28fr) minmax(0, var(--measure-article)) minmax(260px, .35fr);
  justify-content: initial;
}
.article-shell.has-legacy-landing {
  grid-template-columns: minmax(0, var(--measure-article));
  justify-content: center;
}
.article-shell.is-short-read {
  grid-template-columns: minmax(0, var(--measure-article));
  padding-block: clamp(54px, 7vw, 96px);
}
.article-shell.is-short-read .rail {
  display: none;
}
.article-shell.has-legacy-landing .rail {
  display: none;
}
.article-shell > * {
  min-width: 0;
}

/* ────────────────────────────────────────────────────────────────
   LEFT RAIL — sticky progress + section links
──────────────────────────────────────────────────────────────── */
.rail {
  position: sticky;
  top: 88px;
  display: grid;
  gap: 18px;
}
.rail[hidden] { display: none; }
.rail strong {
  color: var(--ink);
  font-size: 14px;
}
.rail-nav {
  display: grid;
  gap: 2px;
  padding-left: 12px;
  border-left: 1px solid var(--line-light);
}
.rail-nav a {
  position: relative;
  color: var(--ink-muted);
  display: block;
  padding-block: 7px;
  font-size: 13px;
  line-height: 1.45;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.rail-nav a::before {
  content: "";
  position: absolute;
  left: -13px;
  top: 9px;
  bottom: 9px;
  width: 2px;
  background: transparent;
}
.rail-nav a:hover,
.rail-nav a.is-active {
  color: var(--ink);
  transform: translateX(2px);
}
.rail-nav a.is-active::before { background: var(--resolve); }
.rail-nav a:active { color: var(--cadre); }
.rail-nav a:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 3px;
}
.progress {
  width: 100%;
  height: 3px;
  background: var(--line-light);
}
.progress span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--resolve);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .1s linear;
}

/* ────────────────────────────────────────────────────────────────
   ARTICLE BODY TYPOGRAPHY
──────────────────────────────────────────────────────────────── */
.article { min-width: 0; }

.article p {
  margin: 0 0 1.2em;
  font: 400 clamp(19px, 1.55vw, 22px)/1.76 var(--serif);
  color: var(--ink);
  overflow-wrap: break-word;
  text-wrap: pretty;
}
.article .lead {
  font-size: clamp(22px, 2vw, 29px);
  line-height: 1.55;
  color: var(--ink-muted);
}
.article h2 {
  margin: 2.1em 0 .65em;
  font-size: clamp(34px, 3.8vw, 56px);
  line-height: 1.03;
  letter-spacing: -.04em;
  overflow-wrap: anywhere;
  hyphens: auto;
  text-wrap: balance;
}
.article h3 {
  margin: 1.8em 0 .6em;
  font-size: clamp(24px, 2.3vw, 34px);
  line-height: 1.1;
  letter-spacing: -.03em;
  overflow-wrap: anywhere;
  hyphens: auto;
  text-wrap: balance;
}
.article ul {
  margin: 0 0 1.5em;
  padding: 0;
  list-style: none;
}
.article li {
  position: relative;
  padding-left: 28px;
  margin-bottom: .72em;
  font: 400 clamp(18px, 1.45vw, 21px)/1.65 var(--serif);
  overflow-wrap: break-word;
}
.article li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: .72em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--method);
}

/* ────────────────────────────────────────────────────────────────
   SNIPPET — inline callout boxes in article body
──────────────────────────────────────────────────────────────── */
.snippet {
  margin: clamp(34px, 5vw, 56px) 0;
  border-top: 3px solid var(--method);
  border-bottom: 1px solid var(--line-light);
  background: var(--open-blue);
}
.snippet--resolve { border-top-color: var(--resolve); }

.snippet-header {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 22px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line-light);
}
.snippet-label {
  color: var(--method);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .04em;
  padding-top: 4px;
}
.snippet--resolve .snippet-label { color: var(--resolve-deep); }
.snippet h3 {
  margin: 0;
  font-size: clamp(22px, 2.2vw, 31px);
  line-height: 1.1;
  letter-spacing: -.03em;
  overflow-wrap: anywhere;
  hyphens: auto;
  text-wrap: balance;
}
.snippet-body { padding: 24px; }
.snippet-body p,
.snippet-body li {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.58;
  color: var(--ink);
  overflow-wrap: break-word;
}
.snippet-body p { margin: 0 0 1em; }
.snippet-body p:last-child { margin-bottom: 0; }
.snippet-body li::before { top: .62em; background: var(--resolve); }

/* Legacy Ghost articles can contain bare cognitive headings. post.hbs upgrades
   them to canonical .snip blocks; these guards keep article typography from
   leaking back into the snippet system. */
.article .snip--legacy {
  margin-block: clamp(30px, 5vw, 48px);
}
.article .snip--legacy p {
  margin-block: 0;
}
.article .snip--legacy .snip__body > p + p,
.article .snip--legacy .snip__body > ul + p,
.article .snip--legacy .snip__body > ol + p {
  margin-top: 12px;
}
.article .snip--legacy .snip__body > p:not([class]) {
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
}
.article .snip--legacy .snip__title,
.article .snip--legacy .snip__body > p:first-child:not([class]) {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 19px;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--cadre);
}
.article .snip--confondre li::before,
.article .snip--ordre li::before {
  content: none;
}

/* ────────────────────────────────────────────────────────────────
   SIDE SNIPPETS — right sticky column
──────────────────────────────────────────────────────────────── */
.side-snippets {
  position: sticky;
  top: 88px;
  display: grid;
  gap: 16px;
}
.side-snippets:empty { display: none; }

.side-card {
  padding: 20px;
  background: var(--open-blue);
  border-top: 3px solid var(--method);
}
.side-card--dark {
  background: var(--frame);
  color: var(--white);
  border-top-color: var(--resolve);
}
.side-card strong {
  display: block;
  margin-bottom: 10px;
  font-size: 14px;
}
.side-card p,
.side-card li {
  margin: 0;
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: break-word;
}
.side-card--dark p,
.side-card--dark li { color: var(--on-dark); }
.side-card ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}
.side-card li {
  position: relative;
  padding-left: 18px;
}
.side-card li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .6em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--resolve);
}

/* ────────────────────────────────────────────────────────────────
   POST NEXT — dark CTA
──────────────────────────────────────────────────────────────── */
.post-next[hidden],
.post-legacy-cta-slot[hidden] {
  display: none;
}
.post-legacy-cta-slot .cta {
  background: var(--frame-deep);
  color: var(--white);
  padding-block: clamp(86px, 10vw, 146px);
  padding-inline: clamp(20px, 4vw, 64px);
}
.post-legacy-cta-slot .cta__content {
  width: min(100%, 760px);
  margin-inline: auto;
  text-align: center;
}
.post-legacy-cta-slot .cta .eyebrow {
  margin: 0 0 26px;
  color: var(--method-pale);
  font-size: 15px;
  font-weight: 780;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.post-legacy-cta-slot .cta h2 {
  margin: 0;
  color: var(--white);
  font-size: clamp(42px, 5.2vw, 72px);
  line-height: 1.02;
  letter-spacing: -.04em;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.post-legacy-cta-slot .cta p:not(.eyebrow) {
  margin: 28px auto 0;
  color: var(--on-dark-2);
  font: 400 clamp(20px, 1.8vw, 26px)/1.5 var(--serif);
  max-width: 58ch;
  text-wrap: pretty;
}
.post-legacy-cta-slot .cta__actions,
.post-legacy-cta-slot .cta .actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-top: 42px;
}
.post-legacy-cta-slot .btn--primary,
.post-legacy-cta-slot .btn--secondary {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 13px 22px;
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 760;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}
.post-legacy-cta-slot .btn--primary {
  background: var(--resolve);
  color: var(--white);
}
.post-legacy-cta-slot .btn--secondary {
  color: var(--white);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.22);
}
.post-next { background: var(--resolve-deep); color: var(--white); }
.post-next-layout {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: clamp(48px, 9vw, 132px);
  padding-block: clamp(86px, 10vw, 146px);
  align-items: end;
}
.post-next-layout h2 {
  max-width: 13ch;
  font-size: clamp(46px, 6vw, 84px);
  line-height: .98;
  letter-spacing: -.04em;
  margin: 0;
  overflow-wrap: anywhere;
  hyphens: auto;
  text-wrap: balance;
}
.post-next-layout p {
  margin: 0 0 28px;
  color: #ffe7eb;
  font: 400 20px/1.55 var(--serif);
  overflow-wrap: break-word;
  text-wrap: pretty;
}

/* ────────────────────────────────────────────────────────────────
   ANIMATIONS
──────────────────────────────────────────────────────────────── */
.motion-ready .hero-copy { animation: post-hero-in .8s .08s var(--ease) both; }
.motion-ready .cognitive-summary:not([hidden]):not(:empty) { animation: post-summary-in .9s .16s var(--ease) both; }

@keyframes post-hero-in {
  from { opacity: .01; transform: translateY(30px); filter: blur(8px); }
  to   { opacity: 1; transform: none; filter: none; }
}
@keyframes post-summary-in {
  from { opacity: .01; transform: translateX(28px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-copy, .cognitive-summary { animation: none !important; }
  .progress span { transition: none; }
}

/* ────────────────────────────────────────────────────────────────
   RESPONSIVE
──────────────────────────────────────────────────────────────── */
@media (max-width: 1120px) {
  .post-hero-layout,
  .reader-grid,
  .post-next-layout { grid-template-columns: 1fr; }
  .post-hero-layout { align-items: start; }
  .post-hero h1 { width: 100%; }
  .cognitive-summary { align-self: auto; }
  .article-shell {
    grid-template-columns: minmax(0, var(--measure-article)) minmax(240px, .35fr);
    justify-content: center;
  }
  .article-shell:not(.has-side),
  .article-shell.is-short-read {
    grid-template-columns: minmax(0, var(--measure-article));
  }
  .rail { display: none; }
}

@media (max-width: 820px) {
  .post-hero-layout {
    gap: 28px;
    padding-block: 56px 74px;
  }
  .article-meta { margin-bottom: 22px; }
  .post-hero h1 {
    font-size: clamp(36px, 10.6vw, 48px);
    line-height: 1.04;
    letter-spacing: -.018em;
    width: min(100%, 10.8ch);
    overflow-wrap: break-word;
    word-break: normal;
  }
  .hero-deck {
    margin-top: 24px;
    font-size: clamp(19px, 5.1vw, 22px);
  }
  .article-shell {
    grid-template-columns: 1fr;
    padding-block: 54px 82px;
  }
  .toc {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
  .toc a {
    width: 100%;
    white-space: normal;
  }
  .side-snippets { position: static; order: -1; }
  .snippet-header { grid-template-columns: 1fr; gap: 8px; }
}

@media (max-width: 560px) {
  .hero-copy,
  .reader-grid {
    width: min(100%, 350px);
    margin-inline: 0 auto;
  }
  .hero-deck {
    max-width: 100%;
  }
  .post-hero h1 {
    width: min(100%, 9.2ch);
  }
  .toc a {
    max-width: 100%;
  }
  .hero-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
  .hero-actions .btn,
  .hero-actions a {
    width: 100%;
    white-space: normal;
  }
}

@media (max-width: 420px) {
  .article-meta {
    gap: 8px 12px;
    font-size: 13px;
  }
  .article-meta .meta-tag::before {
    width: 34px;
  }
  .post-hero h1 {
    font-size: clamp(33px, 9.6vw, 39px);
    width: min(100%, 10.4ch);
  }
  .reader-title {
    font-size: clamp(26px, 8vw, 34px);
  }
}
