/* ==========================================================================
   Privacy Policy + Legal Notice (/privacy, /legal, /fr/confidentialite,
   /fr/mentions-legales) — views/partials/legal-layout.ejs.
   Loaded only on these pages, AFTER /css/style.css. Includes the print
   stylesheet (bottom): "Print / save as PDF" prints only the document.
   Motion is very light (section fade-in from style.css [data-reveal], TOC
   highlight transition) and only under .js-motion; without it all is visible.
   ========================================================================== */

/* ---- Page header ----------------------------------------------------------- */
.legal-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.4rem; margin-top: 1.5rem; font-size: 0.92rem; color: var(--muted-light); }
.legal-meta-item { display: inline-flex; align-items: center; gap: 0.4rem; }
.legal-meta-item .icon { color: var(--ember); }
.legal-print {
  display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.5rem 1rem; font-size: 0.9rem;
  border-color: rgba(250, 247, 242, 0.6); color: var(--off-white);
}
.legal-print:hover { background: var(--off-white); color: var(--charcoal); }
.legal-print[hidden] { display: none; }

/* ---- "In short" ------------------------------------------------------------ */
.legal-page { padding-top: 2.5rem; }
.legal-summary {
  background: var(--beige-soft); border-radius: var(--radius-lg); padding: 1.5rem;
  margin-bottom: 2.5rem;
}
.legal-summary-head h2 { margin: 0 0 0.25rem; }
.legal-summary-head p { margin: 0 0 1.25rem; color: var(--muted); font-size: 0.95rem; }
.legal-summary-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.85rem; }
.legal-summary-card {
  display: flex; gap: 0.85rem; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.1rem;
}
.legal-summary-card h3 { font-family: var(--font-body); font-size: 0.98rem; font-weight: 700; margin: 0 0 0.2rem; }
.legal-summary-card p { margin: 0; font-size: 0.92rem; color: var(--muted); overflow-wrap: anywhere; }
.legal-summary-card .link-arrow { margin-top: 0.4rem; font-size: 0.9rem; }
.legal-summary-icon, .legal-card-icon, .legal-callout-icon {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 12px; background: var(--charcoal); color: var(--ember);
}

/* ---- Layout: TOC + document ------------------------------------------------ */
.legal-grid { display: grid; gap: 1.5rem; }
.legal-aside { min-width: 0; }

/* TOC — phones: collapsible "On this page" (main.js closes it); desktop: sticky list */
.legal-toc { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.legal-toc-summary {
  display: flex; align-items: center; gap: 0.5rem; cursor: pointer; list-style: none;
  padding: 0.85rem 1rem; font-weight: 700;
}
.legal-toc-summary::-webkit-details-marker { display: none; }
.legal-toc-summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform 0.2s ease; }
.legal-toc[open] .legal-toc-summary::after { transform: rotate(-135deg); }
.legal-toc-summary .icon { color: var(--ember-text); }
.legal-toc nav { padding: 0 1rem 1rem; }
.legal-toc-title { display: none; }
.legal-toc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.15rem; counter-reset: none; }
.legal-toc-list a {
  display: flex; gap: 0.6rem; align-items: baseline; padding: 0.4rem 0.6rem; border-radius: 8px;
  color: var(--charcoal-80, var(--charcoal)); text-decoration: none; font-size: 0.92rem; line-height: 1.35;
  border-left: 3px solid transparent;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.legal-toc-list a:hover { background: var(--beige-soft); color: var(--charcoal); }
.legal-toc-list a[aria-current="true"] { background: var(--beige-soft); border-left-color: var(--ember); color: var(--charcoal); font-weight: 600; }
.legal-toc-num { flex: none; min-width: 1.4em; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ember-text); }
.legal-top { display: inline-flex; align-items: center; gap: 0.3rem; margin-top: 0.75rem; padding-left: 0.6rem; font-size: 0.85rem; color: var(--muted); }

