:root {
  --ink: #1a2421;
  --muted: #5c6b66;
  --paper: #f3efe6;
  --paper-2: #e8e2d4;
  --teal: #0d5c63;
  --teal-deep: #084248;
  --amber: #c47a2c;
  --ok: #2f6b4f;
  --ko: #9b3a2f;
  --line: rgba(26, 36, 33, 0.12);
  --radius: 14px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Manrope", system-ui, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(13, 92, 99, 0.18), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(196, 122, 44, 0.14), transparent 50%),
    linear-gradient(165deg, #ebe6da 0%, var(--paper) 45%, #dfe8e4 100%);
  line-height: 1.55;
}

.bg-grid {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(13, 92, 99, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(13, 92, 99, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black 0%, transparent 70%);
  z-index: 0;
}

.hero,
main,
.footer {
  position: relative;
  z-index: 1;
}

.hero {
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(3.5rem, 12vw, 6.5rem) 1.5rem 3rem;
  text-align: left;
}

.brand {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 7vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--teal-deep);
  line-height: 1.05;
}

.hero h1 {
  margin: 0 0 1rem;
  font-family: var(--font-body);
  font-size: clamp(1.05rem, 2.5vw, 1.25rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--amber);
}

.lede {
  margin: 0 0 2rem;
  max-width: 34rem;
  font-size: 1.1rem;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  border: 1.5px solid transparent;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--teal);
  color: #f7f4ec;
  border-color: var(--teal);
}

.btn-primary:hover:not(:disabled) {
  background: var(--teal-deep);
  border-color: var(--teal-deep);
}

.btn-ghost {
  background: transparent;
  color: var(--teal-deep);
  border-color: rgba(13, 92, 99, 0.35);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(13, 92, 99, 0.08);
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.section {
  padding: 1.75rem 1.5rem;
  background: rgba(247, 244, 236, 0.72);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(6px);
}

.section h2 {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--teal-deep);
}

.section-intro {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 0.98rem;
}

.resource-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  background: var(--paper-2);
  border-radius: 12px;
  margin-bottom: 1.25rem;
}

.file-name {
  display: block;
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
}

.file-hint {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.dashboard-preview {
  display: block;
  position: relative;
  margin: 0 0 1.25rem;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0b1628;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dashboard-preview:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(8, 66, 72, 0.18);
}

.dashboard-preview img {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
}

.dashboard-preview-label {
  display: block;
  padding: 0.65rem 1rem;
  background: rgba(247, 244, 236, 0.95);
  color: var(--teal-deep);
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
}

.steps {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.steps li + li {
  margin-top: 0.35rem;
}

.steps code {
  font-size: 0.88em;
  background: var(--paper-2);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.quiz-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .quiz-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 960px) {
  .quiz-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.quiz-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.15rem 1.1rem;
  background: var(--paper-2);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.quiz-card:hover {
  border-color: rgba(13, 92, 99, 0.4);
  transform: translateY(-2px);
}

.quiz-card.active {
  border-color: var(--teal);
  background: rgba(13, 92, 99, 0.08);
}

.quiz-card-label {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--amber);
}

.quiz-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--teal-deep);
}

.quiz-card p {
  margin: 0 0 0.5rem;
  flex: 1;
  font-size: 0.9rem;
  color: var(--muted);
}

.quiz-card .btn {
  align-self: flex-start;
}

.qcm-head {
  margin-bottom: 1.25rem;
}

.progress {
  height: 6px;
  background: rgba(13, 92, 99, 0.12);
  border-radius: 99px;
  overflow: hidden;
  margin: 1rem 0 0.5rem;
}

.progress-bar {
  height: 100%;
  width: 10%;
  background: linear-gradient(90deg, var(--teal), #1a8a8f);
  border-radius: 99px;
  transition: width 0.35s ease;
}

.progress-label {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--teal);
  letter-spacing: 0.02em;
}

