/* Clipscrit, socle commun : jetons, typographie, navigation, pied de page, composants.
   Règle de sens : contour plein = vient de TikTok ; contour pointillé = se passe sur ton appareil. */

@font-face { font-family: "Geist"; src: url("/fonts/geist-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Geist"; src: url("/fonts/geist-latin-wght-italic.woff2") format("woff2"); font-weight: 100 900; font-style: italic; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/fonts/geist-mono-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #f3f4f6;
  --surface: #fcfcfd;
  --shell: rgba(20, 22, 30, .035);
  --sunken: #ebedf1;
  --fg: #15161a;
  --muted: #5c606b;
  --line: rgba(20, 22, 30, .09);
  --line-strong: rgba(20, 22, 30, .18);
  --accent: #3d5bdb;
  --accent-fg: #fcfcfd;
  --accent-soft: rgba(61, 91, 219, .1);
  --accent-line: rgba(61, 91, 219, .32);
  --mark: rgba(61, 91, 219, .2);
  --chart-1: #3d5bdb;   /* sous-titres TikTok */
  --chart-2: #c9792c;   /* transcrit sur l’appareil */
  --error: #b42318;
  --error-strong: #8f1d14;
  --error-soft: #fdf3f2;
  --ok: #24724a;
  --nav-bg: rgba(252, 252, 253, .74);
  --shadow-sm: 0 1px 2px rgba(20, 24, 40, .05);
  --shadow: 0 1px 2px rgba(20, 24, 40, .04), 0 12px 32px -16px rgba(30, 40, 90, .2);
  --shadow-lg: 0 1px 2px rgba(20, 24, 40, .05), 0 28px 64px -28px rgba(30, 40, 90, .34);
  --inset: inset 0 1px 0 rgba(255, 255, 255, .7);

  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  /* Courbes fortes (Emil Kowalski) : jamais d’ease-in sur l’interface */
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --ease-in-out: cubic-bezier(.77, 0, .175, 1);
  --ease-drawer: cubic-bezier(.32, .72, 0, 1);
  --t-press: 140ms;
  --t-ui: 200ms;

  /* Rayons concentriques : coque 22, cœur 16 (22 − 6 de marge), contrôles 12, petits 8 */
  --r-shell: 22px;
  --r-core: 16px;
  --r-ctl: 12px;
  --r-sm: 8px;
  --nav-h: 64px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0f12; --surface: #16171b; --shell: rgba(255, 255, 255, .035); --sunken: #1e1f24;
  --fg: #ececef; --muted: #a2a5ae; --line: rgba(255, 255, 255, .08); --line-strong: rgba(255, 255, 255, .17);
  --accent: #8099ff; --accent-fg: #0e0f12; --accent-soft: rgba(128, 153, 255, .13); --accent-line: rgba(128, 153, 255, .36); --mark: rgba(128, 153, 255, .28);
  --chart-1: #6f86f2; --chart-2: #b87a3c;
  --error: #ff8a7a; --error-strong: #ffb4a9; --error-soft: rgba(255, 138, 122, .1); --ok: #6fcf97;
  --nav-bg: rgba(22, 23, 27, .72);
  --shadow-sm: 0 1px 0 rgba(255, 255, 255, .03) inset;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 16px 40px -20px rgba(0, 0, 0, .8);
  --shadow-lg: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 30px 70px -30px rgba(0, 0, 0, .9);
  --inset: inset 0 1px 0 rgba(255, 255, 255, .04);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e0f12; --surface: #16171b; --shell: rgba(255, 255, 255, .035); --sunken: #1e1f24;
    --fg: #ececef; --muted: #a2a5ae; --line: rgba(255, 255, 255, .08); --line-strong: rgba(255, 255, 255, .17);
    --accent: #8099ff; --accent-fg: #0e0f12; --accent-soft: rgba(128, 153, 255, .13); --accent-line: rgba(128, 153, 255, .36); --mark: rgba(128, 153, 255, .28);
    --chart-1: #6f86f2; --chart-2: #b87a3c;
    --error: #ff8a7a; --error-strong: #ffb4a9; --error-soft: rgba(255, 138, 122, .1); --ok: #6fcf97;
    --nav-bg: rgba(22, 23, 27, .72);
    --shadow-sm: 0 1px 0 rgba(255, 255, 255, .03) inset;
    --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 16px 40px -20px rgba(0, 0, 0, .8);
    --shadow-lg: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 30px 70px -30px rgba(0, 0, 0, .9);
    --inset: inset 0 1px 0 rgba(255, 255, 255, .04);
  }
}

