@font-face {
  font-family: 'Noto Sans Devanagari';
  src: url('fonts/NotoSansDevanagari-Variable.ttf') format('truetype');
  font-style: normal; font-weight: 100 900; font-display: swap;
}
.hero-figure.stories-ready { container: students / inline-size; }
.student-scene { position: relative; width: 100%; height: calc(125.018cqw + var(--story-headroom, 0px)); isolation: isolate; --student-crossfade-duration: 1000ms; }
.student-group, .student-portrait { position: absolute; top: var(--story-headroom, 0px); left: 0; width: 100%; height: auto; filter: drop-shadow(2px 5px 3px rgb(50 37 29 / 18%)); }
.student-group { opacity: 1; transition: opacity 120ms ease; }
.student-targets { position: absolute; top: var(--story-headroom, 0px); left: 0; right: 0; height: 125.018cqw; }
.student-target { position: absolute; inset: 0; border: 0; padding: 0; background: transparent; cursor: pointer; clip-path: var(--student-shape); }
.student-target:focus-visible { background: rgb(205 103 64 / 18%); outline: none; }
.student-story { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity 160ms ease; }
/* Dymek i postać mają jedno opacity na wspólnej warstwie .student-story. */
.student-bubble { position: absolute; }
.student-bubble-art { display: block; width: 100%; height: 100%; }
.student-draw-lead, .student-draw-path { stroke-dasharray: 1; stroke-dashoffset: 1; }
.student-letter { opacity: 0; }
@keyframes student-bubble-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
/* Znak jest widoczny od początku swojej krótkiej animacji. steps(1, end)
   przy 1 ms potrafi zachować opacity: 0 po zakończeniu wskutek zaokrąglenia czasu. */
@keyframes student-letter-appear { from, to { opacity: 1; } }
.student-scene:is([data-state="story"], [data-state="closing"], [data-state="returning"]) .student-draw-lead {
  animation: student-bubble-draw 123ms cubic-bezier(.42, 0, .75, .58) 0ms both;
}
.student-scene:is([data-state="story"], [data-state="closing"], [data-state="returning"]) .student-draw-path {
  animation: student-bubble-draw 727ms cubic-bezier(.28, .17, .55, 1) 123ms both;
}
.student-scene:is([data-state="story"], [data-state="closing"], [data-state="returning"]) .student-letter {
  animation: student-letter-appear 1ms linear calc(max(var(--student-crossfade-duration), 850ms) + 40ms + var(--letter-index) * 24ms) forwards;
}
.student-speech { position: absolute; inset: 8% 10% 24%; display: flex; align-items: center; justify-content: center; font-family: var(--heading-font); font-size: calc(clamp(16px, 3.6cqw, 19px) * var(--heading-size-scale, 1)); font-weight: var(--heading-weight, 300); line-height: 1.4; text-align: center; overflow-wrap: break-word; }
.student-speech > p { min-width: 0; width: 100%; }
.student-greeting { color: var(--accent); }
.student-greeting:lang(hi) { font-family: 'Noto Sans Devanagari', sans-serif; font-weight: 400; font-size: 1.08em; }
.student-scene[data-state="story"] .student-group,
.student-scene[data-state="closing"] .student-group { opacity: 0; }
.student-scene[data-state="story"] :is(.student-group, .student-story) { transition-duration: var(--student-crossfade-duration); }
.student-scene[data-state="returning"] .student-group { opacity: 1; }
/* Powrót ma wspólną oś czasu rysunku i przenikania sterowaną w stories.js. */
.student-scene[data-state="returning"] :is(.student-group, .student-story) { transition: none; }
.student-scene[data-state="story"] .student-story,
.student-scene[data-state="closing"] .student-story,
.student-scene[data-state="returning"] .student-story { visibility: visible; }
.student-scene[data-state="story"] .student-story,
.student-scene[data-state="closing"] .student-story { opacity: 1; }
.hero-figure.stories-ready figcaption { height: 44px; min-height: 44px; padding: 4px 12px; display: grid; place-items: center; position: relative; }
.student-return { border: 0; background: transparent; padding: 6px 12px; min-height: 32px; font-family: var(--heading-font); font-weight: var(--heading-weight, 300); font-size: calc(13px * var(--heading-size-scale, 1)); cursor: pointer; }
.student-return:hover { color: var(--accent); }
.student-return[hidden], .student-hint[hidden] { display: none; }
/* Rozmiar dymka dopasowuje się do tekstu, ale ogonek pozostaje zakotwiczony przy ustach. */
@container students (max-width: 440px) {
  .student-speech { font-size: calc(clamp(16px, 4.3cqw, 18px) * var(--heading-size-scale, 1)); }
}
@media (max-width: 640px) {
  .student-scene { height: var(--mobile-scene-height, 78cqw); overflow: hidden; clip-path: url('#student-mobile-crop'); }
  .student-group, .student-targets { top: var(--mobile-group-top, 0px); }
  .student-speech { font-size: calc(clamp(12px, 3.7cqw, 15px) * var(--heading-size-scale, 1)); line-height: 1.35; }
  .hero-figure figcaption { display: none !important; }
  .hero-figure:has(.student-scene:focus-visible) { outline: 2px solid var(--accent); outline-offset: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .student-group, .student-story, .student-bubble { transition: none; }
  .student-draw-lead, .student-draw-path { animation: none !important; stroke-dashoffset: 0; }
  .student-letter { animation: none !important; opacity: 1; }
}
