:root {
  --background: #ffffff;
  --foreground: #111111;
  --muted: #6b6b6b;
  --border: #111111;
  --accent: #ee3300;
  --accent-ink: #a82400;
  --accent-tint: #fdece6;
  --font-sans: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, Menlo, Consolas, monospace;
  --font-display: "Playfair Display", Georgia, serif;
}
:root.dark {
  --background: #140c0b;
  --foreground: #f4efee;
  --muted: #aaa09e;
  --border: #41322f;
  --accent: #ff5a33;
  --accent-ink: #ffd2c6;
  --accent-tint: #2f1814;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--background); color: var(--foreground);
  font-family: var(--font-sans); line-height: 1.5;
  transition: background-color .15s ease, color .15s ease;
}
img { max-width: 100%; }
a { color: inherit; }
h1, h2, h3, h4, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.container { width: 100%; max-width: 72rem; margin: 0 auto; padding: 0 1.5rem; }
.container.narrow { max-width: 48rem; }
.main { flex: 1; }
.page { padding-top: 3rem; padding-bottom: 3rem; }
.accent { color: var(--accent); }
.muted { color: var(--muted); }
.meta { color: var(--muted); font-size: .75rem; }
.inline { display: inline; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.stack.narrow-form { max-width: 32rem; }

.h1 { font-family: var(--font-display); font-size: 1.875rem; font-weight: 600; }
.h2 { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; }
.h3 { font-family: var(--font-display); font-size: 1.125rem; font-weight: 600; }
.eyebrow { font-size: .75rem; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); }
.eyebrow-wide { letter-spacing: .2em; }
.link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; background: none; border: 0; padding: 0; cursor: pointer; }
.muted-btn { color: var(--muted); font-size: .875rem; }
.link-danger { color: #b91c1c; background: none; border: 0; cursor: pointer; font-size: .75rem; text-decoration: underline; padding: 0; }
:root.dark .link-danger { color: #f87171; }

/* Header / footer */
.site-header { border-bottom: 1px solid var(--border); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 1rem; padding-bottom: 1rem; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; }
.brand-logo { height: 2.25rem; width: 2.25rem; }
.brand-name { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; letter-spacing: -.01em; }
.nav { display: flex; flex-wrap: wrap; gap: .5rem; }
.btn-nav {
  display: inline-block; border: 1px solid var(--border); background: transparent; padding: .5rem 1rem;
  font-size: .875rem; text-decoration: none; cursor: pointer; border-radius: 0;
}
.btn-nav:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-nav-team { border-color: var(--accent); background: var(--accent-tint); color: var(--accent-ink); }
.header-right { display: flex; align-items: center; gap: .75rem; }
.theme-toggle {
  height: 2rem; width: 2rem; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: transparent; cursor: pointer;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.icon-sun { display: none; }
:root.dark .icon-sun { display: block; }
:root.dark .icon-moon { display: none; }
.user-chip { display: flex; align-items: center; gap: .5rem; }
.user-name { font-size: .875rem; }
.login-box { display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; }
.login-hint { font-size: .7rem; color: var(--muted); }
.site-footer { border-top: 1px solid var(--border); font-size: .875rem; color: var(--muted); }
.footer-inner { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: space-between; padding-top: 1.5rem; padding-bottom: 1.5rem; }
.footer-inner a:hover { color: var(--accent); }

/* Boutons */
.btn-solid, .btn-accent, .btn-small {
  display: inline-block; text-decoration: none; cursor: pointer; font-size: .875rem; font-weight: 500;
  padding: .5rem 1rem; border: 1px solid transparent;
}
.btn-solid { background: var(--foreground); color: var(--background); }
.btn-solid:hover { background: var(--accent); color: #fff; }
.btn-lg { padding: .75rem 1.5rem; font-size: 1rem; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-ink); }
:root.dark .btn-accent:hover { background: #ff7a58; color: #140c0b; }
.btn-small { padding: .25rem .75rem; font-size: .8rem; background: transparent; border-color: var(--border); }
.btn-small:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { color: #b91c1c; }
:root.dark .btn-danger { color: #f87171; }
.file-btn { position: relative; }

/* Pastilles */
.pill { display: inline-block; font-size: .75rem; padding: .15rem .75rem; border-radius: 999px; border: 1px solid transparent; }
.pill-xs { font-size: .65rem; padding: .05rem .5rem; }
.pill-solid { background: var(--accent); color: #fff; }
.pill-outline { border-color: var(--accent); color: var(--accent-ink); }
.pill-green { background: #dcfce7; color: #166534; }
.pill-yellow { background: #fef9c3; color: #854d0e; }
:root.dark .pill-green { background: #14532d; color: #bbf7d0; }
:root.dark .pill-yellow { background: #713f12; color: #fef08a; }
.pills { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .5rem; }

/* Avatars */
.avatar { border-radius: 50%; object-fit: cover; display: inline-block; }
.avatar-sm { width: 1.75rem; height: 1.75rem; }
.avatar-sm2 { width: 2.25rem; height: 2.25rem; flex: none; }
.avatar-md { width: 3rem; height: 3rem; flex: none; }
.avatar-lg { width: 4.5rem; height: 4.5rem; }
.avatar-empty { background: var(--accent-tint); }

/* Grilles / cartes */
.grid { display: grid; gap: 1.5rem; }
.grid-tight { gap: 1rem; }
@media (min-width: 640px) { .grid-2, .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.card { border: 1px solid var(--border); border-radius: .5rem; background: var(--background); }
.article-card { display: block; text-decoration: none; overflow: hidden; transition: box-shadow .15s; }
.article-card:hover { box-shadow: 0 4px 14px rgba(0, 0, 0, .12); }
.card-cover { aspect-ratio: 16 / 9; background: var(--accent-tint); overflow: hidden; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.article-card:hover .card-cover img { transform: scale(1.05); }
.card-body { padding: 1rem; display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; }
.card-title { font-family: var(--font-display); font-size: 1.125rem; font-weight: 600; }
.article-card:hover .card-title { color: var(--accent); }
.card-excerpt { color: var(--muted); font-size: .875rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.person { display: flex; align-items: center; gap: .75rem; padding: 1rem; }
.person-name { font-weight: 500; }
.member { padding: 1.5rem; text-align: center; display: flex; flex-direction: column; align-items: center; gap: .5rem; }
.member-name { font-size: 1.1rem; font-weight: 600; }

.featured { display: grid; gap: 1.5rem; text-decoration: none; align-items: center; }
@media (min-width: 640px) { .featured { grid-template-columns: 1fr 1fr; } }
.featured-cover { aspect-ratio: 16 / 9; background: var(--accent-tint); border: 1px solid var(--border); border-radius: .5rem; overflow: hidden; }
.featured-cover img { width: 100%; height: 100%; object-fit: cover; }
.featured-title { font-family: var(--font-display); font-size: 1.75rem; margin: .25rem 0 .75rem; }
.featured:hover .featured-title { color: var(--accent); }
.featured-section { margin: 2rem 0 3rem; padding-bottom: 3rem; border-bottom: 1px solid var(--border); }

/* Accueil */
.hero { text-align: center; padding-bottom: 2.5rem; margin-bottom: 3rem; border-bottom: 1px solid var(--border); }
.hero-title { font-family: var(--font-display); font-size: 2.5rem; margin: .5rem 0 1rem; }
@media (min-width: 640px) { .hero-title { font-size: 3rem; } }
.hero-text { max-width: 36rem; margin: 0 auto; }
.section { margin-bottom: 3rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }

/* Article public */
.article-title { font-family: var(--font-display); font-size: 2rem; font-weight: 600; margin: .75rem 0; }
@media (min-width: 640px) { .article-title { font-size: 2.5rem; } }
.article-cover { width: 100%; border: 1px solid var(--border); border-radius: .5rem; margin-top: 1.5rem; object-fit: cover; }
.prose { margin-top: 2rem; line-height: 1.75; font-size: 1.05rem; overflow-wrap: anywhere; }
.prose::after { content: ""; display: block; clear: both; }
.prose p { margin: 1rem 0; }
.prose h2, .prose h3 { font-family: var(--font-display); line-height: 1.25; margin: 2rem 0 .75rem; }
.prose h2 { font-size: 1.6rem; }
.prose h3 { font-size: 1.3rem; }
.prose a { color: var(--accent); text-decoration: underline; }
.prose ul { list-style: disc; padding-left: 1.5rem; margin: 1rem 0; }
.prose ol { list-style: decimal; padding-left: 1.5rem; margin: 1rem 0; }
.prose blockquote { border-left: 4px solid var(--accent); margin: 1.5rem 0; padding-left: 1rem; font-style: italic; color: var(--muted); }
.prose img { border-radius: .375rem; height: auto; }
.prose-sm { font-size: .9rem; }

/* Commentaires */
.comments { border-top: 1px solid var(--border); padding-top: 2rem; padding-bottom: 3rem; }
.comment-list { display: flex; flex-direction: column; gap: 1.25rem; margin: 1.25rem 0 2rem; }
.comment { display: flex; gap: .75rem; }
.comment-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-size: .875rem; }
.comment-text { white-space: pre-wrap; margin-top: .25rem; overflow-wrap: anywhere; }

/* Archives */
.archive-month { margin-top: 2rem; }
.archive-title { text-transform: capitalize; border-bottom: 1px solid var(--border); padding-bottom: .5rem; }
.archive-row { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; text-decoration: none; border-bottom: 1px solid var(--border); }
.archive-row:hover { color: var(--accent); }

/* Login / mentions / notices */
.login-page { max-width: 28rem; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.login-logo { height: 4rem; width: 4rem; }
.notice { border: 1px solid var(--accent); background: var(--accent-tint); color: var(--accent-ink); padding: .75rem 1rem; font-size: .9rem; border-radius: .375rem; margin: 1rem 0; text-align: left; }
.flash { margin-top: 1rem; padding: .6rem 1rem; border-radius: .375rem; font-size: .9rem; border: 1px solid var(--border); }
.flash-success { background: #dcfce7; color: #166534; border-color: #86efac; }
.flash-error { background: var(--accent-tint); color: var(--accent-ink); border-color: var(--accent); }
.legal { margin-top: 2rem; display: flex; flex-direction: column; gap: 1.5rem; font-size: .9rem; }
.legal p { margin-top: .4rem; }
code { font-family: var(--font-mono); }

/* Formulaires */
.field { display: flex; flex-direction: column; gap: .35rem; }
.field label { font-size: .875rem; font-weight: 500; }
.input {
  width: 100%; border: 1px solid var(--border); background: var(--background); color: var(--foreground);
  padding: .5rem .75rem; border-radius: .375rem;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
select.input { color: var(--foreground); background: var(--background); }
.row-inline { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.row-inline .input { flex: 1; min-width: 12rem; }
.preview { height: 8rem; width: 100%; object-fit: cover; border: 1px solid var(--border); border-radius: .375rem; }

/* Admin */
.admin-wrap { padding-top: 2.5rem; padding-bottom: 3rem; max-width: 64rem; }
.admin-nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--border); padding-bottom: 1rem; margin-bottom: 2rem; }
.admin-links { display: flex; flex-wrap: wrap; gap: 1.25rem; font-size: .9rem; }
.admin-links a { text-decoration: none; }
.admin-links a:hover { color: var(--accent); }
.admin-right { display: flex; align-items: center; gap: .75rem; }
.rows { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: .5rem; margin: 1rem 0; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .85rem 1rem; flex-wrap: wrap; }
.row + .row { border-top: 1px solid var(--border); }
.row-block { flex-direction: column; align-items: stretch; }
.row-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.row-main { min-width: 0; }
.row-title { font-weight: 500; text-decoration: none; }
.row-title:hover { color: var(--accent); }
.row-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.stats { border: 1px solid var(--border); border-radius: .5rem; padding: 1rem 1.25rem; margin-bottom: 2rem; }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-top: 1rem; }
@media (min-width: 640px) { .stats-grid { grid-template-columns: repeat(5, 1fr); } }
.stat-value { font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; }
.notes, .settings-card, .readonly { padding: 1.25rem; margin-top: 2rem; display: flex; flex-direction: column; gap: .75rem; }
.notes-list { max-height: 24rem; overflow-y: auto; display: flex; flex-direction: column; gap: 1rem; }
.tabs { display: flex; gap: 1.5rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: .5rem 0; color: var(--muted); cursor: pointer; }
.tab.is-active { border-bottom-color: var(--accent); color: var(--accent-ink); }

/* Éditeur Tiptap */
.editor { border: 1px solid var(--border); border-radius: .375rem; overflow: hidden; position: relative; }
.editor-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .125rem; padding: .375rem; border-bottom: 1px solid var(--border); background: var(--background); }
.tb-btn { border: 0; background: transparent; border-radius: .25rem; padding: .375rem; cursor: pointer; display: inline-flex; color: var(--foreground); }
.tb-btn:hover { background: var(--accent-tint); }
.tb-btn.is-active { background: var(--accent-tint); color: var(--accent-ink); }
.tb-btn:disabled { opacity: .4; cursor: not-allowed; }
.tb-sep { width: 1px; height: 1.25rem; background: var(--border); margin: 0 .25rem; }
.tb-select { border: 1px solid var(--border); background: var(--background); color: var(--foreground); border-radius: .25rem; padding: .25rem .5rem; font-size: .875rem; }
.tb-color { position: relative; width: 1.75rem; height: 1.75rem; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; border-radius: .25rem; }
.tb-color:hover { background: var(--accent-tint); }
.tb-color .dot { width: 1rem; height: 1rem; border-radius: 50%; border: 1px solid var(--border); }
.tb-color input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.editor-panel { padding: .75rem; border-bottom: 1px solid var(--border); background: var(--accent-tint); }
.editor-panel label { display: block; font-size: .75rem; font-weight: 500; color: var(--accent-ink); margin-bottom: .25rem; }
.editor-panel textarea { font-family: var(--font-mono); font-size: .875rem; }
.panel-actions { display: flex; gap: .5rem; margin-top: .5rem; }
.grammar-list { max-height: 16rem; overflow-y: auto; display: flex; flex-direction: column; gap: .5rem; }
.grammar-item { border: 1px solid var(--border); background: var(--background); border-radius: .375rem; padding: .6rem; }
.grammar-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .4rem; }
.grammar-actions button { border: 1px solid var(--accent); background: transparent; color: var(--accent-ink); font-size: .75rem; padding: .2rem .5rem; border-radius: .25rem; cursor: pointer; }
.grammar-actions button:hover { background: var(--accent); color: #fff; }
.grammar-actions button.ignore { border-color: var(--border); color: var(--muted); }
.bubble { display: flex; gap: .125rem; border: 1px solid var(--border); background: var(--background); padding: .25rem; border-radius: .375rem; box-shadow: 0 4px 12px rgba(0, 0, 0, .15); }
.editor .ProseMirror { min-height: 300px; padding: .75rem 1rem; outline: none; line-height: 1.75; }
.editor .ProseMirror > * + * { margin-top: .75em; }
.editor .ProseMirror h2, .editor .ProseMirror h3 { font-family: var(--font-display); }
.editor .ProseMirror h2 { font-size: 1.5rem; }
.editor .ProseMirror h3 { font-size: 1.25rem; }
.editor .ProseMirror a { color: var(--accent); text-decoration: underline; }
.editor .ProseMirror ul { list-style: disc; padding-left: 1.5rem; }
.editor .ProseMirror ol { list-style: decimal; padding-left: 1.5rem; }
.editor .ProseMirror blockquote { border-left: 4px solid var(--accent); padding-left: 1rem; font-style: italic; color: var(--muted); }
.editor .ProseMirror img { cursor: grab; border-radius: .375rem; height: auto; }
.editor .ProseMirror img.ProseMirror-selectednode { outline: 2px solid var(--accent); outline-offset: 2px; cursor: grabbing; }
.editor .ProseMirror p.is-editor-empty:first-child::before { content: attr(data-placeholder); float: left; color: var(--muted); pointer-events: none; height: 0; }
.editor .ProseMirror::after { content: ""; display: block; clear: both; }
