/* patterns: UX.008 — Charte graphique Jaikit (dark-first, or premium) */


/* ── Tokens invariants ──────────────────────────────────────────── */
:root {
  --or:       #d4a853;
  --or-clair: #e8c278;
  --or-pale:  #f5e6c0;
  --accent:   #4a9eff;
  --rouge:    #e85d4a;
  --vert:     #52c07e;
  --r-sm: 8px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 40px;
  --r-full: 999px;
}

/* ── Thème sombre (défaut) ──────────────────────────────────────── */
:root[data-theme="dark"], :root:not([data-theme]) {
  --bg:        #0a0a0f;
  --bg-2:      #12121a;
  --bg-3:      #1c1c28;
  --text:          #f0ece4;
  --text-dim:      #c8c4bc;
  --text-muted:    #6b6878;
  /* Texte sur fond --or/--or-clair (boutons primaires, badges) : le blanc pur
     n'y contraste qu'à 2.20:1 (échec WCAG AA). Un ton très sombre y passe à 9.5:1+. */
  --text-contrast: #1a1400;
  --border:      #334155;
  --shadow-or:   0 0 60px rgba(212, 168, 83, .18);
  --shadow-card: 0 4px 32px rgba(0, 0, 0, .5);
  --primary: var(--or);
}

/* ── Thème clair ─────────────────────────────────────────────────── */
:root[data-theme="light"] {
  --bg:        #ffffff;
  --bg-2:      #f8fafc;
  --bg-3:      #f1f5f9;
  --text:          #0f172a;
  --text-dim:      #475569;
  --text-muted:    #64748b;
  --text-contrast: #000000;
  --border:      #e2e8f0;
  --shadow-or:   0 0 40px rgba(212, 168, 83, .12);
  --shadow-card: 0 4px 24px rgba(15, 23, 42, .08);
  --primary: var(--or);
}

/* ── Reset & base ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  transition: background 0.2s, color 0.2s;
}
h1, h2, h3, h4, h5 { font-family: 'Syne', sans-serif; line-height: 1.1; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--or-clair); }
code, .mono { font-family: 'JetBrains Mono', monospace; font-size: 0.875em; }

/* ── Layout ──────────────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.section { padding: 5rem 0; }
.section--alt { background: var(--bg-2); }

/* ── Navbar ──────────────────────────────────────────────────────── */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,10,15,0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
}
:root[data-theme="light"] .navbar { background: rgba(255,255,255,0.92); }
.navbar__inner {
  max-width: 1200px; margin: 0 auto; padding: 0 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
}
.navbar__brand {
  display: flex; align-items: center; gap: 0.75rem;
  text-decoration: none;
}
.navbar__logo { height: 36px; width: auto; }
.navbar__wordmark {
  font-family: 'Syne', sans-serif; font-weight: 700;
  font-size: 1.1rem; letter-spacing: 4px;
  color: var(--text); text-transform: uppercase;
}
.navbar__actions { display: flex; align-items: center; gap: 1rem; }

/* ── Boutons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: 'DM Sans', sans-serif; font-weight: 500;
  border: none; cursor: pointer; text-decoration: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.btn-primary {
  background: var(--or); color: var(--text-contrast);
  border-radius: var(--r-md); padding: 12px 28px; font-size: 1rem;
}
.btn-primary:hover { background: var(--or-clair); color: var(--text-contrast); }
.btn-secondary {
  background: transparent; color: var(--or);
  border: 1px solid var(--or); border-radius: var(--r-md);
  padding: 10px 24px; font-size: 0.95rem;
}
.btn-secondary:hover { background: var(--or); color: var(--text-contrast); }
.btn-ghost {
  background: transparent; color: var(--text-dim);
  border-radius: var(--r-sm); padding: 8px 16px;
}
.btn-ghost:hover { color: var(--text); background: var(--bg-3); }
.btn-theme {
  background: none; border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 6px 10px;
  cursor: pointer; font-size: 1rem; color: var(--text-dim);
  transition: border-color 0.2s;
}
.btn-theme:hover { border-color: var(--or); }

/* ── Hero ────────────────────────────────────────────────────────── */
.hero {
  min-height: 80vh;
  display: flex; align-items: center;
  padding: 6rem 0 4rem;
  position: relative; overflow: hidden;
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: top;
  opacity: 1;
}
.hero.hidden-hero {
  min-height: 0;
  max-height: 0;
  padding: 0;
  opacity: 0;
  margin: 0;
  border: none;
}
.hero__content { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.hero__logo-wrap { display: flex; justify-content: center; margin-bottom: 2.5rem; }
.hero__logo-img { height: 80px; width: auto; filter: drop-shadow(var(--shadow-or)); }
.hero__tagline {
  font-family: 'Syne', sans-serif; font-weight: 700;
  font-size: clamp(2rem, 5vw, 3.5rem);
  text-align: center;
  background: linear-gradient(135deg, var(--text) 60%, var(--or));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1.5rem;
}
.hero__sub {
  text-align: center; color: var(--text-dim);
  font-size: 1.1rem; max-width: 600px; margin: 0 auto 2.5rem;
}
.hero__cta { display: flex; justify-content: center; }

/* ── Animations ──────────────────────────────────────────────────── */
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}
.animate-bounce {
  display: inline-block;
  animation: bounce 2s infinite;
}

