/* ==========================================================================
   Coque commune : barre du haut, onglets du bas, rail TV, réglages, bannière
   ========================================================================== */

.ic { width: 1.25em; height: 1.25em; flex: none; }
.ic.on, [aria-current='page'] > .ic { fill: currentColor; }
.owl, .owl-avatar { width: 100%; height: auto; display: block; }
.vig, .cov { width: 100%; height: 100%; display: block; }
.logo { display: block; flex: none; }

/* ---------- Fractions empilées ---------- */
.frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1.05; font-weight: 800; margin: 0 .18em; font-family: var(--font-display); }
.frac span:first-child { padding: 0 .22em .08em; border-bottom: 3px solid currentColor; }
.frac span:last-child { padding-top: .08em; }

.shell { min-height: 100vh; display: flex; flex-direction: column; }
.shell-main { flex: 1; outline: none; }

/* ---------- Barre du haut (ordinateur, tablette) ----------
   La marque occupe la largeur du plan du catalogue : la recherche s'aligne sur la colonne de contenu. */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.topbar-in {
  max-width: 1520px; margin: 0 auto; min-height: var(--nav-h); padding: 0 var(--s3);
  display: grid; grid-template-columns: var(--plan-w) minmax(0, 1fr) auto; column-gap: var(--s4); align-items: center;
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none !important; justify-self: start; padding: 4px 8px 4px 4px; margin-left: -4px; border-radius: var(--r-m); }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.45rem; letter-spacing: -.015em; }
.brand-tag { font-size: .78rem; font-weight: 700; color: var(--muted); letter-spacing: .01em; margin-top: 3px; }
.tsearch { position: relative; width: 100%; max-width: 560px; transition: opacity 160ms ease, transform 160ms ease; }
.tsearch .ic { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; width: 20px; height: 20px; }
.tsearch .field { padding-left: 46px; padding-right: 48px; min-height: 44px; background: var(--sunk); border-color: transparent; font-size: 1rem; }
.tsearch .field:hover { background: var(--paper); border-color: var(--line); }
.tsearch .field:focus { background: var(--paper); border-color: var(--act-line); }
.tsearch-key {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%); pointer-events: none;
  min-width: 26px; height: 26px; padding: 0 7px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-xs); border: 1px solid var(--line-strong); background: var(--paper);
  font: 700 .82rem/1 var(--font-body); color: var(--muted);
}
.tsearch .field:focus + .tsearch-key, .tsearch .field:not(:placeholder-shown) + .tsearch-key { display: none; }
@media (hover: none) { .tsearch-key { display: none; } }
/* Sur l'accueil, la recherche de la barre n'apparaît que lorsque le grand champ a défilé hors de l'écran */
@media (min-width: 720px) {
  body.home-search:not(.search-docked) .tsearch { opacity: 0; visibility: hidden; transform: translateY(-4px); }
}
.tnav { display: flex; align-items: center; gap: 6px; justify-self: end; }
.tlink {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: var(--r-m);
  color: var(--ink); font-family: var(--font-display); font-weight: 600; font-size: 1rem; text-decoration: none !important;
  transition: background-color 120ms ease;
}
.tlink .ic { color: var(--act-text); width: 20px; height: 20px; }
.tlink[aria-current='page'] { background: var(--act-soft); color: var(--act-text); }
@media (hover: hover) { .tlink:hover { background: var(--sunk); } }
.tsep { width: 1px; height: 24px; background: var(--line); margin: 0 6px; }
.aa span { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; letter-spacing: 0; }
.chipuser {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 10px 0 4px; margin-left: 4px;
  border-radius: var(--r-pill); background: var(--paper); border: 1px solid var(--line-strong); color: var(--ink); font-weight: 800;
  transition: border-color 120ms ease;
}
.chipuser .ic { width: 16px; height: 16px; color: var(--muted); }
.avatar-l { width: 34px; height: 34px; border-radius: 50%; background: var(--act); color: var(--act-ink); display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 700; font-size: .98rem; }
@media (hover: hover) { .chipuser:hover { border-color: var(--act); } }

/* Tablette : plus de colonne de plan, la marque reprend sa largeur naturelle */
@media (max-width: 1239px) {
  .topbar-in { grid-template-columns: auto minmax(0, 1fr) auto; column-gap: var(--s3); }
  .tsearch { justify-self: center; }
}
@media (max-width: 959px) {
  .brand-tag, .tlink span { display: none; }
  .tlink { padding: 0 11px; }
}

.tabbar, .rail { display: none; }

/* ---------- Smartphone : recherche en haut, onglets en bas ---------- */
@media (max-width: 719px) {
  .topbar-in { display: flex; flex-wrap: wrap; padding: 8px 16px 12px; min-height: 0; gap: 8px 10px; }
  .tsearch { flex: 1 1 100%; max-width: none; order: 3; }
  .tsearch .field { min-height: 48px; }
  .tnav { margin-left: auto; }
  .tnav .tlink, .tnav .tsep, .chipuser-name { display: none; }
  .chipuser { padding-right: 8px; }
  .brand-name { font-size: 1.3rem; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: var(--paper); border-top: var(--line-w) solid var(--line);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); gap: 6px;
  }
  .tabbar a, .tabbar button {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px;
    border-radius: var(--r-m); color: var(--muted); font-weight: 800; font-size: .82rem; text-decoration: none; min-height: 58px;
  }
  .tabbar .ic { width: 26px; height: 26px; }
  .tabbar [aria-current='page'] { color: var(--act-text); background: var(--act-soft); }
  .shell-main { padding-bottom: 88px; }
}

