/* ============================================
   Happy App Studio — feuille de style unique
   Vitrine (clair + sombre), pages app, pages légales.

   Cible : Baseline « Widely available ». Ce qui est plus récent
   (text-wrap, animations liées au défilement, transitions entre pages)
   n'est qu'une amélioration : la page reste complète sans.
   ============================================ */

@layer reset, tokens, base, components, pages, utilities;

/* --------------------------------------------
   Reset : par type d'élément, jamais sur `*`
   -------------------------------------------- */
@layer reset {
  html {
    -webkit-text-size-adjust: none;
    text-size-adjust: none;
  }

  :where(body, h1, h2, h3, p, ul, ol, dl, dd, figure, fieldset, legend) {
    margin: 0;
  }

  :where(ul[role="list"], fieldset, legend) {
    padding: 0;
  }

  :where(ul[role="list"]) {
    list-style: none;
  }

  :where(fieldset) {
    border: 0;
    min-inline-size: 0;
  }

  :where(a, button, input, summary, details, li, ul, div, section, article,
    header, footer, main, nav, form, label, span, p, h1, h2, h3) {
    box-sizing: border-box;
  }

  :where(img, svg) {
    display: block;
    max-inline-size: 100%;
  }

  :where(img) {
    block-size: auto;
  }

  :where(button, input) {
    font: inherit;
    color: inherit;
  }

  /* `hidden` gagne toujours, même sur un composant en display: flex. */
  [hidden] {
    display: none !important;
  }
}

/* --------------------------------------------
   Tokens
   -------------------------------------------- */
@layer tokens {
  :root {
    color-scheme: light;

    /* Surfaces et textes */
    --paper: #fbf8f3;
    --surface: #ffffff;
    --ink: #1d1a2b;
    --ink-soft: #57536b;
    --line: #e4dfea;
    --night: #14121f;
    --on-night: #ffffff;

    /* Les six couleurs du logo */
    --logo-violet: #8f6fd6;
    --logo-blue: #3fa3dc;
    --logo-green: #72b043;
    --logo-yellow: #f6b92f;
    --logo-orange: #f0683a;
    --logo-pink: #ee5fa2;

    /* Anneau de focus à deux tons : lisible sur clair comme sur image sombre */
    --focus-ring: #1d1a2b;
    --focus-halo: #ffffff;

    /* Typographie */
    --font-display: 'Fredoka', ui-rounded, system-ui, sans-serif;
    --font-text: 'Nunito', system-ui, sans-serif;
    --font-ui: system-ui, sans-serif;
    --text-s: 0.875rem;
    --text-m: 1rem;
    --text-l: 1.125rem;
    --text-xl: clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem);
    --text-2xl: clamp(1.75rem, 1.35rem + 1.8vw, 2.5rem);
    --text-hero: clamp(2.25rem, 1.3rem + 4.2vw, 4.5rem);

    /* Espacements */
    --space-2xs: 0.25rem;
    --space-xs: 0.5rem;
    --space-s: 0.75rem;
    --space-m: 1rem;
    --space-l: 1.5rem;
    --space-xl: 2.5rem;
    --space-2xl: clamp(3rem, 2rem + 5vw, 6rem);
    --gutter: clamp(1.25rem, 0.5rem + 4vw, 3rem);
    --page-max: 70rem;
    --prose-max: 40rem;

    /* Formes */
    --radius-s: 0.75rem;
    --radius-m: 1.25rem;
    --radius-l: 2rem;
    --radius-pill: 999px;
    --lift: 0.375rem;

    --shadow-soft: 0 0.5rem 1.5rem rgb(29 26 43 / 0.08);
    --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  }

  /* La vitrine suit le thème du système ; les pages app restent claires
     (leurs couleurs par app supposent leur propre fond). */
  :root.theme-auto {
    color-scheme: light dark;
  }

  @media (prefers-color-scheme: dark) {
    :root.theme-auto {
      --paper: #13111c;
      --surface: #1e1b2c;
      --ink: #f5f2fb;
      --ink-soft: #b9b4cb;
      --line: #353049;
      --night: #1e1b2c;
      --focus-ring: #ffffff;
      --focus-halo: #13111c;
      --shadow-soft: 0 0.5rem 1.5rem rgb(0 0 0 / 0.4);
    }
  }
}

