/* PalCMS — thème par défaut
   Les couleurs de marque (--brand, --accent) sont injectées depuis les paramètres du site. */

:root {
  --brand: #4f9dff;
  --accent: #ffc93c;

  --bg: #0e1218;
  --bg-soft: #151b24;
  --surface: #1a2029;
  --surface-2: #212936;
  --border: #2b3441;
  --text: #e8edf4;
  --text-dim: #9aa7b8;
  --text-faint: #6b7787;

  --ok: #3ecf8e;
  --warn: #ffb020;
  --danger: #ff5f5f;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 28px rgba(0, 0, 0, .35);
  --wrap: 1120px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f7fa;
    --bg-soft: #ffffff;
    --surface: #ffffff;
    --surface-2: #f0f3f8;
    --border: #dde3ec;
    --text: #18202b;
    --text-dim: #5a6778;
    --text-faint: #8794a6;
    --shadow: 0 6px 20px rgba(20, 30, 50, .08);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1em; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.muted { color: var(--text-dim); }
.small { font-size: .875rem; }
.inline { display: inline; }
.center { text-align: center; }
.stack > * + * { margin-top: 1rem; }

.skip-link {
  position: absolute; left: -9999px; top: 0; background: var(--brand); color: #fff;
  padding: .6rem 1rem; z-index: 100; border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

/* --- En-tête ------------------------------------------------------------ */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg-soft) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex; align-items: center; gap: 1.25rem; min-height: 64px; flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand) 40%, transparent);
}
.brand-name { font-size: 1.05rem; }

.site-nav { display: flex; gap: .25rem; margin-right: auto; flex-wrap: wrap; }
.site-nav a {
  color: var(--text-dim); padding: .45rem .7rem; border-radius: var(--radius-sm);
  font-size: .94rem; font-weight: 500;
}
.site-nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.site-nav a.is-active { color: var(--text); background: var(--surface-2); }

.header-actions { display: flex; align-items: center; gap: .5rem; }

.nav-toggle, .nav-burger { display: none; }

@media (max-width: 860px) {
  .nav-burger {
    display: flex; flex-direction: column; justify-content: center; gap: 4px;
    width: 40px; height: 40px; margin-left: auto; cursor: pointer;
    border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 9px;
  }
  .nav-burger span { display: block; height: 2px; background: var(--text); border-radius: 2px; }
  .site-nav, .header-actions { display: none; width: 100%; }
  .nav-toggle:checked ~ .site-nav,
  .nav-toggle:checked ~ .header-actions {
    display: flex; flex-direction: column; align-items: stretch; padding-bottom: .75rem;
  }
  .nav-toggle:checked ~ .header-actions .btn { width: 100%; text-align: center; }
}

/* --- Boutons ------------------------------------------------------------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .5rem .95rem; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: .92rem; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: background .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--brand); color: #0b1017; }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 85%, #fff); }

.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface); border-color: var(--brand); }

.btn-quiet { background: none; color: var(--text-dim); }
.btn-quiet:hover { color: var(--text); background: var(--surface-2); }

.btn-danger { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-sm { padding: .3rem .6rem; font-size: .82rem; }
.btn-block { width: 100%; }

/* --- Blocs -------------------------------------------------------------- */

.section { padding: 3rem 0; }
.section-tight { padding: 1.75rem 0; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
}
.card + .card { margin-top: 1rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* --- Héros -------------------------------------------------------------- */

.hero {
  position: relative; overflow: hidden;
  padding: clamp(3rem, 8vw, 5.5rem) 0;
  background:
    radial-gradient(900px 400px at 15% -10%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 70%),
    radial-gradient(700px 350px at 85% 10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    var(--bg-soft);
  border-bottom: 1px solid var(--border);
}
.hero h1 { margin-bottom: .4rem; }
.hero .lead { font-size: 1.1rem; color: var(--text-dim); max-width: 60ch; }
.hero-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.5rem; }

/* --- Statut / statistiques --------------------------------------------- */

.stat-row { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.1rem;
}
.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: .8rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; margin-top: .25rem; }

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.dot-on { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.dot-off { background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 22%, transparent); }

.badge {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .18rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600;
  background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--border);
}
.badge-on { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.badge-off { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.badge-warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: color-mix(in srgb, var(--warn) 12%, transparent); }

.server-card { display: flex; flex-direction: column; gap: .9rem; }
.server-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.server-address {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9rem;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .45rem .7rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem;
}
.copy-btn { background: none; border: none; color: var(--brand); cursor: pointer; font-size: .82rem; font-family: inherit; font-weight: 600; }

.bar { height: 7px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--accent)); border-radius: 999px; transition: width .4s ease; }

.player-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
  padding: .25rem .65rem; font-size: .83rem;
}
.chip b { font-weight: 600; }
.chip .lvl { color: var(--text-faint); margin-left: .3rem; }

/* --- Contenu éditorial -------------------------------------------------- */

