/* Site public Gloomantis : identité sombre et premium. Deux palettes (data-palette sur <html>) proposées au fondateur. */
:root,
[data-palette='violet'] {
  --bg: #0a0812;
  --bg-2: #100c1c;
  --surface: #161126;
  --surface-2: #1e1733;
  --border: #2e2548;
  --text: #eeeaf7;
  --muted: #a9a0c2;
  --accent: #a77bff;
  --accent-strong: #8b5cf6;
  --accent-soft: rgba(167, 123, 255, 0.14);
  --glow: rgba(139, 92, 246, 0.45);
  --on-accent: #0d0819;
}
[data-palette='vert'] {
  --bg: #070c0a;
  --bg-2: #0b1410;
  --surface: #111c17;
  --surface-2: #17261f;
  --border: #233a30;
  --text: #e8f3ed;
  --muted: #9cb5a8;
  --accent: #4ade80;
  --accent-strong: #22c55e;
  --accent-soft: rgba(74, 222, 128, 0.12);
  --glow: rgba(34, 197, 94, 0.4);
  --on-accent: #04110a;
}
:root {
  --radius: 14px;
  --wrap: 1180px;
  --font: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: dark;
}

*,
*::before,
*::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: radial-gradient(1200px 600px at 80% -10%, var(--accent-soft), transparent 60%), var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; outline: none; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--text); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
ul { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 780px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.center-text { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 16px; top: -60px; background: var(--accent); color: var(--on-accent); padding: 8px 14px; border-radius: 8px; z-index: 20; }
.skip-link:focus { top: 12px; }

/* En-tête */
.site-header { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: 0.14em; font-size: 0.95rem; }
.logo img { border-radius: 10px; }
.menu summary { list-style: none; cursor: pointer; padding: 8px 14px; border: 1px solid var(--border); border-radius: 10px; font-weight: 600; }
.menu summary::-webkit-details-marker { display: none; }
.menu-panel { position: absolute; left: 0; right: 0; top: 64px; background: var(--bg-2); border-bottom: 1px solid var(--border); padding: 12px 16px 20px; }
.nav-list a { display: block; padding: 10px 4px; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border); }
.nav-list a[aria-current='page'], .nav-list a:hover { color: var(--accent); }
.search { display: flex; gap: 8px; margin-top: 14px; }
.search input { flex: 1; min-width: 0; }
.search button { white-space: nowrap; }

.nav-desktop { display: none; }
@media (min-width: 1024px) {
  .menu { display: none; }
  .nav-desktop { display: flex; align-items: center; gap: 16px; }
  .nav-desktop .nav-list { display: flex; gap: 2px; }
  .nav-desktop .nav-list a { border: 0; padding: 8px 10px; border-radius: 8px; font-size: 0.95rem; }
  .nav-desktop .nav-list a[aria-current='page'] { background: var(--accent-soft); }
  .nav-desktop .search { margin: 0; }
  .nav-desktop .search input { width: 160px; }
}

/* Formulaires */
input, select, button { font: inherit; color: inherit; }
input, select { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0 12px; height: 42px; margin: 0; }
input:focus, select:focus { border-color: var(--accent); }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 9px 18px; border-radius: 10px; border: 1px solid transparent;
  background: var(--accent); color: var(--on-accent); font-weight: 650; text-decoration: none; cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}
button:hover, .button:hover { color: var(--on-accent); transform: translateY(-1px); box-shadow: 0 8px 24px -8px var(--glow); }
.button-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.button-ghost:hover { color: var(--text); border-color: var(--accent); }
.search button { background: var(--surface-2); color: var(--text); border-color: var(--border); }

