/* ==========================================================================
   Memento — design system
   Hand-written CSS. Organised as: tokens · reset · layout · components · prose.
   ========================================================================== */

/* ---------- Tokens -------------------------------------------------------- */
:root {
  color-scheme: light dark;

  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Fira Code",
    "Cascadia Code", Menlo, Consolas, monospace;

  /* Fluid type scale */
  --step--1: clamp(0.83rem, 0.8rem + 0.15vw, 0.9rem);
  --step-0: clamp(0.95rem, 0.9rem + 0.2vw, 1.05rem);
  --step-1: clamp(1.13rem, 1.05rem + 0.4vw, 1.33rem);
  --step-2: clamp(1.4rem, 1.25rem + 0.75vw, 1.85rem);
  --step-3: clamp(1.75rem, 1.5rem + 1.25vw, 2.6rem);
  --step-4: clamp(2.1rem, 1.7rem + 2vw, 3.4rem);

  --space-2xs: 0.375rem;
  --space-xs: 0.625rem;
  --space-sm: 0.9rem;
  --space-md: 1.4rem;
  --space-lg: 2.2rem;
  --space-xl: 3.5rem;
  --space-2xl: 5.5rem;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-full: 999px;

  --container: 74rem;
  --container-narrow: 46rem;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* Light palette (default) */
  --bg: #fbfbfa;
  --bg-elevated: #ffffff;
  --bg-sunken: #f2f2ef;
  --surface-border: #e7e6e1;
  --text: #1b1b1a;
  --text-soft: #55534d;
  --text-faint: #8a877f;
  --accent: #4f46e5;
  --accent-strong: #4338ca;
  --accent-contrast: #ffffff;
  --accent-wash: #eef0ff;
  --premium: #b4791b;
  --premium-wash: #fbf1dd;
  --success: #167a4b;
  --danger: #c23b39;
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);
  --shadow-sm: 0 1px 2px rgba(20, 20, 20, 0.06), 0 1px 3px rgba(20, 20, 20, 0.05);
  --shadow-md: 0 10px 30px -12px rgba(20, 20, 20, 0.18);
  --shadow-lg: 0 30px 60px -20px rgba(20, 20, 20, 0.28);
  --gradient: radial-gradient(60% 60% at 20% 0%, #eef0ff 0%, transparent 60%),
    radial-gradient(50% 50% at 100% 0%, #fdeede 0%, transparent 55%);
}

:root[data-theme="dark"],
:root:not([data-theme="light"]) {
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0f11;
    --bg-elevated: #17171a;
    --bg-sunken: #202024;
    --surface-border: #2b2b30;
    --text: #ededec;
    --text-soft: #b6b5b0;
    --text-faint: #85847e;
    --accent: #8b83ff;
    --accent-strong: #a29bff;
    --accent-contrast: #14131b;
    --accent-wash: #1e1c33;
    --premium: #e0b062;
    --premium-wash: #2a2113;
    --success: #4ac088;
    --danger: #f0736f;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 12px 34px -14px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, 0.75);
    --gradient: radial-gradient(60% 60% at 20% 0%, #1c1b2e 0%, transparent 60%),
      radial-gradient(50% 50% at 100% 0%, #241d12 0%, transparent 55%);
  }
}

:root[data-theme="dark"] {
  --bg: #0f0f11;
  --bg-elevated: #17171a;
  --bg-sunken: #202024;
  --surface-border: #2b2b30;
  --text: #ededec;
  --text-soft: #b6b5b0;
  --text-faint: #85847e;
  --accent: #8b83ff;
  --accent-strong: #a29bff;
  --accent-contrast: #14131b;
  --accent-wash: #1e1c33;
  --premium: #e0b062;
  --premium-wash: #2a2113;
  --success: #4ac088;
  --danger: #f0736f;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 12px 34px -14px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, 0.75);
  --gradient: radial-gradient(60% 60% at 20% 0%, #1c1b2e 0%, transparent 60%),
    radial-gradient(50% 50% at 100% 0%, #241d12 0%, transparent 55%);
}

/* ---------- Reset ------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

img,
picture,
svg,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--accent-strong);
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 0.15em;
}
a:hover {
  text-decoration-color: currentColor;
}

h1,
h2,
h3,
h4 {
  line-height: 1.15;
  font-weight: 640;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

::selection {
  background: color-mix(in srgb, var(--accent) 25%, transparent);
}

/* ---------- Layout ---------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(1rem, 5vw, 2rem);
}
.container--narrow {
  max-width: var(--container-narrow);
}

main {
  flex: 1;
  padding-block: var(--space-xl);
}

.section {
  padding-block: var(--space-xl);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  transition: top 0.2s var(--ease);
  z-index: 100;
}
.skip-link:focus {
  top: 1rem;
}

.stack > * + * {
  margin-top: var(--flow, var(--space-md));
}

.grid-cards {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
}
/* Lets a wrapper div (e.g. a filter target) sit between .grid-cards and .card
   without becoming its own grid item — the card keeps stretching like before. */
.filter-passthrough {
  display: contents;
}

/* ---------- Header --------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--surface-border);
}
.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-height: 4.25rem;
}
.brand {
  font-weight: 700;
  font-size: var(--step-1);
  letter-spacing: -0.03em;
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}
.brand__mark {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 7px;
  background: linear-gradient(140deg, var(--accent), #ec8b4b);
  box-shadow: var(--shadow-sm);
}
.main-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-inline-start: auto;
}
.main-nav a {
  color: var(--text-soft);
  text-decoration: none;
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: var(--step--1);
  font-weight: 550;
  transition: color 0.15s, background 0.15s;
}
.main-nav a:hover,
.main-nav a[aria-current] {
  color: var(--text);
  background: var(--bg-sunken);
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.site-header .nav-toggle {
  display: none;
}
.main-nav a[aria-current="page"] {
  color: var(--text);
  background: var(--bg-sunken);
  font-weight: 640;
}
/* Elements that only make sense once JS has enhanced the page. */
.header-actions .only-js {
  display: none;
}
.js .header-actions .only-js {
  display: inline-flex;
}

@media (max-width: 62rem) {
  .site-header .nav-toggle {
    display: inline-flex;
  }
  .site-header .header-account {
    display: none;
  }
  .main-nav {
    position: fixed;
    inset: 4.25rem 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
    padding: var(--space-sm) clamp(1rem, 5vw, 2rem);
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--surface-border);
    box-shadow: var(--shadow-md);
    max-height: calc(100vh - 4.25rem);
    overflow-y: auto;
  }
  /* Without JS the menu is simply always visible (progressive enhancement). */
  .js .main-nav {
    transform: translateY(-120%);
    transition: transform 0.28s var(--ease);
    pointer-events: none;
    visibility: hidden;
  }
  .js .main-nav[data-open="true"] {
    transform: translateY(0);
    pointer-events: auto;
    visibility: visible;
  }
  .main-nav a {
    padding: 0.8rem 1rem;
    font-size: var(--step-0);
  }
  body.nav-open {
    overflow: hidden;
  }
}

/* ---------- Buttons ------------------------------------------------- */
.btn {
  --btn-bg: var(--bg-elevated);
  --btn-fg: var(--text);
  --btn-border: var(--surface-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 580;
  font-size: var(--step--1);
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.14s var(--ease), box-shadow 0.14s var(--ease),
    background 0.14s, border-color 0.14s;
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.btn:active {
  transform: translateY(0);
}
.btn--primary {
  --btn-bg: var(--accent);
  --btn-fg: var(--accent-contrast);
  --btn-border: transparent;
}
.btn--primary:hover {
  --btn-bg: var(--accent-strong);
}
.btn--ghost {
  --btn-bg: transparent;
  --btn-border: transparent;
  color: var(--text-soft);
}
.btn--ghost:hover {
  --btn-bg: var(--bg-sunken);
  color: var(--text);
}
.btn--block {
  width: 100%;
}
.btn--lg {
  padding: 0.9rem 1.6rem;
  font-size: var(--step-0);
}
.icon-btn {
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  border-radius: var(--radius-full);
}
.icon {
  width: 1.15rem;
  height: 1.15rem;
  flex: none;
}

/* ---------- Hero + generic page head ------------------------------- */
.page-head {
  margin-bottom: var(--space-lg);
}
.page-head h1 {
  font-size: var(--step-3);
}
.page-head p {
  color: var(--text-soft);
  margin-top: var(--space-xs);
  max-width: 40ch;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-strong);
}

.hero {
  position: relative;
  padding-block: var(--space-2xl) var(--space-xl);
  background-image: var(--gradient);
  overflow: hidden;
}
.hero h1 {
  font-size: var(--step-4);
  max-width: 16ch;
}
.hero p {
  font-size: var(--step-1);
  color: var(--text-soft);
  max-width: 52ch;
  margin-top: var(--space-md);
}
.hero__cta {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-top: var(--space-lg);
}
.hero__search {
  margin-top: var(--space-lg);
  max-width: 34rem;
}

/* ---------- Search box -------------------------------------------- */
.search-box {
  position: relative;
}
.search-box input[type="search"] {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.9rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--surface-border);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.search-box input[type="search"]:focus {
  border-color: var(--accent);
}
.search-box .icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
}
/* ---------- Filter box (categories index, category sheets) -------- */
.filter-box {
  position: relative;
  max-width: 26rem;
}
.filter-box .icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
}
.filter-box input[type="search"] {
  width: 100%;
  padding: 0.7rem 1rem 0.7rem 2.9rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--surface-border);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.filter-box input[type="search"]:focus {
  border-color: var(--accent);
}

/* ---------- Search filters (category select on /recherche) -------- */
.search-filters {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: var(--space-md);
  font-size: var(--step--1);
  color: var(--text-soft);
}
.search-filters select {
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--surface-border);
  background: var(--bg-elevated);
  color: var(--text);
}

.search-results {
  position: absolute;
  inset: calc(100% + 0.5rem) 0 auto 0;
  background: var(--bg-elevated);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.4rem;
  max-height: 24rem;
  overflow-y: auto;
  z-index: 20;
}
.search-results:empty {
  display: none;
}
.search-results a {
  display: block;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
}
.search-results a:hover,
.search-results a.is-active {
  background: var(--accent-wash);
}
.search-results .title {
  font-weight: 600;
}
.search-results .meta {
  font-size: var(--step--1);
  color: var(--text-faint);
}

/* ---------- Cards ------------------------------------------------- */
.card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: var(--space-md);
  background: var(--bg-elevated);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: transform 0.16s var(--ease), box-shadow 0.16s var(--ease),
    border-color 0.16s;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--surface-border));
}
.card__kicker {
  font-size: var(--step--1);
  color: var(--text-faint);
  font-weight: 600;
}
.card__title {
  font-size: var(--step-1);
  font-weight: 620;
  letter-spacing: -0.02em;
}
.card__desc {
  color: var(--text-soft);
  font-size: var(--step--1);
  line-height: 1.55;
}
.card__foot {
  margin-top: auto;
  padding-top: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--step--1);
  color: var(--accent-strong);
  font-weight: 560;
}
.card--category {
  flex-direction: row;
  align-items: center;
  gap: var(--space-sm);
}
.card--category .cat-icon {
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--accent-wash);
  color: var(--accent-strong);
}
.card--category .cat-icon .icon {
  width: 1.5rem;
  height: 1.5rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge--premium {
  background: var(--premium-wash);
  color: var(--premium);
}
.badge--free {
  background: color-mix(in srgb, var(--success) 15%, transparent);
  color: var(--success);
}

/* ---------- Sheet page ------------------------------------------ */
.sheet-layout {
  display: grid;
  gap: var(--space-xl);
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 64rem) {
  .sheet-layout {
    grid-template-columns: minmax(0, 1fr) 15rem;
  }
}
.sheet-header h1 {
  font-size: var(--step-3);
  margin-top: 0.4rem;
}
.sheet-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: center;
  color: var(--text-faint);
  font-size: var(--step--1);
  margin-top: var(--space-sm);
}
.toc {
  position: sticky;
  top: 6rem;
  align-self: start;
  font-size: var(--step--1);
}
.toc h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-faint);
  margin-bottom: 0.6rem;
}
.toc ol {
  list-style: none;
  padding: 0;
  border-left: 2px solid var(--surface-border);
}
.toc li {
  margin: 0;
}
.toc a {
  display: block;
  padding: 0.3rem 0 0.3rem 0.9rem;
  margin-left: -2px;
  border-left: 2px solid transparent;
  color: var(--text-soft);
  text-decoration: none;
}
.toc a:hover,
.toc a.is-active {
  color: var(--text);
  border-color: var(--accent);
}
.toc li[data-level="3"] a {
  padding-left: 1.6rem;
  font-size: 0.9em;
}