/* --------------------------------------------
   Base
   -------------------------------------------- */
@layer base {
  html {
    font-family: var(--font-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
  }

  body {
    min-block-size: 100dvh;
    overflow-wrap: break-word;
  }

  :where(h1, h2, h3) {
    line-height: 1.15;
    text-wrap: balance;
  }

  :where(p, li, dd) {
    text-wrap: pretty;
  }

  :where(a) {
    color: inherit;
  }

  :where(a, button, summary, input, [tabindex="0"]):focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 3px;
    box-shadow: 0 0 0 6px var(--focus-halo);
  }

  @media (prefers-reduced-motion: no-preference) {
    html {
      scroll-behavior: smooth;
    }

    /* Fondu entre pages d'un même site (page app ↔ confidentialité ↔ conditions).
       Sans prise en charge : navigation classique. */
    @view-transition {
      navigation: auto;
    }
  }
}

/* --------------------------------------------
   Composants partagés
   -------------------------------------------- */
@layer components {
  /* Lien d'évitement : visible au focus clavier seulement */
  .skip-link {
    position: absolute;
    inset-block-start: var(--space-xs);
    inset-inline-start: var(--space-xs);
    z-index: 100;
    padding: var(--space-xs) var(--space-m);
    border-radius: var(--radius-s);
    background: #1d1a2b;
    color: #ffffff;
    font-weight: 700;
    text-decoration: none;

    &:not(:focus-visible) {
      clip-path: inset(50%);
      block-size: 1px;
      inline-size: 1px;
      overflow: clip;
      white-space: nowrap;
    }
  }

  /* Boutons */
  .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    min-block-size: 2.75rem;
    padding: var(--space-xs) var(--space-l);
    border: 2px solid transparent;
    border-radius: var(--radius-pill);
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;

    & svg {
      flex: none;
    }
  }

  .button-primary {
    background: var(--ink);
    color: var(--paper);

    &:hover {
      box-shadow: var(--lift) var(--lift) 0 var(--logo-yellow);
    }
  }

  .button-quiet {
    border-color: var(--line);
    background: var(--surface);
    color: var(--ink);

    &:hover {
      border-color: var(--ink);
    }
  }

  @media (prefers-reduced-motion: no-preference) {
    .button {
      transition: background-color 0.2s, color 0.2s, border-color 0.2s,
        translate 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
    }

    .button-primary:hover {
      translate: calc(var(--lift) * -0.5) calc(var(--lift) * -0.5);
    }
  }

  /* Sélecteur de langue : <details> natif, les choix sont des boutons.
     Couleurs fixes : il se pose aussi sur l'image sombre de certaines apps. */
  .lang-switcher {
    position: relative;
    font-family: var(--font-ui);
    font-size: var(--text-s);

    & summary {
      display: inline-flex;
      align-items: center;
      gap: var(--space-xs);
      min-block-size: 2.75rem;
      padding: var(--space-xs) var(--space-s);
      border: 1px solid #e4dfea;
      border-radius: var(--radius-pill);
      background: #ffffff;
      color: #1d1a2b;
      font-weight: 600;
      list-style: none;
      cursor: pointer;

      &::-webkit-details-marker {
        display: none;
      }

      &:hover {
        border-color: #1d1a2b;
      }
    }

    & .lang-chevron {
      transition: rotate 0.2s;
    }

    &[open] .lang-chevron {
      rotate: 180deg;
    }
  }

  .lang-menu {
    position: absolute;
    inset-block-start: calc(100% + var(--space-xs));
    inset-inline-end: 0;
    z-index: 50;
    display: grid;
    gap: 2px;
    min-inline-size: 11rem;
    padding: var(--space-xs);
    border: 1px solid #e4dfea;
    border-radius: var(--radius-m);
    background: #ffffff;
    box-shadow: 0 0.75rem 2rem rgb(29 26 43 / 0.18);

    & button {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: var(--space-m);
      inline-size: 100%;
      min-block-size: 2.5rem;
      padding: var(--space-xs) var(--space-s);
      border: 0;
      border-radius: var(--radius-s);
      background: none;
      color: #1d1a2b;
      text-align: start;
      cursor: pointer;

      &:hover {
        background: #f1edf6;
      }

      /* Langue courante : coche + graisse, pas seulement une couleur */
      &[aria-current="true"] {
        font-weight: 700;

        &::after {
          content: '✓';
        }
      }
    }
  }

  /* Badges des stores (SVG inline) */
  .store-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-s);
  }

  .store-badge {
    display: block;
    border-radius: var(--radius-s);

    & svg {
      block-size: 3.5rem;
      inline-size: auto;
      border-radius: var(--radius-s);
      font-family: var(--font-ui);
    }
  }

  @media (prefers-reduced-motion: no-preference) {
    .store-badge {
      transition: translate 0.2s var(--ease-out);

      &:hover {
        translate: 0 -0.125rem;
      }
    }
  }
}

