/*
Theme Name: HITOP-App
Theme URI: https://hitop.fr
Author: Pierre-Jean MARQUET - HITOP
Author URI: https://hitop.fr
Description: Thème WordPress léger à deux styles : « Application » (contenu en cartes, comme une app) ou « Site classique » (en-tête, contenu pleine page, pied de page). Compatible avec le plugin HITOP-RDV.
Version: 1.22.2
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 8.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: hitop-app
*/

:root {
  --accent: #4f46e5;
  --accent-ink: #ffffff;
  --accent-text: var(--accent);
  --bg: #f4f5fb;
  --surface: #ffffff;
  --ink: #141626;
  --muted: #5d6178;
  --line: #e3e5f0;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 22, 38, .06), 0 8px 24px rgba(20, 22, 38, .06);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Cartes de contenu : toujours claires, car les plugins (dont HITOP-RDV) sont conçus pour un fond clair. */
:root {
  --card: #ffffff;
  --card-ink: #141626;
  --card-line: #e3e5f0;
  --card-muted: #5d6178;
}

/* Mode sombre : réglage « Sombre », ou « Automatique » si l'appareil est en mode sombre. */
:root[data-hitop-scheme="dark"] {
  --bg: #0e1020;
  --surface: #171a2e;
  --ink: #eceefb;
  --muted: #9aa0c0;
  --line: #272b47;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
}
@media (prefers-color-scheme: dark) {
  :root[data-hitop-scheme="auto"] {
    --bg: #0e1020;
    --surface: #171a2e;
    --ink: #eceefb;
    --muted: #9aa0c0;
    --line: #272b47;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; font-size: var(--fs, 100%); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);
  font-size: 1rem;
  line-height: var(--lh, 1.55);
  min-height: 100vh;
}

a { color: var(--link, var(--accent)); }
img { max-width: 100%; height: auto; }

/* ---------- Barre d'application ---------- */
.app-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: var(--bar-bg, color-mix(in srgb, var(--surface) 88%, transparent));
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--bar-ink, var(--ink));
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -.01em;
}

.app-logo {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #ec4899));
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 800;
}

.app-nav { margin-left: auto; }
.app-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; flex-wrap: wrap; }
.app-nav a {
  display: block;
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--bar-ink, var(--muted));
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}
.app-nav a:hover,
.app-nav .current-menu-item > a { background: color-mix(in srgb, var(--bar-ink, var(--ink)) 12%, transparent); color: var(--bar-ink, var(--ink)); }

/* ---------- Contenu ---------- */
.app-main {
  max-width: var(--content-w, 1040px);
  margin: 0 auto;
  padding: calc(28px * var(--space, 1)) 20px calc(56px * var(--space, 1));
}

.app-head h1 {
  margin: 0 0 4px;
  font-size: calc(clamp(1.5rem, 3.4vw, 2.1rem) * var(--title-scale, 1));
  font-weight: var(--title-weight, 700);
  letter-spacing: var(--title-ls, -.02em);
  line-height: 1.2;
}
.app-head p { margin: 0; color: var(--muted); }
.archive-description { margin-top: 8px; max-width: 70ch; }
.archive-description p { margin: 0 0 8px; color: var(--muted); }
.archive-description p:last-child { margin-bottom: 0; }
body.style-classic .archive-description p { color: var(--card-muted); }

