/* =====================================================
   TinyToolWeb - site.css
   Cadre commun des outils et des pages simples (à propos, confidentialité…),
   même dessin que l'accueil : en-tête, menu latéral, cartes outils, pied de page.
   Ajouté automatiquement par build.py après tokens.css (l'accueil a le sien dans index.css).
   ===================================================== */

/* --- En-tête : base autonome (les pages simples et d'erreur n'ont pas app.css) --- */
.site-header .header-content { display: flex; align-items: center; justify-content: space-between; }
.site-header .header-actions { display: flex; align-items: center; }
.site-header .logo { text-decoration: none; }
.site-header .back-link { color: var(--text-light); text-decoration: none; }
.site-header .back-link:hover { color: var(--link); }
.site-header .theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}
.site-header .theme-toggle svg { width: 18px; height: 18px; display: block; }
.site-header .theme-icon { display: inline-flex; }

/* --- En-tête (même dessin que l'accueil) --- */
header.site-header {
  padding: 0;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
}
.dark header.site-header { background: var(--bg-body); }
.site-header .header-content { min-height: 60px; flex-wrap: nowrap; gap: var(--spacing-xs); }
.site-header .logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-dark);
}
.site-header .logo:hover { color: var(--text-dark); }
/* Logo : carré « TTW » noir sur clair, blanc sur sombre (même logique que le sélecteur EN | FR) */
.logo-mark {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  padding: 0 5px;
  border-radius: 6px;
  background: var(--text-dark);
  color: var(--bg-surface);
  font-family: Arial, var(--font-sans), sans-serif;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}
.logo-mark::before { content: "TTW"; }
.site-header .header-actions { margin-left: auto; gap: var(--spacing-sm); }
.site-header .back-link { font-size: 0.875rem; font-weight: 500; }
.site-header .lang-switcher {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
}
.site-header .lang-switcher:hover { background: transparent; border-color: var(--border); }
.lang-btn {
  min-width: 44px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-light);
  text-decoration: none;
}
.lang-btn:hover { color: var(--text-dark); }
.lang-btn.active { background: var(--text-dark); color: var(--bg-surface); }
.site-header .theme-toggle {
  min-width: 44px;
  min-height: 44px;
  justify-content: center;
  padding: 0 12px;
  background: transparent;
  border-radius: var(--radius-control);
  color: var(--text-dark);
}
.site-header .theme-toggle:hover { background: transparent; border-color: var(--border-dark); }
.site-header .theme-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 600px) {
  .site-header .back-link { display: none; }   /* le menu ☰ et le logo mènent déjà aux outils */
}
@media (max-width: 1023px) {
  body.has-sidebar header.site-header .logo { margin-left: 50px; }
}

/* Bouton ☰ du menu (mobile) : même style que les autres boutons de l'en-tête */
.mobile-menu-toggle {
  top: 8px;
  width: 44px;
  height: 44px;
  padding: 0;
  background: var(--bg-surface);
  color: var(--text-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  box-shadow: none;
  font-size: 20px;
  line-height: 1;
}
.dark .mobile-menu-toggle { background: var(--bg-body); }
.mobile-menu-toggle:hover { background: var(--bg-surface-hover); transform: none; border-color: var(--border-dark); }

/* --- Mise en page avec menu latéral (comme le catalogue de l'accueil) ---
   Un bloc centré : le menu est une colonne à gauche qui reste visible au défilement,
   l'outil occupe le reste. En dessous de 1024 px : menu en panneau (bouton ☰). */
:root { --side-w: 248px; --header-h: 61px; --layout-max: 1440px; }

header.site-header { position: sticky; top: 0; z-index: 1000; }
body.has-sidebar .site-header .container { max-width: var(--layout-max); padding: 0 24px; }

.tool-layout { max-width: var(--layout-max); margin: 0 auto; }
.tool-content { min-width: 0; }

@media (min-width: 1024px) {
  .tool-layout {
    display: grid;
    grid-template-columns: var(--side-w) minmax(0, 1fr);
    gap: 32px;
    align-items: start;
    padding: 0 24px;
  }
}

/* --- Menu latéral (même dessin que l'index des catégories de l'accueil) --- */
.side-navigation {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  max-height: calc(100vh - var(--header-h) - 32px);
  max-height: calc(100dvh - var(--header-h) - 32px);
  margin-top: 24px;
  padding: 0 4px 16px 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border-dark) transparent;
}
.side-cats,
.side-tools { list-style: none; margin: 0; padding: 0; }
.side-cats > li + li { margin-top: 2px; }