/* ---------- Mode TV : rail vertical à gauche ---------- */
[data-tv='1'] .topbar, [data-tv='1'] .tabbar { display: none; }
[data-tv='1'] .rail {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  position: fixed; left: 0; top: 0; bottom: 0; width: 148px; z-index: 60;
  background: var(--paper); border-right: var(--line-w) solid var(--line); padding: 20px 12px;
}
[data-tv='1'] .railbtn {
  width: 100%; min-height: 104px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--r-l); color: var(--text); font-weight: 800; font-size: .95rem; text-decoration: none;
}
[data-tv='1'] .railbtn .ic { width: 38px; height: 38px; }
[data-tv='1'] .railbtn[aria-current='page'] { background: var(--act-soft); color: var(--act-text); }
[data-tv='1'] .brandbtn { min-height: 80px; margin-bottom: 8px; }
[data-tv='1'] .shell-main { margin-left: 148px; }

/* ---------- Réglages, menu du profil ---------- */
.setrow { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: var(--s2) var(--s3); background: var(--sunk); border-radius: var(--r-l); flex-wrap: wrap; }
.setrow p { font-size: .95rem; }
.menuitem {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 54px; padding: 0 18px;
  border-radius: var(--r-m); background: var(--sunk); color: var(--ink); font-weight: 800; text-decoration: none !important; text-align: left;
  transition: transform var(--dur) var(--ease);
}
.menuitem .ic { color: var(--act-text); }
@media (hover: hover) { .menuitem:hover { transform: translateY(var(--lift)); background: var(--act-soft); } }
.pause-owl { width: 180px; margin: 0 auto; }

/* ---------- Bannière non bloquante ---------- */
.sbanner {
  position: fixed; left: 0; right: 0; margin: 0 auto; bottom: 24px; z-index: 7000;
  width: min(760px, calc(100% - 32px)); display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap;
  padding: var(--s2) var(--s3); border-radius: var(--r-xl);
  background: var(--yellow-bg); color: var(--yellow-strong); border: var(--line-w) solid var(--yellow-line);
  animation: pop 260ms var(--ease) both; font-weight: 700;
}
.sbanner p { flex: 1 1 220px; }
.sbanner .iconpill { background: var(--paper); color: var(--yellow-strong); }
@media (max-width: 719px) { .sbanner { bottom: 96px; } }

/* ---------- Clavier à l'écran : affichage de saisie ---------- */
.osk-display {
  min-height: 72px; padding: 16px 24px; border-radius: var(--r-l); background: var(--sunk); border: var(--line-w) solid var(--line-strong);
  font-family: var(--font-display); font-size: 1.6rem; color: var(--ink); word-break: break-word; display: flex; align-items: center; flex-wrap: wrap;
}
.osk-display.multi { align-items: flex-start; min-height: 160px; font-family: var(--font-body); font-size: 1.25rem; display: block; }
.osk-display .ph { color: var(--muted); font-size: 1.15rem; font-family: var(--font-body); }
.osk-display .caret { display: inline-block; width: 3px; height: 1.2em; margin-left: 3px; background: var(--act); border-radius: 2px; vertical-align: text-bottom; }
[data-tv='1'] .modal { width: min(900px, 100%); }

/* ---------- Pied de page ---------- */
.appfoot { border-top: 1px solid var(--line); background: var(--paper); margin-top: var(--s5); color: var(--text); }
.appfoot-in {
  max-width: 1520px; margin: 0 auto; padding: var(--s5) var(--s3) var(--s4);
  display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: var(--s4);
}
.appfoot-brand { display: flex; flex-direction: column; gap: 12px; }
.appfoot-brand p { font-size: .95rem; color: var(--muted); max-width: 34ch; line-height: 1.55; }
.appfoot-col h2 { font-family: var(--font-body); font-size: .88rem; font-weight: 800; color: var(--ink); margin-bottom: 12px; letter-spacing: .01em; }
.appfoot-col ul { display: flex; flex-direction: column; gap: 0; }
.appfoot-col a, .appfoot-col button {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 10px; margin-left: -10px; border-radius: var(--r-s);
  color: var(--text); font-weight: 700; font-size: .95rem; text-decoration: none !important; transition: background-color 120ms ease, color 120ms ease;
}
.appfoot-col a .ic, .appfoot-col button .ic { width: 18px; height: 18px; color: var(--act-text); }
@media (hover: hover) { .appfoot-col a:hover, .appfoot-col button:hover { background: var(--sunk); color: var(--ink); } }
.appfoot-promises li { display: flex; align-items: flex-start; gap: 10px; font-size: .92rem; color: var(--muted); font-weight: 700; padding: 6px 0; line-height: 1.4; }
.appfoot-promises .ic { width: 18px; height: 18px; color: var(--muted); margin-top: 1px; }
.appfoot-bottom {
  max-width: 1520px; margin: 0 auto; padding: var(--s2) var(--s3) var(--s3); border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: var(--s2); flex-wrap: wrap; font-size: .85rem; font-weight: 700; color: var(--muted);
}
/* Pas de pied de page pendant une activité, une lecture ou sur TV : rien ne doit distraire */
body[data-route='atelier'] .appfoot, body[data-route='lire'] .appfoot, [data-tv='1'] .appfoot { display: none; }
@media (max-width: 1099px) { .appfoot-in { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 719px) {
  .appfoot { margin-top: var(--s4); }
  .appfoot-in { grid-template-columns: minmax(0, 1fr); gap: var(--s3); padding: var(--s4) var(--s2) var(--s3); }
  .appfoot-bottom { padding: var(--s2); flex-direction: column; gap: 4px; }
}