/* Accueil */
.hero { padding: 48px 0 24px; overflow: hidden; }
.hero-inner { display: grid; gap: 24px; align-items: center; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.18em; font-size: 0.78rem; font-weight: 700; color: var(--accent); margin-bottom: 0.6em; }
.hero h1 { font-size: clamp(2.6rem, 9vw, 5rem); letter-spacing: 0.06em; background: linear-gradient(120deg, var(--text) 30%, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 60ch; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.actions.center { justify-content: center; }
.hero-art { position: relative; justify-self: center; width: min(78vw, 420px); }
.hero-art img { position: relative; }
@media (min-width: 900px) {
  .hero { padding: 72px 0 40px; }
  .hero-inner { grid-template-columns: 1.15fr 1fr; }
}

.section { padding: 32px 16px; }
.section-title { font-size: 1.5rem; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.section-note { margin-top: -0.4em; }

.card { position: relative; background: linear-gradient(180deg, var(--surface), var(--bg-2)); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.25s ease; }
.card:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.card:has(.stretched):hover { transform: translateY(-3px); box-shadow: 0 18px 40px -22px var(--glow); }
.stretched { color: var(--text); text-decoration: none; }
.stretched::after { content: ''; position: absolute; inset: 0; border-radius: var(--radius); }
.stretched:focus-visible { outline: none; }
.stretched:focus-visible::after { outline: 2px solid var(--accent); outline-offset: 2px; }

.branch-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .branch-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .branch-grid:not(.two) { grid-template-columns: repeat(4, 1fr); } }
.branch-card { display: flex; flex-direction: column; }
.branch-card p { flex: 1; font-size: 0.95rem; }
.count { align-self: flex-start; font-size: 0.8rem; font-weight: 650; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.count-empty { background: var(--surface-2); color: var(--muted); }

.item-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.item-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.item-cover { aspect-ratio: 16 / 9; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.item-cover img { width: 100%; height: 100%; object-fit: cover; }
.item-cover-empty { font-size: 2.6rem; font-weight: 800; color: var(--accent); opacity: 0.55; }
.item-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 4px; }
.item-body p { font-size: 0.95rem; margin: 0; }
.item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 0.85rem; color: var(--muted); }
.kind { font-size: 0.8rem; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tags li { font-size: 0.78rem; padding: 2px 9px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); }
.tags a { color: inherit; text-decoration: none; position: relative; z-index: 1; }

.status { display: inline-block; font-size: 0.75rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; border: 1px solid currentColor; }
.status-concept { color: #c3bdd6; }
.status-in-development { color: #7cc4ff; }
.status-testing { color: #f6c35b; }
.status-public-beta { color: #c8a6ff; }
.status-available { color: #5fe39a; }
.status-paused, .status-discontinued { color: #9d97ad; }

.news-list { display: grid; gap: 14px; }
.news-list time { font-size: 0.85rem; color: var(--muted); }
.news-list p.muted { margin: 0; }

/* Pages internes */
.page-head { padding: 48px 0 8px; }
.page-head .lead { margin-bottom: 0.6em; }
.breadcrumb { font-size: 0.875rem; color: var(--muted); margin-bottom: 14px; }
.breadcrumb a { color: var(--muted); }
.notice { border: 1px solid var(--border); border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 12px 14px; border-radius: 10px; font-size: 0.95rem; }
.empty { color: var(--muted); padding: 28px; text-align: center; border: 1px dashed var(--border); border-radius: var(--radius); }

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 18px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 160px; flex: 1 1 160px; }
.field.grow { flex: 3 1 240px; }
.field label { font-size: 0.85rem; color: var(--muted); }
.filter-actions { display: flex; align-items: center; gap: 14px; }
.result-count { font-size: 0.9rem; }

.pagination { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; margin-top: 28px; }
.pagination a:last-child { justify-self: end; }

.detail-grid { display: grid; gap: 28px; }
@media (min-width: 900px) { .detail-grid { grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); } }
.detail-cover { border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 24px; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--surface-2); }
.detail-side { display: flex; flex-direction: column; gap: 14px; }
.detail-side h2 { font-size: 1rem; }
.detail-side .card ul:not(.tags) { list-style: disc; padding-left: 1.2em; }
.gallery { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.gallery img { border-radius: 10px; border: 1px solid var(--border); aspect-ratio: 16 / 10; object-fit: cover; width: 100%; }

.prose { max-width: 70ch; }
.prose h2 { margin-top: 1.4em; }
.prose ul { list-style: disc; padding-left: 1.3em; margin-bottom: 1em; }

.agency-head { display: grid; gap: 24px; align-items: center; }
.agency-badge { width: 200px; justify-self: center; }
@media (min-width: 800px) { .agency-head { grid-template-columns: 1fr auto; } .agency-badge { width: 260px; } }

/* Pied de page */
.site-footer { margin-top: 48px; border-top: 1px solid var(--border); background: var(--bg-2); padding: 36px 0 20px; font-size: 0.92rem; }
.footer-grid { display: grid; gap: 28px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1fr; } }
.site-footer h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); }
.site-footer li { margin: 6px 0; }
.site-footer a { color: var(--text); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }
.site-footer .logo { margin-bottom: 10px; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.85rem; }

/* Animations (désactivées si l'utilisateur réduit les animations) */
.rise { animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.rise-2 { animation-delay: 0.15s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Emblème violet : image sans transparence (fond noir) ; le mode « screen » efface le noir sur fond sombre. Les logos verts sont des PNG transparents. */
[data-palette='violet'] .logo img { mix-blend-mode: screen; }
[data-palette='violet'] .hero-art img { border-radius: 50%; mix-blend-mode: screen; }

/* Compte du visiteur */
.account-link { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; padding: 8px 14px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 0.92rem; white-space: nowrap; }
.account-link:hover { border-color: var(--accent); color: var(--accent); }
.account-name { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 1024px) { .account-link { margin-left: 0; } .account-name { max-width: 150px; } }
textarea { font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 0; resize: vertical; min-height: 110px; width: 100%; }
textarea:focus { border-color: var(--accent); }
.form { display: flex; flex-direction: column; gap: 16px; }
.form .field { min-width: 0; flex: none; }
.form input, .form textarea { width: 100%; }
.form-card { max-width: 520px; padding: 24px; }
.form-actions { display: flex; gap: 12px; align-items: center; }
.hint { font-size: 0.82rem; color: var(--muted); margin: 0; }
.error { font-size: 0.85rem; color: #ff8a8a; margin: 0; }
.has-error input, .has-error textarea { border-color: #ff8a8a; }
.alert { border: 1px solid #ff8a8a; border-left-width: 3px; background: rgba(255, 90, 90, 0.08); padding: 10px 14px; border-radius: 10px; margin: 0; font-size: 0.95rem; }
.button-danger { background: #c0392b; border-color: #c0392b; color: #fff; }
.button-danger:hover { color: #fff; box-shadow: 0 8px 24px -8px rgba(192, 57, 43, 0.6); }
.block { display: block; text-align: center; }
.or { text-align: center; color: var(--muted); margin: 14px 0; }
.inline-form { display: inline-block; margin: 0; }
.account-grid { display: grid; gap: 18px; margin-bottom: 22px; }
@media (min-width: 900px) { .account-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.account-grid h2 { font-size: 1.1rem; display: flex; align-items: center; gap: 10px; }
.account-grid h3 { font-size: 0.95rem; color: var(--muted); margin: 14px 0 6px; }
.plain li { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 0.95rem; }
.plain li:last-child { border-bottom: 0; }
.plain .unread strong::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 8px; }
.reply { margin: 6px 0 0; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 6px; font-size: 0.92rem; }
.status-neutral { color: var(--muted); }
.warn { border-color: #f6c35b; margin-bottom: 18px; }
.section .notice { margin-bottom: 18px; }
.item-meta time, .plain time { font-size: 0.85rem; color: var(--muted); }
.form-card + p { margin-top: 14px; }
.card .inline-form + p, .card form + p { margin-top: 14px; }
.logo { flex-shrink: 0; }
@media (max-width: 480px) {
  .header-inner { gap: 8px; }
  .logo { letter-spacing: 0.08em; gap: 8px; }
  .account-link { padding: 8px 10px; font-size: 0.85rem; }
  .account-name { max-width: 60px; }
}

/* Outils d'image (phase P3) : réglages à gauche, aperçus à droite sur grand écran. */
.tool-section { display: flex; flex-direction: column; gap: 16px; }
.tool:not([hidden]) { display: grid; grid-template-columns: minmax(240px, 340px) 1fr; gap: 24px; align-items: start; }
.tool-form { display: flex; flex-direction: column; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.tool-form .field { min-width: 0; flex: none; }
.tool-form input[type="number"], .tool-form input[type="text"], .tool-form input[type="file"], .tool-form select { width: 100%; }
.tool-form input[type="color"] { width: 64px; height: 38px; padding: 2px; }
.tool-form input[type="range"] { width: 100%; accent-color: var(--accent); }
.tool-form .check label { display: flex; align-items: center; gap: 8px; color: var(--text); }
.tool-form [hidden] { display: none; }
.tool-form .hint { margin: 0; font-size: 0.8rem; color: var(--muted); }
.tool > .alert, .tool > [data-empty] { grid-column: 2; margin: 0; }
.tool-output { grid-column: 2; grid-row: 1 / span 3; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.tool-output figure { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.tool-output figcaption { font-weight: 600; margin-bottom: 8px; }
.tool-output img { display: block; max-width: 100%; max-height: 420px; margin: 0 auto; border-radius: 8px; background: repeating-conic-gradient(#222 0% 25%, #2c2c2c 0% 50%) 50% / 16px 16px; }
.tool-output p { margin: 8px 0 0; }
.tool-output > p { grid-column: 1 / -1; }
@media (max-width: 800px) {
  .tool:not([hidden]) { grid-template-columns: 1fr; }
  .tool > .alert, .tool > [data-empty], .tool-output { grid-column: 1; grid-row: auto; }
}

/* Boutique : empreintes et licences longues sans dépassement, prix lisible */
.plain.orders > li.card { padding: 18px 20px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.orders code, .releases code { overflow-wrap: anywhere; word-break: break-all; }
.orders textarea { width: 100%; box-sizing: border-box; font-family: ui-monospace, monospace; font-size: .8rem; }
.price { font-size: 1.6rem; font-weight: 700; margin: 0 0 .75rem; }