/* ---- Document -------------------------------------------------------------- */
.legal-doc { min-width: 0; max-width: 72ch; overflow-wrap: anywhere; }
.legal-section { scroll-margin-top: calc(var(--header-h) + 1.5rem); }
.legal-section + .legal-section { margin-top: 2.5rem; padding-top: 2.25rem; border-top: 1px solid var(--line); }
.legal-section p, .legal-list { line-height: 1.7; }
.legal-section-title { display: flex; align-items: baseline; gap: 0.7rem; font-size: clamp(1.3rem, 3vw, 1.6rem); margin-bottom: 0.9rem; }
.legal-num {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  min-width: 2rem; height: 2rem; padding: 0 0.4rem; border-radius: 9px; transform: translateY(-0.15rem);
  background: var(--charcoal); color: var(--ember); font-family: var(--font-body); font-size: 0.95rem; font-weight: 700;
}
/* Copy-link anchor: shows on hover / focus of the heading (always on touch screens) */
.legal-anchor {
  position: relative; flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px; color: var(--muted); align-self: center;
  opacity: 0; transition: opacity 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}
.legal-section-title:hover .legal-anchor, .legal-anchor:focus-visible, .legal-anchor.is-copied { opacity: 1; }
.legal-anchor:hover, .legal-anchor:focus-visible { background: var(--beige-soft); color: var(--ember-text); }
@media (hover: none) { .legal-anchor { opacity: 0.6; } }
.legal-anchor-done {
  position: absolute; left: 100%; top: 50%; transform: translateY(-50%); margin-left: 0.4rem; white-space: nowrap;
  padding: 0.15rem 0.5rem; border-radius: 6px; background: var(--charcoal); color: var(--off-white);
  font-family: var(--font-body); font-size: 0.75rem; font-weight: 600;
}
.legal-anchor-done[hidden] { display: none; }
.legal-list { padding-left: 1.25rem; margin: 0.75rem 0 1rem; }
.legal-list li + li { margin-top: 0.45rem; }
.legal-list li::marker { color: var(--ember-text); }

/* Callouts ("We never sell your data", "No cookies"…) */
.legal-callout {
  display: flex; gap: 0.9rem; align-items: flex-start; margin: 1.25rem 0 0.5rem;
  padding: 1rem 1.15rem; border-radius: 14px;
  background: #fff6ee; border: 1px solid rgba(232, 116, 42, 0.35); border-left: 4px solid var(--ember);
}
.legal-callout p { margin: 0; line-height: 1.6; }
.legal-callout .legal-callout-title { font-weight: 700; margin-bottom: 0.15rem; }
.legal-callout-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--ember); color: var(--charcoal); }
.legal-callout--note { background: var(--beige-soft); border-color: var(--line); border-left-color: var(--charcoal); }
.legal-callout--note .legal-callout-icon { background: var(--charcoal); color: var(--ember); }

/* Cards: identity / hosting / privacy contact */
.legal-card {
  display: grid; gap: 1rem; align-items: start; margin: 1rem 0;
  padding: 1.25rem; border: 1px solid var(--line); border-radius: 16px; background: var(--surface);
  box-shadow: var(--shadow);
}
.legal-fields { margin: 0; display: grid; gap: 0.7rem; }
.legal-fields div { display: grid; gap: 0.1rem; }
.legal-fields dt { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.legal-fields dd { margin: 0; font-weight: 500; }
.legal-card--contact { background: var(--charcoal); color: var(--off-white); border-color: transparent; }
.legal-card--contact .legal-card-icon { background: var(--ember); color: var(--charcoal); }
.legal-contact-body h3 { color: var(--off-white); font-size: 1.15rem; margin: 0 0 0.35rem; }
.legal-contact-body p { margin: 0 0 0.25rem; }
.legal-contact-name { font-weight: 600; }
.legal-contact-email { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--muted-light); }
.legal-contact-email .icon { color: var(--ember); }
.legal-section .legal-contact-note { color: var(--muted-light); font-size: 0.88rem; line-height: 1.5; margin-top: 0.5rem; }
.legal-contact-btn { justify-self: start; }

