/* ═══════════════════════════════════════════
   gaetanmorvan.fr — charte commune des outils
   Chargée par chaque outil de /tools/, avant ses styles propres.
   Les outils sont toujours en thème sombre.
   ═══════════════════════════════════════════ */

:root {
  color-scheme: dark;
  /* Palette du site */
  --bg: #08080d;
  --bg-2: #101019;
  --text: #f3f2ee;
  --muted: #b4b2c2;
  --muted2: #8f8da0;
  --line: rgba(255, 255, 255, .1);
  --line-2: rgba(255, 255, 255, .2);
  --a1: #8b5cf6;
  --a2: #22d3ee;
  --a3: #f472b6;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #fb7185;
  --grad: linear-gradient(100deg, var(--a1), var(--a3) 55%, var(--a2));
  /* Noms hérités des anciens gabarits d'outils, branchés sur la nouvelle palette */
  --panel: rgba(255, 255, 255, .045);
  --panel2: rgba(255, 255, 255, .08);
  --stroke: rgba(255, 255, 255, .12);
  --border: rgba(255, 255, 255, .12);
  --shine: #a78bfa;
  --gold: #a78bfa;
  --gold2: #c4b5fd;
  --amber: #fbbf24;
  --radius: 16px;
  --radius2: 22px;
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, .7);
  --max: 1120px;
  --fd: "Bricolage Grotesque", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fb: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fm: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: var(--fb);
  --mono: var(--fm);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background: var(--bg); color: var(--text);
  font-family: var(--fb); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--fd); letter-spacing: -.02em; line-height: 1.2; }
a { color: color-mix(in srgb, var(--a2) 80%, var(--text)); }
code, pre, .mono { font-family: var(--fm); }
::selection { background: var(--a1); color: #fff; }
:focus-visible { outline: 2px solid var(--a2); outline-offset: 2px; }
* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .22) transparent; }

/* ── Fond animé (mêmes halos que le site) ── */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg .grid {
  position: absolute; inset: 0; opacity: .5;
  background-image: radial-gradient(rgba(255, 255, 255, .2) 1px, transparent 1px); background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 15%, #000 20%, transparent 75%);
          mask-image: radial-gradient(ellipse 80% 60% at 50% 15%, #000 20%, transparent 75%);
}
.bg .noise { display: none; }
.bg .goldGlow, .bg .blob { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(90px); opacity: .42; }
.bg .g1 { top: -30vmax; left: -20vmax; background: radial-gradient(circle, var(--a1), transparent 62%); animation: toolDrift1 28s ease-in-out infinite alternate; }
.bg .g2 { bottom: -34vmax; right: -24vmax; opacity: .3; background: radial-gradient(circle, var(--a2), transparent 62%); animation: toolDrift2 34s ease-in-out infinite alternate; }
@keyframes toolDrift1 { to { transform: translate(12vmax, 8vmax) scale(1.12); } }
@keyframes toolDrift2 { to { transform: translate(-12vmax, -10vmax) scale(.92); } }

/* ── Barre du haut ── */
.topbar {
  position: sticky; top: 12px; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: calc(100% - 24px); max-width: var(--max); margin: 12px auto 0; padding: 8px 8px 8px 12px;
  background: color-mix(in srgb, var(--bg) 74%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--line); border-radius: 999px;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-family: var(--fd); font-weight: 700; white-space: nowrap; }
.topbar .brand img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line-2); }
.topbar .brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--grad); }
.topbar .nav { display: flex; align-items: center; gap: 4px; }
.topbar .nav a { padding: 9px 14px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 500; font-size: .9rem; white-space: nowrap; transition: background .2s, color .2s; }
.topbar .nav a:hover { background: rgba(255, 255, 255, .08); color: var(--text); }
.topbar .nav a.pill { background: var(--grad); color: #fff; font-weight: 600; }
@media (max-width: 520px) { .topbar .brand span:last-child { display: none; } }

/* Ouvert dans la fenêtre du site : la barre du haut est inutile */
html.embedded .topbar { display: none; }
html.embedded .bg .goldGlow, html.embedded .bg .blob { opacity: .28; }

/* ── Boutons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--panel); color: var(--text);
  font: 600 .92rem var(--fb); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s, background .25s, border-color .25s;
}
.btn:hover { transform: translateY(-2px); background: var(--panel2); }
.btn:active { transform: scale(.97); }
.btn.primary { border-color: transparent; color: #fff; background: var(--grad); background-size: 180% 100%; box-shadow: 0 10px 30px -12px var(--a1); }
.btn.primary:hover { box-shadow: 0 16px 36px -12px var(--a3); background: var(--grad); background-size: 180% 100%; background-position: 100% 0; }
.btn.ghost { background: transparent; }
.btn.small { padding: 9px 14px; font-size: .84rem; }
.btn.large { padding: 14px 26px; font-size: 1rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.ctaRow, .actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ── Champs de saisie (valeurs par défaut, chaque outil peut les préciser) ── */
input[type=text], input[type=search], input[type=url], input[type=email], input[type=number], input[type=password], input[type=date], input:not([type]), select, textarea {
  font: inherit; color: var(--text);
  background: rgba(0, 0, 0, .28); border: 1px solid var(--line-2); border-radius: 12px; padding: 11px 13px; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--a1); box-shadow: 0 0 0 4px color-mix(in srgb, var(--a1) 22%, transparent); }
::placeholder { color: var(--muted2); opacity: .8; }
input[type=range], input[type=checkbox], input[type=radio] { accent-color: var(--a1); }

