/* ═══════════════════════════════════════════════════════════
   DEBLOCK AI — feuille de style
   Design repris de deblock-studios.netlify.app
   (forge/pixel : orange voxel, bords biseautés, bruit)
   Police conservée : Inter
   ═══════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0b0703;
  --bg-2:      #150d05;
  --surface:   rgba(255, 148, 43, 0.045);
  --surface-2: rgba(255, 148, 43, 0.085);
  --border:    rgba(255, 148, 43, 0.13);
  --border-2:  rgba(255, 148, 43, 0.24);

  --accent:    #ff7a1a;
  --accent-2:  #ffb054;
  --amber:     #ffc75e;
  --text:      #f6efe3;
  --muted:     #b09a83;

  --grad:      linear-gradient(120deg, #ff5e1a 0%, #ff9426 55%, #ffc75e 120%);
  --grad-soft: linear-gradient(120deg, rgba(255, 126, 26, .16), rgba(255, 199, 94, .10));

  /* biseau « Minecraft » */
  --bevel-dark:  rgba(20, 8, 0, 0.38);
  --bevel-light: rgba(255, 255, 255, 0.28);

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'SF Mono', 'Fira Code', ui-monospace, monospace;

  --radius:    10px;
  --radius-sm: 8px;
  --nav-h:     72px;
  --shadow:    0 24px 60px -20px rgba(0, 0, 0, .65);
  --maxw:      1000px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* place pour la barre de saisie fixe */
  padding-bottom: 170px;
}

/* Atmosphère : braises chaudes */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(1000px 700px at 85% -10%, rgba(255, 122, 26, 0.10), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(255, 199, 94, 0.07), transparent 60%),
    var(--bg);
}

::selection { background: rgba(255, 122, 26, .4); color: #fff; }

::-webkit-scrollbar { width: 9px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--accent), rgba(255, 199, 94, .5));
  border-radius: 8px;
  border: 2px solid var(--bg);
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

/* ── Couche de bruit ────────────────────────────────── */
.noise {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: .032;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── Typographie ────────────────────────────────────── */
.grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent-2);
}
.eyebrow::before,
.eyebrow::after {
  content: "";
  width: 30px;
  height: 5px;
  background: var(--grad);
  box-shadow: inset -2px -2px 0 var(--bevel-dark), inset 2px 2px 0 var(--bevel-light);
}

/* ── Boutons ────────────────────────────────────────── */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 30px;
  border-radius: 8px;
  font-family: var(--font);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s, border-color .25s, background .25s;
  will-change: transform;
}
.btn svg { transition: transform .25s; }

.btn-primary {
  background: var(--grad);
  color: #1c0d02;
  box-shadow:
    inset -4px -4px 0 var(--bevel-dark),
    inset 4px 4px 0 var(--bevel-light),
    0 10px 34px -8px rgba(255, 122, 26, .55);
}
.btn-primary:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow:
    inset -4px -4px 0 var(--bevel-dark),
    inset 4px 4px 0 var(--bevel-light),
    0 18px 44px -8px rgba(255, 140, 26, .72);
}
.btn-primary:hover svg { transform: translateX(3px); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-ghost {
  background: var(--surface);
  border: 1px solid var(--border-2);
  color: var(--text);
  backdrop-filter: blur(8px);
  box-shadow: inset -3px -3px 0 rgba(0, 0, 0, .35), inset 3px 3px 0 rgba(255, 255, 255, .08);
}
.btn-ghost:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 148, 43, .75);
  background: var(--surface-2);
  box-shadow:
    inset -3px -3px 0 rgba(0, 0, 0, .35),
    inset 3px 3px 0 rgba(255, 255, 255, .08),
    0 14px 34px -14px rgba(255, 122, 26, .38);
}

.btn-sm { padding: 10px 16px; font-size: .68rem; }