.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Filter Bar ──────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.filter-btn {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 16px;
  border-radius: var(--r-xl);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
}
.filter-btn:hover {
  border-color: var(--or);
  color: var(--text);
}
.filter-btn.active {
  background: var(--or);
  color: var(--text-contrast);
  border-color: var(--or);
}

/* ── Carousel wrapper ────────────────────────────────────────────── */
.carousel-wrapper {
  position: relative;
  margin-top: 1rem;
}

/* ── Projets — mobile carrousel (default) ────────────────────────── */
.projects-grid {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  gap: 1rem;
  padding: 1rem 0 1.5rem 0;
  scrollbar-width: none;
}
.projects-grid::-webkit-scrollbar { display: none; }

.projects-grid--soon .project-card { opacity: 0.7; }

.project-card {
  position: relative;
  overflow: hidden;
  flex: 0 0 auto;
  width: 80vw;
  max-width: 340px;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  display: flex; flex-direction: column; gap: 0.75rem;
  transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: var(--shadow-card);
}
/* Liseré couleur propre à chaque projet (--card-accent passé en inline) */
.project-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--card-accent, var(--or));
}
.project-card:hover {
  border-color: var(--card-accent, var(--or));
  transform: translateY(-5px);
  box-shadow: var(--shadow-or);
}
.project-card__icon {
  font-size: 1.6rem;
  width: 52px; height: 52px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--card-accent, var(--or)) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--card-accent, var(--or)) 32%, transparent);
}
.project-card__name { font-family: 'Syne', sans-serif; font-size: 1.2rem; font-weight: 700; }
.project-card__tagline { color: var(--text-dim); font-size: 0.9rem; flex: 1; }
.project-card__footer { display: flex; align-items: center; justify-content: space-between; margin-top: 0.5rem; }
/* Tag "Gratuit" sur les apps accessibles */
.project-card__free {
  position: absolute;
  top: 1.25rem; right: 1.25rem;
  font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: var(--r-full);
  color: var(--vert);
  background: rgba(82, 192, 126, 0.12);
  border: 1px solid var(--vert);
}

/* ── Carousel dots (mobile) ──────────────────────────────────────── */
.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 0 1rem;
}
.carousel-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.25s, transform 0.25s, width 0.25s;
}
.carousel-dot.active {
  background: var(--or);
  width: 24px;
  border-radius: 4px;
  transform: none;
}

/* ── Projets — desktop grid ──────────────────────────────────────── */
@media (min-width: 769px) {
  .projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    overflow-x: visible;
    scroll-snap-type: none;
    gap: 2rem;
    scrollbar-width: auto;
  }
  .projects-grid::-webkit-scrollbar { display: initial; height: 8px; }
  .project-card {
    width: auto;
    max-width: none;
    scroll-snap-align: none;
  }
  .carousel-dots { display: none; }
}

