/* ==========================================================================
   ENCRAGE — policedécrituree.com
   Feuille de style unique du site (design verrouillé, dérivé du prototype)
   Sections : 1.Variables  2.Reset  3.Layout  4.Composants  5.Utilitaires  6.Responsive
   ========================================================================== */

/* ==== 1. VARIABLES ===================================================== */
:root {
  /* Couleurs — thème clair */
  --bg: #F7FAF7;
  --bg-elevated: rgba(255, 255, 255, 0.85);
  --surface: #FFFFFF;
  --input-bg: #FCFDFC;
  --text: #1B2B22;
  --text-muted: #5C6E63;
  --border: #DCE5DE;
  --accent: #1F7A52;
  --accent-soft: #DCF2E4;
  --accent-contrast: #FCFDFC;
  --shadow-sm: 0 1px 2px rgba(27, 43, 34, 0.06);
  --shadow-md: 0 1px 2px rgba(27, 43, 34, 0.06), 0 8px 24px rgba(27, 43, 34, 0.08);
  --shadow-card-hover: 0 4px 12px var(--accent-soft);

  /* Typographie */
  --font-display: 'Newsreader', Georgia, serif;
  --font-body: 'Manrope', system-ui, -apple-system, sans-serif;
  --fs-xs: 12px;  --fs-sm: 13px;  --fs-base: 15px;  --fs-md: 16px;
  --fs-lg: 19px;  --fs-xl: 24px;
  --fs-2xl: clamp(1.8rem, 2.5vw, 2.4rem);
  --fs-hero: clamp(2.25rem, 4.5vw + 1rem, 4rem);
  --lh-tight: 1.05; --lh-heading: 1.3; --lh-body: 1.6; --lh-relaxed: 1.7;
  --ls-tight: -0.02em; --ls-heading: -0.01em; --ls-caps: 0.06em;

  /* Espacement — seules valeurs autorisées */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px;
  --sp-6: 32px; --sp-7: 48px; --sp-8: 64px; --sp-9: 96px;

  /* Rayons */
  --radius-sm: 6px; --radius-md: 10px; --radius-lg: 16px;
  --radius-xl: 20px; --radius-pill: 999px;

  /* Transitions */
  --transition: 0.2s ease;
}

[data-theme="dark"] {
  --bg: #14201F;
  --bg-elevated: rgba(26, 40, 39, 0.85);
  --surface: #1A2827;
  --input-bg: #1D2C2B;
  --text: #EFF5F0;
  --text-muted: #9FB2A6;
  --border: #35494A;
  --accent: #5FD0A0;
  --accent-soft: #1E4636;
  --accent-contrast: #0F231C;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* ==== 2. RESET ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}
img { max-width: 100%; display: block; }
h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul[class], ol[class] { padding: 0; list-style: none; }
button {
  font-family: var(--font-body);
  cursor: pointer;
  color: inherit;
}
textarea, input { font-family: var(--font-body); color: var(--text); }
::selection { background: var(--accent-soft); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--text); }

/* Accessibilité : focus visible + lien d'évitement */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  padding: var(--sp-3) var(--sp-4);
  background: var(--accent); color: var(--accent-contrast);
  border-radius: 0 0 var(--radius-md) 0; font-weight: 700;
}
.skip-link:focus { left: 0; color: var(--accent-contrast); }

/* ==== 3. LAYOUT ======================================================== */
.wrap-narrow { max-width: 1120px; margin: 0 auto; }
.wrap-wide { max-width: 1280px; margin: 0 auto; }

/* ==== 4. COMPOSANTS ==================================================== */

/* ---- Header ---- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-5);
  padding: var(--sp-4) clamp(20px, 5vw, 64px);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.brand {
  font-family: var(--font-display);
  font-weight: 600; font-size: var(--fs-xl);
  letter-spacing: var(--ls-heading);
  color: var(--text);
}
.brand:hover { color: var(--accent); }
.site-nav { display: flex; align-items: center; gap: clamp(16px, 3vw, 32px); }
.site-nav > a {
  font-size: var(--fs-base); font-weight: 500; color: var(--text-muted);
  min-height: 44px; display: inline-flex; align-items: center;
}
.site-nav > a:hover, .site-nav > a[aria-current="page"] { color: var(--accent); }

/* Menu déroulant « Plus » */
.nav-more { position: relative; }
.nav-more-toggle {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  background: transparent; border: 0;
  font-size: var(--fs-base); font-weight: 500; color: var(--text-muted);
  min-height: 44px; padding: 0;
}
.nav-more-toggle:hover, .nav-more-toggle[aria-expanded="true"] { color: var(--accent); }
.nav-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 230px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--sp-2);
  display: none;
}
.nav-dropdown.is-open { display: block; }
.nav-dropdown a {
  display: block;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  color: var(--text); font-size: var(--fs-base); font-weight: 500;
  border-bottom: 1px solid var(--border);
}
.nav-dropdown a:last-child { border-bottom: 0; }
.nav-dropdown a:hover, .nav-dropdown a[aria-current="page"] {
  background: var(--accent-soft); color: var(--accent);
}

