/* Subject colors are paired with dark text, a pictogram and a written label. */
:root {
  --play-border: #d9d2eb;
  --play-shadow: 0 5px 0 #ece6f5;
}
body { background: #fbf8ff; }
.content { max-width: 1270px; }
.pico-companion {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  position: relative;
  isolation: isolate;
  padding: .8rem 1.4rem;
  margin-bottom: 1.8rem;
  border: 2px solid #e0d4f1;
  border-radius: 1.5rem;
  background: linear-gradient(112deg, #fff0d5, #f4eaff 62%, #e5f5ff);
  overflow: hidden;
}
.pico-companion::after {
  content: '✦';
  position: absolute;
  right: 1.3rem;
  top: .35rem;
  font-size: 3rem;
  color: #c9b4e4;
  z-index: -1;
}
.pico-portrait {
  flex: 0 0 104px;
  position: relative;
  min-height: 104px;
  border-radius: 50%;
  background: #fffaf0;
}
.companion-fox { display: block; width: 104px; height: 104px; }
.pico-portrait > span { position: absolute; color: #966109; right: 0; top: 0; font-size: 1.4rem; }
.pico-name { margin: 0 0 .2rem; color: #654581; font-size: .8rem; font-weight: 800; }
.pico-message { margin: 0; font-size: clamp(1.15rem, 2.2vw, 1.45rem); font-weight: 800; line-height: 1.3; }
.pico-description { margin: .35rem 0 0; max-width: 42rem; color: #4c4864; font-size: .95rem; }
.pico-discreet { padding-block: .65rem; border-radius: 1rem; }
.pico-discreet .pico-portrait { flex-basis: 74px; min-height: 74px; }
.pico-discreet .companion-fox { width: 74px; height: 74px; }
body[data-page="parents"] .pico-companion,
body[data-page="sources"] .pico-companion,
body[data-page="accessibilite"] .pico-companion { background: #f2edfb; }
.subject-emblem {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  color: var(--subject-ink);
  background: var(--subject-surface);
  border-radius: 15px;
}
.subject-emblem svg { width: 29px; height: 29px; }
.catalogue-title { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .65rem; margin-bottom: .8rem; }
.catalogue-title h2 { margin: 0; }
.subject-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
  gap: .7rem;
  margin: .8rem 0 1.3rem;
}
.subject-tile {
  min-width: 0;
  min-height: 116px;
  padding: .85rem .5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  border: 2px solid #e0dbe8;
  border-radius: 19px;
  background: #fff;
  color: #292442;
  font-weight: 700;
  font-size: .9rem;
  line-height: 1.25;
  box-shadow: 0 4px 0 #ebe5f1;
}
.subject-tile .subject-emblem { width: 50px; height: 50px; }
.subject-tile span:last-child { overflow-wrap: anywhere; }
.subject-tile:hover { border-color: var(--subject-ink); background: var(--subject-surface); }
.subject-tile[aria-pressed="true"] {
  border-color: var(--subject-ink);
  background: var(--subject-surface);
  box-shadow: 0 4px 0 var(--subject-ink);
}
.subject-tile[aria-pressed="true"] > span:last-child::after { content: ' ✓'; }
.themed-lesson {
  border: 1px solid #d9d3e5;
  border-top: 6px solid var(--subject-ink);
  border-radius: 20px;
  box-shadow: var(--play-shadow);
  background: linear-gradient(var(--subject-surface), #fff 100px);
}
.lesson-subject-label { display: flex; align-items: center; gap: .7rem; margin-bottom: 1rem; }
.lesson-subject-label .eyebrow { margin: 0; letter-spacing: .035em; color: #4c4864; font-size: .75rem; }
.themed-lesson h3 { font-size: 1.3rem; }
.themed-lesson > p { line-height: 1.5; }
.themed-lesson .btn { border-color: var(--subject-ink); color: var(--subject-ink); box-shadow: 0 4px 0 var(--subject-ink); background: #fff; }
.themed-lesson .btn:hover { background: var(--subject-surface); }
.programme-subject-title { display: flex; align-items: center; gap: .65rem; }
.programme-panel { border-width: 2px; box-shadow: var(--play-shadow); }
.programme-panel .themed-programme { padding-top: 0; margin-top: .65rem; border: 1px solid #ddd6e9; border-radius: 13px; overflow: hidden; }
.programme-panel .themed-programme > summary {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .65rem .8rem;
  background: var(--subject-surface);
}
.programme-panel .themed-programme > summary::before { content: '▸'; color: var(--subject-ink); }
.programme-panel .themed-programme[open] > summary::before { content: '▾'; }
.programme-panel .themed-programme > summary .subject-emblem { width: 36px; height: 36px; background: white; border-radius: 11px; }
.programme-panel .themed-programme > summary svg { width: 24px; height: 24px; }
.programme-panel .themed-programme > a { display: inline-block; margin: .75rem .8rem .25rem; }
.programme-panel .themed-programme > ul { margin: .75rem 1rem; }
.programme-progress { background: linear-gradient(115deg, #f5f0ff, #eaf9f4); border: 2px solid #d4dce8; }
.cp-routes .panel:first-child { background: #f4ebff; border-top: 5px solid #673b9c; }
.cp-routes .panel:last-child { background: #fff3d8; border-top: 5px solid #925012; }
.lesson-header-art { display: flex; align-items: center; gap: .35rem; flex-shrink: 0; }
.lesson-pico { width: 58px; height: 58px; }
.dialog-head { background: var(--subject-surface, #f4efff); padding-block: .55rem; }
.dialog-head #activity-heading { flex: 1; }
.dialog-head .subject-emblem { width: 39px; height: 39px; background: white; border-radius: 12px; }
.dialog-head .subject-emblem svg { width: 25px; height: 25px; }
.class-dialog[data-grade="CM1"] .lesson-pico,
.class-dialog[data-grade="CM2"] .lesson-pico { width: 44px; height: 44px; }
.class-dialog[data-grade="CM1"] .pico-note svg,
.class-dialog[data-grade="CM2"] .pico-note svg { width: 50px; height: 50px; }
.dialog-body .example { border-color: var(--subject-ink, #f1d99b); }
body[data-grade="CM1"] .subject-tile,
body[data-grade="CM2"] .subject-tile { border-radius: 12px; min-height: 102px; }
body[data-grade="CM1"] .subject-tile .subject-emblem,
body[data-grade="CM2"] .subject-tile .subject-emblem { width: 42px; height: 42px; border-radius: 12px; }
.large .pico-description, .large .subject-tile { font-size: 1.1rem; }
button:focus-visible, summary:focus-visible, a:focus-visible, select:focus-visible {
  outline: 3px solid #44276e;
  outline-offset: 4px;
}
@media (max-width: 760px) {
  .pico-companion { padding: .75rem .85rem; gap: .75rem; margin-bottom: 1.3rem; border-radius: 1.1rem; }
  .pico-portrait, .pico-discreet .pico-portrait { flex-basis: 72px; min-height: 72px; }
  .companion-fox, .pico-discreet .companion-fox { width: 72px; height: 72px; }
  .pico-description { font-size: .85rem; }
  .pico-companion::after { font-size: 2rem; right: .45rem; }
  .subject-tiles { grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: .55rem; }
  .subject-tile { padding: .65rem .4rem; min-height: 106px; font-size: .8rem; border-radius: 15px; }
  .lesson-header-art { gap: .15rem; }
  .lesson-header-art .subject-emblem { width: 30px; height: 30px; border-radius: 8px; }
  .lesson-header-art .subject-emblem svg { width: 22px; height: 22px; }
  .lesson-pico { width: 46px; height: 46px; }
  .dialog-head { gap: .45rem; padding-inline: .7rem; }
  .dialog-head #activity-heading { font-size: .8rem; }
  .dialog-head .close { flex: 0 0 44px; }
  .programme-panel .themed-programme > summary { padding: .5rem; font-size: .9rem; gap: .45rem; }
}
.subjects .subject-emblem { width: 64px; height: 64px; border-radius: 19px; }
.subjects .subject-emblem svg { width: 37px; height: 37px; }
.home-discoveries { margin-top: 1.5rem; }

/* Lien légal du pied de page : même gabarit que les boutons voisins */
footer a{color:inherit;font-size:11px;text-decoration:underline;display:inline-flex;align-items:center;min-height:28px}
footer a:focus-visible{outline:3px solid var(--green);outline-offset:2px}

/* Titre d'accueil : respiration entre le titre et la phrase d'introduction */
.welcome-hero h1 + p { margin-top: .9rem; }

/* Icônes de navigation */
.nav-icon { width: 20px; height: 20px; flex: 0 0 20px; }

/* Chemins guidés du CP : une grande carte par étape */
.route-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.2rem; }
.cp-route { border-radius: 24px; padding: 1.3rem; border: 2px solid transparent; }
.route-read { background: #f4ebff; border-color: #e2d2fb; --route-ink: #5b2f91; --route-soft: #e7d7ff; }
.route-count { background: #fff3d8; border-color: #f6dfab; --route-ink: #7a420c; --route-soft: #ffe3a6; }
.route-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: 1rem; }
.route-head h3 { margin: 0; font-size: 1.35rem; color: var(--route-ink); }
.route-dots { display: flex; gap: .35rem; margin: 0; }
.route-dots span { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid var(--route-ink); }
.route-dots span.on { background: var(--route-ink); }
.cp-routes .route-path { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
.route-step {
  width: 100%; min-height: 76px; display: grid; grid-template-columns: 36px 52px 1fr auto; align-items: center; gap: .7rem;
  padding: .6rem .9rem .6rem .6rem; border: 2px solid var(--route-soft); border-radius: 18px; background: #fff;
  box-shadow: 0 4px 0 var(--route-soft); text-align: start; font-weight: 700; font-size: 1.1rem; color: var(--ink);
  transition: transform .12s ease, box-shadow .12s ease;
}
.route-step:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--route-soft); }
.route-step:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--route-soft); }
.route-num {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--route-soft); color: var(--route-ink); font-size: 1rem;
}
.route-icon { font-size: 2.3rem; line-height: 1; text-align: center; }
.route-step.is-done .route-num { background: #2f7d4f; color: #fff; }
.route-step.is-next { border-color: var(--route-ink); box-shadow: 0 4px 0 var(--route-ink); }
.route-badge { background: var(--route-ink); color: #fff; border-radius: 999px; padding: .25rem .75rem; font-size: .9rem; white-space: nowrap; }
.route-stars .off { color: #e6dccb; }
.route-stars { color: #c47a00; font-size: 1.2rem; letter-spacing: 1px; white-space: nowrap; }
.cp-route .practice-next { margin-top: 1rem; }
.calm .route-step, .calm .route-step:hover { transform: none; }

/* Mobile : marque en haut, navigation en barre du bas */
@media (max-width: 760px) {
  .sidebar { display: flex !important; flex-direction: row !important; align-items: center; border-right: 0 !important; justify-content: space-between; gap: .5rem; padding: 10px 16px !important; }
  .sidebar .side-bottom { display: block !important; margin: 0; }
  .sidebar .side-bottom .side-note { display: none; }
  .sidebar .comfort-btn { font-size: 0 !important; min-width: 48px; min-height: 44px; padding: 0 .6rem; border-radius: 12px; border: 2px solid var(--line) !important; background: #fff !important; color: var(--ink); }
  .comfort-btn span { font-size: 16px; font-weight: 800; }
  .sidebar nav {
    position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; margin: 0 !important;
    display: grid !important; grid-template-columns: repeat(5, 1fr); gap: 0 !important;
    background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(37, 40, 76, .08);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .sidebar nav .nav {
    flex-direction: column; justify-content: center; gap: 2px !important; min-height: 56px; padding: 4px 2px !important;
    font-size: 11px !important; border-radius: 12px; white-space: nowrap; box-shadow: none !important;
  }
  .sidebar nav .nav[aria-current=page] { background: var(--mint) !important; color: var(--green) !important; }
  .nav-icon { width: 22px; height: 22px; }
  .page { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .cp-route { padding: 1rem; }
  .route-head h3 { font-size: 1.2rem; }
  .route-step { grid-template-columns: 30px 44px 1fr auto; font-size: 1rem; min-height: 70px; gap: .55rem; }
  .route-num { width: 30px; height: 30px; }
  .route-icon { font-size: 2rem; }
}