@media (max-width: 64rem) {
  .toc {
    position: static;
  }
}

.related {
  margin-top: var(--space-2xl);
}
.related h2 {
  font-size: var(--step-2);
  margin-bottom: var(--space-md);
}

/* ---------- Paywall -------------------------------------------- */
.paywall {
  position: relative;
  margin-top: -6rem;
  padding: 6rem var(--space-md) var(--space-lg);
  background: linear-gradient(
    to bottom,
    transparent,
    var(--bg) 4rem,
    var(--bg)
  );
  text-align: center;
}
.paywall__card {
  max-width: 34rem;
  margin-inline: auto;
  padding: var(--space-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.paywall__card h2 {
  font-size: var(--step-2);
}
.paywall__card p {
  color: var(--text-soft);
  margin: var(--space-sm) 0 var(--space-md);
}
.paywall__icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto var(--space-sm);
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  background: var(--premium-wash);
  color: var(--premium);
}

/* ---------- Forms -------------------------------------------- */
.form-card {
  max-width: 27rem;
  margin-inline: auto;
  padding: var(--space-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.form-card h1 {
  font-size: var(--step-2);
  margin-bottom: var(--space-md);
}
.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: var(--space-sm);
}
.field label {
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--text-soft);
}
.field input:not([type="checkbox"]),
.field select,
.field textarea {
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--surface-border);
  background: var(--bg);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
}
.form-error {
  color: var(--danger);
  font-size: var(--step--1);
  list-style: none;
  padding: 0;
  margin: 0.25rem 0 0;
}
.checkbox-field .checkbox-line {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}
.checkbox-field input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.15rem;
  flex: none;
  accent-color: var(--accent);
}
.checkbox-field label {
  font-weight: 500;
  color: var(--text-soft);
  line-height: 1.45;
  cursor: pointer;
}
.form-help {
  font-size: var(--step--1);
  color: var(--text-faint);
}
.form-links {
  margin-top: var(--space-md);
  font-size: var(--step--1);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* ---------- Flash messages --------------------------------- */
.flashes {
  position: fixed;
  inset: auto 1rem 1rem auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 80;
  max-width: min(24rem, calc(100vw - 2rem));
}
.flash {
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--surface-border);
  box-shadow: var(--shadow-lg);
  font-size: var(--step--1);
  animation: flash-in 0.3s var(--ease);
}
.flash--success {
  border-left: 3px solid var(--success);
}
.flash--error {
  border-left: 3px solid var(--danger);
}
.flash--info {
  border-left: 3px solid var(--accent);
}
@keyframes flash-in {
  from {
    opacity: 0;
    transform: translateY(0.5rem);
  }
}

