/* Charte du site de l'association : voir research.md, R14.
   Signature : l'étoile à huit branches, deux carrés superposés, comme les angles droits de la charte. */
@font-face {
  font-family: "PT Sans";
  src: url("fonts/pt-sans-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "PT Sans";
  src: url("fonts/pt-sans-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --bleu: #213b88;
  --ardoise: #37373f;
  --encre: #27272b;
  --filet: #dbdbdf;
  --turquoise: #72cfd5;
  --motif: url("motif.svg");
}

* { box-sizing: border-box; border-radius: 0; }

body {
  margin: 0;
  background: #ffffff;
  color: var(--encre);
  font: 400 1.0625rem/1.625 "PT Sans", sans-serif;
}

a { color: var(--bleu); }
a:hover { color: var(--ardoise); }
:focus-visible { outline: 3px solid var(--ardoise); outline-offset: 2px; }

/* Bandeau : le motif s'efface vers le texte, pour rester lisible. */

header {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem 1rem;
  color: #ffffff;
  background: linear-gradient(to left, transparent, var(--bleu) 70%), var(--motif) right center / 56px, var(--bleu);
  border-bottom: 4px solid var(--turquoise);
}
header img { width: 48px; height: auto; display: block; flex: none; }
h1 { margin: 0; font-size: 1.25rem; font-weight: 700; line-height: 1.2; }
.schedule { margin: 0.125rem 0 0; font-size: 0.875rem; line-height: 1.35; white-space: pre-line; }

main { max-width: 40rem; margin: 0 auto; padding: 1.25rem 1rem 2rem; }

/* Discussion : seule la question en cours ressort. */

.message { margin: 0 0 0.75rem; overflow-wrap: anywhere; }
.message p { margin: 0 0 0.5rem; white-space: pre-line; }
.message p:last-child { margin-bottom: 0; }

.message.past { color: var(--ardoise); font-size: 0.9375rem; line-height: 1.5; }
.message.past .question { font-weight: 400; color: inherit; font-size: inherit; }

.message.current { margin: 1rem 0 1.25rem; animation: arrive 180ms ease-out; }
.question {
  display: block;
  margin-top: 0.5rem;
  color: var(--bleu);
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.3;
}
p > .question:first-child { margin-top: 0; }

.message.user {
  width: fit-content;
  max-width: 85%;
  margin-left: auto;
  padding-right: 0.75rem;
  border-right: 3px solid var(--bleu);
  color: var(--bleu);
  font-size: 0.9375rem;
  font-weight: 700;
  text-align: right;
}

@keyframes arrive {
  from { opacity: 0; transform: translateY(0.375rem); }
}
@media (prefers-reduced-motion: reduce) {
  .message.current { animation: none; }
}

/* Fiche de rendez-vous : encadrée à confirmer, pleine une fois enregistrée. */

.card { margin: 0.5rem 0; padding: 1rem 1.125rem; border: 2px solid var(--bleu); }
.message.past .card { padding: 0.5rem 0.75rem; border: 1px solid var(--filet); }
.card dl { margin: 0; }
.card dl > div { padding: 0.375rem 0; border-top: 1px solid var(--filet); }
.card dl > div:first-child { border-top: 0; }
.card dt { color: var(--bleu); font-size: 0.875rem; font-weight: 700; line-height: 1.3; }
.card dd { margin: 0; font-weight: 700; line-height: 1.35; }
.message.past .card dt, .message.past .card dd { color: inherit; font-weight: 400; }

.message.finished:has(.card) > p:first-child {
  color: var(--bleu);
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.3;
}

.card.done {
  padding: 1.25rem 1.25rem 1.5rem;
  color: #ffffff;
  background: linear-gradient(to left, transparent, var(--bleu) 75%), var(--motif) right center / 72px, var(--bleu);
  border-color: var(--bleu);
  border-bottom: 4px solid var(--turquoise);
}
.card.done dt { color: #ffffff; font-weight: 400; }
.card.done dl > div { border-top-color: rgb(255 255 255 / 0.28); }

/* Réponses : un seul bouton principal par étape, zones de toucher généreuses. */

button {
  min-height: 3rem;
  padding: 0.5rem 1.25rem;
  border: 2px solid var(--bleu);
  background: var(--bleu);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  line-height: 1.25;
  cursor: pointer;
}
button:hover:not(:disabled) { background: var(--ardoise); border-color: var(--ardoise); }
button:disabled { opacity: 0.55; cursor: default; }

button.secondary { background: #ffffff; color: var(--bleu); }
button.secondary:hover:not(:disabled) { background: var(--bleu); border-color: var(--bleu); color: #ffffff; }

button.link {
  min-height: 2.75rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--bleu);
  font-weight: 400;
  text-decoration: underline;
}
button.link:hover:not(:disabled) { background: none; color: var(--ardoise); }

.answer { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.5rem; }
.answer > button { grid-column: span 6; }
.answer > button.third { grid-column: span 2; }
.answer > button.half { grid-column: span 3; }
.answer form { grid-column: span 6; display: flex; gap: 0.5rem; }
.answer form input { flex: 1; min-width: 0; }
.answer form + button { margin-top: 0.25rem; }

input {
  width: 100%;
  min-height: 3rem;
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--ardoise);
  background: #ffffff;
  color: inherit;
  font: inherit;
}

.restart { margin: 1rem 0 0; }

.notice {
  margin: 1.5rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--filet);
  color: var(--ardoise);
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Sur grand écran, le bandeau devient une colonne fixe où l'étoile prend toute sa place. */

@media (min-width: 60rem) {
  body.chat { display: grid; grid-template-columns: minmax(20rem, 26rem) 1fr; min-height: 100vh; }
  body.chat header {
    position: sticky;
    top: 0;
    height: 100vh;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 1.25rem;
    padding: 2.5rem;
    background: linear-gradient(to top, var(--bleu) 42%, transparent), var(--motif) center top / 120px, var(--bleu);
    border-bottom: 0;
    border-right: 4px solid var(--turquoise);
  }
  body.chat header img { width: 88px; }
  body.chat h1 { font-size: 2.5rem; line-height: 1.1; }
  body.chat .schedule { font-size: 1.0625rem; line-height: 1.5; }
  body.chat main { width: 100%; padding: 3rem 2rem; }
}

/* Espace protégé */

body.admin main { max-width: 60rem; }
.toolbar { display: flex; justify-content: flex-end; }

.saturday { padding: 1rem 0; border-top: 2px solid var(--bleu); }
.saturday.closed { border-top-color: var(--filet); }
.saturday-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; }
h2 { margin: 0; color: var(--bleu); font-size: 1.25rem; line-height: 1.3; }
.saturday.closed h2 { color: var(--ardoise); }
.count { margin: 0; color: var(--ardoise); font-size: 0.9375rem; }

table { width: 100%; margin-top: 0.75rem; border-collapse: collapse; font-size: 1rem; }
th, td { padding: 0.5rem; border-bottom: 1px solid var(--filet); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
th { color: var(--bleu); font-size: 0.875rem; }
td:first-child { font-weight: 700; white-space: nowrap; }
td.action { text-align: right; }
tr.slot-free td, tr.slot-closed td { color: var(--ardoise); }
tr.slot-closed td:nth-child(2) { color: var(--bleu); font-weight: 700; }
details { margin-top: 0.5rem; }
summary {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  color: var(--bleu);
  cursor: pointer;
  text-decoration: underline;
}
details[open] summary { text-decoration: none; font-weight: 700; }
button.compact { min-height: 2.25rem; padding: 0.25rem 0.75rem; font-size: 0.9375rem; white-space: nowrap; }

.warning { margin: 0.75rem 0; padding: 0.75rem 1rem; border: 2px solid var(--bleu); }
.warning ul { margin: 0.5rem 0 0; padding-left: 1.25rem; }

#login { max-width: 24rem; }
#login label { display: block; margin-bottom: 0.25rem; font-weight: 700; }
#login button { margin-top: 0.75rem; }

@media (max-width: 40rem) {
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table, tbody, tr, td { display: block; width: 100%; }
  tr { padding: 0.5rem 0; border-top: 1px solid var(--filet); }
  td { padding: 0.125rem 0; border: 0; white-space: normal; }
  td:first-child { white-space: normal; color: var(--bleu); font-size: 1.125rem; }
  td:not(:first-child)::before { content: attr(data-label) " : "; color: var(--ardoise); font-size: 0.875rem; }
  td:empty, td.action::before { display: none; }
  td.action { text-align: left; padding-top: 0.375rem; }
}