/* ── Badges ──────────────────────────────────────────────────────── */
.badge { padding: 4px 8px; border-radius: var(--r-full); font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; display: inline-flex; align-items: center; gap: 0.25rem; border: 1px solid transparent; }
.badge--live { color: var(--or); background: rgba(239,185,93,0.1); border-color: var(--or); }
.badge--beta { color: var(--primary); background: rgba(144,213,255,0.1); border-color: var(--primary); }
.badge--soon { color: var(--text-dim); background: var(--bg-2); border-color: var(--border); }
.badge--down { color: #f87171; background: rgba(248,113,113,0.1); border-color: #f87171; }

/* ── Section titles ──────────────────────────────────────────────── */
.section-title {
  font-family: 'Syne', sans-serif; font-size: 2rem; font-weight: 700;
  margin-bottom: 0.5rem;
}
.section-title span { color: var(--or); }
.section-sep {
  width: 48px; height: 3px;
  background: var(--or); border-radius: 2px;
  margin-bottom: 2rem;
}

/* ── About / BMC ─────────────────────────────────────────────────── */
.about-content { max-width: 800px; }
.about-content p, .about-content li { color: var(--text-dim); line-height: 1.8; margin-bottom: 0.75rem; }
.about-content strong { color: var(--text); }
.about-content h2, .about-content h3 { margin-bottom: 0.5rem; margin-top: 1.5rem; }

.bmc-wrap {
  display: flex; align-items: flex-start; gap: 2rem;
  background: var(--bg-2); border: 0.5px solid var(--or);
  border-radius: var(--r-lg); padding: 2rem;
  box-shadow: var(--shadow-or);
}
@media (max-width: 600px) { .bmc-wrap { flex-direction: column; align-items: center; text-align: center; } }
.bmc-avatar { width: 80px; height: 80px; border-radius: 50%; flex-shrink: 0; }
.bmc-text { flex: 1; }
.bmc-text p { color: var(--text-dim); margin-bottom: 1rem; }
.bmc-text strong { color: var(--text); }

/* ── Footer ──────────────────────────────────────────────────────── */
footer {
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  text-align: center;
}
.footer__links { display: flex; justify-content: center; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
/* --text-muted sur --bg-2 ne fait que 3.44:1 (échec WCAG AA) ; --text-dim passe à 10.7:1. */
.footer__links a { color: var(--text-dim); font-size: 0.875rem; }
.footer__links a:hover { color: var(--or); }
.footer__copy { color: var(--text-dim); font-size: 0.8rem; }

/* ── Cards admin ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-2); border: 0.5px solid var(--border);
  border-radius: var(--r-lg); padding: 1.5rem;
  box-shadow: var(--shadow-card);
}
.stat-card {
  background: var(--bg-2); border: 0.5px solid var(--border);
  border-radius: var(--r-md); padding: 1.25rem;
  display: flex; flex-direction: column; gap: 0.25rem;
}
.stat-card__value { font-family: 'Syne', sans-serif; font-size: 2rem; font-weight: 700; color: var(--or); }
.stat-card__label { color: var(--text-muted); font-size: 0.875rem; }

.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem;
}
@media (max-width: 800px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

/* ── Admin layout ────────────────────────────────────────────────── */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 220px; background: var(--bg-2);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0; flex-shrink: 0;
}
.admin-sidebar__logo { padding: 0 1.25rem 1.5rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.admin-sidebar__logo a { display: flex; align-items: center; gap: 0.5rem; text-decoration: none; }
.admin-sidebar__logo img { height: 28px; }
.admin-sidebar__logo span { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 0.9rem; letter-spacing: 3px; color: var(--text); }
.admin-nav__item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.65rem 1.25rem;
  color: var(--text-dim); text-decoration: none; font-size: 0.9rem;
  transition: color 0.15s, background 0.15s;
}
.admin-nav__item:hover { color: var(--text); background: var(--bg-3); }
.admin-nav__item.active { color: var(--or); background: rgba(212,168,83,.08); border-right: 2px solid var(--or); }
.admin-main { flex: 1; padding: 2rem; overflow-x: hidden; }
.admin-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2rem; }
.admin-title { font-family: 'Syne', sans-serif; font-size: 1.5rem; font-weight: 700; }

/* ── Forms ───────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1rem; }
label { font-size: 0.875rem; color: var(--text-dim); }
input[type="text"], input[type="password"], input[type="number"], input[type="email"],
textarea, select {
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--text);
  padding: 10px 14px; font-family: 'DM Sans', sans-serif; font-size: 0.95rem;
  transition: border-color 0.2s; width: 100%;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--or);
}
textarea { resize: vertical; min-height: 100px; }

/* ── Table ───────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--r-md); border: 0.5px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
th { background: var(--bg-3); color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; padding: 0.75rem 1rem; text-align: left; }
td { padding: 0.75rem 1rem; border-top: 1px solid var(--border); color: var(--text-dim); font-size: 0.9rem; }
tr:hover td { background: var(--bg-3); }

/* ── Status indicators ───────────────────────────────────────────── */
.status-ok  { color: var(--vert); }
.status-ko  { color: var(--rouge); }
.status-unk { color: var(--text-muted); }