/* ---------- Breadcrumb ------------------------------------ */
.breadcrumb {
  font-size: var(--step--1);
  color: var(--text-faint);
  margin-bottom: var(--space-md);
}
.breadcrumb ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0;
}
.breadcrumb li::after {
  content: "/";
  margin-left: 0.4rem;
  color: var(--surface-border);
}
.breadcrumb li:last-child::after {
  content: none;
}
.breadcrumb a {
  color: var(--text-soft);
  text-decoration: none;
}
.breadcrumb a:hover {
  color: var(--text);
}

/* ---------- Pricing ------------------------------------- */
.plans {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  max-width: 44rem;
  margin-inline: auto;
}
.plan {
  padding: var(--space-lg);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
}
.plan--featured {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  position: relative;
}
.plan__price {
  font-size: var(--step-3);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: var(--space-xs) 0 var(--space-md);
}
.plan__price span {
  font-size: var(--step-0);
  font-weight: 500;
  color: var(--text-faint);
}
.plan ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: var(--space-md) 0;
}
.plan li {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  font-size: var(--step--1);
  color: var(--text-soft);
}
.plan li .icon {
  color: var(--success);
  margin-top: 0.15rem;
}

/* ---------- Footer ------------------------------------- */
.site-footer {
  border-top: 1px solid var(--surface-border);
  background: var(--bg-elevated);
  padding-block: var(--space-xl) var(--space-lg);
  font-size: var(--step--1);
}
.footer-grid {
  display: grid;
  gap: var(--space-lg);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
}
.footer-grid h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-faint);
  margin-bottom: 0.7rem;
}
.footer-grid a {
  display: block;
  padding: 0.25rem 0;
  color: var(--text-soft);
  text-decoration: none;
}
.footer-grid a:hover {
  color: var(--text);
}
.newsletter-box h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-faint);
  margin-bottom: 0.3rem;
}
.newsletter-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.newsletter-form input[type="email"] {
  flex: 1;
  min-width: 10rem;
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--surface-border);
  background: var(--bg);
  color: var(--text);
}
.newsletter-form .btn {
  flex-shrink: 0;
  padding: 0.55rem 1rem;
}
.footer-bottom {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--surface-border);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  justify-content: space-between;
  align-items: center;
  color: var(--text-faint);
}
.powered-by {
  font-weight: 600;
  color: var(--text-soft);
}