/* --------------------------------------------
   Pages
   -------------------------------------------- */
@layer pages {

  /* ===== Vitrine ===== */

  .vitrine-page {
    background: var(--paper);
    color: var(--ink);
  }

  .vitrine-page :where(h1, h2, h3) {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.01em;
  }

  .site-header,
  .site-main,
  .site-footer {
    max-inline-size: var(--page-max);
    margin-inline: auto;
    padding-inline: var(--gutter);
  }

  .site-header {
    container: site-header / inline-size;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-m);
    padding-block: var(--space-l);
  }

  .brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-s);
    border-radius: var(--radius-s);
    font-family: var(--font-display);
    font-size: var(--text-l);
    font-weight: 600;
    text-decoration: none;
  }

  /* Le logo est dessiné pour un fond sombre (« STUDIO » en blanc) :
     il vit toujours sur une tuile nuit, comme une icône d'app. */
  .brand-mark {
    inline-size: 2.75rem;
    block-size: 2.75rem;
    padding: 0.25rem;
    border-radius: var(--radius-s);
    background: var(--night);
  }

  .site-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
  }

  /* En-tête étroit : le bouton contact se réduit à son icône (le texte
     reste dans l'arbre d'accessibilité), le nom du studio aussi. */
  @container site-header (inline-size < 34rem) {
    .contact-label,
    .brand-name {
      position: absolute;
      clip-path: inset(50%);
      block-size: 1px;
      inline-size: 1px;
      overflow: clip;
      white-space: nowrap;
    }

    .button-contact {
      padding-inline: var(--space-s);
    }
  }

  /* --- Hero --- */
  .hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-xl) var(--space-2xl);
    padding-block: var(--space-xl) var(--space-2xl);
  }

  .hero-text {
    flex: 3 1 22rem;
    min-inline-size: 0;
  }

  .hero-title {
    font-size: var(--text-hero);
    line-height: 1.05;
    letter-spacing: -0.02em;
  }

  /* Surlignage aux couleurs du logo : le texte garde le contraste de l'encre. */
  .highlight {
    padding-block-end: 0.04em;
    background: linear-gradient(90deg, var(--logo-violet), var(--logo-blue),
      var(--logo-green), var(--logo-yellow), var(--logo-orange), var(--logo-pink))
      no-repeat 0 100% / 100% 0.14em;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
  }

  .hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-s);
    margin-block-start: var(--space-xl);
  }

  .hero-art {
    flex: 1 1 11rem;
    max-inline-size: clamp(12rem, 4rem + 22vw, 21rem);
    margin-inline: auto;
    padding: var(--space-m) calc(var(--space-m) + var(--lift) * 3) calc(var(--space-m) + var(--lift) * 3) var(--space-m);
  }

  /* Tuile nuit posée sur trois feuilles de couleur : ombres nettes, sans flou. */
  .hero-logo {
    inline-size: 100%;
    padding: 6%;
    border-radius: 22%;
    background: var(--night);
    rotate: -4deg;
    box-shadow:
      var(--lift) var(--lift) 0 var(--logo-yellow),
      calc(var(--lift) * 2) calc(var(--lift) * 2) 0 var(--logo-pink),
      calc(var(--lift) * 3) calc(var(--lift) * 3) 0 var(--logo-blue);
  }

  /* --- Sections d'apps --- */
  .apps-section {
    padding-block-end: var(--space-2xl);
    scroll-margin-block-start: var(--space-l);
  }

  .section-title {
    margin-block-end: var(--space-l);
    font-size: var(--text-2xl);
  }

  .section-title-lab {
    font-size: var(--text-xl);
    color: var(--ink-soft);
  }

  .app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 18.5rem), 1fr));
    gap: var(--space-l);
  }

  /* Carte : cinq rangées (icône, nom, accroche, description, lien) alignées
     d'une carte à l'autre par subgrid. Sans subgrid : rangées propres à la carte. */
  .app-card {
    --card-fill: linear-gradient(140deg, var(--card-a), var(--card-b));
    --card-ink: color-mix(in oklab, var(--app-color) 78%, var(--ink));
    --card-edge: color-mix(in oklab, var(--app-color) 22%, transparent);

    position: relative;
    display: grid;
    grid-row: span 5;
    grid-template-rows: auto auto auto 1fr auto;
    grid-template-rows: subgrid;
    row-gap: var(--space-xs);
    padding: var(--space-l);
    border: 1px solid var(--card-edge);
    border-radius: var(--radius-l);
    background: var(--card-fill);
    transition: border-color 0.2s;

    &:hover,
    &:focus-within {
      border-color: var(--card-ink);
    }
  }

  @media (prefers-color-scheme: dark) {
    .theme-auto .app-card {
      --card-fill: linear-gradient(140deg,
        color-mix(in oklab, var(--card-a) 26%, var(--surface)),
        color-mix(in oklab, var(--card-b) 14%, var(--surface)));
      --card-ink: color-mix(in oklab, var(--app-color) 30%, white);
      --card-edge: color-mix(in oklab, var(--card-a) 30%, transparent);
    }
  }

  .app-card-icon {
    inline-size: 5.5rem;
    block-size: 5.5rem;
    margin-block-end: var(--space-s);
    object-fit: contain;
    filter: drop-shadow(0 0.375rem 0.5rem rgb(0 0 0 / 0.16));
  }

  .app-card-name {
    font-size: var(--text-xl);

    & a {
      text-decoration: none;

      /* Toute la carte est cliquable, avec un seul lien dans l'ordre de tabulation. */
      &::after {
        content: '';
        position: absolute;
        inset: 0;
        border-radius: var(--radius-l);
      }

      &:focus-visible {
        outline: none;
        box-shadow: none;

        &::after {
          outline: 3px solid var(--focus-ring);
          outline-offset: 3px;
        }
      }
    }
  }

  .app-card-tagline {
    color: var(--card-ink);
    font-weight: 700;
    line-height: 1.35;
  }

  .app-card-description {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
    color: var(--ink-soft);
    font-size: var(--text-s);
  }

  .app-card-cta {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    margin-block-start: var(--space-s);
    color: var(--ink);
    font-weight: 700;
  }

  .app-card-badge {
    position: absolute;
    inset-block-start: var(--space-l);
    inset-inline-end: var(--space-l);
    padding: var(--space-2xs) var(--space-s);
    border: 1px solid var(--card-ink);
    border-radius: var(--radius-pill);
    color: var(--card-ink);
    font-size: var(--text-s);
    font-weight: 700;
  }

  .app-card.is-wip {
    border-style: dashed;
    border-color: var(--card-ink);
  }

  @media (prefers-reduced-motion: no-preference) {
    .app-card {
      transition: border-color 0.2s, translate 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out);

      &:hover,
      &:focus-within {
        translate: calc(var(--lift) * -0.5) calc(var(--lift) * -0.5);
        box-shadow: var(--lift) var(--lift) 0 var(--card-ink);
      }
    }

    .app-card-cta svg {
      transition: translate 0.25s var(--ease-out);
    }

    .app-card:hover .app-card-cta svg {
      translate: 0.25rem 0;
    }

    /* Les cartes montent en entrant dans la fenêtre : animation liée au
       défilement, sans JavaScript. Ailleurs, elles sont simplement là. */
    @supports (animation-timeline: view()) {
      .app-card {
        animation: card-rise linear both;
        animation-timeline: view();
        animation-range: entry 0% entry 35%;
      }
    }
  }

  @keyframes card-rise {
    from {
      opacity: 0;
      transform: translateY(1.25rem);
    }
  }

  /* --- Pied de page --- */
  .site-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-l);
    padding-block: 0 var(--space-xl);

    /* Filet aligné sur le contenu, pas sur la gouttière */
    &::before {
      content: '';
      flex-basis: 100%;
      margin-block-end: var(--space-m);
      border-block-start: 1px solid var(--line);
    }
  }

  .footer-title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 600;
  }

  .footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-s);
  }

  .footer-copy {
    flex-basis: 100%;
    color: var(--ink-soft);
    font-size: var(--text-s);
  }

  /* ===== Pages app et pages légales ===== */

  .app-page,
  .legal-page {
    --bg: #fdfbf7;
    --card: #f5f0e8;
    --text: #2d3436;
    --text-muted: #5f6672;
    --border: #e5e7eb;
    --accent: #7c3aed;
    --font-title: 'Outfit', sans-serif;
    --font-body: 'Outfit', sans-serif;
    --color-title: var(--text);
    --color-body: var(--text-muted);

    background: var(--bg);
    color: var(--color-body);
    font-family: var(--font-body);
  }

  .app-page.has-bg-gradient {
    background: var(--bg-gradient);
  }

  /* Image de fond : calque fixe (pas de background-attachment: fixed,
     saccadé sur mobile) sous un voile sombre pour le contraste du texte. */
  .app-page.has-bg-image {
    background: #0c0c0f;

    &::before {
      content: '';
      position: fixed;
      inset: 0;
      z-index: -1;
      block-size: 100lvh;
      background:
        linear-gradient(rgb(12 12 15 / 0.75), rgb(12 12 15 / 0.6) 50%, rgb(12 12 15 / 0.8)),
        var(--bg-image) center / cover no-repeat;
    }

    /* Le texte passe aussi sur les zones claires de l'image (la lune d'Aouh). */
    & :where(.app-hero, .prose, .app-footer, .eyebrow-title, #faq-title) {
      text-shadow: 0 1px 3px rgb(0 0 0 / 0.75);
    }
  }

  .app-header {
    display: flex;
    justify-content: flex-end;
    padding: var(--space-m) var(--gutter);
  }

  /* Colonne de lecture centrée ; la galerie de captures prend toute la largeur. */
  .app-main {
    display: grid;
    grid-template-columns:
      [full-start] minmax(var(--gutter), 1fr)
      [content-start] minmax(0, var(--prose-max))
      [content-end] minmax(var(--gutter), 1fr) [full-end];
    row-gap: var(--space-xl);
    padding-block-end: var(--space-2xl);

    & > * {
      grid-column: content;
    }

    & > .screenshots {
      grid-column: full;
    }
  }

  .app-hero {
    display: grid;
    justify-items: center;
    gap: var(--space-s);
    text-align: center;
  }

  .status-badge {
    padding: var(--space-2xs) var(--space-m);
    border-radius: var(--radius-pill);
    background: #fdf0d3;
    color: #7a4b00;
    font-size: var(--text-s);
    font-weight: 600;
  }

  .app-icon {
    inline-size: auto;
    block-size: clamp(7rem, 5rem + 9vw, 10.5rem);
    margin-block-end: var(--space-s);
    view-transition-name: app-icon;
  }

  .app-title {
    display: grid;
    gap: var(--space-xs);
    color: var(--color-title);
    font-family: var(--font-title);
    font-weight: 700;
  }

  .app-title-name {
    font-size: clamp(2.25rem, 1.6rem + 3vw, 3.75rem);
    letter-spacing: -0.02em;
    line-height: 1.05;
  }

  .app-title-rest {
    font-size: var(--text-xl);
    font-weight: 600;
    line-height: 1.25;
  }

  .app-subtitle {
    font-size: var(--text-l);
    font-weight: 500;
  }

  .app-description {
    max-inline-size: 34rem;
    margin-block-start: var(--space-xs);
    line-height: 1.7;
  }

  .app-actions {
    display: grid;
    justify-items: center;
    gap: var(--space-l);
    text-align: center;
  }

  .webapp-cta {
    min-block-size: 3.5rem;
    padding-inline: var(--space-xl);
    background: var(--accent);
    color: #ffffff;
    font-size: var(--text-l);
    box-shadow: 0 0.375rem 1.125rem rgb(0 0 0 / 0.18);
  }

  .webapp-cta-hint {
    margin-block-start: var(--space-xs);
    font-size: var(--text-s);
  }

  @media (prefers-reduced-motion: no-preference) {
    .webapp-cta:hover {
      translate: 0 -0.125rem;
    }
  }

  /* --- Captures d'écran : galerie à défilement horizontal --- */
  .eyebrow-title {
    margin-block-end: var(--space-m);
    color: var(--color-body);
    font-size: var(--text-s);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-align: center;
    text-transform: uppercase;
  }

  .shots-scroller {
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scroll-padding-inline: var(--gutter);
    scrollbar-width: thin;
  }

  .shots {
    display: flex;
    gap: var(--space-m);
    inline-size: max-content;
    margin-inline: auto;
    padding: var(--space-2xs) var(--gutter) var(--space-m);
  }

  /* Cadre de téléphone en CSS : une bordure et un rayon, rien à charger. */
  .shot {
    flex: none;
    inline-size: clamp(11rem, 8rem + 14vw, 15rem);
    border: 0.375rem solid #17151f;
    border-radius: 2rem;
    background: #17151f;
    overflow: clip;
    scroll-snap-align: start;

    & img {
      inline-size: 100%;
      border-radius: 1.625rem;
    }
  }

  /* --- Rubriques de contenu et FAQ --- */
  .prose {
    display: grid;
    gap: var(--space-xl);
  }

  .prose-title {
    margin-block-end: var(--space-s);
    color: var(--color-title);
    font-family: var(--font-title);
    font-size: var(--text-xl);
    font-weight: 600;
  }

  .prose-body {
    line-height: 1.7;

    & p + p {
      margin-block-start: var(--space-s);
    }

    & a {
      color: inherit;
    }
  }

  /* Cartes à couleurs fixes : leur fond crème est le même pour toutes les
     apps, alors que le texte du thème peut être clair (Aouh, sur fond sombre). */
  .faq-list {
    display: grid;
    gap: var(--space-s);
  }

  .faq-item {
    border: 1px solid #e3dccf;
    border-radius: var(--radius-m);
    background: var(--card);
    color: #4b5563;

    & summary {
      display: flex;
      align-items: center;
      gap: var(--space-m);
      min-block-size: 3rem;
      padding: var(--space-s) var(--space-l);
      border-radius: var(--radius-m);
      color: #1f2937;
      font-weight: 600;
      list-style: none;
      cursor: pointer;

      &::-webkit-details-marker {
        display: none;
      }

      /* Repère d'ouverture, collé au libellé : un chevron qui pivote */
      &::before {
        content: '';
        flex: none;
        inline-size: 0.5rem;
        block-size: 0.5rem;
        border-inline-end: 2px solid currentColor;
        border-block-end: 2px solid currentColor;
        rotate: -45deg;
        transition: rotate 0.2s;
      }
    }

    &[open] summary::before {
      rotate: 45deg;
    }

    /* Ouverture animée là où le navigateur sait interpoler vers `auto` ;
       ailleurs, la réponse s'ouvre d'un coup. */
    &::details-content {
      interpolate-size: allow-keywords;
      overflow: clip;
    }

    &:not([open])::details-content {
      block-size: 0;
    }
  }

  @media (prefers-reduced-motion: no-preference) {
    .faq-item::details-content {
      transition: block-size 0.3s, content-visibility 0.3s;
      transition-behavior: allow-discrete;
    }
  }

  .faq-answer {
    padding: 0 var(--space-l) var(--space-m) calc(var(--space-l) + var(--space-m) + 0.5rem);
    line-height: 1.65;
  }

  /* --- Inscription à la bêta (apps en développement) --- */
  .beta-signup {
    justify-self: center;
    inline-size: min(100%, 26rem);
    padding: var(--space-l);
    border: 1px solid #e3dccf;
    border-radius: var(--radius-l);
    background: var(--card);
    color: #4b5563;
    text-align: center;
  }

  .beta-title {
    color: #1f2937;
    font-family: var(--font-title);
    font-size: var(--text-xl);
    font-weight: 700;
  }

  .beta-form {
    display: grid;
    gap: var(--space-m);
    margin-block-start: var(--space-l);
    text-align: start;
  }

  .field-label {
    display: block;
    margin-block-end: var(--space-2xs);
    color: #1f2937;
    font-size: var(--text-s);
    font-weight: 600;
  }

  .beta-input {
    inline-size: 100%;
    min-block-size: 3rem;
    padding: var(--space-xs) var(--space-m);
    border: 1px solid #8b8fa0;
    border-radius: var(--radius-s);
    background: #ffffff;
    color: #1f2937;

    &:focus-visible {
      border-color: var(--accent);
    }
  }

  .beta-platforms {
    display: flex;
    gap: var(--space-xs);
  }

  /* Radios natives masquées visuellement, jamais retirées : le clavier et les
     lecteurs d'écran les voient, le libellé porte l'état (fond + coche). */
  .beta-platform {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    min-block-size: 3rem;
    border: 1px solid #8b8fa0;
    border-radius: var(--radius-s);
    background: #ffffff;
    color: #1f2937;
    font-weight: 600;
    cursor: pointer;

    & input {
      position: absolute;
      inset: 0;
      opacity: 0;
      cursor: pointer;
    }

    &:has(:checked) {
      border-color: var(--accent);
      background: var(--accent);
      color: #ffffff;

      &::before {
        content: '✓';
      }
    }

    &:has(:focus-visible) {
      outline: 3px solid var(--focus-ring);
      outline-offset: 3px;
    }
  }

  .beta-submit {
    min-block-size: 3rem;
    border-radius: var(--radius-s);
    background: var(--accent);
    color: #ffffff;

    &:hover:not(:disabled) {
      filter: brightness(0.92);
    }

    &:disabled {
      opacity: 0.6;
      cursor: not-allowed;
    }
  }

  .beta-message {
    margin-block-start: var(--space-m);
    padding: var(--space-s) var(--space-m);
    border-radius: var(--radius-s);
    font-weight: 600;
  }

  .beta-message-success {
    background: #dcf5ea;
    color: #065f46;
  }

  .beta-message-error {
    background: #fde4e4;
    color: #991b1b;
  }

  /* --- Pied des pages app et légales --- */
  .app-footer {
    display: grid;
    justify-items: center;
    gap: var(--space-s);
    padding: var(--space-xl) var(--gutter);
    font-size: var(--text-s);
    text-align: center;
  }

  .legal-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-xs) var(--space-l);
  }

  .app-footer a {
    display: inline-block;
    padding-block: var(--space-2xs);
    color: var(--color-title);
  }

  /* --- Bannière store (mobile) : couleurs fixes, comme les cartes --- */
  .store-banner {
    position: fixed;
    inset-inline: var(--space-s);
    inset-block-end: calc(var(--space-s) + env(safe-area-inset-bottom, 0px));
    z-index: 100;
    display: flex;
    align-items: center;
    gap: var(--space-s);
    padding: var(--space-s);
    border: 1px solid rgb(0 0 0 / 0.08);
    border-radius: var(--radius-m);
    background: #ffffff;
    box-shadow: 0 0.5rem 1.75rem rgb(0 0 0 / 0.18);
  }

  .store-banner-icon {
    flex: none;
    inline-size: 2.75rem;
    block-size: 2.75rem;
    object-fit: contain;
  }

  .store-banner-text {
    flex: 1;
    min-inline-size: 0;
    display: grid;
    line-height: 1.3;
  }

  .store-banner-title {
    color: #1f2937;
    font-family: var(--font-title);
    font-weight: 700;
  }

  .store-banner-subtitle {
    color: #5f6672;
    font-size: var(--text-s);
  }

  .store-banner-title,
  .store-banner-subtitle {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .store-banner-cta {
    flex: none;
    min-block-size: 2.5rem;
    padding-inline: var(--space-m);
    background: var(--accent);
    color: #ffffff;
    font-size: var(--text-s);
  }

  /* La bannière ne recouvre jamais la fin de page. */
  body:has(.store-banner:not([hidden])) {
    padding-block-end: 6rem;
  }

  /* ===== Pages légales ===== */

  .legal-page {
    color: var(--text);
  }

  .legal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-m);
    max-inline-size: calc(var(--prose-max) + var(--gutter) * 2);
    margin-inline: auto;
    padding: var(--space-m) var(--gutter);
  }

  .back-link {
    display: inline-flex;
    align-items: center;
    min-block-size: 2.75rem;
    color: var(--text-muted);
    font-size: var(--text-s);
    font-weight: 600;
    text-decoration: none;

    &:hover {
      color: var(--text);
      text-decoration: underline;
    }
  }

  .legal-main {
    max-inline-size: calc(var(--prose-max) + var(--gutter) * 2);
    margin-inline: auto;
    padding: var(--space-l) var(--gutter) var(--space-xl);
  }

  .legal-intro {
    display: grid;
    justify-items: center;
    gap: var(--space-xs);
    margin-block-end: var(--space-xl);
    text-align: center;
  }

  .legal-icon {
    inline-size: auto;
    block-size: 6rem;
    margin-block-end: var(--space-xs);
    view-transition-name: app-icon;
  }

  .legal-title {
    font-size: var(--text-2xl);
    font-weight: 700;
  }

  .legal-app-name {
    color: var(--text-muted);
  }

  .legal-content {
    line-height: 1.75;

    & h2 {
      margin-block: var(--space-xl) var(--space-s);
      font-size: var(--text-xl);
      font-weight: 600;
      text-wrap: balance;
    }

    & h2:first-child {
      margin-block-start: 0;
    }

    & :where(p, ul, ol) {
      margin-block-end: var(--space-s);
      color: var(--text-muted);
    }

    /* Liens soulignés : la couleur seule ne les distingue pas. */
    & a {
      color: var(--accent);
      text-underline-offset: 0.15em;
    }
  }

  .legal-updated {
    margin-block-start: var(--space-xl);
    color: var(--text-muted);
    font-size: var(--text-s);
    text-align: center;
  }

  /* ===== Contraste renforcé et couleurs forcées ===== */

  @media (prefers-contrast: more) {
    :root {
      --ink-soft: #3b3750;
      --line: #6b667d;
    }

    .app-page,
    .legal-page {
      --text-muted: #3f4651;
    }
  }

  @media (forced-colors: active) {
    /* Les ombres et fonds disparaissent : les états passent par les bordures. */
    .highlight {
      background: none;
      text-decoration: underline;
    }

    .hero-logo,
    .brand-mark {
      border: 1px solid CanvasText;
      forced-color-adjust: none;
      background: #14121f;
    }

    .beta-platform:has(:checked) {
      border: 3px solid Highlight;
    }
  }
}

/* --------------------------------------------
   Utilitaires
   -------------------------------------------- */
@layer utilities {
  .visually-hidden {
    position: absolute;
    clip-path: inset(50%);
    block-size: 1px;
    inline-size: 1px;
    overflow: clip;
    white-space: nowrap;
  }
}