/* ---------- Base */
* { box-sizing: border-box; }
html, body { margin: 0; }
html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 32px);
}
@media (pointer: fine) { html { overscroll-behavior: none; } }
body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  padding-top: calc(var(--nav-h) + 28px);
}
/* Lumière ambiante très douce, sur un calque fixe (jamais sur un conteneur qui défile) */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: 80vh;
  pointer-events: none;
  z-index: -1;
  background: radial-gradient(55% 60% at 75% 0%, var(--accent-soft), transparent 70%);
}
::selection { background: var(--mark); color: var(--fg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
[hidden] { display: none !important; }
svg.i { width: 16px; height: 16px; flex: none; fill: currentColor; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
img { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
button, select, input, textarea { font: inherit; color: inherit; }
input, select, textarea { font-size: max(16px, 1em); } /* pas de zoom iOS au focus */
button { cursor: pointer; border: 0; background: none; touch-action: manipulation; }
button, a, [role="button"], .no-select { -webkit-user-select: none; user-select: none; }

/* Bilingue : les blocs data-lang suivent la langue de la page */
html[lang="fr"] [data-lang="en"], html[lang="en"] [data-lang="fr"] { display: none !important; }

.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 32px; }
.skip { position: fixed; left: 16px; top: -60px; z-index: 40; padding: 10px 14px; background: var(--fg); color: var(--bg); border-radius: var(--r-ctl); transition: transform var(--t-ui) var(--ease-out); }
.skip:focus-visible { transform: translateY(76px); }

/* ---------- Navigation : îlot flottant translucide */
.nav {
  position: fixed;
  z-index: 30;
  top: 12px;
  left: 50%;
  translate: -50% 0;
  width: min(1200px - 32px, calc(100% - 24px));
  min-height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 10px 8px 18px;
  background: var(--nav-bg);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow), var(--inset);
  backdrop-filter: blur(18px) saturate(170%);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
}
@media (prefers-reduced-transparency: reduce) { .nav { background: var(--surface); backdrop-filter: none; } }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--fg); text-decoration: none; font-weight: 600; letter-spacing: -.02em; font-size: 17px; }
.brand-mark { display: flex; align-items: center; gap: 2px; height: 22px; padding: 0 4px; border-radius: 7px; background: var(--fg); }
.brand-mark i { display: block; width: 2.5px; border-radius: 2px; background: var(--bg); }
.brand-mark i:nth-child(1) { height: 7px; }
.brand-mark i:nth-child(2) { height: 13px; }
.brand-mark i:nth-child(3) { height: 9px; background: var(--accent); }
.brand-mark i:nth-child(4) { height: 15px; background: var(--accent); }
.brand-mark i:nth-child(5) { height: 6px; }
.nav-links { display: flex; align-items: center; gap: 2px; margin: 0 auto; padding: 0; list-style: none; }
.nav-links a {
  display: inline-flex; align-items: center; gap: 7px;
  height: 40px; padding: 0 14px;
  border-radius: var(--r-ctl);
  color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500;
  transition: color var(--t-ui) ease, background-color var(--t-ui) ease;
}
.nav-links a .i { width: 15px; height: 15px; }
.nav-links a[aria-current="page"] { color: var(--fg); background: var(--sunken); }
@media (hover: hover) and (pointer: fine) { .nav-links a:hover { color: var(--fg); } }
.nav-tools { display: flex; align-items: center; gap: 6px; }
/* Cinq liens : sous 1100 px les icônes s’effacent pour garder la barre sur une ligne */
@media (max-width: 1100px) {
  .nav { gap: 10px; }
  .nav-links a { padding: 0 10px; }
  .nav-links a .i { display: none; }
}