/* ---------- Language switcher ------------------------- */
.lang-switch {
  position: relative;
}
.lang-switch__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  background: var(--bg-elevated);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 0.3rem;
  min-width: 8rem;
}
.lang-switch__menu a {
  display: block;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-soft);
  font-size: var(--step--1);
}
.lang-switch__menu a[aria-current] {
  color: var(--text);
  font-weight: 600;
  background: var(--bg-sunken);
}

/* ---------- Reveal-on-scroll --------------------------
   Only hide elements when JS is available to reveal them again — otherwise
   content must stay visible (no JS, blocked script, slow network…). */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(1.2rem);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.js [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---------- Utilities -------------------------------- */
.muted {
  color: var(--text-faint);
}
.text-center {
  text-align: center;
}
.mt-lg {
  margin-top: var(--space-lg);
}
.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
}
.divider {
  height: 1px;
  background: var(--surface-border);
  border: 0;
  margin-block: var(--space-lg);
}
.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-lg);
}
.stat b {
  display: block;
  font-size: var(--step-2);
  letter-spacing: -0.02em;
}
.stat span {
  color: var(--text-faint);
  font-size: var(--step--1);
}
.list-plain {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* ---------- Prose (rendered Markdown) ---------------- */
.prose {
  max-width: 68ch;
}
.prose > * + * {
  margin-top: var(--space-md);
}
.prose h2 {
  font-size: var(--step-2);
  margin-top: var(--space-xl);
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--surface-border);
}
.prose h3 {
  font-size: var(--step-1);
  margin-top: var(--space-lg);
}
.prose h2:first-child,
.prose h3:first-child {
  margin-top: 0;
}
.prose p,
.prose li {
  color: var(--text);
}
.prose ul,
.prose ol {
  padding-left: 1.4rem;
}
.prose li + li {
  margin-top: 0.35rem;
}
.prose a {
  font-weight: 550;
}
.prose strong {
  font-weight: 650;
}
.prose blockquote {
  border-left: 3px solid var(--accent);
  padding-left: var(--space-md);
  color: var(--text-soft);
  font-style: italic;
}
.prose kbd {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-sunken);
  border: 1px solid var(--surface-border);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 0.1em 0.45em;
  white-space: nowrap;
}
.prose :not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-sunken);
  padding: 0.15em 0.4em;
  border-radius: 5px;
}
.prose pre {
  font-family: var(--font-mono);
  font-size: 0.86em;
  line-height: 1.6;
  background: #12131a;
  color: #e7e7ea;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  overflow-x: auto;
  border: 1px solid var(--surface-border);
}
:root[data-theme="light"] .prose pre {
  background: #12131a;
}
.prose pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}
.code-block {
  position: relative;
}
.code-block .copy-btn {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  opacity: 0;
  transition: opacity 0.15s;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  color: #e7e7ea;
}
.code-block:hover .copy-btn,
.code-block .copy-btn:focus-visible {
  opacity: 1;
}
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--step--1);
}
.prose th,
.prose td {
  padding: 0.65rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--surface-border);
}
.prose thead th {
  background: var(--bg-sunken);
  font-weight: 640;
}
.prose tbody tr:last-child td {
  border-bottom: 0;
}
.heading-anchor {
  color: var(--text-faint);
  text-decoration: none;
  margin-left: 0.4rem;
  opacity: 0;
  transition: opacity 0.15s;
}
.prose h2:hover .heading-anchor,
.prose h3:hover .heading-anchor {
  opacity: 1;
}

