/* The children's mode (src/audience.ts): the same page as the adults', with the same layout, in brighter colours, a
   rounder letter, a larger text, and an icon for each reading. Loaded after styles.css on every page, on only in the
   children's mode (media="all"; public/app.js switches it at once): its tokens take the place of the adults' (the dark
   ones by the same selectors, later). */

:root {
  --bg: #fff6d8;
  --paper: #ffffff;
  --ink: #2b2940;
  --muted: #6a6480;
  --line: #f0dc9e;
  --accent: #e0662f;
  --accent-ink: #b8461a;
  --notes-bg: #eaf5ff;
  --notes-paper: #ffffff;
  --notes-ink: #1f2b4a;
  --notes-muted: #52607e;
  --notes-line: #c2daf2;
  --notes-accent: #2f74c0;
  --tone-first-bg: #e4f0ff;
  --tone-first-line: #a9cbf3;
  --tone-first-ink: #2160a8;
  --tone-psalm-bg: #ddf6e8;
  --tone-psalm-line: #9edbbb;
  --tone-psalm-ink: #1d7a4e;
  --tone-second-bg: #ffeadd;
  --tone-second-line: #f4c4a2;
  --tone-second-ink: #a4501f;
  --tone-gospel-bg: #fff1b8;
  --tone-gospel-line: #f0d36c;
  --tone-gospel-ink: #8a6400;
  /* A letter with round ends, as in the books of children; the device's own, without a download. */
  --rounded:
    ui-rounded, 'SF Pro Rounded', Nunito, Quicksand, 'Varela Round', 'Arial Rounded MT', 'Century Gothic', 'Segoe UI', system-ui, sans-serif;
  --sans: var(--rounded);
  --serif: var(--rounded);
  --radius: 16px;
  /* Larger bands, for the badge of their picture. */
  --band-height: 3.1rem;
  /* The parts of the notes: a soft background, the sticky notes of Le savais-tu, a wrong answer of the quiz. */
  --kid-soft: #e6f2ff;
  --kid-fact: #fff4c2;
  --wrong: #c0392b;
  --wrong-bg: #fde4e0;
}

/* The night. */
:root[data-theme='dark'] {
  --bg: #16192b;
  --paper: #1f2340;
  --ink: #eceaf8;
  --muted: #aaa6c8;
  --line: #343a62;
  --accent: #ffa25c;
  --accent-ink: #ffbd85;
  --notes-bg: #121729;
  --notes-paper: #1a2240;
  --notes-ink: #e2ecff;
  --notes-muted: #a6b5d8;
  --notes-line: #2d3a66;
  --notes-accent: #8cc4ff;
  --tone-first-bg: #1b2a4a;
  --tone-first-line: #34518a;
  --tone-first-ink: #a9cbff;
  --tone-psalm-bg: #15322a;
  --tone-psalm-line: #2a5c4a;
  --tone-psalm-ink: #95e2bd;
  --tone-second-bg: #35241b;
  --tone-second-line: #62432f;
  --tone-second-ink: #f5bf9a;
  --tone-gospel-bg: #352c10;
  --tone-gospel-line: #625120;
  --tone-gospel-ink: #f7d978;
  --kid-soft: #1d2a4d;
  --kid-fact: #3a3216;
  --wrong: #ff8f80;
  --wrong-bg: #45201c;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #16192b;
    --paper: #1f2340;
    --ink: #eceaf8;
    --muted: #aaa6c8;
    --line: #343a62;
    --accent: #ffa25c;
    --accent-ink: #ffbd85;
    --notes-bg: #121729;
    --notes-paper: #1a2240;
    --notes-ink: #e2ecff;
    --notes-muted: #a6b5d8;
    --notes-line: #2d3a66;
    --notes-accent: #8cc4ff;
    --tone-first-bg: #1b2a4a;
    --tone-first-line: #34518a;
    --tone-first-ink: #a9cbff;
    --tone-psalm-bg: #15322a;
    --tone-psalm-line: #2a5c4a;
    --tone-psalm-ink: #95e2bd;
    --tone-second-bg: #35241b;
    --tone-second-line: #62432f;
    --tone-second-ink: #f5bf9a;
    --tone-gospel-bg: #352c10;
    --tone-gospel-line: #625120;
    --tone-gospel-ink: #f7d978;
    --kid-soft: #1d2a4d;
    --kid-fact: #3a3216;
    --wrong: #ff8f80;
    --wrong-bg: #45201c;
  }
}

