/* ==========================================================
   sltcyann.dev — feuille de style unique
   Couleurs : violet (principal), bleu et rouge (accents).
   Le thème est choisi par assets/js/boot.js (attribut data-theme).
   ========================================================== */

:root {
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 14px;
  --radius-sm: 8px;
  --maxw: 1080px;
  --gutter: clamp(16px, 4vw, 32px);

  /* Thème sombre (par défaut) */
  --bg: #0d0a14;
  --bg-soft: #130f1d;
  --surface: #191425;
  --surface-2: #211a31;
  --border: #2f2645;
  --text: #ece8f5;
  --muted: #a69dbb;
  --violet: #a78bfa;
  --violet-strong: #8b5cf6;
  --blue: #60a5fa;
  --red: #f87171;
  --ok: #4ade80;
  --on-accent: #0d0a14;
  --shadow: 0 10px 30px rgb(0 0 0 / 0.35);
  --grad: linear-gradient(90deg, var(--red), var(--violet) 50%, var(--blue));
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #faf8fd;
  --bg-soft: #f3effa;
  --surface: #ffffff;
  --surface-2: #f5f1fc;
  --border: #e2d9f1;
  --text: #1b1528;
  --muted: #5c536f;
  --violet: #6d28d9;
  --violet-strong: #7c3aed;
  --blue: #1d4ed8;
  --red: #dc2626;
  --ok: #15803d;
  --on-accent: #ffffff;
  --shadow: 0 10px 30px rgb(60 30 110 / 0.10);
  color-scheme: light;
}

/* ---------- Langues : on cache la langue inactive ---------- */
html:not([data-lang="en"]) [data-l="en"],
html[data-lang="en"] [data-l="fr"] { display: none !important; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  background-image:
    radial-gradient(60rem 30rem at 85% -10%, rgb(139 92 246 / 0.16), transparent 60%),
    radial-gradient(40rem 25rem at -10% 10%, rgb(96 165 250 / 0.10), transparent 60%);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
}
main { flex: 1; }
img, svg { max-width: 100%; }
a { color: var(--violet); text-underline-offset: 3px; }
a:hover { color: var(--blue); }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
code, .mono { font-family: var(--font-mono); }
::selection { background: var(--violet-strong); color: #fff; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 100;
  background: var(--violet-strong); color: #fff; padding: 8px 14px; border-radius: var(--radius-sm);
}
.skip-link:focus { left: 8px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- En-tête & navigation ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; gap: 12px; min-height: 64px; }
.brand {
  font-family: var(--font-mono); font-weight: 700; font-size: .98rem;
  color: var(--text); text-decoration: none; white-space: nowrap; margin-right: auto;
}
.brand .at { color: var(--violet); }
.brand .path { color: var(--blue); }
.cursor {
  display: inline-block; width: .55em; height: 1.05em; margin-left: 2px;
  background: var(--violet); vertical-align: -0.15em;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.nav-links { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  display: block; padding: 8px 12px; border-radius: var(--radius-sm);
  color: var(--muted); text-decoration: none; font-weight: 500;
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.nav-links a[aria-current="page"] { color: var(--text); background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--violet); }

.nav-tools { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 40px; height: 40px; padding: 0 8px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); cursor: pointer;
  font: inherit; font-size: .85rem;
}
.icon-btn:hover { border-color: var(--violet); }
.icon-btn svg { width: 20px; height: 20px; }
.theme-btn .ico { display: none; }
.theme-btn[data-pref="system"] .ico-system,
.theme-btn[data-pref="light"] .ico-light,
.theme-btn[data-pref="dark"] .ico-dark { display: inline-flex; }

.lang-switch { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.lang-switch button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 38px; padding: 0; border: 0; cursor: pointer;
  background: var(--surface); opacity: .55;
}
.lang-switch button + button { border-left: 1px solid var(--border); }
.lang-switch button[aria-pressed="true"] { opacity: 1; background: var(--surface-2); }
.lang-switch svg { width: 22px; height: 15px; border-radius: 2px; box-shadow: 0 0 0 1px rgb(0 0 0 / .15); }

.menu-btn { display: none; }
.menu-btn .bar { display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; position: relative; }
.menu-btn .bar::before, .menu-btn .bar::after { content: ""; position: absolute; left: 0; width: 18px; height: 2px; background: currentColor; border-radius: 2px; }
.menu-btn .bar::before { top: -6px; }
.menu-btn .bar::after { top: 6px; }

@media (max-width: 820px) {
  .menu-btn { display: inline-flex; }
  .nav { flex-wrap: wrap; }
  .nav-links {
    display: none; order: 10; width: 100%; flex-direction: column;
    padding: 8px 0 14px; gap: 2px;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px; }
}
@media (max-width: 420px) {
  .brand .path, .brand .host { display: none; }
}