table { border-collapse: collapse; }
hr { border: 0; border-top: 1px solid var(--line); }

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

/* ═══════════ Composants communs des outils (inc/tool.php) ═══════════ */
.toolWrap { max-width: var(--max); margin: 0 auto; padding: 22px 16px 60px; }
html.embedded .toolWrap { padding-top: 16px; }
.toolHero { padding: 6px 4px 20px; }
.toolHero h1 { margin: 0 0 8px; font-size: clamp(1.6rem, 5vw, 2.4rem); font-weight: 800; letter-spacing: -.03em; }
.toolHero p { margin: 0; color: var(--muted); max-width: 70ch; }
.tk-eyebrow { font-family: var(--fm); font-size: .7rem !important; letter-spacing: .14em; text-transform: uppercase; color: var(--muted2) !important; margin-bottom: 10px !important; }
.tk-card { padding: 20px; border-radius: var(--radius2); border: 1px solid var(--line); background: var(--panel); margin-top: 14px; }
.tk-card > h2 { margin: 0 0 14px; font-size: 1.1rem; }
.tk-card > h2 small { font: 400 .8rem var(--fb); color: var(--muted2); margin-left: 8px; letter-spacing: 0; }
.tk-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); align-items: end; }
.tk-2 { display: grid; gap: 14px; }
@media (min-width: 900px) { .tk-2 { grid-template-columns: 1fr 1fr; align-items: start; } .tk-2.tk-wide-right { grid-template-columns: .8fr 1.2fr; } }
.tk-field { display: grid; gap: 6px; font-size: .84rem; font-weight: 600; color: var(--text); }
.tk-field small { font-weight: 400; color: var(--muted2); }
.tk-field input, .tk-field select, .tk-field textarea { width: 100%; font-weight: 400; }
textarea { min-height: 140px; resize: vertical; line-height: 1.5; }
.tk-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; }
.tk-check { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 400; cursor: pointer; }
.tk-kpis { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-top: 14px; }
.tk-kpi { padding: 16px; border-radius: var(--radius); border: 1px solid var(--line); background: rgba(0, 0, 0, .22); display: grid; gap: 4px; }
.tk-kpi span { color: var(--muted2); font-size: .78rem; }
.tk-kpi b { font-family: var(--fd); font-size: 1.55rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; font-variant-numeric: tabular-nums; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; overflow-wrap: anywhere; }
.tk-kpi.plain b { background: none; color: var(--text); }
.tk-kpi small { color: var(--muted); font-size: .76rem; }
.tk-scroll { overflow-x: auto; margin-top: 12px; border-radius: 12px; border: 1px solid var(--line); }
.tk-table { width: 100%; font-size: .86rem; }
.tk-table th { text-align: left; padding: 10px 12px; font-weight: 500; font-size: .74rem; color: var(--muted2); border-bottom: 1px solid var(--line-2); white-space: nowrap; background: rgba(0, 0, 0, .25); position: sticky; top: 0; }
.tk-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tk-table tr:last-child td { border-bottom: 0; }
.tk-table .n, .tk-table th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tk-table tfoot td { font-weight: 700; background: rgba(0, 0, 0, .25); }
.tk-note { color: var(--muted2); font-size: .82rem; margin: 12px 0 0; line-height: 1.5; }
.tk-out { margin-top: 12px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 0, 0, .3); font-family: var(--fm); font-size: .84rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; min-height: 52px; }
.tk-out.prose { font-family: var(--fb); font-size: .95rem; }
.tk-drop { display: grid; place-items: center; gap: 6px; text-align: center; padding: 30px 18px; border-radius: var(--radius); border: 2px dashed var(--line-2); background: rgba(0, 0, 0, .18); color: var(--muted); cursor: pointer; transition: border-color .2s, background .2s; }
.tk-drop:hover, .tk-drop.over { border-color: var(--a1); background: color-mix(in srgb, var(--a1) 10%, transparent); }
.tk-drop strong { color: var(--text); font-size: 1rem; }
.tk-drop input { display: none; }
.tk-tag { display: inline-block; padding: 2px 9px; border-radius: 6px; font-size: .72rem; font-weight: 600; border: 1px solid currentColor; white-space: nowrap; }
.tk-tag.ok { color: var(--ok); } .tk-tag.warn { color: var(--warn); } .tk-tag.bad { color: var(--bad); } .tk-tag.info { color: var(--a2); }
.tk-list { display: grid; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.tk-list li { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 0, 0, .2); font-size: .9rem; }
.tk-list li p { margin: 0; color: var(--muted); grid-column: 2; font-size: .86rem; overflow-wrap: anywhere; }
.tk-list li strong { font-weight: 600; }
.tk-score { font-family: var(--fd); font-size: 3.4rem; font-weight: 800; letter-spacing: -.04em; line-height: 1; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tk-meter { height: 8px; border-radius: 8px; background: rgba(255, 255, 255, .1); overflow: hidden; margin-top: 8px; }
.tk-meter i { display: block; height: 100%; border-radius: 8px; background: var(--grad); transition: width .4s; }
.tk-msg { margin-top: 12px; font-weight: 600; font-size: .9rem; }
.tk-msg.err { color: var(--bad); } .tk-msg.ok { color: var(--ok); }
.tk-hide { display: none !important; }
canvas.tk-chart { width: 100% !important; max-height: 320px; margin-top: 12px; }
@media print { .topbar, .bg, .btn, .tk-drop { display: none !important; } body { background: #fff; color: #000; } .tk-card { border-color: #ccc; } }