body {
  font-size: 1.05rem;
}

.brand {
  color: var(--accent-ink);
  font-size: 1.3rem;
  font-weight: 800;
}

.day h1,
.readings-header h2,
.notes-header h2,
.drawer-title {
  font-weight: 800;
}

/* The table of contents of the notes in the ink of the readings', so that the two read the same. */
.drawer-toc a,
.drawer-toc .jump-type {
  color: var(--ink);
}

.drawer-toc .jump-ref {
  color: var(--muted);
}

/* ---- The day: a page of a calendar, the band of its liturgical colour on top. */
.day {
  padding: 0.9rem 1.1rem 1rem;
  background: var(--paper);
  border: 2px solid var(--line);
  border-top: 10px solid var(--lit);
  border-radius: 22px;
  box-shadow: 0 5px 0 var(--line);
}

/* ---- The readings: each a card of its tone, rounded and apart, its band at its top; the line that opens it as a
   speech bubble, its reference as a label. The tables of contents, the sticky bands and the scroll are the adults'
   (styles.css, public/app.js); the text of AELF is shown as it is, larger. */
.readings-header + .reading {
  margin-top: 0.75rem;
}

/* The readings' header, its top rounded as the cards under it; square once it sticks at the top (public/app.js). */
.readings-header {
  border-radius: 22px 22px 0 0;
}

.readings-header.is-stuck {
  border-radius: 0;
}

.reading:is(.tone-first, .tone-psalm, .tone-second, .tone-gospel) {
  --card-pad: 1.1rem;
  /* Apart, one under the other; as wide as the readings' header, from one edge of a phone to the other
     (styles.css). */
  margin-top: 0;
  margin-bottom: 1.25rem;
  border: 2px solid var(--tone-line);
  border-radius: 24px;
  box-shadow: 0 6px 0 var(--tone-line);
}

.readings-header + .reading:is(.tone-first, .tone-psalm, .tone-second, .tone-gospel),
.reading:is(.tone-first, .tone-psalm, .tone-second, .tone-gospel) + .reading:is(.tone-first, .tone-psalm, .tone-second, .tone-gospel) {
  border-top: 2px solid var(--tone-line);
}

.reading:is(.tone-first, .tone-psalm, .tone-second, .tone-gospel) .reading-header {
  border-radius: 22px 22px 0 0;
  border-bottom: 2px dashed var(--tone-line);
}

/* The band of a note as high inside as its reading's, whose line is thicker here. */
.note-type {
  border-bottom-width: 2px;
}

/* As soon as a card touches the readings' header, its band there (public/app.js): its top square, the band's and the
   card's, from one side of the card to the other, no page showing at their corners. */
.reading:is(.tone-first, .tone-psalm, .tone-second, .tone-gospel) .reading-header.is-touching {
  border-radius: 0;
}

