/* @label Argile
   @description La salle de psychomotricité : lin, terre cuite et eucalyptus, des formes douces et des cartes modelées à la main.

   Style « Soft UI Evolution » du catalogue ui-ux-pro-max : du relief doux,
   mais des bordures et des contrastes francs — pas de neumorphisme illisible.
   Young Serif pour les titres, une serif ronde et chaleureuse ; Figtree pour
   le texte, la grotesque que le catalogue recommande pour la santé. */
@import url("https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Figtree:ital,wght@0,400..800;1,400..600&family=Young+Serif&display=swap");

:root {
  --font-sans: Figtree, ui-sans-serif, system-ui, sans-serif;
  --font-display: "Young Serif", Georgia, serif;
  --font-editorial: "Young Serif", Georgia, serif;
  --font-fraunces: "Young Serif", Georgia, serif;
  --font-mono: "DM Mono", ui-monospace, monospace;

  /* Les tailles en rem de Tailwind (`text-xs`, `text-sm`…), relevées
     comme les tailles en pixels plus bas. */
  --text-xs: 0.875rem;
  --text-sm: 1rem;
  --text-base: 1.0625rem;

  /* Le lin. */
  --background: 32 38% 95%;
  --foreground: 15 32% 13%;
  --card: 34 50% 98.5%;
  --card-foreground: 15 32% 13%;
  --popover: 34 50% 98.5%;
  --popover-foreground: 15 32% 13%;

  /* La terre cuite. */
  --primary: 14 64% 41%;
  --primary-foreground: 34 60% 98%;
  --primary-glow: 16 72% 62%;

  --secondary: 30 32% 91%;
  --secondary-foreground: 15 32% 15%;
  --muted: 30 28% 91%;
  --muted-foreground: 18 14% 37%;

  /* L'aubergine : ce qui s'enregistre. */
  --accent: 342 36% 31%;
  --accent-foreground: 34 60% 98%;

  /* L'ocre clair. */
  --warm: 36 82% 80%;
  --warm-foreground: 24 62% 17%;
  --warm-ink: 28 80% 34%;

  /* L'eucalyptus. */
  --croco: 165 34% 30%;
  --croco-foreground: 34 60% 98%;

  --sage: 165 26% 56%;
  --clinical: 165 34% 27%;
  --ivory: 34 50% 98.5%;
  --paper: 32 38% 95%;
  --graphite: 15 32% 13%;
  --sun: 36 82% 70%;

  --destructive: 0 64% 42%;
  --destructive-foreground: 0 0% 100%;

  --border: 28 26% 85%;
  --input: 24 14% 54%;
  --ring: 14 64% 41%;

  --radius: 1.125rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.375rem;
  --radius-3xl: 1.75rem;

  --gradient-primary: linear-gradient(160deg, hsl(16 66% 47%) 0%, hsl(12 62% 38%) 100%);
  --gradient-accent: linear-gradient(160deg, hsl(342 36% 36%) 0%, hsl(342 40% 27%) 100%);
  --gradient-soft: linear-gradient(180deg, hsl(34 50% 98.5%) 0%, hsl(32 38% 95%) 100%);
  --gradient-warm: linear-gradient(160deg, hsl(36 86% 82%) 0%, hsl(28 80% 74%) 100%);
  --gradient-paper: linear-gradient(180deg, hsl(34 50% 99%) 0%, hsl(32 40% 96%) 100%);
  --gradient-graphite: linear-gradient(180deg, hsl(15 30% 12%) 0%, hsl(14 28% 17%) 100%);
  --gradient-mesh: none;

  /* Des ombres chaudes et diffuses, jamais grises. */
  --elev-xs: 0 1px 2px hsl(15 40% 20% / 0.06);
  --elev-sm: 0 2px 6px -2px hsl(15 40% 20% / 0.10), 0 1px 1px hsl(15 40% 20% / 0.04);
  --elev-md: 0 14px 30px -18px hsl(14 50% 25% / 0.30), 0 3px 8px -4px hsl(15 40% 20% / 0.10);
  --elev-lg: 0 30px 60px -32px hsl(14 50% 22% / 0.40), 0 6px 14px -8px hsl(15 40% 20% / 0.12);
  --elev-glow: 0 14px 30px -14px hsl(14 64% 41% / 0.55);
  --elev-deep: 0 40px 80px -36px hsl(14 40% 12% / 0.5);
  --elev-glow-sage: 0 0 0 1px hsl(165 34% 30% / 0.2), 0 14px 32px -16px hsl(165 34% 30% / 0.45);

  --sidebar-background: 15 30% 12%;
  --sidebar-foreground: 30 30% 86%;
  --sidebar-primary: 16 72% 62%;
  --sidebar-primary-foreground: 15 32% 10%;
  --sidebar-accent: 15 24% 18%;
  --sidebar-accent-foreground: 34 60% 98%;
  --sidebar-border: 15 22% 22%;
  --sidebar-ring: 16 72% 62%;

  --transition-base: 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --transition-snap: 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@layer base {
  body { font-feature-settings: normal; }

  /* Young Serif n'a qu'une graisse : pas de gras simulé. */
  h1, h2, h3, h4 {
    font-feature-settings: normal;
    font-weight: 400;
    font-synthesis: none;
    letter-spacing: -0.01em;
  }

  ::selection {
    background: hsl(16 72% 62% / 0.28);
    color: hsl(var(--foreground));
  }
}

@layer components {
  /* Deux taches de lumière, terre cuite et eucalyptus, fixes derrière la
     page — le grain d'origine reste par-dessus. */
  .page-main {
    background-color: hsl(var(--background));
    background-image:
      radial-gradient(900px 520px at 100% 0%, hsl(16 72% 70% / 0.16), transparent 65%),
      radial-gradient(800px 520px at 0% 100%, hsl(165 30% 60% / 0.14), transparent 65%);
    background-attachment: fixed;
  }

  .page-title,
  .section-title,
  .h-editorial { font-weight: 400; letter-spacing: -0.01em; }

  .section-label,
  .clinical-path__kicker {
    font-family: var(--font-mono);
    letter-spacing: 0.08em;
    color: hsl(var(--primary));
  }

  /* Les cartes modelées : quatre rayons légèrement différents, comme une
     pièce tournée à la main. */
  .card-elevated,
  .card-signature,
  .card-paper,
  .jarvis-identity-panel {
    border-radius: 26px 20px 28px 22px / 22px 26px 20px 28px;
  }
  .card-premium {
    border-radius: 20px 16px 22px 18px / 18px 21px 16px 22px;
  }
  .card-premium,
  .card-elevated,
  .card-signature,
  .card-graphite { border-color: hsl(var(--border)); }
  .card-premium::after,
  .card-elevated::after { box-shadow: inset 0 1px 0 hsl(0 0% 100% / 0.8); }

  .card-paper { color: hsl(var(--foreground)); border-color: hsl(var(--border)); }

  .input-premium,
  .textarea-premium {
    background-color: hsl(34 50% 99%);
    border-color: hsl(var(--input) / 0.75);
  }

  .chip {
    background: hsl(var(--secondary));
    border-color: hsl(var(--border));
  }

  .btn-primary { box-shadow: var(--elev-glow); }

  .ia-tools-section { background-color: hsl(34 50% 99%); }
}

/* `.card-elevated` est un @utility de Tailwind, pas un composant : ses
   surcharges doivent vivre dans le calque `utilities`, après le sien. */
@layer utilities {
  .card-elevated {
    border-color: hsl(var(--border));
    border-radius: 26px 20px 28px 22px / 22px 26px 20px 28px;
  }
}

/* ============================================================
   Une lecture plus grande — Argile, thème par défaut.
   Les vues écrivent leurs tailles en pixels (`text-[13px]`) : on les
   remappe une à une, +20 % environ sur le texte courant (plancher à
   12 px), moins sur les titres, qui sont déjà grands. Dans le calque
   `utilities`, après les utilitaires générés : à spécificité égale,
   l'ordre l'emporte.
   ============================================================ */
@layer utilities {
  .text-\[8\.5px\] { font-size: 11px; }
  .text-\[9px\] { font-size: 11.5px; }
  .text-\[10px\] { font-size: 12px; }
  .text-\[10\.5px\] { font-size: 12.5px; }
  .text-\[11px\] { font-size: 13px; }
  .text-\[11\.5px\] { font-size: 13.5px; }
  .text-\[12px\] { font-size: 14px; }
  .text-\[12\.5px\] { font-size: 14.5px; }
  .text-\[13px\] { font-size: 15.5px; }
  .text-\[13\.5px\] { font-size: 16px; }
  .text-\[14px\] { font-size: 16.5px; }
  .text-\[14\.5px\] { font-size: 17px; }
  .text-\[15px\] { font-size: 17.5px; }
  .text-\[16px\] { font-size: 17.5px; }
  .text-\[17px\] { font-size: 18.5px; }
  .text-\[18px\] { font-size: 19.5px; }
  .text-\[19px\] { font-size: 20.5px; }
  .text-\[20px\] { font-size: 21.5px; }
  .text-\[22px\] { font-size: 23.5px; }
  .text-\[24px\] { font-size: 25.5px; }
  .text-\[26px\] { font-size: 27.5px; }
  .text-\[30px\] { font-size: 31.5px; }

  @media (min-width: 40rem) {
    .sm\:text-\[14px\] { font-size: 16.5px; }
    .sm\:text-\[26px\] { font-size: 27.5px; }
  }
  @media (min-width: 64rem) {
    .lg\:text-\[30px\] { font-size: 31.5px; }
  }

  /* Sur téléphone, le plancher de lecture de la base (15-16 px) reste un
     plancher : on le relève d'autant. */
  @media (max-width: 639px) {
    :where(p, li, dd, blockquote).text-\[12\.5px\],
    :where(p, li, dd, blockquote).text-\[13px\],
    :where(p, li, dd, blockquote).text-\[13\.5px\] { font-size: 16.5px; }
    :where(p, li, dd, blockquote, div).text-\[14px\],
    :where(p, li, dd, blockquote, div).text-\[14\.5px\] { font-size: 17.5px; }
  }
}

/* Les composants fixent leur taille par @apply, dans le calque
   `components` : même remappage. */
@layer components {
  .eyebrow,
  .section-label { font-size: 13px; }
  .clinical-path__kicker { font-size: 12px; }
  .clinical-path__label { font-size: 14.5px; }
  .page-title { font-size: 23.5px; }
  .page-subtitle { font-size: 15.5px; }
  .section-title { font-size: 17px; }
  .section-subtitle { font-size: 14.5px; }
  .input-premium,
  .textarea-premium { font-size: 16px; }
  .chip { font-size: 13.5px; }
  .chip-toggle { font-size: 14.5px; }
  .chip-suggest,
  .btn-relance,
  .btn-section { font-size: 14px; }
  .btn-quiet { font-size: 14.5px; }
  .btn-outline { font-size: 15px; }
  .btn-primary { font-size: 16px; }
  .chip-slash { font-size: 12.5px; }
  .mode-switch__item { font-size: 15px; }
  @media (min-width: 40rem) {
    .page-title { font-size: 27.5px; }
    .page-subtitle { font-size: 16.5px; }
  }
  @media (min-width: 64rem) {
    .page-title { font-size: 31.5px; }
  }
}

/* ============================================================
   L'encart de l'accueil (« Un copilote IA spécialisé… ») : le dégradé
   terre cuite des boutons, décalé d'un cran vers le foncé — sur la partie
   claire du dégradé des boutons, l'ivoire plafonnait à 4,3:1 pour un
   paragraphe. Les jetons graphite/ivory y reprennent leur sens d'origine.
   ============================================================ */
@layer utilities {
  aside.bg-graphite {
    --color-ivory: hsl(34 60% 98%);
    --color-graphite: hsl(15 32% 13%);
    background-color: hsl(14 66% 39%);
    background-image: linear-gradient(160deg, hsl(16 68% 43%) 0%, hsl(12 64% 35%) 100%);
  }
  /* Le sous-titre (grand corps, 3:1 suffit) et le paragraphe (4,5:1). */
  aside.bg-graphite .text-ivory\/50 { color: hsl(34 60% 98% / 0.85); }
  aside.bg-graphite .text-ivory\/60 { color: hsl(34 60% 98% / 0.96); }
  aside.bg-graphite .text-ivory\/85 { color: hsl(34 60% 98%); }
  aside.bg-graphite .border-ivory\/20 { border-color: hsl(34 60% 98% / 0.55); }
  /* Le filet et la lueur étaient terre cuite : invisibles sur terre cuite. */
  aside.bg-graphite .bg-primary { background-color: hsl(34 60% 98%); }
  /* Les survols posaient de la terre cuite sur de la terre cuite. */
  aside.bg-graphite .hover\:bg-primary:hover {
    background-color: hsl(15 32% 13%);
    color: hsl(34 60% 98%);
  }
  aside.bg-graphite .hover\:text-primary:hover { color: hsl(34 60% 98%); }
  aside.bg-graphite .hover\:border-primary\/60:hover { border-color: hsl(34 60% 98%); }
}

/* Hors @layer : ces règles visent des éléments qui portent déjà des
   utilitaires Tailwind (couleurs, bordures, arrondis). */
.font-display { font-weight: 400; font-synthesis: none; }

.page-shell > header { background-color: hsl(34 50% 98% / 0.9); }
.page-shell > header > div > a:first-child > div:first-child {
  background: var(--gradient-primary);
  color: hsl(var(--primary-foreground));
  border-radius: 16px 12px 18px 13px;
}

/* ============================================================
   Accessibilité — revue ui-ux-pro-max (WCAG 2.2 AA).
   ============================================================ */
input::placeholder,
textarea::placeholder { color: hsl(var(--muted-foreground) / 0.92); }

:where(button, [role="button"], a, select, summary, [tabindex]):focus-visible {
  outline: 3px solid hsl(var(--ring));
  outline-offset: 2px;
  box-shadow: none;
}
.input-premium:focus,
.textarea-premium:focus {
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.28);
  outline: none;
}
