html { scroll-behavior: smooth; }
:root {
  --brand: #724ae8;
  --bg-dark: #111;
}

body { font-size: 16px; }

#accueil {
  background-image: url('img/baldursbackgorund.webp');
  background-size: cover;
  background-position: center;
  min-height: 850px;
  display: grid;
  place-items: center;
}

h1 { min-height: 600px; display: grid; place-items: center; }

#back-to-top {
  text-decoration: none;
  position: fixed;
  bottom: 16px;
  right: 16px;
  background-color: #000;
  border-radius: 50%;
  padding: 8px;
  z-index: 10;
}

#back-to-top img { width: 40px; height: 40px; display: block; }

#reseaux img { width: 50px; height: 50px; object-fit: cover; }

/* Chatbot */
.chatbot-toggler {
  position: fixed;
  right: 20px;
  bottom: 73px;
  height: 50px;
  width: 50px;
  color: #fff;
  border: none;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background-color: var(--brand);
  border-radius: 50%;
  transition: transform 0.2s ease, opacity 0.2s ease;
  z-index: 1000;
}

.chatbot-toggler span { position: absolute; }

.show-chatbot .chatbot-toggler { transform: rotate(90deg); }

.show-chatbot .chatbot-toggler span:first-child { opacity: 0; }
.show-chatbot .chatbot-toggler span:last-child { opacity: 1; }

.chatbot {
  position: fixed;
  right: 40px;
  bottom: 150px;
  width: 420px;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  background-color: #fff;
  border-radius: 15px;
  transform-origin: bottom right;
  box-shadow: 0 12px 32px rgba(0,0,0,.2);
  transition: opacity 0.12s ease, transform 0.12s ease;
  z-index: 999;
}

.show-chatbot .chatbot {
  opacity: 1;
  pointer-events: auto;
}

.chatbot header {
  background: var(--brand);
  padding: 16px 0;
  text-align: center;
  position: relative;
}

.chatbot header span.close-btn {
  position: absolute;
  right: 20px;
  top: 50%;
  display: block;
  color: #fff;
  cursor: pointer;
  transform: translateY(-50%);
}

.chatbot header h2 { color: #fff; font-size: 1.2rem; margin: 0; }

.chatbot .chatbox {
  height: 510px;
  overflow-y: auto;
  padding: 30px 20px 100px;
}

.chatbot .chat { display: flex; align-items: flex-end; }

.chatbot .incoming span {
  height: 32px; width: 32px;
  align-self: flex-end;
  background-color: var(--brand);
  color: #fff;
  text-align: center;
  line-height: 32px;
  border-radius: 4px;
  margin: 0 10px 7px 0;
}

.chatbot .outgoing { margin: 20px 0; justify-content: flex-end; }

.chatbot .chat p {
  color: #fff;
  max-width: 75%;
  white-space: pre-wrap;
  font-size: 0.95rem;
  padding: 12px 16px;
  border-radius: 10px 10px 0 10px;
  background: var(--brand);
  margin: 0;
}

.chatbot .incoming p {
  color: #000;
  background: #f2f2f2;
  border-radius: 10px 10px 10px 0;
}

.chatbot .chat-input {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  width: 100%;
  gap: 5px;
  display: flex;
  background: #fff;
  padding: 5px 20px;
  border-top: 1px solid #ccc;
}

.chat-input textarea {
  height: 55px;
  width: 100%;
  border: none;
  outline: none;
  max-height: 180px;
  font-size: 0.95rem;
  resize: none;
  padding: 16px 15px 16px 0;
}

.chat-input span {
  align-self: flex-end;
  height: 55px;
  line-height: 55px;
  color: var(--brand);
  font-size: 1.35rem;
  cursor: pointer;
  visibility: hidden;
}

.chat-input textarea:valid ~ span { visibility: visible; }

/* Accessibilité & préférences */
.visually-hidden {
  position: absolute !important;
  clip: rect(1px, 1px, 1px, 1px);
  padding: 0 !important; border: 0 !important; height: 1px !important; width: 1px !important; overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

@media (max-width: 460px) {
  .table>:not(caption)>*>* { padding: 0.25rem; }

  .chatbot {
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }

  .chatbot .chatbox { height: calc(100% - 110px); }
}
