/* Couleurs choisies par Hanna (js/theme.js, js/page-colors.js).
   Les règles d'un rôle ne s'appliquent que si Hanna l'a réglé (attribut data-t-<rôle> sur <html>) : sinon l'app garde son style d'origine. */

/* ---------- fond des rubriques : voiles réglables, qui suivent le « fond des pages » ---------- */
.view--universe::before {
  background:
    linear-gradient(180deg, rgb(236 227 214 / 30%) 0%, rgb(236 227 214 / 55%) 60%, rgb(236 227 214 / 78%) 100%),
    var(--universe) center / cover no-repeat;
  background:
    linear-gradient(180deg,
      var(--page-veil-1, color-mix(in srgb, var(--stone) 30%, transparent)) 0%,
      var(--page-veil-2, color-mix(in srgb, var(--stone) 55%, transparent)) 60%,
      var(--page-veil-3, color-mix(in srgb, var(--stone) 78%, transparent)) 100%),
    var(--universe) center / cover no-repeat;
}

/* ---------- rôles de l'interface ---------- */
:root[data-t-link] .section-head__link,
:root[data-t-link] .card__link,
:root[data-t-link] .feature-link,
:root[data-t-link] .credit a { color: var(--link); }

:root[data-t-tabbar] .tabbar { background: var(--tabbar); }
:root[data-t-tab-on] .tab--on { color: var(--tab-on); }
:root[data-t-topbar] .langbar { background: var(--topbar); }

:root[data-t-tag] .block__title--pill,
:root[data-t-tag] .card__eyebrows .card__eyebrow { background: var(--tag); }
:root[data-t-tag-text] .block__title--pill,
:root[data-t-tag-text] .card__eyebrows .card__eyebrow { color: var(--tag-text); }