.seg { display: inline-flex; padding: 3px; border-radius: var(--r-ctl); background: var(--sunken); border: 1px solid var(--line); }
.seg button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 34px; height: 32px; padding: 0 10px;
  font-size: 13px; color: var(--muted); border-radius: 9px; white-space: nowrap;
  transition: color var(--t-ui) ease, background-color var(--t-ui) ease, transform var(--t-press) var(--ease-out);
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: var(--shadow-sm), 0 1px 3px rgba(20, 24, 40, .1); }
.seg button:active { transform: scale(.96); }
@media (hover: hover) and (pointer: fine) { .seg button:hover { color: var(--fg); } }
.seg .i { width: 15px; height: 15px; }
.seg--mono button { font: 500 13px var(--mono); }
.seg--icons button { padding: 0; width: 34px; }

/* ---------- Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 16px;
  font-size: 14px; font-weight: 500; color: var(--fg);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-ctl);
  white-space: nowrap; text-decoration: none;
  transition: transform var(--t-press) var(--ease-out), background-color var(--t-ui) ease, border-color var(--t-ui) ease, color var(--t-ui) ease;
}
.btn .i { width: 16px; height: 16px; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
@media (hover: hover) and (pointer: fine) { .btn:hover:not(:disabled) { border-color: var(--fg); } }
.btn--ink { background: var(--fg); color: var(--bg); border-color: var(--fg); }
@media (hover: hover) and (pointer: fine) { .btn--ink:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); } }
.btn--ghost { background: transparent; border-color: transparent; color: var(--muted); }
@media (hover: hover) and (pointer: fine) { .btn--ghost:hover:not(:disabled) { color: var(--fg); background: var(--sunken); border-color: transparent; } }
.btn.done { color: var(--ok); }
/* Icône nichée dans le bouton (bouton dans le bouton) */
.btn .nest { display: grid; place-items: center; width: 28px; height: 28px; margin-right: -8px; border-radius: 9px; background: color-mix(in srgb, currentColor 14%, transparent); transition: transform var(--t-ui) var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .btn:hover .nest { transform: translateX(2px); } }

/* ---------- Double cadre : coque extérieure + cœur */
.bezel { padding: 6px; border-radius: var(--r-shell); background: var(--shell); border: 1px solid var(--line); }
.core { border-radius: var(--r-core); background: var(--surface); box-shadow: var(--shadow), var(--inset); }