/* ── Barre de navigation ────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 clamp(16px, 4vw, 40px);
  border-bottom: 1px solid transparent;
  transition: background .35s, border-color .35s, backdrop-filter .35s;
}
.nav.scrolled {
  background: rgba(11, 7, 3, .82);
  backdrop-filter: blur(16px);
  border-bottom-color: var(--border);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  flex-shrink: 0;
}
.brand-logo {
  width: 34px; height: 34px;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 14px rgba(255, 122, 26, .45));
}
.logo-text {
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.logo-text em { font-style: normal; color: transparent;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

/* Sélecteur de mode */
.mode-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 5px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  transition: color .2s, background .2s;
}
.mode-btn:hover { color: var(--text); }
.mode-btn.active {
  color: #1c0d02;
  background: var(--grad);
  box-shadow: inset -2px -2px 0 var(--bevel-dark), inset 2px 2px 0 var(--bevel-light);
}
.mode-dot {
  width: 7px; height: 7px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: inset -1px -1px 0 rgba(0,0,0,.35);
  flex-shrink: 0;
}
.mode-dot-mc { background: var(--amber); }
.mode-btn.active .mode-dot { background: #1c0d02; box-shadow: none; }

.nav-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 2px;
  background: var(--muted);
  flex-shrink: 0;
}
.status-pill.ok .status-dot { background: #6ee27a; box-shadow: 0 0 10px rgba(110, 226, 122, .8); }
.status-pill.busy .status-dot { background: var(--amber); animation: pulse 1s ease-in-out infinite; }
.status-pill.error .status-dot { background: #ff5a4a; box-shadow: 0 0 10px rgba(255, 90, 74, .8); }
@keyframes pulse { 50% { opacity: .25; } }

/* Sélecteur de langue */
.lang-switcher { position: relative; flex-shrink: 0; }

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color .2s, border-color .2s, background .2s;
}
.lang-toggle:hover { color: var(--text); border-color: var(--border-2); background: var(--surface-2); }
.lang-flag { font-size: .95rem; line-height: 1; }
.lang-caret { opacity: .7; transition: transform .2s; }
.lang-switcher.open .lang-caret { transform: rotate(180deg); }

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 120;
  min-width: 170px;
  padding: 6px;
  border: 1px solid var(--border-2);
  border-radius: 10px;
  background: rgba(21, 13, 5, .96);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  animation: fadeUp .18s ease both;
}
.lang-menu[hidden] { display: none; }

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border-radius: 7px;
  color: var(--muted);
  font-size: .84rem;
  font-weight: 600;
  text-align: left;
  transition: background .18s, color .18s;
}
.lang-option:hover { background: var(--surface-2); color: var(--text); }
.lang-option[aria-selected="true"] { color: var(--accent-2); }
.lang-option .lang-check { margin-left: auto; color: var(--accent); opacity: 0; }
.lang-option[aria-selected="true"] .lang-check { opacity: 1; }

/* ── Contenu principal ──────────────────────────────── */
main {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: calc(var(--nav-h) + 56px) clamp(18px, 4vw, 40px) 40px;
}

/* Accueil */
.welcome { text-align: center; animation: fadeUp .8s cubic-bezier(.2,.8,.2,1) both; }

.hero-title {
  margin: 26px 0 22px;
  font-size: clamp(2rem, 6vw, 3.4rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -.03em;
  text-transform: uppercase;
}
.hero-title .l1 {
  display: block;
  animation: fadeUp 1s cubic-bezier(.2,.8,.2,1) both;
  animation-delay: .12s;
  text-shadow: 4px 4px 0 rgba(255, 94, 26, .28);
}
.hero-title .l2 {
  display: block;
  animation: fadeUp 1s cubic-bezier(.2,.8,.2,1) both;
  animation-delay: .22s;
  filter: drop-shadow(0 10px 26px rgba(255, 122, 26, .35));
}

.hero-sub {
  max-width: 560px;
  margin: 0 auto;
  color: var(--muted);
  font-size: clamp(1rem, 1.6vw, 1.1rem);
  animation: fadeUp 1s .36s both;
}
.hero-sub strong { color: var(--text); font-weight: 700; }

/* Suggestions (cartes « crafting frame ») */
.suggestions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  max-width: 760px;
  margin: 46px auto 0;
  text-align: left;
  animation: fadeUp 1s .5s both;
}

