/*
 * Coquille commune aux pages contenu (articles + ressources) : jetons de couleur du site,
 * colonne de lecture, aside, bandeau d'action et pied de page. Les feuilles `ressource*.css`
 * ne portent plus que le contenu propre à une famille de ressources (étapes, blocs de prompt,
 * calculateur…).
 *
 * Les jetons reprennent ceux de `kalya.css`. `SiteNav` (fixed) est chargé via `kalya.css` ;
 * `.rl-main` réserve l'espace sous la barre.
 */

:root {
  --ink: #0e1430;
  --ink-2: #1a2148;
  --blue: #253788;
  --blue-deep: #1b2a6e;
  --blue-soft: #eef1fa;
  --orange: #ff7015;
  --orange-soft: #ffe3d1;
  --paper: #ffffff;
  --paper-2: #f8f8f6;
  --muted: rgba(14, 20, 48, 0.62);
  --line: rgba(14, 20, 48, 0.1);
  --line-strong: rgba(14, 20, 48, 0.2);
  --r: 14px;
  --r-dm: 22%;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body.rl {
  margin: 0;
  min-height: 100vh;
  font-family: 'Geist', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'ss01', 'ss02';
}

.mono {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-feature-settings: normal;
}

/* --- Colonnes (espace sous SiteNav fixed) --- */

.rl-main {
  padding: 120px 0 24px;
}

.rl-shell {
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
}

.rl--prose .rl-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 264px;
  gap: 64px;
  align-items: start;
  max-width: 1120px;
}

.rl--prose .rl-col {
  max-width: 72ch;
}

.rl--tool .rl-shell {
  max-width: 1040px;
}

.rl-head {
  margin-bottom: 32px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  font-family: 'Geist Mono', ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0 0 14px;
}

.eyebrow::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--orange);
  transform: rotate(45deg);
  border-radius: var(--r-dm);
  flex: 0 0 8px;
}

.rl-breadcrumb {
  margin: 0 0 20px;
  font-size: 13px;
  color: var(--muted);
}

.rl-breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rl-breadcrumb li + li::before {
  content: '/';
  margin-right: 6px;
  color: var(--line-strong);
}

.rl-breadcrumb a {
  color: inherit;
  text-underline-offset: 3px;
}

.rl-breadcrumb a:hover {
  color: var(--ink);
}

.rl-breadcrumb [aria-current='page'] {
  color: var(--ink);
}

.rl-published {
  margin: -4px 0 14px;
  font-size: 14px;
  color: var(--muted);
}

h1 {
  font-size: clamp(1.9rem, 4.2vw, 2.9rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  margin: 0 0 14px;
  line-height: 1.06;
}

.lede {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
  max-width: 58ch;
}

.rl-cover {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  margin-top: 28px;
  border-radius: var(--r);
}

/* --- Corps rédigé (articles, guides, étapes) --- */

.prose {
  font-size: 17px;
  line-height: 1.72;
  max-width: 70ch;
}

.prose > h2 {
  font-size: clamp(1.35rem, 2.4vw, 1.7rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 2.2em 0 0.6em;
}

.prose > h3 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 1.8em 0 0.5em;
}

.prose > h2:first-child,
.prose > h3:first-child,
.prose > p:first-child {
  margin-top: 0;
}

.prose > p {
  margin: 0 0 1.15em;
}

/* `:not([class])` : seules les listes écrites en Markdown, jamais celles d'un composant (`.steps`). */
.prose > ul:not([class]),
.prose > ol:not([class]) {
  margin: 0 0 1.3em;
  padding-left: 1.2em;
}

.prose > ul:not([class]) li + li,
.prose > ol:not([class]) li + li {
  margin-top: 0.5em;
}

.prose > blockquote {
  margin: 1.6em 0;
  padding-left: 20px;
  border-left: 2px solid var(--orange);
  color: var(--muted);
}

.prose strong {
  font-weight: 600;
}

/* Idem : un lien de composant (bouton, copie) garde ses styles. */
.prose a:not([class]) {
  color: var(--blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition:
    color 0.2s ease,
    text-decoration-thickness 0.2s ease;
}

.prose a:not([class]):hover {
  color: var(--ink);
  text-decoration-thickness: 2px;
}

/* Corps d'article uniquement : les liens Markdown sont orange. */
[data-article-content].prose a:not([class]) {
  color: var(--orange);
}

/* --- Recos : bande sous la grille de lecture --- */

.rl-main:has(.rl-reco) {
  padding-bottom: 0;
}

.rl-main:has(.rl-reco) + .rl-cta {
  margin-top: 0;
}

.rl-reco {
  margin-top: 72px;
  padding: 48px 0 56px;
  background: var(--paper-2);
  border-top: 1px solid var(--line);
}

.rl-reco-inner {
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
}

.rl--prose .rl-reco-inner {
  max-width: 1120px;
}

.rl--tool .rl-reco-inner {
  max-width: 1040px;
}

.rl-reco-block + .rl-reco-block {
  margin-top: 40px;
}

.rl-reco h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  font-size: clamp(1.35rem, 2.4vw, 1.7rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.rl-reco h2::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--orange);
  transform: rotate(45deg);
  border-radius: var(--r-dm);
  flex: 0 0 8px;
}

.rl-reco-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.rl-reco li {
  display: flex;
  min-width: 0;
}

.rl-reco a {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 22px 22px 18px;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  color: inherit;
  text-decoration: none;
}

.rl-reco a:hover {
  border-color: var(--ink);
}

.rl-reco a:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 3px;
}