/* Contenu (pages, articles) */
.entry { background: var(--card); color: var(--card-ink); border: var(--card-bw, 1px) solid var(--card-line); border-radius: var(--radius); padding: calc(clamp(16px, 3vw, 30px) * var(--space, 1)); box-shadow: var(--shadow); margin-bottom: calc(18px * var(--space, 1)); }
.entry-title { margin: 0 0 6px; letter-spacing: var(--title-ls, -.02em); font-weight: var(--title-weight, 700); line-height: 1.25; }
h1.entry-title { font-size: calc(2rem * var(--title-scale, 1)); }
h2.entry-title { font-size: calc(1.5rem * var(--title-scale, 1)); }
.entry-title a { color: inherit; text-decoration: none; }
.entry-meta { margin: 0 0 14px; font-size: 13px; color: var(--card-muted); }
.entry-meta a { color: inherit; text-decoration: underline; }
.entry-more { margin: 10px 0 0; font-weight: 600; }
.entry-more a { color: var(--accent-text); }
.post-navigation { margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--card-line); }
.post-navigation .nav-links { justify-content: space-between; }
.post-navigation .nav-links a { background: transparent; color: var(--card-ink); border-color: var(--card-line); }
.entry-content > :first-child { margin-top: 0; }
.entry-content > :last-child { margin-bottom: 0; }
.app-logo-img { width: 32px; height: 32px; object-fit: contain; border-radius: 8px; }
.nav-links { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 0; }
.nav-links a, .nav-links span { padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--radius-btn, 8px); background: var(--surface); color: var(--ink); text-decoration: none; }
.nav-links .current { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.alignwide, .alignfull { max-width: 100%; }
.wp-caption { max-width: 100%; }

/* Image mise en avant dans les listes d'articles */
.entry-thumb { display: block; flex: 0 0 auto; max-width: 100%; }
.entry-thumb-img { display: block; width: var(--thumb-w, 300px); max-width: 100%; height: auto; aspect-ratio: var(--thumb-ratio, 1 / 1); object-fit: cover; border-radius: var(--radius-img, 10px); }
.entry.has-thumb.thumb-top .entry-thumb { margin-bottom: 14px; }
.entry.has-thumb.thumb-left { display: flex; align-items: flex-start; gap: 18px; }
.entry.has-thumb.thumb-left .entry-thumb { max-width: 45%; }
.entry-body { min-width: 0; flex: 1 1 auto; }
@media (max-width: 640px) {
  .entry.has-thumb.thumb-left { flex-direction: column; gap: 0; }
  .entry.has-thumb.thumb-left .entry-thumb { max-width: 100%; margin-bottom: 14px; }
}

.app-footer { max-width: var(--content-w, 1040px); margin: 0 auto; padding: 8px 20px 32px; text-align: center; font-size: 13px; color: var(--foot-ink, var(--muted)); background: var(--foot-bg, transparent); }
.app-footer p { margin: 0 0 6px; }
.app-footer-text > :last-child { margin-bottom: 0; }
.app-footer-nav ul { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; }
.app-footer-nav a { color: var(--foot-ink, var(--muted)); text-decoration: none; }
.app-footer-nav a:hover { color: var(--accent); text-decoration: underline; }

/* ---------- Recherche, barre latérale, widgets ---------- */
.search-form { display: flex; gap: 6px; max-width: 420px; }
.search-form label { flex: 1; margin: 0; }
.search-form .search-field { width: 100%; box-sizing: border-box; padding: 8px 12px; border: 1px solid var(--card-line); border-radius: var(--radius-sm, 8px); font: inherit; background: #fff; color: #1c1d2b; }
.search-form .search-submit { padding: 8px 14px; border: 0; border-radius: var(--radius-btn, 8px); background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600; cursor: pointer; }
.app-search { margin-left: 8px; }
.app-search .search-form { max-width: 240px; }
.app-burger-panel .search-form { margin: 8px 6px 4px; max-width: none; }
.app-notfound .search-form { margin: 14px 0; }
.app-head .search-form { margin-top: 12px; }

.app-main.has-sidebar { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 32px; align-items: start; }
.app-main.has-sidebar.sidebar-left { grid-template-columns: 280px minmax(0, 1fr); }
.app-main.has-sidebar.sidebar-left .app-sidebar { order: -1; }
.app-content { min-width: 0; }
.widget { margin: 0 0 20px; padding: 16px; background: var(--card); color: var(--card-ink); border: var(--card-bw, 1px) solid var(--card-line); border-radius: var(--radius); font-size: 15px; }
.widget-title { margin: 0 0 10px; font-size: 1rem; letter-spacing: -.01em; }
.widget ul { margin: 0; padding-left: 1.1em; }
.widget a { color: var(--accent-text); }
.widget > :last-child { margin-bottom: 0; }
.app-footer-widgets { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; text-align: left; margin: 0 0 24px; }
.app-footer-widgets .widget { margin: 0; padding: 0; background: transparent; border: 0; border-radius: 0; color: inherit; font-size: 14px; }
.app-footer-widgets .widget-title { color: var(--foot-ink, var(--ink)); }
.app-footer-widgets .widget a { color: var(--foot-ink, var(--muted)); }
.app-footer-widgets .widget a:hover { color: var(--accent); }
@media (max-width: 800px) {
  .app-main.has-sidebar, .app-main.has-sidebar.sidebar-left { grid-template-columns: minmax(0, 1fr); }
  .app-main.has-sidebar.sidebar-left .app-sidebar { order: 0; }
}
@media (max-width: 640px) {
  body.has-burger .app-bar .app-search { display: none; }
  .app-bar .app-search { flex: 1 0 100%; margin: 0; }
  .app-bar .app-search .search-form { max-width: none; }
}
body.style-classic .widget { background: transparent; border: 0; border-radius: 0; padding: 0; }
body.style-classic .widget + .widget { padding-top: 20px; border-top: 1px solid var(--card-line); }
body.style-classic .app-footer-widgets .widget + .widget { padding-top: 0; border-top: 0; }

/* ---------- Mode application mobile (activé dans Personnaliser) ---------- */
body.hitop-app-mobile {
  -webkit-tap-highlight-color: transparent;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
body.hitop-app-mobile input,
body.hitop-app-mobile select,
body.hitop-app-mobile textarea { font-size: 16px; } /* évite le zoom automatique sur iOS */
body.hitop-app-mobile button,
body.hitop-app-mobile input[type="submit"],
body.hitop-app-mobile .button { min-height: 44px; }

.app-tabbar, .app-install { display: none; }

@media (max-width: 640px) {
  body.hitop-app-mobile .app-main { padding: 12px 0 calc(24px + env(safe-area-inset-bottom)); }
  body.hitop-app-mobile.has-app-tabbar .app-main { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  body.hitop-app-mobile .app-head { padding: 0 14px; }
  body.hitop-app-mobile .entry { border-radius: 0; border-left: 0; border-right: 0; box-shadow: none; margin-bottom: 10px; }

  body.hitop-app-mobile .app-tabbar {
    display: block;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 60;
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .app-tabbar ul { list-style: none; margin: 0; padding: 0; display: flex; }
  .app-tabbar li { flex: 1; min-width: 0; }
  .app-tabbar li:nth-child(n+6) { display: none; } /* 5 onglets maximum */
  .app-tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 56px; padding: 6px 4px;
    font-size: 12px; font-weight: 600; text-align: center;
    color: var(--muted); text-decoration: none;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .app-tabbar .current-menu-item > a,
  .app-tabbar .current_page_item > a { color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }

  body.hitop-app-mobile .app-install {
    display: flex;
    align-items: center;
    gap: 10px;
    position: fixed;
    left: 12px; right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 70;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }
  body.hitop-app-mobile.has-app-tabbar .app-install { bottom: calc(68px + env(safe-area-inset-bottom)); }
  body.hitop-app-mobile .app-install[hidden] { display: none; }
  .app-install-text { flex: 1; font-size: 13px; line-height: 1.35; }
  .app-install-text b { display: block; font-size: 14px; }
  .app-install-text span { color: var(--muted); }
  .app-install-go {
    border: 0; border-radius: 10px; padding: 0 14px;
    background: var(--accent); color: var(--accent-ink); font-weight: 600;
  }
  .app-install-close {
    border: 0; background: transparent; color: var(--muted);
    font-size: 24px; line-height: 1; width: 36px;
  }
}

/* Commentaires */
.comments-area { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--card-line); }
.comments-title { font-size: 1.1rem; margin: 0 0 14px; }
.comment-list { list-style: none; margin: 0 0 20px; padding: 0; }
.comment-list .children { list-style: none; margin: 0; padding-left: 20px; }
.comment-body { padding: 12px 0; border-bottom: 1px solid var(--card-line); }
.comment-meta { font-size: 13px; color: #5d6178; }
.comment-meta .avatar { vertical-align: middle; border-radius: 50%; margin-right: 8px; }
.comment-content p { margin: 8px 0; }
.comment-reply-link { font-size: 13px; }
.comment-respond label { display: block; font-size: 14px; margin: 10px 0 4px; }
.comment-respond input[type="text"], .comment-respond input[type="email"], .comment-respond input[type="url"], .comment-respond textarea { width: 100%; max-width: 100%; padding: 10px; border: 1px solid var(--card-line); border-radius: var(--radius-sm, 8px); font: inherit; }
.comment-respond .submit { margin-top: 12px; padding: 10px 18px; border: 0; border-radius: var(--radius-btn, 10px); background: var(--accent); color: var(--accent-ink); font-weight: 600; cursor: pointer; }

/* ---------- Menu hamburger (téléphone, réglable dans Personnaliser) ---------- */
.app-burger { display: none; }

@media (max-width: 640px) {
  .app-burger { display: block; position: fixed; top: calc(6px + env(safe-area-inset-top)); z-index: 80; }
  .app-burger-right { right: calc(10px + env(safe-area-inset-right)); }
  .app-burger-left { left: calc(10px + env(safe-area-inset-left)); }
  body.has-burger:not(.has-app-header) .app-main { padding-top: 62px; }
  body.burger-left .app-bar { padding-left: calc(64px + env(safe-area-inset-left)); } /* le bouton ne recouvre pas le logo */

  .app-burger-btn {
    list-style: none;
    display: flex; align-items: center; justify-content: center;
    width: 44px; height: 44px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .app-burger-btn::-webkit-details-marker { display: none; }
  .app-burger-btn::marker { content: ''; }
  .app-burger-icon,
  .app-burger-icon::before,
  .app-burger-icon::after { display: block; width: 20px; height: 2px; border-radius: 2px; background: var(--ink); }
  .app-burger-icon { position: relative; transition: background .15s; }
  .app-burger-icon::before,
  .app-burger-icon::after { content: ''; position: absolute; left: 0; transition: transform .15s, top .15s; }
  .app-burger-icon::before { top: -6px; }
  .app-burger-icon::after { top: 6px; }
  .app-burger[open] .app-burger-icon { background: transparent; }
  .app-burger[open] .app-burger-icon::before { top: 0; transform: rotate(45deg); }
  .app-burger[open] .app-burger-icon::after { top: 0; transform: rotate(-45deg); }

  .app-burger-panel {
    position: absolute; top: 52px;
    min-width: 220px; max-width: calc(100vw - 20px); max-height: calc(100vh - 90px);
    overflow: auto; padding: 6px;
    background: var(--surface); color: var(--ink);
    border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  }
  .app-burger-right .app-burger-panel { right: 0; }
  .app-burger-left .app-burger-panel { left: 0; }
  .app-burger-panel ul { list-style: none; margin: 0; padding: 0; }
  .app-burger-panel a { display: block; padding: 12px 14px; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 600; }
  .app-burger-panel a:hover { background: var(--bg); }
  .app-burger-panel .current-menu-item > a,
  .app-burger-panel .current_page_item > a { color: var(--accent); background: var(--bg); }
  .app-burger-panel .sub-menu { padding-left: 14px; }
  .app-burger-panel .sub-menu a { font-weight: 500; font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  .app-burger-icon, .app-burger-icon::before, .app-burger-icon::after { transition: none; }
}

/* ---------- Style « site classique » (Personnaliser > HITOP-App > Style du site) ---------- */
body.style-classic { background: var(--page-bg, var(--card)); color: var(--card-ink); }
body.style-classic .app-bar {
  position: static;
  flex-wrap: wrap;
  padding: 14px max(24px, calc((100vw - var(--content-w, 1040px)) / 2));
  background: var(--bar-bg, var(--surface));
  backdrop-filter: none;
}
body.style-classic .app-brand { font-size: 1.15rem; }
body.style-classic .app-logo-img { width: auto; height: 44px; max-width: 220px; border-radius: 0; object-fit: contain; }
body.style-classic .app-nav a { padding: 8px 14px; font-size: 15px; }
body.style-classic .app-main { padding: calc(40px * var(--space, 1)) 24px calc(64px * var(--space, 1)); }
body.style-classic .app-head { margin-bottom: 24px; }
body.style-classic .entry { background: transparent; border: 0; border-radius: 0; box-shadow: none; padding: 0; margin-bottom: calc(36px * var(--space, 1)); }
body.style-classic .entry + .entry { padding-top: 32px; border-top: 1px solid var(--card-line); }
body.style-classic .entry-title { font-size: calc(clamp(1.8rem, 4vw, 2.6rem) * var(--title-scale, 1)); }
body.style-classic h2.entry-title { font-size: calc(clamp(1.3rem, 3vw, 1.7rem) * var(--title-scale, 1)); }
body.style-classic .entry-content { font-size: 1.05rem; line-height: var(--lh, 1.7); }
body.style-classic .app-footer { max-width: none; padding: 28px max(24px, calc((100vw - var(--content-w, 1040px)) / 2)); background: var(--foot-bg, var(--surface)); border-top: 1px solid var(--line); }

@media (max-width: 640px) {
  body.style-classic .app-bar { padding: 12px 16px; }
  body.style-classic.burger-left .app-bar { padding-left: calc(64px + env(safe-area-inset-left)); }
  body.style-classic.has-app-header .app-burger { top: calc(12px + env(safe-area-inset-top)); }
  body.style-classic.has-burger .app-bar { min-height: 68px; } /* le bouton tient dans l'en-tête */
  body.style-classic .app-main { padding: 24px 16px 48px; }
  body.style-classic:not(.has-burger) .app-nav { display: block; width: 100%; margin-left: 0; } /* sans hamburger, le menu reste visible */
  body.style-classic .app-footer { padding: 24px 16px; }
}

/* Accessibilité */
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link:focus { position: fixed; top: 8px; left: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 640px) {
  .app-bar { padding: 8px 14px; gap: 10px; }
  .app-nav { display: none; }
  .app-main { padding: 18px 12px 40px; }
}

/* ---------- 1.13.0 : en-tête, grille, fil d'Ariane, boutons ---------- */
body.header-sticky .app-bar { position: sticky; top: 0; }
body.header-static .app-bar { position: static; }
body.nav-left .app-nav { margin-left: 8px; }
body.nav-center .app-nav { margin-left: auto; margin-right: auto; }
@media (max-width: 640px) {
  body.nav-left .app-nav, body.nav-center .app-nav { margin-left: 0; margin-right: 0; }
}

.entry-content a, .entry-meta a, .comment-content a, .archive-description a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }

.breadcrumb { margin: 0 0 14px; font-size: 13px; }
.breadcrumb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 0; color: var(--muted); }
.breadcrumb li + li::before { content: "/"; margin: 0 8px; opacity: .6; }
.breadcrumb a { color: var(--accent-text); }
body.style-classic .breadcrumb ol { color: var(--card-muted); }

.entries.layout-grid2, .entries.layout-grid3 { display: grid; gap: 20px; align-items: start; }
.entries.layout-grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.entries.layout-grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.entries.layout-grid2 .entry, .entries.layout-grid3 .entry { margin-bottom: 0; }
.entries.layout-grid2 .entry.has-thumb, .entries.layout-grid3 .entry.has-thumb { display: block; }
.entries.layout-grid2 .entry.has-thumb .entry-thumb, .entries.layout-grid3 .entry.has-thumb .entry-thumb { max-width: 100%; width: 100%; margin-bottom: 14px; }
.entries.layout-grid2 .entry-thumb-img, .entries.layout-grid3 .entry-thumb-img { width: 100%; }
body.style-classic .entries.layout-grid2 .entry + .entry, body.style-classic .entries.layout-grid3 .entry + .entry { padding-top: 0; border-top: 0; }
body.style-classic .entries.layout-grid2 .entry, body.style-classic .entries.layout-grid3 .entry { margin-bottom: 24px; }
@media (max-width: 900px) { .entries.layout-grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .entries.layout-grid2, .entries.layout-grid3 { grid-template-columns: minmax(0, 1fr); } }

.app-fab { position: fixed; bottom: calc(16px + env(safe-area-inset-bottom)); right: calc(16px + env(safe-area-inset-right)); z-index: 70; padding: 12px 20px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 700; text-decoration: none; box-shadow: 0 6px 20px rgba(20, 22, 38, .3); }
body.fab-left .app-fab { right: auto; left: calc(16px + env(safe-area-inset-left)); }
body.has-app-tabbar .app-fab, body.has-app-tabbar .app-top { bottom: calc(76px + env(safe-area-inset-bottom)); }
.app-fab:hover { filter: brightness(1.08); }
@media (min-width: 641px) { .app-fab.fab-mobile-only { display: none; } }

.app-top { position: fixed; bottom: calc(16px + env(safe-area-inset-bottom)); left: calc(16px + env(safe-area-inset-left)); z-index: 65; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink); font-size: 20px; line-height: 1; cursor: pointer; box-shadow: var(--shadow); }
body.fab-left .app-top { left: auto; right: calc(16px + env(safe-area-inset-right)); }
.app-top[hidden], .app-back[hidden] { display: none; }

.app-back { position: fixed; top: calc(10px + env(safe-area-inset-top)); left: calc(10px + env(safe-area-inset-left)); z-index: 90; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font-size: 20px; cursor: pointer; box-shadow: var(--shadow); }
body.burger-left .app-back { left: calc(64px + env(safe-area-inset-left)); }
@media (forced-colors: active) { .app-fab, .app-top, .app-back { border: 2px solid ButtonText; } }

/* ---------- 1.14.0 : préréglage « Apple » (structure ; les valeurs viennent des réglages) ---------- */
body.look-apple .app-bar,
body.look-apple.style-classic .app-bar {
  background: var(--bar-bg, color-mix(in srgb, var(--surface) 72%, transparent));
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(128, 128, 128, .22);
}
body.look-apple .app-brand { letter-spacing: -.01em; }
body.look-apple .entry-meta { letter-spacing: .01em; }

/* ---------- 1.15.0 : réseaux, partage, auteur, articles liés, icônes d'onglets ---------- */
.hitop-icon { display: block; }
.app-tabbar .tab-ico { display: block; line-height: 0; }
.app-tabbar .tab-label { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

.app-footer-legal { margin-top: 10px; font-size: 12px; }
.app-footer-legal p { margin: 0 0 4px; }
.app-footer-legal a { color: inherit; }

.entry-share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 24px 0 0; padding-top: 16px; border-top: 1px solid var(--card-line); font-size: 14px; }
.entry-share ul { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
.entry-share a { display: inline-flex; width: 40px; height: 40px; align-items: center; justify-content: center; padding: 0; border: 1px solid var(--card-line); border-radius: 50%; color: var(--card-ink); text-decoration: none; }
/* Couleurs d'origine des réseaux (icône blanche sur fond de marque) */
.entry-share a { border-color: transparent; color: #fff; }
.entry-share a.share-facebook { background: #1877f2; }
.entry-share a.share-x { background: #000; }
.entry-share a.share-linkedin { background: #0a66c2; }
.entry-share a.share-message { background: #128c7e; }
.entry-share a.share-mail { background: #5f6368; }
.entry-share a:hover, .entry-share a:focus-visible { color: #fff; filter: brightness(1.12); }
.author-box { display: flex; gap: 14px; align-items: flex-start; margin: 24px 0 0; padding: 16px; border: 1px solid var(--card-line); border-radius: var(--radius); }
.author-avatar { border-radius: 50%; flex: none; }
.author-name { margin: 0 0 4px; font-weight: 700; }
.author-bio { margin: 0; color: var(--card-muted); font-size: 14px; }
.related-posts { margin: 24px 0 0; padding-top: 16px; border-top: 1px solid var(--card-line); }
.related-title { margin: 0 0 8px; font-size: 1.05rem; }
.related-posts ul { margin: 0; padding-left: 1.1em; }
.related-posts li { margin: 4px 0; }
.related-date { color: var(--card-muted); font-size: 13px; }

/* --- SEO / GEO : sommaire et modèles de blocs --- */
.toc { margin: 0 0 20px; padding: 12px 16px; border: 1px solid var(--card-line); border-radius: var(--radius-sm, 8px); }
.toc summary { cursor: pointer; font-weight: 600; }
.toc ul { margin: 8px 0 0; padding-left: 18px; }
.toc .toc-l3 { margin-left: 16px; list-style-type: circle; }
.entry-content h2[id], .entry-content h3[id] { scroll-margin-top: 80px; }
.hitop-answer, .hitop-definition { margin: 0 0 20px; padding: 12px 16px; border-left: 4px solid var(--accent); border-radius: var(--radius-sm, 8px); background: rgba(127, 127, 127, .08); }
.hitop-answer > :last-child, .hitop-definition > :last-child { margin-bottom: 0; }
.hitop-stat-number { margin: 0; font-size: 2rem; font-weight: 700; line-height: 1.1; color: var(--accent-text, var(--accent)); }
.hitop-stat-label { margin: 4px 0 0; font-size: .9rem; opacity: .8; }