.suggestion {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 22px;
  border-radius: var(--radius);
  background: linear-gradient(165deg, var(--surface-2), rgba(255,148,43,.015));
  border: 1px solid var(--border);
  color: var(--text);
  font-size: .9rem;
  text-align: left;
  transform-style: preserve-3d;
  transition: border-color .35s, box-shadow .35s, transform .2s ease-out;
  will-change: transform;
}
.suggestion:hover {
  border-color: rgba(255, 148, 43, .5);
  box-shadow: 0 30px 70px -22px rgba(255, 122, 26, .32), var(--shadow);
}
.suggestion::before,
.suggestion::after {
  content: "";
  position: absolute;
  width: 18px; height: 18px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .35s;
}
.suggestion::before { top: 10px; left: 10px; border-top: 3px solid var(--accent); border-left: 3px solid var(--accent); }
.suggestion::after { bottom: 10px; right: 10px; border-bottom: 3px solid var(--accent); border-right: 3px solid var(--accent); }
.suggestion:hover::before,
.suggestion:hover::after { opacity: 1; }

.suggestion-icon {
  width: 12px; height: 12px;
  flex-shrink: 0;
  background: var(--grad);
  box-shadow: inset -3px -3px 0 var(--bevel-dark), inset 3px 3px 0 var(--bevel-light), 3px 3px 0 rgba(255, 94, 26, .3);
}

.suggestion-arrow { color: var(--accent-2); margin-left: auto; flex-shrink: 0; transition: transform .25s; }
.suggestion:hover .suggestion-arrow { transform: translateX(5px); }

/* ── Conversation ───────────────────────────────────── */
.chat { display: flex; flex-direction: column; gap: 26px; }

.msg { display: flex; gap: 14px; animation: fadeUp .5s cubic-bezier(.2,.8,.2,1) both; }
.msg.user { flex-direction: row-reverse; }

.msg-avatar {
  width: 40px; height: 40px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 6px;
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .04em;
  background: var(--grad-soft);
  border: 1px solid var(--border);
  box-shadow: inset -3px -3px 0 rgba(20, 8, 0, .25), inset 3px 3px 0 rgba(255, 255, 255, .1);
}
.msg.user .msg-avatar {
  background: var(--grad);
  color: #1c0d02;
  box-shadow: inset -3px -3px 0 var(--bevel-dark), inset 3px 3px 0 var(--bevel-light);
}

.msg-body { min-width: 0; flex: 1; max-width: 100%; }
.msg.user .msg-body { flex: 0 1 auto; max-width: 86%; }

.msg-role {
  font-size: .66rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 8px;
}
.msg.user .msg-role { text-align: right; color: var(--muted); }