/* Interrupteur de thème */
.theme-toggle {
  width: 52px; height: 30px; flex-shrink: 0;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 3px; position: relative;
  display: flex; align-items: center;
}
.theme-toggle .thumb {
  display: block; width: 22px; height: 22px;
  border-radius: 50%; background: var(--accent);
  transform: translateX(0);
  transition: transform var(--transition);
}
[data-theme="dark"] .theme-toggle .thumb { transform: translateX(22px); }

/* ---- Fil d'Ariane ---- */
.breadcrumb { padding: var(--sp-4) clamp(20px, 5vw, 64px) 0; }
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--text-muted); }
.breadcrumb li + li::before { content: "›"; margin-right: var(--sp-2); color: var(--text-muted); }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb [aria-current="page"] { color: var(--text); font-weight: 600; }

/* ---- Héros + générateur ---- */
.hero {
  padding: clamp(48px, 8vw, 96px) clamp(20px, 5vw, 64px) var(--sp-7);
}
.badge {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-4);
  border-radius: var(--radius-pill);
  background: var(--accent-soft); color: var(--accent);
  font-size: var(--fs-sm); font-weight: 600;
  margin-bottom: var(--sp-4);
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 500; font-size: var(--fs-hero);
  line-height: var(--lh-tight); letter-spacing: var(--ls-tight);
  margin-bottom: var(--sp-4);
  max-width: 16ch;
}
.hero .lead {
  font-size: clamp(16px, 1.4vw, 19px);
  color: var(--text-muted);
  max-width: 56ch; line-height: var(--lh-body);
  margin-bottom: var(--sp-6);
}
.hero .lead a {
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Carte de saisie */
.input-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: clamp(16px, 3vw, 28px);
}
.input-card label {
  display: block;
  font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: var(--ls-caps);
  margin-bottom: var(--sp-2);
}
.input-card textarea {
  width: 100%; resize: none;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--input-bg);
  font-size: clamp(18px, 2vw, 24px); font-weight: 600;
  padding: var(--sp-4);
  line-height: 1.4;
}
.input-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: var(--sp-2); gap: var(--sp-3);
}
.quick-chips { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.quick-chips button {
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--fs-xs); font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent; color: var(--accent);
  min-height: 28px;
}
.quick-chips button:hover { background: var(--accent-soft); }
.char-count { font-size: var(--fs-xs); color: var(--text-muted); }

.controls {
  display: flex; flex-wrap: wrap; gap: var(--sp-5);
  margin-top: var(--sp-4); align-items: center;
  border-top: 1px solid var(--border);
  padding-top: var(--sp-4);
}
.control-group { display: flex; align-items: center; gap: var(--sp-3); }
.control-label {
  font-size: var(--fs-xs); font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: var(--ls-caps);
}
.control-group input[type="range"] { width: 150px; accent-color: var(--accent); }
.size-value { font-size: var(--fs-sm); color: var(--text-muted); min-width: 40px; }
.swatches { display: flex; gap: var(--sp-2); }
.swatch {
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--border); padding: 0;
  background: var(--text);
}
.swatch.is-selected {
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---- Section catégories + grille ---- */
.generator {
  padding: var(--sp-2) clamp(16px, 4vw, 48px) 80px;
  display: flex; flex-wrap: wrap; align-items: flex-start;
  gap: var(--sp-4);
}

.cat-sidebar { position: sticky; top: 86px; width: 225px; flex-shrink: 0; transition: width var(--transition); }
.cat-sidebar.is-collapsed { width: 46px; }
.cat-sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-2); padding: 0 0 var(--sp-2);
}
.cat-sidebar-title {
  font-size: var(--fs-xs); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-muted);
}
.cat-collapse {
  width: 30px; height: 30px; flex-shrink: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  font-size: var(--fs-base);
  display: flex; align-items: center; justify-content: center;
}
.cat-sidebar.is-collapsed .cat-sidebar-title,
.cat-sidebar.is-collapsed .cat-nav { display: none; }
.cat-nav {
  display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto; max-height: calc(100vh - 160px);
  padding-right: var(--sp-1);
}
.cat-link {
  text-align: left; flex-shrink: 0;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent; color: var(--text);
  font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  width: 100%; min-height: 44px;
  display: inline-flex; align-items: center;
}
.cat-link:hover { background: var(--accent-soft); color: var(--accent); }
.cat-link.is-active, .cat-link[aria-current="page"] {
  border-color: var(--accent);
  background: var(--accent-soft); color: var(--accent);
}