.side-cats summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 4px 10px 4px 4px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  color: var(--text-dark);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.side-cats summary::-webkit-details-marker { display: none; }
.side-cats summary:hover { background: var(--bg-surface); border-color: var(--border); }
.side-cats details[open] > summary { background: var(--bg-surface); border-color: var(--cat); }

.cat-emoji {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--bg-lighter);
  background: color-mix(in srgb, var(--cat, #888) 14%, transparent);
  font-size: 1rem;
  line-height: 1;
}
.dark .cat-emoji { background: color-mix(in srgb, var(--cat, #888) 22%, transparent); }
.side-cat-name { flex: 1; min-width: 0; }
.cat-n {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-light);
  font-variant-numeric: tabular-nums;
}

.side-tools { margin: 4px 0 8px 20px; padding-left: 12px; border-left: 2px solid color-mix(in srgb, var(--cat, #888) 35%, transparent); }
.side-tools a {
  display: block;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--text-light);
  font-size: 0.875rem;
  line-height: 1.35;
  text-decoration: none;
}
.side-tools a:hover { color: var(--text-dark); background: var(--bg-surface); }
.side-tools a.is-current {
  color: var(--text-dark);
  font-weight: 650;
  background: var(--bg-surface);
  box-shadow: inset 3px 0 0 var(--cat, var(--link));
}

/* Mobile : le menu devient un panneau coulissant (bouton ☰, voir site.js) */
.menu-overlay { display: none; }
@media (max-width: 1023px) {
  .side-navigation {
    position: fixed;
    left: 0;
    margin: 0;
    max-height: none;
    padding: 16px 12px 32px;
    top: 0;
    z-index: 1003;
    width: min(320px, 86vw);
    height: 100vh;
    height: 100dvh;
    padding-top: 16px;
    background: var(--bg-surface);
    box-shadow: var(--shadow-lg);
    transform: translateX(-105%);
    visibility: hidden;
    transition: transform var(--transition-slow), visibility 0s linear 0.3s;
  }
  .side-navigation.mobile-open { transform: none; visibility: visible; transition: transform var(--transition-slow); }
  .dark .side-navigation { background: var(--bg-surface); }
  .menu-overlay.active { display: block; position: fixed; inset: 0; z-index: 1002; background: rgba(0, 0, 0, 0.5); }
  .mobile-menu-toggle { display: block; position: fixed; left: 12px; z-index: 1001; }
}
@media (min-width: 1024px) {
  .mobile-menu-toggle { display: none; }
}

/* --- Fil d'Ariane (au-dessus du titre de l'outil) --- */
.breadcrumb { padding: 20px 16px 0; }
.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px 0;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.8125rem;
  color: var(--text-light);
}
.breadcrumb li { display: inline-flex; align-items: center; min-width: 0; }
.breadcrumb li + li::before { content: "›"; margin: 0 8px; color: var(--text-lighter); }
.breadcrumb a { color: var(--text-light); text-decoration: none; }
.breadcrumb a:hover { color: var(--link); text-decoration: underline; }
.breadcrumb [aria-current="page"] { color: var(--text-dark); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
body.tool .tool-content > main { padding-top: 12px; }

/* --- Bloc « Soutenir » (généré par build.py, avant « Outils similaires ») --- */
.support-wrap { margin-top: 8px; }
.support-wrap .support-section { margin-bottom: 0; }

/* --- Cartes outils (« Outils similaires ») : identiques à l'accueil --- */
.related-tools { margin: var(--spacing-xl) 0 0; }
.related-tools .container { max-width: 900px; }
.related-tools h2 { font-size: 1.25rem; font-weight: 750; letter-spacing: -0.02em; color: var(--text-dark); margin-bottom: var(--spacing-md); }

.tools-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.tool-card { position: relative; min-width: 0; }
.tool-card > a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  height: 100%;
  min-height: 56px;
  padding: 11px 44px 11px 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--cat, var(--border-dark));
  border-radius: 10px;
  background: var(--bg-surface);
  color: var(--text-dark);
  text-decoration: none;
}
.tool-card > a:hover { border-color: var(--cat, var(--border-dark)); }
.tool-card > a:hover strong { color: var(--link); }
.tool-card strong { font-size: 0.9375rem; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.tool-card span {
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--text-light);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
@media (max-width: 559px) {
  .tool-card span { display: none; }
  .tool-card > a { justify-content: center; padding: 10px 40px 10px 12px; }
  .tool-card strong { font-size: 0.875rem; }
}

/* Étoile favori (mêmes favoris que l'accueil : site.js) */
.favorite-btn {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #8a94a6;
  cursor: pointer;
}
.favorite-btn::before {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  margin: auto;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M12 2.8l2.8 5.8 6.3.9-4.6 4.4 1.1 6.3L12 17.2l-5.6 3 1.1-6.3L2.9 9.5l6.3-.9z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M12 2.8l2.8 5.8 6.3.9-4.6 4.4 1.1 6.3L12 17.2l-5.6 3 1.1-6.3L2.9 9.5l6.3-.9z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.favorite-btn:hover,
.favorite-btn[aria-pressed="true"] { color: var(--star); }
.favorite-btn[aria-pressed="true"]::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.8l2.8 5.8 6.3.9-4.6 4.4 1.1 6.3L12 17.2l-5.6 3 1.1-6.3L2.9 9.5l6.3-.9z'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.8l2.8 5.8 6.3.9-4.6 4.4 1.1 6.3L12 17.2l-5.6 3 1.1-6.3L2.9 9.5l6.3-.9z'/%3E%3C/svg%3E");
}
.dark .favorite-btn { color: #71717a; }
.dark .favorite-btn:hover,
.dark .favorite-btn[aria-pressed="true"] { color: var(--star); }

/* --- Pied de page (identique à l'accueil) --- */
.site-footer {
  margin-top: 48px;
  padding: 28px 0 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  font-size: 0.875rem;
}
.dark .site-footer { background: var(--bg-body); }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer p { margin: 0; }
.footer-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; margin-bottom: 18px; }
.site-footer .logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-dark);
  text-decoration: none;
}
.footer-tagline { color: var(--text-light); }
.footer-nav + .footer-nav { margin-top: 12px; }
.footer-cats,
.footer-links { display: flex; flex-wrap: wrap; gap: 2px 18px; }
.footer-cats a,
.footer-links a,
.footer-lang {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: var(--text-dark);
  text-decoration: none;
}
.site-footer .footer-links { margin: 0; font-size: inherit; }
.site-footer .footer-links a { color: var(--text-light); text-decoration: none; }
.footer-cats a:hover,
.site-footer .footer-links a:hover,
.footer-lang:hover { color: var(--link); text-decoration: underline; }
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--text-light);
}
.footer-lang { font-weight: 600; }

/* --- Impression : ni menu, ni marge réservée, ni pied de page --- */
@media print {
  .tool-layout { display: block; padding: 0; max-width: none; }
  #side-menu, .mobile-menu-toggle, .menu-overlay, .site-footer, .related-tools { display: none !important; }
}
