/* Painted autumn Ottawa behind dark maroon surfaces. The scene is the painting (art/); text
   either sits on the painted cream sky in deep maroon, or on a dark maroon surface in near-white.
   Measured WCAG contrast: --maroon on the sky 9.8 at the cream horizon, 8.3 at the peach top;
   on --surface-solid (#26100c): --ink 16.9, --ink-2 9.6, --ink-3 5.3, --accent-text 7.3.
   Buttons: --on-accent on --orange 5.1. Surfaces take a hairline border and no shadow. */
:root {
  --red: #9F0A28;
  --orange: #D55C2B;
  --sage: #89A46F;

  --maroon: #6e0b1f;
  --field: #f3e5cf;
  --surface: rgba(38, 16, 12, 0.9);
  --surface-solid: #26100c;
  --raised: rgba(255, 255, 255, 0.06);
  --hairline: rgba(255, 255, 255, 0.12);
  --ink: #faf7f4;
  --ink-2: rgba(250, 247, 244, 0.74);
  --ink-3: rgba(250, 247, 244, 0.52);
  --accent-text: #f4875a;
  --sage-text: #b3cf96;
  --on-accent: #120806;
  --radius: 18px;
  --sans: "Inter", system-ui, sans-serif;
  --display: "Instrument Sans", "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

/* The one gradient: the sky behind the painted layers, peach overhead easing to the painting's
   own cream at the horizon. */
html, body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  background: linear-gradient(180deg, #f4cfa6 0%, #f3e5cf 55%);
  background-color: var(--field);
  background-attachment: fixed;
}

.city { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; z-index: 0; }

/* reveal.js scroll view: transparent so the town shows, with our own layout per slide. */
.reveal-viewport { background: transparent !important; color: var(--ink); }
/* The laptop sits outside .reveal, so it takes the page colour, not reveal's black default. */
.stage { color: var(--ink); }

/* Beaver (#48). On slides with open space on the right he stands there, over Parliament; where
   the laptop fills the right, he steps down to the lower left corner; on the phone slides he
   stands in the middle, between the card and the phone.
   Dragging him turns him around. */
.companion {
  position: fixed; z-index: 3; right: 3vw; top: 50%; width: 42vw; height: 23vw; transform: translateY(-40%);
  cursor: grab; touch-action: none;
  transition: width 0.6s ease, height 0.6s ease, right 0.6s ease, top 0.6s ease, transform 0.6s ease;
}
.companion.is-turning { cursor: grabbing; }
body[data-companion="middle"] .companion { right: 35vw; top: 50%; width: 30vw; height: 16vw; transform: translateY(-20%); }
/* In the corner he stands over the card's lower edge but below its last line of text, above the
   Play button, and takes no clicks. demo.js sets --corner-room to the height between that line
   and the Play button; he shrinks only when that is under 160px. */
body[data-companion="corner"] .companion {
  --corner-height: min(160px, var(--corner-room, 160px));
  right: calc(100vw - 8px - var(--corner-height) * 1.875); top: calc(100vh - 60px - var(--corner-height));
  width: calc(var(--corner-height) * 1.875); height: var(--corner-height); transform: none; pointer-events: none;
}
@media (max-width: 700px) {
  .companion, body[data-companion="corner"] .companion, body[data-companion="middle"] .companion { right: calc(100vw - 8px - 140px); top: calc(100vh - 60px - 105px); width: 140px; height: 105px; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .companion { transition: none; } }
/* Slide text grows with the window so wide screens keep a laptop's proportions. */
.reveal { position: relative; z-index: 1; font-family: var(--sans); font-size: clamp(17px, 1.15vw, 23px); color: var(--ink); }
.reveal .slides { text-align: left; }
/* reveal.js sizes each section to its 960 px design width and centres it with a transform. */
.reveal .slides section[data-view] {
  width: 100% !important;
  height: 100% !important;
  inset: 0 !important;
  transform: none !important;
  display: flex !important;
  align-items: center;
  padding: 0 min(6vw, 110px) !important;
}
.reveal .scroll-page-content { height: 100%; }
.reveal .scrollbar { z-index: 3; }
.reveal .scrollbar-slide { background: var(--orange); }
.reveal .scrollbar-playhead { background: var(--ink); }

.reveal h1, .reveal h2, .reveal h3 {
  font-family: var(--display);
  color: var(--ink);
  text-transform: none;
  letter-spacing: -0.025em;
  margin: 0 0 0.4em;
  text-shadow: none;
  line-height: 1.05;
}
.reveal h2 { font-size: 2.4em; font-weight: 600; }
.reveal p { margin: 0 0 0.7em; line-height: 1.5; }

/* Intro and close: text only, every line on one left edge, over a light scrim that fades out
   toward the right so the painting stays clear on that side. */
.slide-scrim::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(248, 238, 224, 0.94) 0%, rgba(248, 238, 224, 0.8) 30%, rgba(248, 238, 224, 0) 60%);
}
.hello { position: relative; z-index: 1; display: grid; gap: 3vh; width: min(46vw, 860px); }
/* Lines marked .fit never wrap; demo.js shrinks each one until it fits the column. */
.fit { white-space: nowrap; }
.reveal .greeting {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(48px, 5.4vw, 104px);
  letter-spacing: -0.035em;
  line-height: 1.1 !important;
  white-space: nowrap;
  margin: 0 !important;
  color: var(--maroon);
  /* Right-to-left greetings still start at the column's left edge; the box hugs the text so the
     stream edge sweeps across the word, not the whole column. */
  text-align: left;
  width: fit-content;
}
/* Each greeting streams in behind a soft gradient edge, in its own reading direction. */
.greeting.in {
  -webkit-mask-image: linear-gradient(90deg, #000 45%, transparent 55%);
  mask-image: linear-gradient(90deg, #000 45%, transparent 55%);
  -webkit-mask-size: 260% 100%;
  mask-size: 260% 100%;
  animation: stream 0.9s cubic-bezier(0.25, 0.7, 0.25, 1) both;
}
.greeting.in[dir="rtl"] {
  -webkit-mask-image: linear-gradient(270deg, #000 45%, transparent 55%);
  mask-image: linear-gradient(270deg, #000 45%, transparent 55%);
  animation-name: stream-rtl;
}

.brand { display: grid; justify-items: start; gap: 0.35em; }
.wordmark {
  font-family: var(--display) !important;
  font-size: clamp(56px, 5.6vw, 110px) !important;
  font-weight: 700 !important;
  letter-spacing: -0.04em !important;
  line-height: 1 !important;
  margin: 0 !important;
  color: var(--maroon) !important;
}
.tagline { font-size: 1.45em; font-weight: 500; color: var(--maroon); margin: 0.2em 0 0 !important; }
.brand-fr { font-size: 1.2em; color: var(--maroon); opacity: 0.8; margin: 0 !important; }
.hello-close { gap: 4vh; }

/* Story pages: the concept sheet's paragraphs, one page each. Every line is the same size and
   keeps its place; a new line appears below the earlier ones, which dim. Hidden fragments still
   take their space, so revealing a line never moves another. The story sits at a fixed top, so a
   taller extra below it never re-centres the lines. */
.story { position: relative; z-index: 1; width: min(46vw, 880px); align-self: flex-start; margin-top: 15vh; }
/* The three-language diagram needs more room than a line of text. */
.story:has(.flow) { width: min(54vw, 980px); }
/* On a phone the story takes the screen's width, and the diagram stacks its three languages. */
@media (max-width: 700px) {
  .story, .story:has(.flow) { width: calc(100vw - 32px); margin-top: 5vh; }
  .story .flow { grid-template-columns: 1fr; gap: 0.4em; }
  .story .node { padding: 0.55em 0.8em; gap: 0.25em; }
  .story .flow-link { display: none; }
}
.story-para { margin: 0 !important; font-family: var(--display); color: var(--maroon); }
.reveal .slides .story .beat {
  display: block;
  font-size: clamp(26px, 2.5vw, 48px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 0.35em;
  transition: opacity 0.5s ease;
}
.reveal .slides .story .beat.past { opacity: 0.6; }
/* A highlighter stroke under the key words, drawn in when the line arrives. */
.story mark {
  color: inherit;
  background: linear-gradient(transparent 62%, rgba(213, 92, 43, 0.42) 62%) no-repeat 0 0 / 0% 100%;
}
.beat.now mark { animation: highlight 0.8s 0.35s cubic-bezier(0.3, 0.7, 0.3, 1) forwards; }
.beat.past mark { background-size: 100% 100%; }
.extra:not(.on) { display: none; }
.word {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0 0.05em;
  cursor: pointer;
  text-decoration: underline dotted rgba(213, 92, 43, 0.9);
  text-decoration-thickness: 0.07em;
  text-underline-offset: 0.16em;
  border-radius: 0.15em;
}
.word:hover, .word.on { background: rgba(213, 92, 43, 0.22); text-decoration-style: solid; }
.word:disabled { cursor: default; text-decoration: none; background: none; }
.extra { margin-top: 4.5vh; display: grid; gap: 1.2em; justify-items: start; }
.hint { margin: 0 !important; font-size: 0.95em; color: var(--maroon); opacity: 0.8; }

.icon { width: 1.15em; height: 1.15em; flex: none; fill: currentColor; }
.icon .wave { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
/* Speaker buttons on the light scrim: maroon outline, filled while their clip plays. */
.say {
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  font: 600 1em var(--sans);
  color: var(--maroon);
  background: rgba(255, 250, 244, 0.7);
  border: 1.5px solid rgba(110, 11, 31, 0.35);
  border-radius: 999px;
  padding: 0.55em 1.1em;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.extra > .say + .say { margin-top: -0.4em; }
.say-lang { font-size: 0.78em; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.75; }
.say-text { font-family: var(--display); font-size: 1.15em; }
.say:hover { border-color: var(--maroon); }
.say.playing { background: var(--maroon); color: var(--ink); border-color: var(--maroon); }

/* One sentence travelling from a speaker's native language through French to English. */
.flow { display: grid; grid-template-columns: 1fr 2.2em 1fr 2.2em 1fr; align-items: stretch; width: 100%; }
.node {
  display: grid;
  align-content: start;
  gap: 0.45em;
  text-align: left;
  font: inherit;
  color: var(--maroon);
  background: rgba(255, 250, 244, 0.78);
  border: 1.5px solid rgba(110, 11, 31, 0.25);
  border-radius: 14px;
  padding: 0.9em 1em;
  cursor: pointer;
  transition: background 0.25s, border-color 0.25s, transform 0.25s;
}
.node .icon { justify-self: end; margin-top: auto; }
.node-role { font-size: 0.72em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.7; }
.node-text { font-family: var(--display); font-weight: 600; font-size: 1.05em; line-height: 1.3; }
.node:hover { border-color: var(--maroon); }
.node.playing, .node.speaking { background: var(--maroon); color: var(--ink); border-color: var(--maroon); transform: translateY(-3px); }
.flow-link { align-self: center; height: 2px; background: var(--orange); position: relative; margin: 0 0.3em; }
.flow-link::after { content: ""; position: absolute; right: -1px; top: -5px; border: 6px solid transparent; border-left: 9px solid var(--orange); border-right: 0; }

/* An exchange opened from a word sits in a dark card. */
.ex-slot:not(:empty) { width: 100%; max-height: 38vh; overflow: auto; background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 0 1.4em; color: var(--ink); }
.ex-slot .qa { border-top: 0; }

/* An exchange: question, arrow, answer rows. */
.qa {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 3.5em minmax(0, 1.1fr);
  align-items: center;
  gap: 1.3em;
  padding: 0.95em 0;
  border-top: 1px solid var(--hairline);
}
.q p, .a p { margin: 0 0 0.25em !important; }
.q-main { font-family: var(--display); font-weight: 600; font-size: 1.3em; line-height: 1.25 !important; color: var(--ink); }
.q-alt { font-size: 1.12em; color: var(--ink-2); line-height: 1.3 !important; }
.a-en { font-size: 0.92em; color: var(--ink-2); line-height: 1.4 !important; }
.a-main { font-size: 0.98em; font-weight: 600; color: var(--ink); line-height: 1.4 !important; margin-bottom: 0.6em !important; }
.a cite { font-style: italic; }
/* The concept sheet's arrow becomes the play button between each question and its answer. */
.arrow {
  justify-self: center;
  width: 2.6em;
  height: 2.6em;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 0;
  cursor: pointer;
  color: var(--on-accent);
  background: var(--orange);
  position: relative;
}
.arrow::before { content: ""; position: absolute; right: 100%; width: 0.9em; height: 2px; background: var(--orange); }
.arrow::after { content: ""; position: absolute; left: 100%; width: 0.9em; height: 2px; background: var(--orange); }
.arrow.playing { background: var(--ink); }
.qa { cursor: pointer; }
.qa [data-clip] { border-radius: 0.35em; padding: 0.05em 0.3em; margin-left: -0.3em !important; transition: background 0.2s, color 0.2s; }
.qa [data-clip]:hover { background: var(--raised); }
.qa [data-clip].speaking { background: rgba(213, 92, 43, 0.3); color: var(--ink); }

/* Cards beside the laptop. */
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 1.6em 1.8em;
  width: min(720px, 38vw);
  max-height: calc(100vh - 64px);
  overflow: auto;
}
.card p { color: var(--ink-2); font-size: 1.12em; }
.card-side { width: min(520px, 28vw); }
/* On a phone every card spans the width; there is no room beside it. */
@media (max-width: 700px) {
  .card, .card-side { width: calc(100vw - 32px); }
}
.meta { font-size: 0.78em !important; color: var(--ink-3) !important; margin-top: 1.2em !important; }


.app-button {
  align-self: flex-start;
  font: inherit;
  font-weight: 600;
  color: var(--on-accent);
  background: var(--orange);
  border: 0;
  border-radius: 0.6em;
  padding: 0.55em 1.2em;
  cursor: pointer;
}
.app-button-quiet { background: var(--raised); color: var(--accent-text); }
.card .app-button { margin-top: 0.3em; }
.app-button-large { font-size: 1.1em; justify-self: start; }
/* The closing page's actions: Start over, and Open the app on the laptop's server. */
.close-actions { display: flex; flex-wrap: wrap; gap: 0.8em; }
a.app-button { text-decoration: none; }

/* Laptop, fixed on the right while the interface slides scroll. */
.stage {
  position: fixed;
  z-index: 2;
  right: min(5vw, 90px);
  top: 50%;
  transform: translateY(-50%);
  width: min(900px, 46vw);
  display: grid;
  gap: 18px;
  justify-items: center;
  pointer-events: none;
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.stage.wide { width: min(1180px, 58vw); }
.laptop { margin: 0; width: 100%; }
.lid { background: #1b1716; border-radius: 18px 18px 5px 5px; padding: 1.4% 1.4% 2%; border: 1px solid var(--hairline); }
.screen { container-type: inline-size; background: #0f0c0b; border-radius: 5px; aspect-ratio: 16 / 10; overflow: hidden; }
.base { height: 16px; margin: 0 -7%; background: #2b2523; border-radius: 0 0 14px 14px; position: relative; }
.base::before { content: ""; position: absolute; left: 42%; right: 42%; top: 0; height: 6px; border-radius: 0 0 6px 6px; background: #161211; }

/* Screen contents scale with the laptop width, so each screen fits at every window size. */
/* The laptop shows a scaled copy of the desktop app (src/beaver/desktop/ui): its night-green
   field, Inria Sans, the sidebar with the five topics, and translucent dark cards. The app's
   colours are redefined here so every screen inside picks them up. */
.app {
  --ink: #f4efe6; --ink-2: #cfc6b8; --ink-3: #a39a8c;
  --raised: rgba(255, 255, 255, 0.07); --hairline: rgba(255, 255, 255, 0.1);
  --orange: #e3a86f; --app-surface: rgba(14, 23, 21, 0.78); --app-accent: #9a4e27;
  height: 100%; display: grid; grid-template-columns: 24% minmax(0, 1fr); gap: 1.1em; padding: 1.1em;
  font-family: "Inria Sans", system-ui, sans-serif; font-size: 2.1cqi; color: var(--ink);
  background: radial-gradient(ellipse 60% 70% at 72% 0%, rgba(160, 205, 150, 0.35), transparent 70%), linear-gradient(#2d4a33, #13241b 70%, #0b1712);
}
.stage.wide .app { font-size: 1.55cqi; }
.app-side, .app-card { background: var(--app-surface); border-radius: 0.9em; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.09); }
.app-side { padding: 1.4em 1.1em; display: flex; flex-direction: column; gap: 1.2em; min-height: 0; }
.app-brand { display: flex; flex-direction: column; line-height: 1.05; color: var(--ink-2); }
.app-brand strong { font-size: 3.4em; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
.app-brand-fr { font-style: italic; font-weight: 300; }
.app-label { margin: 0 !important; font-size: 0.75em; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.app-topics { list-style: none; margin: -0.6em 0 0; padding: 0; display: grid; gap: 0.2em; }
.app-topics li { padding: 0.45em 0.6em; border-radius: 0.6em; color: var(--ink-2); }
.app[data-topic="duties"] [data-topic="duties"], .app[data-topic="documents"] [data-topic="documents"],
.app[data-topic="ask"] [data-topic="ask"], .app[data-topic="notebooks"] [data-topic="notebooks"],
.app[data-topic="rover"] [data-topic="rover"] { background: rgba(227, 168, 111, 0.14); color: var(--ink); font-weight: 700; }
.app-main { min-width: 0; min-height: 0; display: flex; }
.app-view { display: none; flex: 1; flex-direction: column; gap: 0.9em; min-height: 0; min-width: 0; }
.app-view.on { display: flex; animation: rise 0.45s ease-out; }
.app-view h3 { margin: 0 !important; font-size: 2em !important; font-weight: 700; font-family: inherit !important; color: var(--ink); }
.app-card { padding: 1.1em 1.3em; min-height: 0; display: flex; flex-direction: column; gap: 0.7em; }
.app-composer { flex-direction: row; align-items: center; gap: 0.8em; }
.app-talk { flex: none; width: 4.6em; height: 4.6em; border-radius: 50%; display: grid; place-items: center; text-align: center; font-size: 0.75em; font-weight: 700; background: var(--app-accent); color: #fff; }
.app-input { flex: 1; padding: 0.55em 1em; border-radius: 999px; background: rgba(255, 255, 255, 0.07); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-btn { align-self: start; padding: 0.5em 1.2em; border-radius: 999px; background: var(--app-accent); color: #fff; font-weight: 700; }
.app-composer .app-btn { align-self: center; }
.app .bubble, .app .duties time, .app .nb-head strong { font-family: inherit; }
.app-label { font-size: 0.85em; color: var(--ink-3); }
.app-note { margin: 0 !important; color: var(--ink-3); font-size: 0.9em; }

.seg { display: inline-flex; border: 1px solid var(--hairline); border-radius: 0.5em; overflow: hidden; width: max-content; }
.seg span { padding: 0.25em 0.75em; color: var(--ink-2); }
.seg span.on { background: var(--orange); color: var(--on-accent); font-weight: 600; }

.tag { font-size: 0.78em; font-weight: 600; padding: 0.15em 0.6em; border-radius: 999px; background: var(--raised); color: var(--ink-2); }
.tag.ok { background: var(--sage); color: var(--on-accent); }


/* Conversation screen: camera frame beside the reply, as in the desktop interface. */
.ask { display: grid; grid-template-columns: 0.75fr 1.5fr; gap: 1.4em; min-height: 0; flex: 1; }
.ask-frame { margin: 0; }
.ask-frame img { width: 100%; height: auto; border-radius: 0.7em; display: block; }
.ask-turns { overflow: auto; min-height: 0; display: grid; gap: 0.7em; align-content: start; padding-right: 0.3em; scrollbar-width: none; }
.bubble { justify-self: start; margin: 0 !important; font-family: var(--display); font-size: 1.35em; font-weight: 600; padding: 0.35em 0.8em; border-radius: 0.8em 0.8em 0.8em 0.2em; background: var(--raised); border: 1px solid var(--hairline); color: var(--ink); }
.groups { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6em; }
.groups li { border-left: 2px solid var(--orange); padding-left: 0.8em; display: grid; gap: 0.2em; }
.line { margin: 0 !important; display: grid; grid-template-columns: 4.6em 1fr; align-items: baseline; line-height: 1.4; border-radius: 0.4em; padding: 0.1em 0.3em; color: var(--ink-2); transition: background 0.2s, color 0.2s; }
.line .code { font-size: 0.8em; font-weight: 600; color: var(--ink-3); }
.line.speaking { background: rgba(213, 92, 43, 0.24); color: var(--ink); }

/* The phone on the rover slides: the rover's phone page (src/beaver/rover/phone/phone.css) in its
   light colours, scaled to the phone's width. */
.phone-stage { position: fixed; z-index: 2; right: max(8vw, calc(50vw - 520px)); top: 50%; transform: translateY(-50%); pointer-events: none; }
.phone { margin: 0; width: min(300px, 24vw, 44vh); aspect-ratio: 9 / 19; padding: 3.2%; border-radius: 13% / 6%; background: #1b1716; border: 1px solid var(--hairline); box-shadow: 0 1.5em 3em rgba(40, 12, 6, 0.35); }
.phone-screen { container-type: inline-size; height: 100%; border-radius: 10% / 4.6%; background: #f6f4ef; color: #1f1a16; overflow: hidden; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
.phone-view { display: none; height: 100%; flex-direction: column; align-items: center; gap: 5.5cqi; padding: 10cqi 5cqi; text-align: center; font-size: 4.4cqi; line-height: 1.5; }
.phone-view.on { display: flex; animation: rise 0.45s ease-out; }
.phone-view h3 { margin: 0 !important; font-size: 1.75em !important; font-weight: 700; font-family: inherit !important; color: #1f1a16; }
.ph-language { align-self: stretch; display: grid; gap: 0.35em; text-align: left; font-weight: 600; }
.ph-select, .ph-locate { display: block; align-self: stretch; padding: 0.55em 0.75em; border: 1px solid #57504a; border-radius: 0.6em; background: #fff; font-weight: 400; text-align: left; }
.ph-locate { text-align: center; }
.ph-status { margin: 0 !important; color: #57504a; font-size: 1em !important; }
.ph-talk { width: 52%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; background: #9a4e27; color: #fff; font-size: 1.15em; font-weight: 600; flex: none; }
.ph-answer { align-self: stretch; padding: 0.9em; border-radius: 0.7em; background: #fff; text-align: left; }
.ph-answer h4 { margin: 0 0 0.4em; font-size: 0.95em; color: #57504a; }
.ph-answer p { margin: 0 !important; font-size: 0.95em !important; color: #1f1a16; }
/* On the answer slides the page scrolls down to the answer, as it does on a phone. */
.phone-view:has(.ph-answer) { justify-content: flex-end; }
.phone-view:has(.ph-answer) .ph-talk { width: 30%; }
/* Demo mode (#51): a badge on the drawn phone and laptop, and a link to the real app on each card,
   shown only on the laptop's server. */
.laptop, .phone { position: relative; }
.demo-badge { position: absolute; z-index: 1; top: -0.9em; left: 50%; transform: translateX(-50%); padding: 0.25em 0.8em; border-radius: 999px; background: var(--maroon); color: #fff; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }
.card .try { margin: 1.1em 0 0; font-size: 1em; }
.card .try a { display: inline-block; min-height: 24px; padding: 0.2em 0; color: var(--accent-text); font-weight: 600; pointer-events: auto; }

/* The sample question on a rover card, since the phone page shows only the reply. */
.card .sample { margin: 1em 0 0.1em; font-family: var(--display); font-weight: 700; color: var(--ink); font-size: 1.2em; }
.card .sample-en { margin: 0; font-size: 0.95em; color: var(--ink-3); }
@media (max-width: 700px) { .phone-stage { display: none; } }

/* Deadlines screen: date, duty in two languages, and its source. */
.duties { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7em; overflow: auto; min-height: 0; scrollbar-width: none; }
.duties li { display: grid; grid-template-columns: 7.5em 1fr; column-gap: 1em; border-left: 2px solid var(--orange); padding-left: 0.8em; }
.duties time { grid-row: span 3; font-family: var(--display); font-weight: 700; color: var(--ink); }
.duties .source { font-size: 0.8em; color: var(--ink-3); padding-left: 0.3em; }

/* Documents screen: a photographed letter drawn as paper and grey lines of text. */
.doc-photo { margin: 0.4em 0 0; width: 78%; justify-self: center; align-self: start; aspect-ratio: 3 / 4; background: #f3ece1; border-radius: 0.5em; padding: 1.4em 1.2em; display: grid; align-content: start; gap: 0.7em; transform: rotate(-2deg); box-shadow: 0 0.6em 1.4em rgba(0, 0, 0, 0.35); }
.doc-photo span { height: 0.4em; border-radius: 999px; background: #c9bfb1; }
.doc-photo span:nth-child(3n) { width: 70%; }
.doc-photo .doc-seal { width: 2.4em; height: 2.4em; border-radius: 50%; background: var(--red); margin-bottom: 0.6em; }

/* Notebook screen. */
.nb-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3em 0.9em; }
.nb-head strong { font-family: var(--display); font-size: 1.5em; }
.nb-head [lang="fr"] { color: var(--ink-3); }
.vocab { width: 100%; border-collapse: collapse; }
.vocab th { text-align: left; font-size: 0.75em; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); padding: 0.4em 0.7em 0.4em 0; border-bottom: 1px solid var(--hairline); }
.vocab td { padding: 0.45em 0.7em 0.45em 0; border-bottom: 1px solid var(--hairline); vertical-align: top; color: var(--ink-2); }
.vocab td:first-child { font-weight: 600; color: var(--ink); }
.concept { margin-top: 0.4em; padding: 0.8em 1em; border-radius: 0.8em; background: var(--raised); border-left: 3px solid var(--sage); }
.concept h3 { margin: 0 0 0.3em !important; font-size: 1.1em !important; }
.concept p { margin: 0 !important; color: var(--ink-2); }

.autoplay {
  position: fixed;
  z-index: 4;
  left: 20px;
  bottom: 20px;
  font: 600 14px var(--sans);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
}
.autoplay[aria-pressed="true"] { background: var(--orange); color: var(--on-accent); border-color: var(--orange); }
.ambience {
  position: fixed;
  z-index: 4;
  right: 20px;
  bottom: 20px;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font: 600 14px var(--sans);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
}
.ambience[aria-pressed="false"] .wave { display: none; }

button:focus-visible { outline: 3px solid var(--accent-text); outline-offset: 2px; }

@keyframes highlight { to { background-size: 100% 100%; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes stream { from { -webkit-mask-position: 100% 0; mask-position: 100% 0; } to { -webkit-mask-position: 0 0; mask-position: 0 0; } }
@keyframes stream-rtl { from { -webkit-mask-position: 0 0; mask-position: 0 0; } to { -webkit-mask-position: 100% 0; mask-position: 100% 0; } }
@keyframes flow { to { stroke-dashoffset: -16; } }

@media (prefers-reduced-motion: reduce) {
  .app-view.on, .greeting.in { animation: none; }
  .beat.now mark { animation: none; background-size: 100% 100%; }
  .stage { transition: none; }
}

/* Phone layout. The floating menu takes the top 72px and Beaver stands between the Play and Sound
   buttons at the bottom, so every slide keeps clear of both; iOS Safari's 100vh reaches under its
   toolbar, so positions come from the bottom edge and heights use the dynamic viewport. The
   laptop and the drawn phone are hidden: beside a full-width card there is no room for them. */
@media (max-width: 700px) {
  .reveal .slides section[data-view] { padding: 72px 16px 116px !important; align-items: flex-start; }
  /* A column no wider than the screen, so the one-line .fit lines shrink to it rather than widen it. */
  .hello { width: 100%; gap: 2vh; margin-top: 18vh; grid-template-columns: minmax(0, 1fr); }
  .hello > * { min-width: 0; }
  .tagline { font-size: 1.1em; }
  .brand-fr { font-size: 1em; }
  .story, .story:has(.flow) { width: 100%; margin-top: 0; }
  .card, .card-side { width: 100%; max-height: calc(100dvh - 72px - 116px); }
  .stage { display: none !important; }
  .companion, body[data-companion="corner"] .companion, body[data-companion="middle"] .companion {
    right: auto; top: auto; left: 50%; bottom: 8px; width: 150px; height: 100px; transform: translateX(-50%);
  }
  /* Story lines and the three-language diagram share one screen, so both run smaller. */
  .reveal .slides .story .beat { font-size: 20px; }
  /* Each diagram card's speaker icon moves to its top right corner, which saves a row per card. */
  .story .node { position: relative; padding: 0.45em 2.4em 0.45em 0.7em; }
  .story .node .icon { position: absolute; top: 0.55em; right: 0.7em; margin: 0; }
  .extra { margin-top: 2vh; }
  /* The pale backdrop behind the intro and closing text spans the whole width: the text does. */
  .slide-scrim::before {
    background: linear-gradient(180deg, rgba(248, 238, 224, 0.94) 0%, rgba(248, 238, 224, 0.86) 60%, rgba(248, 238, 224, 0) 100%);
  }
}
/* Short phones, such as the iPhone SE: the diagram page's three cards and story lines need less
   height still. */
@media (max-width: 700px) and (max-height: 700px) {
  .reveal .slides .story .beat { font-size: 17px; margin-bottom: 0.25em; }
  .story .node-text { font-size: 0.95em; }
  .story .flow { gap: 0.3em; }
}