/* ---------- Puces, clavier, code */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; border-radius: 7px; background: var(--sunken); font: 12px var(--mono); color: var(--fg); white-space: nowrap; }
.chip .i { width: 13px; height: 13px; }
kbd { display: inline-block; padding: 1px 6px; font: 12px var(--mono); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; background: var(--surface); }
code { font: .9em var(--mono); padding: .1em .35em; border-radius: 6px; background: var(--sunken); }
.codeblock { position: relative; margin: 16px 0; border-radius: var(--r-core); background: #111216; color: #e7e8ec; border: 1px solid rgba(255, 255, 255, .06); overflow: hidden; }
:root[data-theme="dark"] .codeblock { background: #0b0c0f; }
.codeblock .bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 16px; border-bottom: 1px solid rgba(255, 255, 255, .07); font: 12px var(--mono); color: #9ea1ab; }
.codeblock pre { margin: 0; padding: 16px; overflow-x: auto; font: 13px/1.65 var(--mono); }
.codeblock code { padding: 0; background: none; color: inherit; font: inherit; }
.codeblock .copy { height: 30px; padding: 0 10px; font-size: 12px; color: #c9cbd2; border-radius: 8px; display: inline-flex; align-items: center; gap: 6px; transition: background-color var(--t-ui) ease, transform var(--t-press) var(--ease-out); }
.codeblock .copy:active { transform: scale(.96); }
@media (hover: hover) and (pointer: fine) { .codeblock .copy:hover { background: rgba(255, 255, 255, .08); } }
.codeblock .copy .i { width: 13px; height: 13px; }
.tok-k { color: #9fb2ff; } .tok-s { color: #e3b27c; } .tok-c { color: #6e7280; }

/* ---------- Pied de page */
.foot { margin-top: auto; padding: 40px 0 36px; font-size: 14px; color: var(--muted); }
.foot .wrap > div { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; padding-top: 24px; border-top: 1px solid var(--line); }
.foot nav { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.foot a { color: var(--muted); text-decoration: none; }
@media (hover: hover) and (pointer: fine) { .foot a:hover { color: var(--fg); } }

/* ---------- Onde sonore (signature) */
.wave { display: flex; align-items: center; gap: 3px; height: 34px; }
.wave span { width: 4px; height: var(--h); border-radius: 2px; background: var(--accent); opacity: .55; transform-origin: center; animation: wave 1.6s var(--ease-in-out) infinite; animation-delay: calc(var(--n) * -90ms); }
@keyframes wave { 50% { transform: scaleY(.45); opacity: .3; } }

/* ---------- Les deux chemins (carte « Sinon » conservée telle quelle) */
.paths { display: flex; gap: 12px; flex-wrap: wrap; }
.path { flex: 1 1 210px; display: flex; flex-direction: column; gap: 8px; padding: 18px; border-radius: 12px; background: var(--surface); }
.path--yes { border: 1.5px solid var(--accent); }
.path--no { border: 1.5px dashed var(--line-strong); }
.path .tag { font: 500 12px var(--mono); color: var(--muted); }
.path--yes .tag { color: var(--accent); }
.path .t { margin: 0; font-weight: 600; letter-spacing: -.01em; line-height: 1.35; }
.path .d { margin: 0; font-size: 14px; color: var(--muted); }
.path .chip { align-self: flex-start; margin-top: auto; }

/* ---------- Cookies : carte carrée en bas à droite (zone la moins chargée des pages) */
.cookie-card {
  position: fixed;
  z-index: 40;
  right: max(24px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  width: 280px;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  border-radius: var(--r-shell);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg), var(--inset), 0 0 0 6px var(--shell);
  opacity: 0;
  transform: translateY(16px) scale(.98);
  transform-origin: bottom right;
  transition: opacity 180ms ease, transform 180ms var(--ease-out);
}
.cookie-card.in { opacity: 1; transform: none; transition-duration: 260ms; }
.cc-head { display: flex; align-items: center; gap: 10px; }
.cc-head .i { width: 24px; height: 24px; color: var(--accent); }
.cc-title { margin: 0; font-size: 1.1rem; font-weight: 600; letter-spacing: -.02em; }
.cc-text { margin: 0; font-size: 13.5px; line-height: 1.5; text-wrap: pretty; }
.cc-muted { color: var(--muted); }
.cc-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: auto; }
.cc-actions .btn { height: 42px; padding: 0 10px; font-size: 14px; white-space: nowrap; }
.cc-link { align-self: center; margin: -4px 0 -6px; padding: 4px 8px; font-size: 13px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; border-radius: var(--r-sm); }
@media (hover: hover) and (pointer: fine) { .cc-link:hover { color: var(--fg); } }
.cc-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line); }
.cc-row p { margin: 0; }
.cc-name { font-size: 14px; font-weight: 600; }
.cc-desc { font-size: 13px; color: var(--muted); line-height: 1.45; }
.cc-always { flex: none; font: 12px var(--mono); color: var(--muted); }
.cc-switch { flex: none; position: relative; width: 44px; height: 26px; border-radius: 13px; background: var(--line-strong); transition: background-color var(--t-ui) ease; }
.cc-switch span { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(20, 24, 40, .25); transition: transform var(--t-ui) var(--ease-out); }
.cc-switch[aria-checked="true"] { background: var(--accent); }
.cc-switch[aria-checked="true"] span { transform: translateX(18px); }
.foot .cc-open { padding: 0; font: inherit; color: var(--muted); }
@media (hover: hover) and (pointer: fine) { .foot .cc-open:hover { color: var(--fg); } }
@media (max-width: 520px) {
  .cookie-card { left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); width: auto; aspect-ratio: auto; padding: 18px; }
}

/* ---------- Mobile */
@media (max-width: 760px) {
  :root { --nav-h: 108px; }
  .wrap { padding: 0 16px; }
  .nav { flex-wrap: wrap; row-gap: 6px; padding: 8px 8px 8px 14px; border-radius: 18px; top: max(8px, env(safe-area-inset-top)); }
  .nav-links { order: 3; width: 100%; margin: 0; justify-content: space-between; }
  .nav-links a { flex: 1 1 auto; justify-content: center; padding: 0 6px; height: 38px; font-size: 13px; }
  .nav-tools { margin-left: auto; }
  .seg--icons button { width: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