.rl-reco-title {
  font-size: clamp(1.15rem, 1.6vw, 1.35rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.rl-reco-desc {
  font-size: 15px;
  line-height: 1.5;
  color: var(--muted);
}

.rl-reco-arrow {
  margin-top: auto;
  padding-top: 14px;
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
  transition:
    transform 0.2s ease,
    color 0.2s ease;
}

.rl-reco a:hover .rl-reco-title,
.rl-reco a:focus-visible .rl-reco-title {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.rl-reco a:hover .rl-reco-arrow,
.rl-reco a:focus-visible .rl-reco-arrow {
  color: var(--orange);
  transform: translateX(4px);
}

@media (min-width: 760px) {
  .rl-reco-grid:has(li:nth-child(2)) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* --- Aside de lecture --- */

.rl-aside {
  position: sticky;
  top: 96px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.rl-aside-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.rl-aside-label::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--orange);
  transform: rotate(45deg);
  border-radius: var(--r-dm);
  flex: 0 0 8px;
}

.rl-aside-text {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}

.rl-aside-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--orange);
  color: white;
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition:
    background 0.25s ease,
    transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.rl-aside-cta:hover {
  background: #ff5a00;
  transform: translateY(-1px);
}

.rl-aside-link {
  display: inline-block;
  margin-top: 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--blue);
  text-decoration: none;
}

.rl-aside-link:hover {
  text-decoration: underline;
}

/* --- Bandeau d'action --- */

.rl-cta {
  margin-top: 88px;
  padding: 76px 0;
  background: radial-gradient(120% 130% at 0% 0%, #1f2a5c 0%, #0e1430 58%);
  color: white;
}

.rl-cta-inner {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.rl-cta-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 20px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.55);
}

.rl-cta-label::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--orange);
  transform: rotate(45deg);
  border-radius: var(--r-dm);
  flex: 0 0 8px;
}

.rl-cta-title {
  margin: 0 0 16px;
  font-size: clamp(1.7rem, 3.6vw, 2.6rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.06;
  max-width: 26ch;
}

.rl-cta-text {
  margin: 0 0 32px;
  max-width: 56ch;
  font-size: 16px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.78);
}

.rl-cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.rl-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 500;
  text-decoration: none;
  transition:
    background 0.25s ease,
    color 0.25s ease,
    border-color 0.25s ease,
    transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.rl-btn--primary {
  background: var(--orange);
  color: white;
}

.rl-btn--primary:hover {
  background: #ff5a00;
  transform: translateY(-2px);
}

.rl-btn--ghost {
  color: rgba(255, 255, 255, 0.88);
  border-color: rgba(255, 255, 255, 0.28);
}

.rl-btn--ghost:hover {
  background: white;
  color: var(--ink);
  border-color: white;
}

.rl-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 13px;
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.rl-btn:hover .rl-arrow {
  transform: translateX(3px);
}

/* --- Crédits, juste au-dessus du footer du site --- */

.rl-credits-inner {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 24px 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.rl-credits-inner p {
  margin: 0;
}

.rl-credits-inner a {
  color: var(--blue);
  text-decoration: none;
}

.rl-credits-inner a:hover {
  text-decoration: underline;
}

/* --- Mur d'accès : aperçu du contenu derrière la modale --- */

/*
 * Le contenu n'est jamais retiré du document : tant que le mur est actif, il n'est qu'un aperçu
 * illisible, écourté et inerte derrière la modale (voir `ResourceAccess.astro`).
 */
[data-resource-content] {
  transition:
    filter 0.6s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.ressource-gate [data-resource-content] {
  max-height: 58vh;
  overflow: hidden;
  filter: blur(5px);
  opacity: 0.75;
  pointer-events: none;
  user-select: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 0 38%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0 38%, transparent 100%);
}

/* --- Mouvement d'entrée --- */

@keyframes rl-rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

.rl-head,
.rl-aside {
  animation: rl-rise 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.rl-aside {
  animation-delay: 0.12s;
}

@media (max-width: 980px) {
  .rl--prose .rl-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 48px;
  }

  .rl--prose .rl-col {
    max-width: none;
  }

  .rl-aside {
    position: static;
  }
}

@media (max-width: 620px) {
  .rl-shell,
  .rl-cta-inner,
  .rl-credits-inner,
  .rl-reco-inner {
    padding-left: 18px;
    padding-right: 18px;
  }

  .rl-main {
    padding-top: 100px;
  }

  .rl-cta {
    margin-top: 64px;
    padding: 56px 0;
  }

  .rl-btn,
  .rl-aside-cta {
    width: 100%;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  [data-resource-content],
  [data-article-content],
  .rl-head,
  .rl-aside,
  .rl-btn,
  .rl-arrow,
  .rl-aside-cta,
  .rl-reco-arrow {
    animation: none;
    transition: none;
  }
}