.question-text {
  margin: 0 0 1.25rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--ink);
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: start;
  width: 100%;
  text-align: left;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #faf7f0;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.95rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.choice:hover {
  border-color: rgba(13, 92, 99, 0.45);
  background: #fff;
}

.choice:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.choice.selected {
  border-color: var(--teal);
  background: rgba(13, 92, 99, 0.08);
}

.choice.is-correct {
  border-color: #2f7d4a;
  background: rgba(47, 125, 74, 0.12);
}

.choice.is-correct .choice-key {
  background: #2f7d4a;
  color: #f7f4ec;
}

.choice.is-wrong {
  border-color: #b33a3a;
  background: rgba(179, 58, 58, 0.1);
}

.choice.is-wrong .choice-key {
  background: #b33a3a;
  color: #f7f4ec;
}

.answer-feedback {
  margin: 1rem 0 0;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.98rem;
  line-height: 1.45;
}

.answer-feedback.ok {
  color: #1f5c35;
  background: rgba(47, 125, 74, 0.14);
  border: 1px solid rgba(47, 125, 74, 0.35);
}

.answer-feedback.ko {
  color: #8a2a2a;
  background: rgba(179, 58, 58, 0.12);
  border: 1px solid rgba(179, 58, 58, 0.3);
  font-weight: 600;
}

.choice-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: rgba(13, 92, 99, 0.12);
  color: var(--teal-deep);
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.choice.selected .choice-key {
  background: var(--teal);
  color: #f7f4ec;
}

.quiz-nav {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.5rem;
  align-items: center;
}

.quiz-nav-right {
  display: flex;
  gap: 0.65rem;
  margin-left: auto;
}

.choice.locked {
  cursor: default;
}

.choice.locked:hover {
  border-color: var(--line);
  background: #faf7f0;
}

.choice.locked.is-correct:hover {
  border-color: #2f7d4a;
  background: rgba(47, 125, 74, 0.12);
}

.choice.locked.is-wrong:hover {
  border-color: #b33a3a;
  background: rgba(179, 58, 58, 0.1);
}

.choice:disabled {
  opacity: 1;
}

.result-panel {
  text-align: center;
}

.score-label {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
}

.score-value {
  margin: 0.35rem 0 0.5rem;
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 700;
  color: var(--teal-deep);
  line-height: 1;
}

.score-message {
  margin: 0 0 1.5rem;
  color: var(--muted);
}

.review {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1.5rem;
}

.review-item {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #faf7f0;
  font-size: 0.9rem;
}

.review-item.ok {
  border-color: rgba(47, 107, 79, 0.35);
  background: rgba(47, 107, 79, 0.08);
}

.review-item.ko {
  border-color: rgba(155, 58, 47, 0.3);
  background: rgba(155, 58, 47, 0.07);
}

.review-item strong {
  display: block;
  margin-bottom: 0.25rem;
}

.review-hint {
  color: var(--muted);
  font-size: 0.85rem;
}