.styles-area { flex: 1; min-width: 0; }
.styles-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--sp-3); margin-bottom: var(--sp-4); flex-wrap: wrap;
}
.styles-head h2 {
  font-family: var(--font-display);
  font-weight: 500; font-size: 1.5rem;
  letter-spacing: var(--ls-heading);
}
.show-all { font-size: 14px; font-weight: 600; }

.styles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(270px, 100%), 1fr));
  gap: var(--sp-4);
}
.style-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  display: flex; flex-direction: column; gap: 14px;
  min-height: 140px;
  transition: all var(--transition);
}
.style-card:hover { border-color: var(--accent); box-shadow: var(--shadow-card-hover); }
.style-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
}
.style-name {
  font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.style-cat {
  font-size: 11px; color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 9px; border-radius: var(--radius-pill);
  font-weight: 600; white-space: nowrap;
}
.style-output {
  flex: 1; word-break: break-word;
  padding: var(--sp-2) 0; min-height: 50px;
}
.style-output span { line-height: var(--lh-heading); }
.style-actions { display: flex; gap: var(--sp-2); align-items: stretch; }
.btn-copy {
  flex: 1;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: transparent; color: var(--text-muted);
  font-size: var(--fs-sm); font-weight: 600;
  min-height: 44px;
}
.btn-copy:hover { border-color: var(--accent); color: var(--accent); }
.btn-copy.is-copied {
  border-color: var(--accent);
  background: var(--accent-soft); color: var(--accent);
}
.btn-fav {
  padding: var(--sp-2) 13px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: transparent; color: var(--text-muted);
  font-size: var(--fs-base); line-height: 1;
  min-height: 44px; min-width: 44px;
}
.btn-fav:hover { border-color: var(--accent); color: var(--accent); }
.btn-fav.is-fav {
  border-color: var(--accent);
  background: var(--accent-soft); color: var(--accent);
}

/* ---- Section « Pourquoi » ---- */
.features {
  padding: var(--sp-8) clamp(20px, 5vw, 64px);
  border-top: 1px solid var(--border);
}
.features h2 {
  font-family: var(--font-display);
  font-weight: 500; font-size: var(--fs-2xl);
  letter-spacing: var(--ls-heading);
  margin-bottom: var(--sp-6);
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--sp-6);
}
.features h3 { font-size: 18px; font-weight: 600; margin-bottom: var(--sp-3); }
.features p { color: var(--text-muted); font-size: var(--fs-base); line-height: var(--lh-relaxed); }

/* ---- Carte auteur (E-E-A-T) ---- */
.author-section { padding: 0 clamp(20px, 5vw, 64px) var(--sp-8); }
.author-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: clamp(24px, 4vw, 48px);
  max-width: 760px;
}
.author-head { display: flex; align-items: center; gap: var(--sp-5); margin-bottom: var(--sp-5); }
.author-photo {
  width: 108px; height: 108px; border-radius: 50%;
  object-fit: cover; border: 1px solid var(--border);
  background: var(--accent-soft);
}
.author-name { font-size: var(--fs-xl); font-weight: 800; }
.author-role {
  font-size: var(--fs-sm); font-weight: 700; color: var(--accent);
  text-transform: uppercase; letter-spacing: var(--ls-caps);
  margin-top: var(--sp-1);
}
.author-bio { color: var(--text-muted); line-height: var(--lh-relaxed); margin-bottom: var(--sp-5); }
.btn-linkedin {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--accent); font-weight: 600; font-size: var(--fs-base);
  min-height: 44px;
}
.btn-linkedin:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* ---- CTA générique (pages internes) ---- */
.cta {
  text-align: left;
  padding: var(--sp-6) clamp(20px, 5vw, 64px);
}
.btn-primary {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-md);
  background: var(--accent); color: var(--accent-contrast);
  font-weight: 700; font-size: var(--fs-base);
  border: 1px solid var(--accent);
  min-height: 44px;
}
.btn-primary:hover { opacity: 0.9; color: var(--accent-contrast); }
.btn-secondary {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-md);
  background: transparent; color: var(--accent);
  font-weight: 600; font-size: var(--fs-base);
  border: 1px solid var(--border);
  min-height: 44px;
}
.btn-secondary:hover { border-color: var(--accent); }