.reading:is(.tone-first, .tone-psalm, .tone-second, .tone-gospel):has(.reading-header.is-touching) {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

/* The first card touches the readings' header from the start: square at its top at once. */
.readings-header + .reading:is(.tone-first, .tone-psalm, .tone-second, .tone-gospel) {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.readings-header + .reading:is(.tone-first, .tone-psalm, .tone-second, .tone-gospel) .reading-header {
  border-radius: 0;
}

@media (max-width: 40rem) {
  .reading:is(.tone-first, .tone-psalm, .tone-second, .tone-gospel) {
    --card-pad: 0.85rem;
  }
}

.reading-ref {
  display: inline-block;
  margin: 0.2rem 0 0.6rem;
  padding: 0.15rem 0.75rem;
  border-radius: 999px;
  background: var(--paper);
  color: var(--tone-ink, var(--muted));
  font-weight: 800;
}

.reading-headline {
  position: relative;
  margin: 0.2rem 0 1.25rem;
  padding: 0.7rem 1rem;
  border-radius: 18px;
  background: var(--paper);
  color: var(--tone-ink, var(--ink));
  font-size: 1.15rem;
  font-style: normal;
  font-weight: 800;
  box-shadow: 0 3px 0 var(--tone-line, var(--line));
}

/* The tail of the bubble. */
.reading-headline::after {
  content: '';
  position: absolute;
  left: 1.6rem;
  bottom: -0.6rem;
  border: 0.65rem solid transparent;
  border-top-color: var(--paper);
  border-bottom: 0;
}

.reading-text {
  font-size: 1.22rem;
  line-height: 1.75;
}

@media (max-width: 40rem) {
  .reading-text {
    font-size: 1.1rem;
    line-height: 1.65;
  }
}

/* ---- The name of each reading, and of its note: bolder, as a title. */
.reading-type,
.note-type,
.note-kind {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-transform: none;
}

/* The buttons of the bands: « Comprendre », « Lecture »; the chips of a note's band, drawn the same. */
.reading-note,
.note .note-reading {
  border-width: 2px;
  background: var(--paper);
  font-size: 0.78rem;
  font-weight: 800;
  box-shadow: 0 3px 0 var(--tone-line, var(--line));
}

@media (min-width: 48rem) {
  .reading-note,
  .note .note-reading {
    font-size: 0.85rem;
  }
}

.note .note-jump {
  border-width: 2px;
  background: var(--paper);
  box-shadow: 0 3px 0 var(--tone-line, var(--line));
}

/* ---- The notes: on the tone of their reading, each part a white card with its picture; L’histoire en bref first,
   on the colour of the page, larger. */
.notes {
  font-size: 1.02rem;
}

.note-header h3 {
  font-size: 1.25rem;
  font-weight: 800;
}

/* The parts, the sources and the box of the oral explanation (styles.css, bare for the grown-ups), each a card. */
.note-essential,
.note-parts .note-part,
.note-sources,
.oral {
  margin: 0.9rem 0 0;
  padding: 0.85rem 1rem 0.95rem;
  background: var(--notes-paper);
  border: 2px solid var(--tone-line, var(--notes-line));
  border-radius: 20px;
  box-shadow: 0 4px 0 var(--tone-line, var(--notes-line));
}

.note-essential {
  background: var(--bg);
}

.note-essential p {
  font-size: 1.15rem;
  line-height: 1.6;
}

.note-essential h4,
.note-part h4,
.note-sources h4,
.oral h4 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.55rem;
  color: var(--notes-ink);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

/* The picture of each part: decorative, its title says it. */
.note-essential h4::before,
.note-part h4::before,
.note-sources h4::before,
.oral h4::before {
  content: var(--part-icon, '✨') / '';
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--part-bg, var(--kid-soft));
  font-size: 1.05rem;
}

.note-essential {
  --part-icon: '📖';
}
.kid-before {
  --part-icon: '⬅️';
}
.kid-after {
  --part-icon: '➡️';
}
.kid-facts {
  --part-icon: '💡';
}
.kid-setting {
  --part-icon: '🏺';
}
.kid-words {
  --part-icon: '🔤';
}
.kid-people {
  --part-icon: '👥';
}
.note-places {
  --part-icon: '📍';
}
.note-chronology {
  --part-icon: '⏳';
}
.kid-quiz {
  --part-icon: '❓';
}
.kid-echoes {
  --part-icon: '📜';
}
.note-church {
  --part-icon: '🕊️';
}
.note-questions {
  --part-icon: '🤔';
}
.note-meditation {
  --part-icon: '🏡';
}
.note-sources {
  --part-icon: '🔎';
}
.oral {
  --part-icon: '🎧';
}

/* Their pictures in small under the player, the large one above it (the grown-ups' strip comes before it). */
.oral {
  display: flex;
  flex-direction: column;
}

.oral-chapters {
  order: 1;
}

.oral-about {
  order: 2;
}

/* Just before and just after, side by side when there is room. */
.kid-around {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0.9rem;
  margin-top: 0.9rem;
}

.note-parts .kid-around > .note-part {
  margin: 0;
}

.kid-part .part-ref {
  margin: 0 0 0.35rem;
  font-weight: 800;
}

.kid-part .part-text {
  margin: 0;
}

/* Did you know: each detail a sticky note. */
.kid-facts-list {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.kid-facts-list li {
  padding: 0.6rem 0.8rem;
  border-radius: 14px;
  background: var(--kid-fact);
}

/* The words to know: a little dictionary. */
.kid-words-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 0.6rem;
  margin: 0;
}

.kid-words-list div {
  padding: 0.55rem 0.8rem;
  border-radius: 14px;
  background: var(--kid-soft);
}

.kid-words-list dt {
  color: var(--notes-accent);
  font-size: 1.08rem;
  font-weight: 800;
}

.kid-words-list dd {
  margin: 0.15rem 0 0;
}

/* Who is who: a round picture with the first letter of each name, of colours that follow one another. */
.kid-people-list {
  display: grid;
  gap: 0.7rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.kid-people-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.kid-people-list p {
  margin: 0;
}

.kid-name {
  font-weight: 800;
}

.kid-avatar {
  display: grid;
  flex: none;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--avatar, #2f74c0);
  color: #ffffff;
  font-size: 1.15rem;
  font-weight: 800;
}

.kid-people-list li:nth-child(4n + 2) .kid-avatar {
  --avatar: #d2552a;
}
.kid-people-list li:nth-child(4n + 3) .kid-avatar {
  --avatar: #1d7a4e;
}
.kid-people-list li:nth-child(4n + 4) .kid-avatar {
  --avatar: #8a4fb0;
}

/* The little quiz: the answers are buttons; once one is picked, the right one turns green, the one picked red if
   wrong, and the sentence that says why appears. Without script. */
.quiz-hint {
  margin: 0 0 0.6rem;
  color: var(--notes-muted);
}

.quiz {
  display: grid;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.quiz fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.quiz legend {
  margin-bottom: 0.5rem;
  padding: 0;
  font-weight: 800;
}

.quiz-choices {
  display: grid;
  gap: 0.45rem;
}

.quiz-choice {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.85rem;
  border: 2px solid var(--notes-line);
  border-radius: 14px;
  background: var(--notes-paper);
  box-shadow: 0 3px 0 var(--notes-line);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.quiz-choice:hover {
  border-color: var(--notes-accent);
  transform: translateY(-1px);
}

.quiz-choice input {
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  accent-color: var(--notes-accent);
}

.quiz-choice:has(input:focus-visible) {
  outline: 3px solid var(--notes-accent);
  outline-offset: 2px;
}

.quiz-question:has(input:checked) .quiz-choice.is-right {
  border-color: var(--ok);
  background: var(--fait-bg);
  box-shadow: 0 3px 0 var(--ok);
}

.quiz-choice:not(.is-right):has(input:checked) {
  border-color: var(--wrong);
  background: var(--wrong-bg);
  box-shadow: 0 3px 0 var(--wrong);
}

.quiz-feedback {
  display: none;
  margin: 0.6rem 0 0;
}

.quiz-question:has(input:checked) .quiz-feedback {
  display: block;
}

.quiz-right {
  color: var(--ok);
}

.quiz-wrong {
  color: var(--wrong);
}

.quiz-right::before {
  content: '🎉 ' / '';
}

.quiz-wrong::before {
  content: '🤔 ' / '';
}

.quiz-question:has(.is-right input:checked) .quiz-wrong,
.quiz-question:has(.quiz-choice:not(.is-right) input:checked) .quiz-right {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .quiz-choice {
    transition: none;
  }
}

/* What the saints say: the quotations on a soft background. */
.church-quote {
  padding: 0.5rem 0.8rem;
  border-left: 0;
  border-radius: 14px;
  background: var(--kid-soft);
}

/* A hard question: a bubble, the question first. */
.hard-question {
  border-left: 0;
  border-radius: 14px;
  background: var(--kid-soft);
}

.hard-question-ask {
  font-style: normal;
  font-weight: 800;
}

/* « Pour en parler en famille »: the question in a bubble, the text it comes from in small under it. */
.meditation-question {
  border-left: 0;
  border-radius: 14px;
  background: var(--kid-soft);
  font-family: inherit;
  font-style: normal;
  font-weight: 800;
}

.meditation-ref {
  margin-top: 0.45rem;
  font-size: 0.85rem;
}

/* The drawers of the maps and of the timeline, with their pictures (carte-enfants.css, frise-enfants.css). */

/* Fredoka, a round letter for children, for their maps and their timeline: free (SIL Open Font License,
   public/fonts/OFL-Fredoka.txt), from the package @fontsource-variable/fredoka 5.3.0, its Latin letters, every weight
   from 300 to 700, 30 kB; loaded only where it is used. */
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-display: swap;
  font-weight: 300 700;
  src: url('fonts/fredoka-latin-wght-normal.woff2') format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Their pictures (public/images-enfants.js), in a picture of the page that does not show. */
.k-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* The pin over the place or the scene chosen hops. */
@keyframes k-hop {
  0%,
  100% {
    transform: translateY(0);
  }
  45% {
    transform: translateY(-5px);
  }
}