/* Tempest/highlight token colours (dark code surface) */
.prose pre .hl-keyword { color: #c792ea; }
.prose pre .hl-property, .prose pre .hl-attribute { color: #82aaff; }
.prose pre .hl-value, .prose pre .hl-string { color: #c3e88d; }
.prose pre .hl-comment { color: #6a7080; font-style: italic; }
.prose pre .hl-type, .prose pre .hl-class { color: #ffcb6b; }
.prose pre .hl-variable { color: #f07178; }
.prose pre .hl-generic { color: #e7e7ea; }
.prose pre .hl-addition { color: #c3e88d; }
.prose pre .hl-deletion { color: #f07178; }

/* ==========================================================================
   Additions — callouts · command palette · feedback · FAQ · density · print
   ========================================================================== */

/* ---------- Callouts (GFM alerts) ------------------------------------- */
.callout {
  --callout-accent: var(--accent);
  border-left: 3px solid var(--callout-accent);
  background: color-mix(in srgb, var(--callout-accent) 8%, var(--bg-elevated));
  padding: var(--space-sm) var(--space-md);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-block: var(--space-md);
}
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }
.callout--tip { --callout-accent: var(--success); }
.callout--warning,
.callout--caution { --callout-accent: var(--danger); }
.callout--important { --callout-accent: var(--premium); }
.callout::before {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--callout-accent);
  margin-bottom: 0.35rem;
}
.callout--note::before { content: "Note"; }
.callout--tip::before { content: "Astuce"; }
.callout--important::before { content: "Important"; }
.callout--warning::before { content: "Attention"; }
.callout--caution::before { content: "Prudence"; }

/* ---------- Sheet toolbar ------------------------------------------- */
.sheet-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: var(--space-md);
}
.sheet-toolbar form { display: contents; }
.sheet-tags { margin-top: var(--space-lg); }

/* ---------- Command palette --------------------------------------- */
.palette {
  border: none;
  background: transparent;
  padding: 0;
  margin: auto;
  width: min(38rem, calc(100vw - 2rem));
  max-height: min(34rem, 80vh);
  display: flex;
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.palette[open] {
  opacity: 1;
  transform: none;
}
@starting-style {
  .palette[open] {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
}
.palette::backdrop {
  background: color-mix(in srgb, #0b0b0f 55%, transparent);
  backdrop-filter: blur(3px);
}
.palette__box {
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.palette__search {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--surface-border);
  flex-shrink: 0;
}
.palette__search .icon { color: var(--text-faint); }
.palette__search input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font-size: var(--step-1);
}
.palette__search kbd {
  font-size: 0.7rem;
  color: var(--text-faint);
  border: 1px solid var(--surface-border);
  border-radius: 5px;
  padding: 0.1em 0.4em;
}
.palette__results {
  position: static;
  border: none;
  box-shadow: none;
  max-height: none;
  border-radius: 0;
  overflow-y: auto;
  padding: 0.4rem;
}
.palette__group-label {
  padding: 0.6rem 0.6rem 0.3rem;
  font-size: var(--step--2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  color: var(--text-faint);
}
.palette__hint {
  display: flex;
  gap: 1rem;
  padding: 0.55rem 1rem;
  border-top: 1px solid var(--surface-border);
  font-size: var(--step--2);
  color: var(--text-faint);
  flex-shrink: 0;
}
.palette__hint kbd {
  font-size: 0.7rem;
  border: 1px solid var(--surface-border);
  border-radius: 4px;
  padding: 0 0.35em;
  margin-right: 0.15em;
}

/* ---------- Feedback widget -------------------------------------- */
.feedback {
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  border-top: 1px solid var(--surface-border);
  font-size: var(--step--1);
  color: var(--text-soft);
}
.feedback form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.feedback .btn { font-size: 1.1rem; padding: 0.35rem 0.7rem; }

/* ---------- OS toggle (Mac/PC keyboard variants in a sheet) ------ */
.os-toggle {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  margin-bottom: var(--space-md);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
}
.os-toggle button {
  border: none;
  background: none;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--text-soft);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.os-toggle button:hover { color: var(--text); }
.os-toggle button.is-active {
  background: var(--accent);
  color: #fff;
}
/* Both variants show until JS picks one (progressive enhancement — see the
   <head> script in base.html.twig, which sets data-os-pref before first paint
   for anyone with JS enabled). */
:root[data-os-pref="pc"] .os-variant[data-os="mac"] { display: none; }
:root[data-os-pref="mac"] .os-variant[data-os="pc"] { display: none; }

/* ---------- FAQ ------------------------------------------------- */
.faq {
  margin-top: var(--space-xl);
}
.faq h2 {
  font-size: var(--step-2);
  margin-bottom: var(--space-md);
}
.faq__item {
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 0.5rem var(--space-md);
  margin-bottom: 0.6rem;
  background: var(--bg-elevated);
}
.faq__item summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.5rem 0;
  list-style: none;
}
.faq__item summary::-webkit-details-marker { display: none; }
.faq__item summary::before {
  content: "+";
  display: inline-block;
  width: 1.2em;
  color: var(--accent-strong);
  font-weight: 700;
}
.faq__item[open] summary::before { content: "\2212"; }
.faq__item p {
  margin: 0 0 0.7rem 1.2em;
  color: var(--text-soft);
}

/* ---------- Density (compact) --------------------------------- */
:root[data-density="compact"] {
  --step-0: clamp(0.88rem, 0.85rem + 0.15vw, 0.95rem);
  --space-md: 1rem;
  --space-lg: 1.6rem;
  --space-xl: 2.4rem;
  --space-2xl: 3.6rem;
}
:root[data-density="compact"] .prose > * + * { margin-top: var(--space-sm); }
:root[data-density="compact"] .prose li + li { margin-top: 0.2rem; }

/* ---------- Print ------------------------------------------- */
@media print {
  .site-header,
  .site-footer,
  .no-print,
  .sheet-toolbar,
  .breadcrumb,
  .heading-anchor,
  .flashes { display: none !important; }
  body { background: #fff; color: #000; }
  main { padding: 0; }
  .sheet-layout { display: block; }
  .prose { max-width: none; }
  .prose pre {
    background: #f4f4f4;
    color: #111;
    border: 1px solid #ccc;
    white-space: pre-wrap;
    word-break: break-word;
  }
  .prose a { color: #000; text-decoration: underline; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #555; }
  .callout { border-color: #999; background: #f7f7f7; }
}

/* ---------- Legal pages ------------------------------------- */
.legal h2 { font-size: var(--step-1); }
.legal h3 { font-size: var(--step-0); }
.legal [title="à compléter"],
.legal [title="to be completed"] {
  background: color-mix(in srgb, var(--premium) 16%, transparent);
  border-bottom: 1px dashed var(--premium);
  padding: 0 0.15em;
  border-radius: 3px;
}
.legal table { font-size: var(--step--1); }