/* ---- Contenu éditorial (pages support) ---- */
.prose {
  padding: var(--sp-7) clamp(20px, 5vw, 64px) var(--sp-8);
  max-width: 760px;
}
.prose h1 {
  font-family: var(--font-display);
  font-weight: 500; font-size: var(--fs-2xl);
  letter-spacing: var(--ls-heading);
  margin-bottom: var(--sp-5);
}
.prose h2 {
  font-family: var(--font-display);
  font-weight: 500; font-size: var(--fs-xl);
  margin: var(--sp-6) 0 var(--sp-3);
}
.prose p, .prose li { color: var(--text-muted); line-height: var(--lh-relaxed); }
.prose p + p { margin-top: var(--sp-4); }
.prose ul { padding-left: var(--sp-5); margin: var(--sp-4) 0; list-style: disc; }

/* ---- Sections de contenu (pages catégorie) ---- */
.page-section {
  padding: var(--sp-7) clamp(20px, 5vw, 64px) 0;
}
.page-section:last-of-type { padding-bottom: var(--sp-8); }
.page-section h2 {
  font-family: var(--font-display);
  font-weight: 500; font-size: var(--fs-2xl);
  letter-spacing: var(--ls-heading);
  margin-bottom: var(--sp-4);
}
.page-section h3 { font-size: 18px; font-weight: 600; margin: var(--sp-5) 0 var(--sp-3); }
.page-section > p { color: var(--text-muted); line-height: var(--lh-relaxed); max-width: 72ch; }
.page-section > p + p { margin-top: var(--sp-4); }
.style-tags { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.style-tags li {
  font-size: var(--fs-sm); font-weight: 600;
  color: var(--accent); background: var(--accent-soft);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-pill);
}

/* ---- FAQ (bloc centré) ---- */
.faq h2 { text-align: center; }
.faq details {
  margin-left: auto; margin-right: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  margin-bottom: var(--sp-3);
  max-width: 760px;
}
.faq summary {
  font-weight: 700; cursor: pointer;
  font-size: var(--fs-md);
  min-height: 44px; display: flex; align-items: center;
}
.faq details[open] { border-color: var(--accent); }
.faq details p { color: var(--text-muted); line-height: var(--lh-relaxed); margin-top: var(--sp-3); }

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--sp-6) clamp(20px, 5vw, 64px);
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: var(--sp-3);
}
.footer-brand { font-family: var(--font-display); font-weight: 600; font-size: 17px; }
.footer-note { font-size: var(--fs-sm); color: var(--text-muted); }
.footer-links {
  display: flex; flex-wrap: wrap; gap: var(--sp-4);
  width: 100%;
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
  margin-top: var(--sp-3);
}
.footer-links a { font-size: var(--fs-sm); color: var(--text-muted); min-height: 44px; display: inline-flex; align-items: center; }
.footer-links a:hover { color: var(--accent); }

/* ==== 5. UTILITAIRES =================================================== */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.hidden { display: none !important; }

/* ==== 6. RESPONSIVE ==================================================== */
@media (max-width: 768px) {
  .cat-sidebar, .cat-sidebar.is-collapsed { position: static; width: 100%; }
  .cat-nav {
    flex-direction: row; flex-wrap: wrap; gap: var(--sp-2);
    max-height: 220px; overflow-y: auto;
    padding-bottom: var(--sp-1); padding-right: 0;
  }
  .cat-link {
    width: auto;
    padding: var(--sp-2) 14px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    background: var(--surface);
  }
  .author-head { flex-direction: column; align-items: flex-start; gap: var(--sp-4); }
}
@media (max-width: 480px) {
  .site-nav { gap: var(--sp-3); }
  .controls { gap: var(--sp-4); }
  .styles-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