.footer {
  text-align: center;
  padding: 0 1.5rem 2.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.footer p {
  margin: 0;
}

@media (max-width: 520px) {
  .section {
    padding: 1.35rem 1.1rem;
  }

  .resource-row {
    flex-direction: column;
    align-items: stretch;
  }

  .resource-row .btn {
    width: 100%;
  }
}

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

.hero,
.section {
  animation: fadeUp 0.55s ease both;
}

.section:nth-of-type(2) {
  animation-delay: 0.08s;
}

.section:nth-of-type(3) {
  animation-delay: 0.14s;
}

/* ——— Fiches de révision (HTML) ——— */

.fiche-nav {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  max-width: 760px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 0;
}

.fiche-nav-links {
  display: flex;
  gap: 0.4rem;
}

.fiche-nav-links a[aria-current="page"] {
  background: rgba(13, 92, 99, 0.12);
  border-color: var(--teal);
  color: var(--teal-deep);
}

.fiche-hero {
  padding-top: 2rem;
  padding-bottom: 1.5rem;
}

.fiche-main {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

.fiche-content h2 {
  margin: 1.75rem 0 0.65rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--teal-deep);
  letter-spacing: -0.02em;
}

.fiche-content h2:first-child {
  margin-top: 0;
}

.fiche-content ul {
  margin: 0.4rem 0 0.8rem;
  padding-left: 1.2rem;
  color: var(--ink);
}

.fiche-content li + li {
  margin-top: 0.3rem;
}

.fiche-content p {
  margin: 0.5rem 0;
}

.fiche-content code {
  font-size: 0.88em;
  background: var(--paper-2);
  padding: 0.12em 0.35em;
  border-radius: 4px;
}

.fiche-content pre {
  margin: 0.75rem 0 1.1rem;
  padding: 1rem 1.1rem;
  background: #1a2e2c;
  color: #e8f0ee;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.5;
}

.fiche-content pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.table-wrap {
  overflow-x: auto;
  margin: 0.75rem 0 1.1rem;
}

.fiche-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.fiche-content th,
.fiche-content td {
  padding: 0.55rem 0.7rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.fiche-content th {
  font-weight: 700;
  color: var(--teal-deep);
  background: rgba(13, 92, 99, 0.06);
}

.callout {
  margin: 0.85rem 0 1.1rem !important;
  padding: 0.75rem 1rem;
  background: rgba(196, 122, 44, 0.12);
  border-left: 3px solid var(--amber);
  border-radius: 0 8px 8px 0;
  color: var(--ink);
  font-size: 0.95rem;
}

.checklist {
  list-style: none;
  padding-left: 0 !important;
}

.checklist label {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  cursor: pointer;
}

.checklist input {
  margin-top: 0.3rem;
  accent-color: var(--teal);
  flex-shrink: 0;
}

.fiche-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.fiche-cta p {
  margin: 0 !important;
  color: var(--muted);
  font-weight: 500;
}

.footer a {
  color: var(--teal-deep);
  font-weight: 600;
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

.resource-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ——— Exercices pratiques ——— */

.exo-card {
  margin: 0 0 1.75rem;
  padding: 1.25rem 1.35rem 1.35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(250, 247, 240, 0.65);
}

.exo-card + .exo-card {
  margin-top: 1.5rem;
}

.exo-label {
  margin: 0 0 0.35rem !important;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--amber);
}

.exo-card h2 {
  margin-top: 0 !important;
}

.exo-card h3 {
  margin: 1.1rem 0 0.45rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--teal-deep);
}

.exo-solution {
  margin-top: 1.15rem;
  border: 1px solid rgba(13, 92, 99, 0.2);
  border-radius: 10px;
  background: rgba(13, 92, 99, 0.05);
  overflow: hidden;
}

.exo-solution summary {
  cursor: pointer;
  list-style: none;
  padding: 0.85rem 1rem;
  font-weight: 600;
  color: var(--teal-deep);
  user-select: none;
}

.exo-solution summary::-webkit-details-marker {
  display: none;
}

.exo-solution summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform 0.15s ease;
}

.exo-solution[open] summary::before {
  transform: rotate(90deg);
}

.exo-solution-body {
  padding: 0 1rem 1rem;
  border-top: 1px solid rgba(13, 92, 99, 0.12);
}

.exo-solution-body > :first-child {
  margin-top: 0.85rem;
}

@media (max-width: 640px) {
  .fiche-nav {
    flex-direction: column;
    align-items: stretch;
  }

  .fiche-nav .btn {
    justify-content: center;
  }

  .fiche-nav-links {
    justify-content: center;
  }

  .fiche-cta {
    flex-direction: column;
    align-items: stretch;
  }

  .fiche-cta .btn {
    width: 100%;
  }

  .resource-actions {
    width: 100%;
  }

  .resource-actions .btn {
    flex: 1;
    justify-content: center;
  }
}