/* ---------- panneau « Couleurs et style » et outil de couleur de page ---------- */
.palettes { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 8px 0 16px; }
.palette {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-height: 64px; padding: 10px;
  border: 1.5px solid var(--border); border-radius: var(--radius-control, 10px); background: var(--surface); color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600; text-align: start; cursor: pointer;
}
.palette__dots { display: flex; gap: 4px; }
.palette__dot { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgb(0 0 0 / 15%); background: var(--dot); }
.theme-group { margin: 14px 0 4px; font-size: 14px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.theme-warnings { margin: 8px 0; padding: 10px 12px; border-radius: 10px; background: var(--ochre-light); color: var(--ochre); font-size: 14px; }
.theme-warnings p + p { margin-top: 4px; }

.page-color {
  position: relative; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: 8px var(--gutter, 16px); padding: 8px 10px; border-radius: 12px; background: rgb(255 255 255 / 92%); color: var(--ink);
}
.page-color__pick { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; font-weight: 600; }
.page-color__pick input { width: 44px; height: 44px; padding: 0; border: 0; background: none; }
.page-color__mode { min-height: 44px; font: inherit; font-size: 16px; }
.page-color__status { width: 100%; font-size: 13px; color: var(--ink-soft); }

/* ---------- modèles d'apparence (js/templates-ui.js) : vignettes dessinées, barre d'aperçu ---------- */
.tpl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 8px 0 16px; }
@media (min-width: 560px) { .tpl-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tpl {
  display: flex; flex-direction: column; align-items: stretch; gap: 4px; min-height: 44px; padding: 8px;
  border: 1.5px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text);
  font: inherit; text-align: start; cursor: pointer;
}
.tpl[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.tpl__name { font-size: 15px; font-weight: 700; line-height: 1.2; }
.tpl__desc { font-size: 13px; line-height: 1.3; color: var(--ink-soft, #5a5650); }
.tpl__mock {
  position: relative; display: flex; flex-direction: column; gap: 4px; height: 180px; padding: 0 0 26px; overflow: hidden;
  border: 1px solid rgb(0 0 0 / 10%); border-radius: 8px; background: var(--m-bg); color: var(--m-ink); font-family: var(--m-font-body);
}
.tpl__mock > * { flex: none; }
.tpl__banner { position: relative; height: 44px; overflow: hidden; background: var(--m-sea); }
.tpl__mock--banner-small .tpl__banner { height: 26px; }
.tpl__mock--banner-full .tpl__banner { height: 58px; }
.tpl__sun { position: absolute; top: 8px; inset-inline-end: 12px; width: 14px; height: 14px; border-radius: 50%; background: var(--m-surface); }
.tpl__hill { position: absolute; bottom: -18px; inset-inline-start: -10px; width: 90px; height: 36px; border-radius: 50%; background: var(--m-navy); opacity: 0.55; }
.tpl__title {
  margin: 2px 8px 0; font-family: var(--m-font-title); font-size: 16px; font-weight: 700; line-height: 1.2;
  color: var(--m-title); text-transform: uppercase; white-space: nowrap; overflow: hidden;
}
.tpl__text { margin: 0 8px; font-size: 10px; line-height: 1.1; color: var(--m-soft); }
.tpl__mock > .tpl__cards { flex: 0 1 auto; min-height: 0; overflow: hidden; }
.tpl__cards { display: flex; flex-direction: column; gap: 4px; margin: 0 8px; }
.tpl__card { display: flex; flex-direction: column; gap: 2px; padding: 3px; border-radius: var(--m-radius); background: var(--m-surface); box-shadow: 0 1px 2px rgb(0 0 0 / 10%); }
.tpl__photo { display: none; height: 16px; border-radius: calc(var(--m-radius) * 0.6); background: var(--m-sea); opacity: 0.7; }
.tpl__line { height: 4px; border-radius: 2px; background: var(--m-ink); opacity: 0.55; }
.tpl__line--short { width: 60%; opacity: 0.3; }
.tpl__mock--list .tpl__card { flex-direction: row; align-items: center; }
.tpl__mock--list .tpl__photo { display: block; flex: none; width: 18px; height: 12px; }
.tpl__mock--list .tpl__line { flex: 1; }
.tpl__mock--grid .tpl__cards { flex-direction: row; }
.tpl__mock--grid .tpl__card { flex: 1; }
.tpl__mock--grid .tpl__photo { display: block; height: 18px; }
.tpl__mock--large .tpl__photo { display: block; height: 28px; }
.tpl__mock--large .tpl__card + .tpl__card { display: none; }
.tpl__btn {
  align-self: flex-start; margin: 2px 8px 0; padding: 2px 10px; border-radius: 999px; background: var(--m-accent); color: var(--m-on-accent);
  font-family: var(--m-font-button); font-size: 10px; font-weight: 700; line-height: 1.4;
}
.tpl__tabs {
  position: absolute; inset-inline: 0; bottom: 0; display: flex; justify-content: space-around; align-items: center; height: 20px;
  border-top: 1px solid rgb(0 0 0 / 8%); background: var(--m-tab);
}
.tpl__tab { width: 10px; height: 10px; border-radius: 3px; background: var(--m-ink); opacity: 0.25; }
.tpl__tab--on { background: var(--m-tab-on); opacity: 1; }

.tpl-bar {
  position: fixed; inset-inline: 0; bottom: calc(var(--tabbar-h) + 8px + env(safe-area-inset-bottom)); z-index: 40;
  display: flex; flex-direction: column; gap: 8px; max-width: 624px; margin: 0 auto; padding: 10px 12px;
  border-radius: 16px; background: var(--charcoal, #2d2a26); color: #ffffff; box-shadow: 0 8px 24px rgb(0 0 0 / 25%);
}
@media (max-width: 640px) { .tpl-bar { inset-inline: 8px; } }
.tpl-bar__status { font-family: "Rubik", system-ui, sans-serif; font-size: 15px; font-weight: 600; }
.tpl-bar__actions { display: flex; gap: 8px; }
.tpl-bar__actions .btn { flex: 1 1 0; min-height: 48px; text-transform: none; }
/* la barre d’aperçu garde une police lisible quel que soit le modèle essayé (même poids que fonts-library.css) */
.tpl-bar__actions .btn:not(#\#) { font-family: "Rubik", system-ui, sans-serif; }
.app:has(.tpl-bar) { padding-bottom: calc(var(--tabbar-h) + 150px + env(safe-area-inset-bottom)); }