/* ── Login ───────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.login-card {
  background: var(--bg-2); border: 0.5px solid var(--border);
  border-radius: var(--r-lg); padding: 2.5rem; width: 100%; max-width: 400px;
  box-shadow: var(--shadow-card);
}
.login-card__logo { display: flex; justify-content: center; margin-bottom: 2rem; }
.login-card__logo img { height: 48px; }
.login-title { font-family: 'Syne', sans-serif; font-size: 1.3rem; font-weight: 700; text-align: center; margin-bottom: 1.5rem; }
.error-msg {
  background: rgba(232,93,74,.12); color: var(--rouge);
  border: 1px solid rgba(232,93,74,.3); border-radius: var(--r-sm);
  padding: 0.65rem 1rem; margin-bottom: 1rem; font-size: 0.9rem;
}

/* ── Ops Toolbox ─────────────────────────────────────────────────── */
.ops-layout { display: flex; gap: 1.5rem; }
.ops-sidebar { width: 200px; flex-shrink: 0; }
.ops-sidebar__item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.65rem 1rem; border-radius: var(--r-sm);
  cursor: pointer; color: var(--text-dim); font-size: 0.9rem;
  transition: color 0.15s, background 0.15s; text-decoration: none;
}
.ops-sidebar__item:hover { background: var(--bg-3); color: var(--text); }
.ops-sidebar__item.active { background: rgba(212,168,83,.08); color: var(--or); }
.ops-main { flex: 1; min-width: 0; }

.recipe-card {
  background: var(--bg-2); border: 0.5px solid var(--border);
  border-radius: var(--r-md); padding: 1.25rem; margin-bottom: 1rem;
}
.recipe-card__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.recipe-card__title { font-weight: 600; font-size: 0.95rem; }
.recipe-card__meta { color: var(--text-muted); font-size: 0.8rem; margin-bottom: 0.75rem; }
.recipe-cmd {
  background: var(--bg-3); border-radius: var(--r-sm);
  padding: 0.75rem 1rem; position: relative;
  font-family: 'JetBrains Mono', monospace; font-size: 0.82rem;
  color: var(--text-dim); word-break: break-all;
  border: 0.5px solid var(--border);
}
.recipe-copy-btn {
  position: absolute; top: 0.5rem; right: 0.5rem;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 3px 10px;
  font-size: 0.75rem; color: var(--text-muted); cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.recipe-copy-btn:hover { color: var(--or); border-color: var(--or); }
.copy-toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 999;
  background: var(--or); color: var(--text-contrast);
  border-radius: var(--r-md); padding: 0.65rem 1.25rem;
  font-size: 0.875rem; opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.copy-toast.show { opacity: 1; }

/* ── Variables sélecteur ─────────────────────────────────────────── */
.vars-bar {
  display: flex; gap: 1rem; flex-wrap: wrap;
  background: var(--bg-2); border: 0.5px solid var(--border);
  border-radius: var(--r-md); padding: 1rem; margin-bottom: 1.5rem;
}
.vars-bar label { font-size: 0.8rem; color: var(--text-muted); }
.vars-bar select, .vars-bar input {
  width: auto; min-width: 160px;
}

/* ── Legal pages ─────────────────────────────────────────────────── */
.legal-content { max-width: 800px; margin: 0 auto; padding: 3rem 1.5rem; }
.legal-content h1 { font-size: 2rem; margin-bottom: 0.5rem; }
.legal-content h2 { font-size: 1.2rem; margin-top: 2rem; margin-bottom: 0.5rem; color: var(--text-dim); }
.legal-content p, .legal-content li { color: var(--text-dim); line-height: 1.8; margin-bottom: 0.5rem; }
.legal-content .placeholder { color: var(--rouge); font-style: italic; }

/* ── Search bar ──────────────────────────────────────────────────── */
.search-bar {
  width: 100%; padding: 10px 14px;
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--text);
  font-size: 0.9rem; margin-bottom: 1rem;
}
.search-bar:focus { outline: none; border-color: var(--or); }

/* ── Pre output ──────────────────────────────────────────────────── */
pre.script-output {
  background: var(--bg-3); border: 0.5px solid var(--border);
  border-radius: var(--r-sm); padding: 1rem;
  font-family: 'JetBrains Mono', monospace; font-size: 0.82rem;
  color: var(--text-dim); overflow-x: auto; white-space: pre-wrap;
  max-height: 400px; overflow-y: auto;
}

/* ── Misc ────────────────────────────────────────────────────────── */
.text-muted { color: var(--text-muted); }
.text-or    { color: var(--or); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-4 { margin-top: 2rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none; }
