/* "Aula narrada" (19/11/2026): the scenes of a lesson as page content. No
   frame around the lesson and no cards behind the text: space, alignment and
   contrast organize it. What stays drawn is what tells the learner something:
   the point the professor is talking about, a choice that can be made, the
   keyboard focus, the caption of an image. The layout follows the width the
   lesson has (container queries), not the window. */
.narrated-lesson {
  --narrated-ink: var(--course-ink, #0f172a);
  --narrated-muted: var(--course-muted, #475569);
  --narrated-line: var(--course-line, #d7e1e9);
  --narrated-surface: #fff;
  --narrated-accent: #0b5f95;
  --narrated-tint: #e8f6ff;
  --narrated-ok: #146c43;
  --narrated-ok-tint: #e9f7ef;
  --narrated-no: #a1300f;
  --narrated-no-tint: #fdf0ec;
  container-type: inline-size;
  container-name: narrated;
  position: relative;
  color: var(--narrated-ink);
  min-width: 0;
}
.narrated-lesson *,
.narrated-lesson *::before,
.narrated-lesson *::after {
  box-sizing: border-box;
}
.narrated-lesson [hidden] {
  display: none !important;
}
.narrated-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---- Controls: one bar that stays in reach while the lesson is read.
   With little room it is a single compact row under the page's own bar, and
   the scene count and the speed sit below it, not following the reader. ---- */
.narrated-top {
  display: contents;
}
.narrated-bar {
  position: sticky;
  top: var(--narrated-sticky-top, 0px);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  background: var(--narrated-surface);
  border-bottom: 1px solid var(--narrated-line);
}
.narrated-lesson .narrated-bar button,
.narrated-lesson .narrated-meta button {
  min-height: 44px;
  margin: 0;
  white-space: nowrap;
}
.narrated-lesson .narrated-play {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 48px;
  padding-inline: 12px;
}
.narrated-play-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.narrated-lesson .narrated-step {
  flex: none;
  min-width: 44px;
  padding-inline: 10px;
  font-size: 1.1rem;
}
.narrated-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 8px;
}
.narrated-lesson .narrated-speed {
  min-width: 4.2em;
  padding-inline: 10px;
  font-variant-numeric: tabular-nums;
}
.narrated-where,
.narrated-clock {
  color: var(--narrated-muted);
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.narrated-lesson .narrated-seek {
  display: block;
  flex: 1 1 60px;
  width: auto;
  min-width: 60px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  accent-color: var(--narrated-accent);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.narrated-seek::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(
    to right,
    var(--narrated-accent) var(--narrated-progress, 0%),
    var(--narrated-line) var(--narrated-progress, 0%)
  );
}
.narrated-seek::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: var(--narrated-line);
}
.narrated-seek::-moz-range-progress {
  height: 6px;
  border-radius: 3px;
  background: var(--narrated-accent);
}
.narrated-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border: 2px solid var(--narrated-surface);
  border-radius: 50%;
  background: var(--narrated-accent);
  box-shadow: 0 0 0 1px var(--narrated-accent);
}
.narrated-seek::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 2px solid var(--narrated-surface);
  border-radius: 50%;
  background: var(--narrated-accent);
  box-shadow: 0 0 0 1px var(--narrated-accent);
}
.narrated-lesson .narrated-seek:focus-visible {
  outline: 3px solid #2268a8;
  outline-offset: 2px;
}
.narrated-status {
  min-height: 1.5em;
  margin: 10px 0 0;
  color: var(--narrated-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* ---- A scene ---- */
.narrated-scene {
  display: flow-root;
  padding: clamp(10px, 2cqi, 22px) 0 6px;
  border-radius: 4px;
}
.narrated-scene:focus-visible {
  outline: 3px solid #2268a8;
  outline-offset: 6px;
}
.narrated-probe {
  position: absolute !important;
  inset: 0 0 auto 0;
  min-height: 0 !important;
  visibility: hidden !important;
  pointer-events: none;
}
.narrated-scene-body {
  /* How far the mark of the point being explained hangs into the margin of
     the lesson, so that the words stay aligned with the title: less than the
     16 px the player leaves around the lesson on a phone. */
  --narrated-hang: 12px;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "head teacher"
    "media media"
    "content content"
    "logo logo";
  align-items: start;
  gap: clamp(14px, 2.6cqi, 30px) clamp(14px, 3.6cqi, 52px);
  font-size: clamp(1.06rem, 0.98rem + 0.55cqi, 1.3rem);
  line-height: 1.5;
}
.narrated-head {
  grid-area: head;
  min-width: 0;
}
.narrated-phase {
  margin: 0;
  color: var(--narrated-accent);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-transform: uppercase;
}
.narrated-logo {
  grid-area: logo;
  justify-self: start;
  display: block;
  width: auto;
  max-width: 120px;
  height: auto;
  max-height: 26px;
  object-fit: contain;
}
.narrated-lesson .narrated-title {
  margin: 4px 0 0;
  color: inherit;
  font-size: clamp(1.4rem, 1.05rem + 2cqi, 2.3rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.18;
  overflow-wrap: anywhere;
}
.narrated-lesson .narrated-title:focus {
  outline: none;
}
.narrated-lesson .narrated-title:focus-visible {
  outline: 3px solid #2268a8;
  outline-offset: 4px;
}
.narrated-teacher {
  grid-area: teacher;
  align-self: end;
  width: clamp(72px, 22cqi, 104px);
  margin: 0;
}
.narrated-teacher img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  object-position: bottom center;
}
.narrated-media {
  grid-area: media;
  margin: 0;
  min-width: 0;
}
.narrated-media img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 6px;
  background: #f1f5f9;
}
.narrated-media[data-kind="photo"] img {
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.narrated-media figcaption {
  margin-top: 8px;
  color: var(--narrated-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}
.narrated-content {
  grid-area: content;
  min-width: 0;
}
.narrated-content > :first-child {
  margin-top: 0;
}
.narrated-lead {
  max-width: 62ch;
  margin: 0 0 clamp(12px, 2cqi, 22px);
  font-weight: 500;
  font-size: clamp(1.12rem, 1rem + 0.9cqi, 1.5rem);
  line-height: 1.42;
  transition: opacity 0.25s ease;
}
.narrated-support {
  max-width: 70ch;
  margin: clamp(12px, 2cqi, 22px) 0 0;
  color: var(--narrated-muted);
  font-size: 0.94em;
}
.is-concealed {
  visibility: hidden;
}
.narrated-lead.is-concealed {
  opacity: 0;
}
/* After the parts of a process: what relates them. */
.narrated-points + .narrated-lead {
  margin: clamp(12px, 2cqi, 22px) 0 0;
}

/* The points of a scene. The one the professor is talking about is marked on
   its side and tinted: that is the only drawing behind the text. */
.narrated-points {
  display: grid;
  gap: clamp(6px, 1.2cqi, 12px);
  margin: 0 0 0 calc(-1 * var(--narrated-hang));
  padding: 0;
  list-style: none;
}
.narrated-point,
.narrated-option {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
  padding: 9px 14px 9px calc(var(--narrated-hang) - 4px);
  border-inline-start: 4px solid transparent;
  border-radius: 0 8px 8px 0;
  transition:
    background-color 0.25s ease,
    border-color 0.25s ease;
}
.narrated-point.is-active {
  border-inline-start-color: var(--narrated-accent);
  background: var(--narrated-tint);
}
.narrated-point-text {
  min-width: 0;
  overflow-wrap: anywhere;
}
.narrated-label {
  display: block;
  margin-bottom: 1px;
  color: var(--narrated-accent);
  font-size: 0.8em;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.35;
}
.narrated-mark {
  flex: none;
  min-width: 1.3em;
  color: var(--narrated-accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.narrated-points[data-kind="steps"] .narrated-mark {
  font-size: 1.5em;
  line-height: 1;
}
.narrated-points[data-kind="stack"] > :first-child .narrated-point-body {
  font-size: 1.08em;
}
.narrated-points[data-kind="versus"] .narrated-label,
.narrated-points[data-kind="checks"] .narrated-label {
  color: var(--narrated-ink);
  font-size: 1.04em;
  letter-spacing: 0;
}
.narrated-points[data-kind="checks"] .narrated-point-body,
.narrated-points[data-kind="versus"] .narrated-point-body {
  color: var(--narrated-muted);
}
.narrated-points[data-kind="takeaways"] .narrated-point-body {
  font-weight: 700;
}
.narrated-lesson [data-role="opening"] .narrated-title {
  font-size: clamp(1.7rem, 1.15rem + 3.2cqi, 3rem);
}
.narrated-lesson [data-role="closing"] .narrated-title {
  font-size: clamp(1.6rem, 1.1rem + 2.8cqi, 2.7rem);
}

/* A demonstration shows the example itself, as the learner would meet it. */
.narrated-example {
  margin: 0 0 clamp(12px, 2cqi, 22px);
}
.narrated-example figcaption {
  margin-bottom: 6px;
  color: var(--narrated-muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.narrated-example blockquote {
  margin: 0;
  padding: 2px 0 2px 18px;
  border-inline-start: 3px solid var(--narrated-ink);
  font-size: clamp(1.08rem, 0.98rem + 0.8cqi, 1.42rem);
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* A question the learner answers here. The outline of each alternative is
   what says it can be chosen. */
.narrated-options {
  display: grid;
  gap: 10px;
  margin: 0;
}
.narrated-lesson .narrated-option {
  align-items: center;
  min-height: 52px;
  margin: 0;
  padding: 12px 16px;
  font-size: inherit;
  font-weight: 400;
  border: 1px solid var(--narrated-line);
  border-radius: 10px;
  cursor: pointer;
}
.narrated-lesson .narrated-option input {
  display: block;
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0;
  padding: 0;
  accent-color: var(--narrated-accent);
}
.narrated-option:has(input:checked),
.narrated-option.is-active:not(.is-correct, .is-incorrect) {
  border-color: var(--narrated-accent);
  background: var(--narrated-tint);
}
.narrated-option:has(input:focus-visible) {
  outline: 3px solid #2268a8;
  outline-offset: 2px;
}
.narrated-options.is-reviewed .narrated-option {
  cursor: default;
}
.narrated-option.is-correct {
  border-color: var(--narrated-ok);
  background: var(--narrated-ok-tint);
}
.narrated-option.is-incorrect {
  border-color: var(--narrated-no);
  background: var(--narrated-no-tint);
}
.narrated-verdict {
  display: block;
  margin-top: 2px;
  font-size: 0.86em;
  font-weight: 700;
}
.is-correct .narrated-verdict {
  color: var(--narrated-ok);
}
.is-incorrect .narrated-verdict {
  color: var(--narrated-no);
}
.narrated-answer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 0;
}
.narrated-answer-actions button {
  min-height: 46px;
  margin: 0;
}
.narrated-answer-message {
  min-height: 1.4em;
  margin: 8px 0 0;
  color: var(--narrated-no);
  font-size: 0.95rem;
}
.narrated-result {
  margin: 14px 0 0;
  font-size: 0.98em;
  font-weight: 700;
}
.narrated-content > .narrated-result {
  margin: 0 0 clamp(10px, 1.8cqi, 18px);
}
.narrated-result.is-correct {
  color: var(--narrated-ok);
}
.narrated-result.is-incorrect {
  color: var(--narrated-no);
}

/* Without the voice: its words, with the scene. */
.narrated-reading {
  max-width: 70ch;
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--narrated-line);
}
.narrated-reading h4 {
  margin: 0 0 6px;
  color: var(--narrated-muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.narrated-reading p {
  margin: 0;
}

/* ---- The lesson as text ---- */
.narrated-transcript {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--narrated-line);
}
.narrated-transcript summary {
  min-height: 44px;
  padding: 10px 0;
  color: var(--narrated-accent);
  font-weight: 600;
  cursor: pointer;
}
.narrated-transcript ol {
  display: grid;
  gap: 14px;
  max-width: 78ch;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}
.narrated-transcript li {
  padding-inline-start: 14px;
  border-inline-start: 3px solid transparent;
}
.narrated-transcript li[aria-current="true"] {
  border-inline-start-color: var(--narrated-accent);
}
.narrated-transcript li button {
  min-height: 44px;
  margin: 0;
  text-align: left;
}
.narrated-transcript li p {
  margin: 6px 0 0;
  line-height: 1.6;
}

/* ---- With room: the professor beside the lesson, columns for what is a
   set, the image beside the explanation ---- */
@container narrated (min-width: 720px) {
  /* One row for everything, the words of the button included. */
  .narrated-top {
    position: sticky;
    top: var(--narrated-sticky-top, 0px);
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--narrated-surface);
    border-bottom: 1px solid var(--narrated-line);
  }
  .narrated-bar {
    position: static;
    flex: 1;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 0;
  }
  .narrated-meta {
    padding: 0;
  }
  .narrated-lesson .narrated-play {
    min-width: 9.5em;
    padding-inline: 18px;
  }
  .narrated-play-text {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
  }
  .narrated-lesson .narrated-step {
    padding-inline: 12px;
  }
  .narrated-scene-body {
    --narrated-hang: 18px;
    grid-template-columns: minmax(0, 1fr) clamp(170px, 25cqi, 290px);
    grid-template-areas:
      "head head"
      "content teacher";
  }
  .narrated-teacher {
    width: 100%;
  }
  /* The author's mark keeps the corner it had on the slides. */
  .narrated-logo {
    position: absolute;
    inset: 0 0 auto auto;
    max-width: 150px;
    max-height: 32px;
  }
  .narrated-scene-body.has-logo .narrated-head {
    padding-inline-end: 176px;
  }
  .narrated-scene-body[data-role="opening"],
  .narrated-scene-body[data-role="closing"] {
    grid-template-columns: minmax(0, 1fr) clamp(210px, 31cqi, 350px);
  }
  /* The checklist keeps the tutor on its left, as in the lesson's model. */
  .narrated-scene-body[data-role="checklist"] {
    grid-template-columns: clamp(170px, 25cqi, 290px) minmax(0, 1fr);
    grid-template-areas:
      "head head"
      "teacher content";
  }
  /* An image takes the side; the professor stands under the explanation. */
  .narrated-scene-body.has-media {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    grid-template-areas:
      "head head"
      "content media"
      "teacher media";
  }
  .narrated-scene-body.has-media .narrated-teacher {
    width: clamp(110px, 15cqi, 170px);
  }
  /* The screen of a procedure is what is being taught: it comes first and
     larger, with its steps beside it. */
  .narrated-scene-body[data-role="capture"].has-media {
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    grid-template-areas:
      "head head"
      "media content"
      "media teacher";
  }
  .narrated-scene-body[data-role="capture"].has-media .narrated-teacher {
    justify-self: end;
  }
  .narrated-points[data-kind="columns"],
  .narrated-points[data-kind="versus"],
  .narrated-scene-body:not([data-role="capture"])
    .narrated-points[data-kind="steps"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: clamp(10px, 2cqi, 26px);
    align-items: start;
  }
  .narrated-points[data-kind="columns"][data-count="3"],
  .narrated-scene-body:not([data-role="capture"])
    .narrated-points[data-kind="steps"][data-count="3"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .narrated-points[data-kind="columns"] .narrated-point,
  .narrated-points[data-kind="versus"] .narrated-point,
  .narrated-scene-body:not([data-role="capture"])
    .narrated-points[data-kind="steps"]
    .narrated-point {
    height: 100%;
    align-items: flex-start;
  }
  .narrated-scene-body:not([data-role="capture"])
    .narrated-points[data-kind="steps"]
    .narrated-point {
    flex-direction: column;
    gap: 6px;
  }
  .narrated-points[data-kind="rows"] .narrated-point-text {
    display: grid;
    grid-template-columns: minmax(7.5em, 22%) minmax(0, 1fr);
    column-gap: 18px;
    align-items: baseline;
    width: 100%;
  }
  .narrated-points[data-kind="rows"] .narrated-label {
    margin: 0;
    font-size: 0.86em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .narrated-lesson * {
    transition: none !important;
  }
}
body.high-contrast .narrated-lesson {
  --narrated-surface: #111;
  --narrated-accent: #9fd3ff;
  --narrated-tint: #242424;
  --narrated-ok: #8fe3b4;
  --narrated-ok-tint: #10291b;
  --narrated-no: #ffb59e;
  --narrated-no-tint: #33160e;
}
body.high-contrast .narrated-media img {
  background: #242424;
}

.narrated-question-card {
  margin-block: 0.75rem;
  padding: clamp(0.75rem, 3cqi, 1.25rem);
  border: 1px solid var(--narrated-line);
  border-radius: 0.75rem;
  background: var(--narrated-surface);
  overflow-wrap: anywhere;
}
.narrated-question-card h3 {
  margin-top: 0;
}
.narrated-meta:has([data-narrated-focus]) {
  flex-wrap: wrap;
}
@container narrated (max-width: 340px) {
  .narrated-lesson .narrated-seek {
    min-width: 0;
  }
}
.narrated-lesson[data-focus-active] {
  box-sizing: border-box;
  background: var(--narrated-surface);
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: auto;
  overscroll-behavior: contain;
  padding: max(0.75rem, env(safe-area-inset-top))
    max(0.75rem, env(safe-area-inset-right))
    max(0.75rem, env(safe-area-inset-bottom))
    max(0.75rem, env(safe-area-inset-left));
}
.narrated-lesson[data-focus-active] .narrated-top {
  display: block;
  position: sticky;
  top: 0;
  z-index: 3;
  padding-bottom: 8px;
  background: var(--narrated-surface);
}
.narrated-lesson[data-focus-active] .narrated-bar {
  position: static;
}
.narrated-lesson.narrated-focus-fallback {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  margin: 0;
}
.narrated-focus-hidden {
  visibility: hidden !important;
}
body:has(.narrated-focus-fallback) {
  overflow: hidden;
}