/* Your rights */
.legal-rights { list-style: none; margin: 1rem 0; padding: 0; display: grid; gap: 0.85rem; }
.legal-right { padding: 1.1rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); display: grid; gap: 0.35rem; align-content: start; }
.legal-right .legal-card-icon { width: 36px; height: 36px; border-radius: 10px; margin-bottom: 0.25rem; }
.legal-right h3 { font-family: var(--font-body); font-size: 1rem; font-weight: 700; margin: 0; }
.legal-section .legal-right p { margin: 0; font-size: 0.92rem; line-height: 1.55; }
.legal-section .legal-right-how { display: flex; gap: 0.35rem; align-items: flex-start; font-size: 0.86rem; color: var(--ember-text); font-weight: 600; }
.legal-right-how .icon { flex: none; margin-top: 0.2rem; }

/* ==========================================================================
   Breakpoints (mobile-first)
   ========================================================================== */
@media (min-width: 600px) {
  .legal-summary { padding: 2rem; }
  .legal-summary-grid { grid-template-columns: repeat(2, 1fr); }
  .legal-rights { grid-template-columns: repeat(2, 1fr); }
  .legal-card { grid-template-columns: auto 1fr; }
  .legal-card--contact { grid-template-columns: auto 1fr auto; align-items: center; }
  .legal-contact-btn { justify-self: end; }
  .legal-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem 1.5rem; }
}
@media (min-width: 900px) {
  .legal-summary-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1024px) {
  .legal-grid { grid-template-columns: 270px minmax(0, 1fr); gap: 3.5rem; align-items: start; }
  .legal-aside { position: sticky; top: calc(var(--header-h) + 1.25rem); max-height: calc(100vh - var(--header-h) - 2.5rem); overflow-y: auto; }
  .legal-toc { border: 0; background: transparent; }
  .legal-toc-summary { display: none; }
  .legal-toc nav { padding: 0; }
  .legal-toc-title { display: block; margin: 0 0 0.6rem 0.6rem; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
  .legal-rights { grid-template-columns: repeat(3, 1fr); }
  .legal-card--contact { grid-template-columns: auto 1fr; }
  .legal-contact-btn { grid-column: 2; justify-self: start; }
}

/* ==========================================================================
   Print / save as PDF: the document only (no header, footer, buttons, TOC)
   ========================================================================== */
@media print {
  .site-header, .site-footer, .whatsapp-float, .skip-link, .legal-print, .legal-aside, .legal-anchor, .legal-contact-btn { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .page-header.legal-header { background: none; color: #000; padding: 0 0 12pt; border-bottom: 1px solid #999; }
  .legal-header h1, .legal-header .lead, .legal-meta { color: #000; }
  .legal-page { padding: 12pt 0 0; }
  .legal-grid { display: block; }
  .legal-doc { max-width: none; }
  .legal-summary { background: none; border: 1px solid #999; padding: 10pt; break-inside: avoid; }
  .legal-summary-grid { grid-template-columns: repeat(2, 1fr); gap: 6pt; }
  .legal-summary-card, .legal-right, .legal-card, .legal-callout { box-shadow: none; background: none; border: 1px solid #bbb; break-inside: avoid; }
  .legal-card--contact, .legal-contact-body h3, .legal-contact-email, .legal-section .legal-contact-note { color: #000; }
  .legal-summary-icon, .legal-card-icon, .legal-callout-icon, .legal-num { background: none; color: #000; border: 1px solid #999; }
  .legal-section-title { break-after: avoid; }
  /* Reveal animations: everything printed, even sections not yet scrolled to */
  [data-reveal] { opacity: 1 !important; transform: none !important; }
  a { color: #000; }
}
