/* O coin du feu.net : feuille de style du brouhaha (index.php et form.php) */
:root {
  --bg: #4d0703;            /* fond de page : rouge brun du site d'origine */
  --page-text: #f6e9df;     /* texte posé directement sur le fond de page */
  --page-muted: #d9b8a6;
  --field: #faf6f1;         /* fond des champs de saisie */
  --surface: #ffffff;
  --surface-2: #f3ece3;
  --text: #2a211b;
  --muted: #7a6a5c;
  --accent: #c4501a;
  --accent-text: #ffffff;
  --border: #e6dccf;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 4px 14px rgb(0 0 0 / .04);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #16120f;
  --page-text: #efe6dc;
  --page-muted: #a8998a;
  --field: #16120f;
  --surface: #211a15;
  --surface-2: #2b221b;
  --text: #efe6dc;
  --muted: #a8998a;
  --accent: #e8743b;
  --accent-text: #1a0f08;
  --border: #3a2e25;
  --shadow: 0 1px 2px rgb(0 0 0 / .4);
}
/* Sans JavaScript : on suit le reglage de l'appareil */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #16120f;
    --page-text: #efe6dc;
    --page-muted: #a8998a;
    --field: #16120f;
    --surface: #211a15;
    --surface-2: #2b221b;
    --text: #efe6dc;
    --muted: #a8998a;
    --accent: #e8743b;
    --accent-text: #1a0f08;
    --border: #3a2e25;
    --shadow: 0 1px 2px rgb(0 0 0 / .4);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--page-text);
  font: 1rem/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
/* Liens ecrits directement sur le fond de page (pas dans une carte) */
main > p a { color: var(--page-text); }
img { max-width: 100%; height: auto; }

/* Largeur du contenu = largeur de la banniere (973px), plus les marges laterales */
.wrap { max-width: calc(973px + 2rem); margin: 0 auto; padding: 0 1rem; }

/* En-tete : banniere + barre d'actions */
.site-header { padding-top: 1rem; }
.banner { display: block; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); line-height: 0; }
.banner img { display: block; width: 100%; height: auto; }
:root[data-theme="dark"] .banner img { filter: brightness(.85); }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-top: 1rem;
}

/* Selecteur de theme */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.4rem; height: 2.4rem; padding: 0; cursor: pointer;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle svg { width: 1.2rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* Le soleil s'affiche en theme sombre (pour passer au clair), la lune en theme clair */
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.btn {
  display: inline-block; cursor: pointer;
  padding: .55rem 1.1rem; border: 0; border-radius: 999px;
  background: var(--accent); color: var(--accent-text);
  font: inherit; font-weight: 600; text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.btn-ghost {
  background: transparent; color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--accent); filter: none; }
.topbar .btn-ghost { color: var(--page-text); border-color: var(--page-muted); }
.topbar .btn-ghost:hover { border-color: var(--page-text); }
a:focus-visible, input:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 2px;
}

/* Titres */
main { padding: 1.25rem 0 3rem; }
h1 { margin: 0 0 .25rem; font-size: 1.8rem; letter-spacing: -.02em; }
.tagline { margin: 0 0 1.5rem; color: var(--page-muted); font-size: .95rem; }
.error { color: #ffb4a8; font-weight: 600; }

/* Messages */
.messages { display: grid; gap: .9rem; }
.message, .card {
  color: var(--text);
}
.message {
  display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 1rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow);
}
.avatar {
  width: 70px; height: 70px; object-fit: cover;
  border-radius: 10px; background: var(--surface-2);
}
.message-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .6rem;
  margin-bottom: .4rem; font-size: .9rem; color: var(--muted);
}
.author { color: var(--text); font-weight: 700; font-size: 1rem; }
.num { font-variant-numeric: tabular-nums; }
/* Bouton d'edition (visible seulement pour l'auteur) : l'icone est gris clair, on lui donne un fond */
.edit {
  margin-left: auto; line-height: 0; padding: 5px;
  background: var(--accent); border-radius: 6px;
}
.edit:hover { filter: brightness(1.12); }
.edit img { display: block; width: 13px; height: 13px; }
.message-title { margin: 0 0 .3rem; font-size: .92rem; font-style: italic; font-weight: 600; }
.message-body { overflow-wrap: anywhere; font-size: .88rem; }
.message-body p { margin: 0 0 .6em; }
.message-body p:last-child { margin-bottom: 0; }
.message-body blockquote {
  margin: .6rem 0; padding: .4rem .9rem;
  border-left: 3px solid var(--accent); background: var(--surface-2);
  border-radius: 0 8px 8px 0; color: var(--muted);
}
.message-body img { border-radius: 6px; vertical-align: middle; }
.centrage { text-align: center; }

/* Pagination */
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.5rem; }
.pager a {
  padding: .5rem 1rem; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); text-decoration: none; font-weight: 600;
}
.pager a:hover { border-color: var(--accent); }
.pager .next { margin-left: auto; }

/* Formulaire */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow);
}
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-weight: 600; margin-bottom: .3rem; }
.hint { font-weight: 400; color: var(--muted); font-size: .88rem; }
input[type=text], textarea {
  width: 100%; padding: .65rem .8rem; font: inherit; color: var(--text);
  background: var(--field); border: 1px solid var(--border); border-radius: 8px;
}
input.short { max-width: 14rem; }
textarea { min-height: 12rem; resize: vertical; }
input:focus, textarea:focus { border-color: var(--accent); }

.toolbar { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .5rem; }
.toolbar button {
  padding: .25rem .6rem; font: .85rem ui-monospace, Menlo, Consolas, monospace;
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 6px; cursor: pointer;
}
.toolbar button:hover { border-color: var(--accent); }
.smileys { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: .6rem; }
.smileys button {
  padding: .2rem; line-height: 0; background: transparent;
  border: 1px solid transparent; border-radius: 6px; cursor: pointer;
}
.smileys button:hover { background: var(--surface-2); border-color: var(--border); }

.captcha { background: var(--surface-2); border-radius: 8px; padding: .8rem 1rem; }
.captcha em { color: var(--accent); font-style: normal; font-weight: 700; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .5rem; }
.notice { color: var(--muted); font-size: .9rem; margin-top: 1.5rem; }
.notice strong { color: var(--text); }

.recap { margin-top: 2rem; }
.recap h2 { font-size: 1.1rem; margin: 0 0 .8rem; color: var(--page-text); }
.recap .message { grid-template-columns: 1fr; padding: .8rem 1rem; box-shadow: none; }

/* Pied de page */
.site-footer {
  border-top: 1px solid color-mix(in srgb, var(--page-muted) 35%, transparent); padding: 1.2rem 0;
  color: var(--page-muted); font-size: .85rem; text-align: center;
}
.site-footer a { color: var(--page-text); }

@media (max-width: 520px) {
  .message { grid-template-columns: 48px minmax(0, 1fr); gap: .75rem; padding: .85rem; }
  .avatar { width: 48px; height: 48px; border-radius: 8px; }
  h1 { font-size: 1.5rem; }
}