.post-card { display: flex; flex-direction: column; }
.post-card .thumb { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; border-radius: var(--radius-sm); margin-bottom: .85rem; background: var(--surface-2); }
.post-meta { font-size: .82rem; color: var(--text-faint); margin-bottom: .5rem; }
.post-card h3 { margin-bottom: .35rem; }
.post-card h3 a { color: var(--text); }

.prose { max-width: 72ch; }
.prose img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.prose h2 { margin-top: 2rem; }
.prose h3 { margin-top: 1.5rem; }
.prose pre { background: var(--surface-2); padding: 1rem; border-radius: var(--radius-sm); overflow-x: auto; border: 1px solid var(--border); }
.prose code { background: var(--surface-2); padding: .15em .4em; border-radius: 4px; font-size: .9em; }
.prose pre code { background: none; padding: 0; }
.prose blockquote { border-left: 3px solid var(--brand); margin: 1.25rem 0; padding: .25rem 0 .25rem 1rem; color: var(--text-dim); }
.prose table { width: 100%; border-collapse: collapse; }
.prose th, .prose td { border: 1px solid var(--border); padding: .5rem .7rem; text-align: left; }

/* --- Formulaires -------------------------------------------------------- */

.form { display: flex; flex-direction: column; gap: 1rem; }
.form-row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field label { font-size: .88rem; font-weight: 600; }
.field .hint { font-size: .8rem; color: var(--text-faint); }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="url"], input[type="search"], select, textarea {
  width: 100%; padding: .6rem .75rem; font-size: .95rem; font-family: inherit;
  color: var(--text); background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);
}
textarea { min-height: 160px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9rem; line-height: 1.6; }
input[type="color"] { width: 56px; height: 38px; padding: 2px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); }

.check { display: flex; align-items: flex-start; gap: .6rem; }
.check input { margin-top: .3rem; flex: none; }
.check label { font-weight: 500; }

.form-actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }

.auth-wrap { max-width: 440px; margin: 3rem auto; }

/* --- Alertes ------------------------------------------------------------ */

.flash, .alert {
  border-radius: var(--radius-sm); padding: .75rem 1rem; margin: 1rem 0;
  border: 1px solid var(--border); background: var(--surface); font-size: .92rem;
}
.flash-success, .alert-success { border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); color: var(--ok); }
.flash-error, .alert-error { border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); }
.alert-warn { border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); color: var(--warn); }
.alert ul { margin: .4rem 0 0; padding-left: 1.2rem; }

/* --- Tableaux ----------------------------------------------------------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th, table.data td { padding: .7rem .85rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data th { background: var(--surface-2); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-dim); font-weight: 600; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data td.wrap-cell { white-space: normal; }

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--text-faint); }

/* --- Pagination --------------------------------------------------------- */

.pagination { display: flex; gap: .4rem; justify-content: center; margin-top: 2rem; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: .4rem .75rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); color: var(--text-dim); font-size: .9rem;
}
.pagination .is-current { background: var(--brand); color: #0b1017; border-color: var(--brand); font-weight: 600; }

/* --- Administration ----------------------------------------------------- */

.admin-layout { display: grid; grid-template-columns: 220px 1fr; gap: 1.5rem; padding: 1.5rem 0 3rem; align-items: start; }
@media (max-width: 860px) { .admin-layout { grid-template-columns: 1fr; } }

.admin-side {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .6rem; position: sticky; top: 80px;
}
@media (max-width: 860px) { .admin-side { position: static; } }
.admin-side a {
  display: block; padding: .5rem .7rem; border-radius: var(--radius-sm);
  color: var(--text-dim); font-size: .92rem; font-weight: 500;
}
.admin-side a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.admin-side a.is-active { background: color-mix(in srgb, var(--brand) 16%, transparent); color: var(--brand); }
.admin-side .side-label {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-faint); padding: .8rem .7rem .3rem; font-weight: 700;
}

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 1.6rem; }

/* --- Installation ------------------------------------------------------- */

.install-wrap { max-width: 640px; margin: 3rem auto; }
.steps { display: flex; gap: .5rem; margin-bottom: 2rem; }
.step {
  flex: 1; text-align: center; padding: .6rem .5rem; border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text-faint); font-size: .85rem; font-weight: 600;
  border: 1px solid var(--border);
}
.step.is-current { background: var(--brand); color: #0b1017; border-color: var(--brand); }
.step.is-done { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }

/* --- Pied de page ------------------------------------------------------- */

.site-footer { border-top: 1px solid var(--border); background: var(--bg-soft); margin-top: 3rem; padding: 2rem 0; }
.footer-inner { display: flex; flex-direction: column; gap: .75rem; }
.footer-links { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .9rem; }

/* --- Divers ------------------------------------------------------------- */

.error-page { text-align: center; padding: 5rem 1rem; }
.error-code { font-size: 5rem; font-weight: 800; line-height: 1; color: var(--brand); opacity: .35; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
