/* Feuille de style commune à toutes les leçons et fiches du cours. */

:root {
  --bg: #fffff8;
  --fg: #111;
  --muted: #5a5a55;
  --rule: #d8d6c8;
  --accent: #a3341f;
  --code-bg: #f3f1e6;
  --ok: #2e6b33;
  --ok-bg: #e7f2e3;
  --ko: #a3341f;
  --ko-bg: #f8e6e1;
  --card: #fbfaf0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161614;
    --fg: #e9e7dc;
    --muted: #a3a194;
    --rule: #3a3933;
    --accent: #e0846c;
    --code-bg: #23221e;
    --ok: #8fcf8a;
    --ok-bg: #1f2e1d;
    --ko: #ef9a86;
    --ko-bg: #3a201a;
    --card: #1d1d1a;
  }
}

* { box-sizing: border-box; }

html { font-size: 18px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  line-height: 1.6;
}

main {
  max-width: 44rem;
  margin: 0 auto;
  padding: 3rem 1rem 5rem;
}

h1 { font-weight: 400; font-size: 2.1rem; line-height: 1.2; margin: 0 0 .3rem; }
h2 { font-weight: 400; font-style: italic; font-size: 1.45rem; margin: 2.6rem 0 .6rem; }
h3 { font-weight: 600; font-size: 1.05rem; margin: 1.8rem 0 .4rem; }

.subtitle { color: var(--muted); font-style: italic; margin: 0 0 2rem; }

.kicker {
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 .6rem;
}

a { color: var(--accent); text-underline-offset: 2px; }

code, pre {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: .82rem;
}

code { background: var(--code-bg); padding: .05rem .3rem; border-radius: 3px; }

pre {
  background: var(--code-bg);
  padding: 1rem;
  overflow-x: auto;
  line-height: 1.4;
  border-radius: 4px;
}

pre code { background: none; padding: 0; }

.diagram { font-size: .74rem; }

table { border-collapse: collapse; width: 100%; font-size: .88rem; margin: 1rem 0; }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-weight: 600; }

.lead { font-size: 1.12rem; }

.key {
  border-left: 3px solid var(--accent);
  padding: .2rem 0 .2rem 1rem;
  margin: 1.4rem 0;
}

.breaks li { margin-bottom: .5rem; }

.cite { font-size: .8rem; color: var(--muted); }

.source {
  background: var(--card);
  border: 1px solid var(--rule);
  padding: 1rem 1.2rem;
  margin: 2rem 0;
}

.source p { margin: .2rem 0; }

.ask {
  font-style: italic;
  color: var(--muted);
  border-top: 1px solid var(--rule);
  padding-top: 1rem;
  margin-top: 3rem;
}

nav.course {
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: .8rem;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem 1.2rem;
  border-bottom: 1px solid var(--rule);
  padding-bottom: .8rem;
  margin-bottom: 2rem;
}

nav.course .todo { color: var(--muted); }

/* Téléphone : texte plus serré, tableaux qui tiennent dans l'écran. */
@media (max-width: 600px) {
  html { font-size: 16px; }
  main { padding: 1.5rem 1rem 3rem; }
  h1 { font-size: 1.7rem; }
  table { font-size: .8rem; }
  th, td { padding: .35rem .3rem; overflow-wrap: anywhere; }
  nav.course { position: sticky; top: 0; background: var(--bg); padding-top: .6rem; }
}

@media print {
  html { font-size: 11pt; }
  body { background: #fff; color: #000; }
  main { max-width: none; padding: 0; }
  nav.course, .exercise button, .exercise input, .exercise textarea { display: none; }
  .exercise .explain, .exercise .model-answer { display: block !important; }
  pre { white-space: pre-wrap; }
}