/* ---------- Héros (accueil) ---------- */
.hero { padding-block: clamp(56px, 12vw, 120px) clamp(40px, 8vw, 80px); }
.prompt { font-family: var(--font-mono); color: var(--muted); font-size: .95rem; margin-bottom: 14px; }
.prompt .sign { color: var(--violet); }
.hero h1 {
  font-size: clamp(2.3rem, 7.5vw, 4.6rem); letter-spacing: -0.02em; margin-bottom: 18px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .lead { font-size: clamp(1.1rem, 2.2vw, 1.3rem); color: var(--muted); max-width: 44rem; }
.hero .lead strong { color: var(--text); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 12px 20px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--violet); color: var(--text); }
.btn-primary { background: var(--violet-strong); border-color: var(--violet-strong); color: #fff; }
.btn-primary:hover { background: var(--violet); border-color: var(--violet); color: var(--on-accent); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- Sections & cartes ---------- */
.section { padding-block: clamp(36px, 7vw, 72px); }
.section-title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 26px; }
.section-title h1, .section-title h2 { margin: 0; }
.section-title .mono { color: var(--violet); font-size: .95rem; }
.page-head { padding-block: clamp(44px, 9vw, 90px) 8px; }
.page-head h1 { font-size: clamp(2rem, 5.5vw, 3.2rem); }
.page-head p { color: var(--muted); max-width: 46rem; font-size: 1.12rem; }

.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); }
.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); transition: transform .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--violet) 55%, var(--border)); }
.card h3 { display: flex; align-items: center; gap: 10px; }
.card p { color: var(--muted); }
.card .card-foot { margin-top: auto; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot.violet { background: var(--violet); } .dot.blue { background: var(--blue); } .dot.red { background: var(--red); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0 0 14px; }
.tag {
  font-family: var(--font-mono); font-size: .78rem; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
}
.tag.fork { color: var(--blue); }
.link-arrow { font-weight: 600; text-decoration: none; }
.link-arrow::after { content: " →"; }

/* ---------- À propos ---------- */
.two-col { display: grid; gap: 32px; grid-template-columns: 1.4fr 1fr; align-items: start; }
@media (max-width: 820px) { .two-col { grid-template-columns: 1fr; } }
.timeline { list-style: none; margin: 0; padding: 0 0 0 22px; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 26px; }
.timeline li::before {
  content: ""; position: absolute; left: -29px; top: 6px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--bg); border: 2px solid var(--violet);
}
.timeline .when { font-family: var(--font-mono); font-size: .85rem; color: var(--violet); }
.timeline h3 { margin: 2px 0 4px; }
.timeline p { color: var(--muted); margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.chips li { padding: 7px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }

/* ---------- Formulaires ---------- */
.form { display: grid; gap: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
.field .hint { color: var(--muted); font-weight: 400; font-size: .9rem; }
.field input, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-soft); color: var(--text);
  font: inherit;
}
.field textarea { min-height: 140px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgb(139 92 246 / .25); }
.counter { text-align: right; font-family: var(--font-mono); font-size: .8rem; color: var(--muted); margin-top: 4px; }
/* Le piège à robots : invisible pour les humains, rempli par les robots */
.hp { position: absolute !important; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.status { min-height: 1.6em; font-weight: 600; margin: 0; }
.status.ok { color: var(--ok); }
.status.err { color: var(--red); }
.notice {
  border: 1px dashed var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; color: var(--muted); background: var(--bg-soft);
}

.gb-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.gb-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.gb-item .who { font-weight: 700; }
.gb-item .when { color: var(--muted); font-size: .85rem; font-family: var(--font-mono); margin-left: 8px; }
.gb-item p { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- Pied de page ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 26px 0; color: var(--muted); font-size: .92rem; }
.site-footer .container { display: flex; flex-wrap: wrap; gap: 10px 24px; justify-content: space-between; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--violet); }

/* ---------- 404 & pages secrètes ---------- */
.big-code {
  font-family: var(--font-mono); font-weight: 800; font-size: clamp(5rem, 22vw, 11rem); line-height: 1;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  margin: 0 0 10px;
}
.whisper { font-family: var(--font-mono); color: var(--muted); opacity: .22; font-size: .8rem; letter-spacing: .3em; user-select: all; margin-top: 48px; }
.term {
  font-family: var(--font-mono); background: #0a0710; color: #d9d2ec;
  border: 1px solid #3a2d57; border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
  overflow-wrap: anywhere;
}
.term .p { color: #a78bfa; }
.term .ok { color: #4ade80; }
.term .err { color: #f87171; }
.term .dim { color: #8c84a3; }
.term form { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.term input {
  flex: 1; min-width: 0; background: transparent; border: 0; border-bottom: 1px dashed #3a2d57;
  color: #fff; font: inherit; padding: 6px 2px;
}
.term input:focus { outline: none; border-bottom-color: #a78bfa; }
.term-out p { margin: 4px 0; }
.flag { font-size: clamp(1rem, 3.4vw, 1.4rem); color: #4ade80; font-weight: 700; word-break: break-all; }
[hidden] { display: none !important; }

/* ---------- Petit toast (Konami hors 404) ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  max-width: calc(100% - 32px); z-index: 200;
  background: var(--surface); color: var(--text); border: 1px solid var(--violet);
  border-radius: var(--radius); padding: 12px 18px; box-shadow: var(--shadow);
  font-family: var(--font-mono); font-size: .92rem;
}
.party { animation: party 2.4s linear 1; }
@keyframes party { from { filter: hue-rotate(0deg); } to { filter: hue-rotate(360deg); } }
.term + p { margin-top: 20px; }
.copy-btn { margin-top: 10px; padding: 8px 16px; font-size: .9rem; }
.win { margin-top: 24px; }
.win h2 { font-size: 1.4rem; }
.win-list { margin: 0 0 12px; padding-left: 20px; }
.win-list li { margin: 4px 0; }
.win code { color: var(--violet); font-weight: 700; }
