/* ====== RESET & BASICS ====== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background: #ede8d0;
  color: #2b1114;
  overflow-x: hidden;

  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a {
  color: #2b1114;
}

/* ====== NAVIGATION MENU ====== */
header {
  width: 100%;
}

nav ul.menu {
  list-style: none;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  background: #aea77b;
}

nav ul.menu li {
  position: relative;
}

nav a {
  display: block;
  color: whitesmoke;
  padding: 14px 16px;
  text-decoration: none;
  transition: background-color 0.3s;
}

nav a:hover,
nav a:focus-visible {
  background-color: #d39a1c;
  outline: none;
}

/* Icon + text only for the Accueil link */
nav a.nav-home {
  display: inline-flex; /* overrides nav a { display: block } */
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
}

nav a.nav-home .nav-icon {
  width: 1em;
  height: 1em;
  fill: currentColor; /* monochrome, matches link color */
  opacity: 0.95;
  transform: translateY(-1px);
}

.submenu-toggle {
  display: block;
  color: whitesmoke;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.3s;
}

.submenu-toggle:hover,
.submenu-toggle:focus-visible {
  background-color: #d39a1c;
  outline: none;
}

/* Submenu (desktop: hover) */
.submenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;

  background: rgba(115, 129, 102, 0.858);
  border-radius: 0 0 8px 8px;
  min-width: 180px;
  list-style: none;
  z-index: 10;

  flex-direction: column;
}

.has-submenu:hover .submenu {
  display: flex;
}

/* Submenu (mobile/touch: checkbox toggle) */
.has-submenu input[type="checkbox"]:checked + .submenu {
  display: flex;
}

.submenu a {
  padding: 10px 16px;
  text-align: left;
  white-space: nowrap;
}

/* ====== MAIN CONTENT WRAPPER ====== */
.brand {
  width: 100%;
  max-width: 900px;
  display: flex;
  justify-content: center;
  margin-top: 6px;
}

.logo {
  width: min(220px, 60vw);
  height: auto;
  display: block;
}

.main-content {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;

  padding: 20px 16px 40px;
}

/* ====== INTRO TEXT ====== */
.intro-text {
  width: 100%;
  max-width: 900px;
  padding: 25px 40px;

  line-height: 1.45;
  font-size: 1rem;
  text-align: justify;
}

/* ====== VIDEO + CHAPTERS ====== */
.video-container {
  width: 100%;
  max-width: 820px;

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

video {
  width: 100%;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

/* ====== CHAPTERS HELP TEXT  ====== */
.chapters-help {
  grid-column: 1 / -1;
  margin: 2px 0 6px;
  padding: 10px 12px;

  font-size: 0.95rem;
  line-height: 1.35;

  border-radius: 10px;

  text-align: left;
}

/* Chapters buttons container */
.chapters {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  align-items: start;
}

/* Buttons fill the cell */
.chapters .btn {
  width: 100%;
  min-height: 44px;
  border-radius: 10px;
  padding: 12px 12px;
  font-size: 0.98rem;
  line-height: 1.2;
}

/* Tablet */
@media (max-width: 900px) {
  .chapters {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile */
@media (max-width: 600px) {
  .chapters {
    grid-template-columns: 1fr;
  }
}

/* ====== BUTTONS  ====== */
.btn {
  background-color: #aea77b;
  color: whitesmoke;
  border: none;

  padding: 12px 14px;
  font-size: 1rem;
  border-radius: 10px;
  cursor: pointer;

  transition:
    background-color 0.3s,
    transform 0.05s;
}

.btn:hover,
.btn:focus-visible {
  background-color: #d39a1c;
  outline: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn.secondary {
  background-color: rgba(43, 17, 20, 0.15);
  color: #2b1114;
}

.btn.secondary:hover,
.btn.secondary:focus-visible {
  background-color: rgba(43, 17, 20, 0.22);
}

/* ====== MODAL (QCM) ====== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 18px;
  z-index: 1000;
}

/* When aria-hidden is true, hide it (to match HTML attribute) */
.modal-backdrop[aria-hidden="true"] {
  display: none;
}

.modal {
  width: 100%;
  max-width: 720px;
  background: rgba(255, 254, 250, 0.98);
  border-radius: 14px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  padding: 18px 18px 16px;

  position: relative;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 10px;

  width: 42px;
  height: 42px;
  border-radius: 999px;

  border: none;
  cursor: pointer;
  font-size: 1.1rem;

  background: rgba(43, 17, 20, 0.12);
  color: #2b1114;
}

.close-btn:hover,
.close-btn:focus-visible {
  background: rgba(43, 17, 20, 0.2);
  outline: none;
}

.close-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.modal-title {
  padding-right: 54px;
  margin-bottom: 10px;
  font-size: 1.3rem;
}

.question {
  margin: 10px 0 14px;
  line-height: 1.45;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.hint {
  font-size: 0.9rem;
  opacity: 0.85;
}

.feedback {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(43, 17, 20, 0.15);
  min-height: 1.2em;
}

/* ====== QCM readability upgrades ====== */

/* prompt */
.prompt {
  text-align: left;
  margin-bottom: 8px;
}

/* italic hint for checkbox questions */
.qcm-hint {
  text-align: left;
  margin: 0 0 10px;
  font-size: 0.95rem;
  opacity: 0.9;
}

/* choices list */
.choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

/* each choice as a big clickable row */
.choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;

  padding: 10px 12px;
  border-radius: 10px;

  background: rgba(43, 17, 20, 0.06);
  border: 1px solid rgba(43, 17, 20, 0.1);

  cursor: pointer;
}

/* hover/focus feedback */
.choice:hover {
  background: rgba(43, 17, 20, 0.09);
}

.choice:focus-within {
  outline: 2px solid rgba(211, 154, 28, 0.9);
  outline-offset: 2px;
}

/* align checkbox/radio nicely */
.choice input {
  margin-top: 2px; /* aligns with first line of text */
  flex: 0 0 auto;
}

/* text block */
.choice span {
  display: block;
  line-height: 1.35;
}

.choice:has(input:checked) {
  background: rgba(211, 154, 28, 0.18);
  border-color: rgba(211, 154, 28, 0.45);
}

/* ====== FOOTER ====== */
footer {
  width: 100%;
  text-align: center;
  font-size: 0.9rem;
  padding: 20px;
  margin-top: auto;
}

footer a {
  color: #2b1114;
  text-decoration: underline;
  transition: color 0.3s;
}

footer a:hover,
footer a:focus-visible {
  color: #ca3504;
  outline: none;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 800px) {
  nav ul.menu {
    flex-direction: column;
    text-align: center;
  }

  nav ul.menu li {
    width: 100%;
  }

  /* On mobile, submenu becomes part of the flow */
  .submenu {
    position: static;
    border-radius: 0;
    min-width: 0;
    width: 100%;
    background: rgba(202, 53, 4, 0.95);
  }

  .submenu a {
    text-align: center;
    padding: 14px 16px;
  }

  .intro-text {
    padding: 18px 16px;
  }

  .chapters {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .btn {
    font-size: 0.98rem;
    padding: 12px;
  }

  .modal {
    padding: 16px 14px 14px;
  }
}