.msg-content {
  position: relative;
  padding: 18px 22px;
  border-radius: var(--radius);
  background: linear-gradient(165deg, var(--surface-2), rgba(255,148,43,.015));
  border: 1px solid var(--border);
  font-size: .95rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.msg.user .msg-content {
  background: var(--grad-soft);
  border-color: var(--border-2);
}
.msg-content p { margin: 0 0 12px; }
.msg-content p:last-child { margin-bottom: 0; }
.msg-content ul { margin: 0 0 12px; padding-left: 4px; }
.msg-content li { position: relative; padding-left: 20px; margin-bottom: 6px; }
.msg-content li::before {
  content: "";
  position: absolute;
  left: 0; top: .62em;
  width: 8px; height: 8px;
  background: var(--grad);
  box-shadow: inset -2px -2px 0 var(--bevel-dark), inset 2px 2px 0 var(--bevel-light);
}
.msg-content strong { color: #fff; font-weight: 700; }
.msg-content code {
  font-family: var(--mono);
  font-size: .85em;
  background: rgba(255, 148, 43, .12);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: .08em .38em;
  color: var(--accent-2);
}
.msg-content pre {
  margin: 0 0 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: rgba(11, 7, 3, .72);
  border: 1px solid var(--border);
  overflow-x: auto;
}
.msg-content pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
  font-size: .84rem;
}
.msg-content a { color: var(--accent-2); text-decoration: underline; text-underline-offset: 3px; }

.msg-sources {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.msg-sources-label {
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.source-chip {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--accent-2);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 5px;
  padding: 3px 9px;
  box-shadow: inset -2px -2px 0 rgba(0, 0, 0, .22), inset 2px 2px 0 rgba(255, 255, 255, .05);
}

/* Erreur dans le fil */
.msg-error .msg-content {
  background: rgba(255, 90, 74, .09);
  border-color: rgba(255, 90, 74, .35);
  color: #ffb3aa;
}

/* Indicateur de saisie */
.typing { display: inline-flex; gap: 6px; align-items: center; height: 1.2em; }
.typing span {
  width: 8px; height: 8px;
  border-radius: 2px;
  background: var(--grad);
  box-shadow: inset -2px -2px 0 var(--bevel-dark);
  animation: blink 1.3s infinite both;
}
.typing span:nth-child(2) { animation-delay: .18s; }
.typing span:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%, 80%, 100% { opacity: .22; } 40% { opacity: 1; } }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(26px); }
  to   { opacity: 1; transform: none; }
}

/* ── Barre de saisie ────────────────────────────────── */
.composer-wrap {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 90;
  padding: 18px clamp(18px, 4vw, 40px) 22px;
  background: linear-gradient(to top, var(--bg) 62%, rgba(11, 7, 3, 0));
}
.composer {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px 12px 12px 20px;
  border-radius: 14px;
  background: rgba(21, 13, 5, .88);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border-2);
  box-shadow: var(--shadow), inset -3px -3px 0 rgba(0, 0, 0, .3), inset 3px 3px 0 rgba(255, 255, 255, .05);
  transition: border-color .25s, box-shadow .25s;
}
.composer:focus-within {
  border-color: rgba(255, 148, 43, .7);
  box-shadow: var(--shadow), inset -3px -3px 0 rgba(0, 0, 0, .3), inset 3px 3px 0 rgba(255, 255, 255, .05), 0 0 0 4px rgba(255, 122, 26, .12);
}
.composer textarea {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  resize: none;
  color: var(--text);
  font-family: var(--font);
  font-size: .96rem;
  line-height: 1.6;
  max-height: 180px;
  padding: 8px 0;
}
.composer textarea::placeholder { color: rgba(176, 154, 131, .7); }
.send-btn { padding: 14px; border-radius: 10px; flex-shrink: 0; }

.composer-hint {
  max-width: var(--maxw);
  margin: 12px auto 0;
  text-align: center;
  font-size: .74rem;
  color: rgba(176, 154, 131, .75);
}

/* ── Apparition au scroll ───────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(34px);
  transition: opacity .8s cubic-bezier(.2,.8,.2,1), transform .8s cubic-bezier(.2,.8,.2,1);
}
.reveal.in { opacity: 1; transform: none; }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 900px) {
  .suggestions { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  :root { --nav-h: 64px; }
  .logo-text { display: none; }
  .status-pill { display: none; }
  .nav-actions .btn-sm span { display: none; }
  .nav-actions .btn-sm { padding: 10px 12px; }
  main { padding-top: calc(var(--nav-h) + 32px); }
  .msg.user .msg-body { max-width: 92%; }
  .msg-avatar { width: 34px; height: 34px; font-size: .9rem; }
}

@media (max-width: 480px) {
  .mode-btn { padding: 7px 10px; font-size: .66rem; }
  .mode-btn span:not(.mode-dot) { max-width: 74px; overflow: hidden; text-overflow: ellipsis; }
  .composer { padding-left: 14px; }
  .lang-code { display: none; }
  .lang-toggle { padding: 8px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  html { scroll-behavior: auto; }
}
