/*
 * Memoir Kit — visual system
 * Ported 1:1 from "Abstract Memoir Room Design" (src/index.css),
 * renamed with the mm- prefix and scoped under body.mm-memoir.
 */

/* ---------- base ---------- */

html {
  background: #d4dde1;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  transition: background-color 0.8s ease;
}

html.theme-night {
  background-color: #080909;
}

body.mm-memoir {
  --ground: #d4dde1;
  --ink: #303a41;
  --pale-ink: var(--mm-c-pale);
  --oval-inner: rgb(255 255 255 / 0.12);
  --oval-edge: rgb(255 255 255 / 0.18);
  margin: 0;
  min-width: 320px;
  min-height: 100svh;
  overflow-x: clip;
  position: relative;
  isolation: isolate;
  color: var(--ink);
  background: var(--ground);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  transition: color 1.2s ease;
}

body.mm-memoir *,
body.mm-memoir *::before,
body.mm-memoir *::after {
  box-sizing: border-box;
}

:where(body.mm-memoir) button {
  color: var(--ink);
  font: inherit;
}

.mm-portal,
.mm-oval,
.mm-word,
.mm-wordmark,
.mm-caption__enter,
.mm-popup-trigger,
.mm-mover,
.mm-word-hero > a,
.mm-next a,
.mm-room-nav a,
body.mm-memoir a {
  text-decoration: none;
}

.mm-memoir :where(a) {
  color: var(--ink);
}

.mm-portal:hover,
.mm-portal:focus-visible,
.mm-oval:hover,
.mm-oval:focus-visible,
.mm-word:hover,
.mm-word:focus-visible,
.mm-wordmark:hover,
.mm-caption__enter:hover,
.mm-popup-trigger:hover,
.mm-word-hero > a:hover,
.mm-next a:hover,
.mm-room-nav a:hover,
body.mm-memoir a:hover {
  text-decoration: none;
}

body.mm-memoir a,
body.mm-memoir a:hover,
body.mm-memoir a:focus,
body.mm-memoir a:visited,
body.mm-memoir a *,
body.mm-memoir a:hover *,
body.mm-memoir a:focus *,
body.mm-memoir a:visited * {
  text-decoration: none !important;
}

body.mm-memoir .brz a,
body.mm-memoir .brz a:hover,
body.mm-memoir .brz a:focus,
body.mm-memoir .brz a:visited,
body.mm-memoir .brz-rich-text a,
body.mm-memoir .brz-rich-text a:hover,
body.mm-memoir .brz-rich-text a:focus,
body.mm-memoir .brz-rich-text a:visited {
  text-decoration: none !important;
}

body.mm-memoir .brz-rich-text a,
body.mm-memoir .brz-rich-text a:hover,
body.mm-memoir .brz-rich-text a:focus,
body.mm-memoir .brz-rich-text a:visited {
  border-bottom: 0 !important;
  background-image: none !important;
}

/* ---------- glowing links ---------- */

.mm-glow-link,
.mm-glow-link:hover,
.mm-glow-link:focus-visible {
  color: inherit;
  text-decoration: none;
}

.mm-glow-link {
  --mm-glow-color: rgb(255 242 196);
  text-shadow:
    0 0 var(--mm-glow-r1, 8px) color-mix(in srgb, var(--mm-glow-color) var(--mm-glow-s1, 75%), transparent),
    0 0 var(--mm-glow-r2, 24px) color-mix(in srgb, var(--mm-glow-color) var(--mm-glow-s2, 48%), transparent),
    0 0 var(--mm-glow-r3, 52px) color-mix(in srgb, var(--mm-glow-color) var(--mm-glow-s3, 26%), transparent);
  transition: text-shadow 380ms ease;
}

.mm-glow-link a,
.mm-glow-link a *,
a.mm-glow-link * {
  text-shadow: inherit;
  transition: text-shadow 380ms ease;
}

.mm-glow-link:hover,
.mm-glow-link:focus-visible,
.mm-glow-link.is-near {
  text-shadow:
    0 0 var(--mm-glow-rn1, 14px) color-mix(in srgb, var(--mm-glow-color) var(--mm-glow-sn1, 100%), transparent),
    0 0 var(--mm-glow-rn2, 40px) color-mix(in srgb, var(--mm-glow-color) var(--mm-glow-sn2, 72%), transparent),
    0 0 var(--mm-glow-rn3, 88px) color-mix(in srgb, var(--mm-glow-color) var(--mm-glow-sn3, 42%), transparent);
}

a.mm-glow-link.is-near:not(:hover):not(:focus-visible),
.mm-glow-link.is-near a:not(:hover):not(:focus-visible) {
  animation: mm-glow-breathe var(--mm-glow-breathe, 2.6s) ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  a.mm-glow-link.is-near:not(:hover):not(:focus-visible),
  .mm-glow-link.is-near a:not(:hover):not(:focus-visible) {
    animation: none;
  }
}

/* ---------- horizontal alignment ---------- */

.mm-align-left {
  text-align: left;
}

.mm-align-center {
  text-align: center;
}

.mm-align-right {
  text-align: right;
}

.mm-align-left > .mm-portal-block {
  justify-content: flex-start;
}

.mm-align-center > .mm-portal-block {
  justify-content: center;
}

.mm-align-right > .mm-portal-block {
  justify-content: flex-end;
}

.mm-align-left > .mm-portal-block,
.mm-align-center > .mm-portal-block,
.mm-align-right > .mm-portal-block {
  text-align: left;
}

.mm-portal-block > .mm-caption {
  text-align: left;
}

.mm-portal-block.mm-side-left > .mm-caption {
  order: -1;
  text-align: right;
}

.mm-portal-block.mm-align-left {
  justify-content: flex-start;
}

.mm-portal-block.mm-align-center {
  justify-content: center;
}

.mm-portal-block.mm-align-right {
  justify-content: flex-end;
}

/* ---------- text colour follows the theme ---------- */

.mm-memoir .mm-ink,
.mm-memoir .mm-ink * {
  color: var(--ink) !important;
}

.mm-memoir .mm-ground {
  background-color: var(--ground) !important;
}

/*
 * Global ink, night only: in day mode the element keeps the colour set in
 * Brizy; in night mode it follows the theme ink.
 */

.theme-night .mm-ink-night,
.theme-night .mm-ink-night * {
  color: var(--ink) !important;
}

/*
 * Consolidated text-colour aliases: old classes keep working.
 * mm-c-script / mm-c-on-dark follow the pale style; mm-c-reading follows ink.
 */

.mm-memoir .mm-c-script,
.mm-memoir .mm-c-script *,
.mm-memoir .mm-c-on-dark,
.mm-memoir .mm-c-on-dark * {
  color: var(--mm-c-pale) !important;
}

.mm-memoir .mm-c-reading,
.mm-memoir .mm-c-reading * {
  color: var(--ink) !important;
}

.mm-hero h1,
.mm-room-hero h1,
.mm-word-hero h1 {
  color: var(--pale-ink) !important;
}

.mm-intro h1 {
  color: var(--ink) !important;
}

.mm-script {
  color: var(--mm-c-pale) !important;
}

.mm-center blockquote {
  color: var(--pale-ink) !important;
}

body.mm-memoir.theme-night {
  --ground: #080909;
  --ink: #d9d9d4;
  --pale-ink: var(--mm-c-pale);
  --oval-inner: rgb(221 220 211 / 0.09);
  --oval-edge: rgb(215 218 216 / 0.14);
}

body.mm-memoir.theme-night::after {
  position: fixed;
  inset: 0;
  z-index: 58;
  box-shadow:
    inset 0 0 28px rgb(220 224 222 / 0.06),
    inset 0 0 80px rgb(220 224 222 / 0.018);
  content: "";
  pointer-events: none;
}

body.mm-memoir:not(.theme-night)::before {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: rgb(255 255 255 / 0.055);
  content: "";
  pointer-events: none;
}

/* ---------- light-follow cursor ---------- */

.mm-light-follow {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgb(255 255 245 / 0.98) 0 12%, rgb(235 244 210 / 0.62) 24%, transparent 70%);
  box-shadow:
    0 0 5px rgb(247 250 220 / 0.45),
    0 0 16px rgb(234 244 207 / 0.2);
  transform: translate3d(-30px, -30px, 0);
  transition: box-shadow 500ms ease;
  will-change: transform;
}

.mm-light-follow.is-near {
  box-shadow:
    0 0 8px rgb(250 252 222 / 0.72),
    0 0 28px rgb(228 241 192 / 0.42),
    0 0 48px rgb(211 231 177 / 0.16);
}

.theme-night .mm-light-follow {
  background: radial-gradient(circle, rgb(238 247 218 / 0.95) 0 12%, rgb(194 221 191 / 0.62) 24%, transparent 70%);
  box-shadow:
    0 0 5px rgb(222 240 204 / 0.48),
    0 0 18px rgb(184 218 184 / 0.2);
}

/* ---------- masthead + controls ---------- */

.mm-masthead {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 80;
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: 22px 26px;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: none;
  transition: color 1.2s ease;
}

.mm-wordmark {
  position: absolute;
  top: 28px;
  left: 50%;
  width: max-content;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: inherit;
  letter-spacing: inherit;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase !important;
  transform: translateX(-50%);
  white-space: nowrap;
}

.mm-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 10px;
}

.mm-controls--right {
  margin-left: auto;
  padding-left: 0;
  padding-right: 10px;
}

.mm-theme-toggle {
  position: relative;
  display: block;
  width: 31px;
  height: 31px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background:
    linear-gradient(rgb(255 255 255 / 0.07), rgb(255 255 255 / 0.07)) padding-box,
    radial-gradient(ellipse at 30% 20%, rgb(255 255 255 / 0.48), transparent 76%) border-box;
  box-shadow:
    inset 0 0 12px rgb(255 255 255 / 0.07),
    0 0 7px rgb(255 255 255 / 0.1);
  cursor: pointer;
}

.mm-theme-toggle svg {
  width: 12px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.2;
}

.mm-theme-toggle > span {
  position: absolute;
  top: 8px;
  left: 8px;
  display: grid;
  width: 14px;
  height: 14px;
  place-items: center;
  background: transparent;
  transition:
    transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 500ms ease;
}

.mm-sun {
  opacity: 1;
}

.mm-moon {
  opacity: 0;
  transform: rotate(-70deg) scale(0.7);
}

.theme-night .mm-sun {
  opacity: 0;
  transform: rotate(70deg) scale(0.7);
}

.theme-night .mm-moon {
  opacity: 1;
  transform: rotate(0) scale(1);
}

.theme-night .mm-theme-toggle {
  background:
    linear-gradient(rgb(255 255 255 / 0.05), rgb(255 255 255 / 0.05)) padding-box,
    radial-gradient(ellipse at 30% 20%, rgb(255 255 255 / 0.24), transparent 76%) border-box;
  box-shadow:
    inset 0 0 12px rgb(255 255 255 / 0.06),
    0 0 8px rgb(255 255 255 / 0.08);
}

/* ---------- page movers ---------- */

.mm-mover {
  position: fixed;
  top: 50%;
  z-index: 70;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  opacity: 0.52;
  transition: opacity 300ms ease;
  writing-mode: vertical-rl;
}

.mm-mover:hover,
.mm-mover:focus-visible {
  opacity: 1;
}

.mm-mover--down {
  left: 25px;
}

.mm-mover--up {
  right: 25px;
  transform: rotate(180deg);
}

/* ---------- fireflies (local) ---------- */

.mm-firefly {
  --magnet-x: 0px;
  --magnet-y: 0px;
  --mm-firefly-scale: 1;
  position: relative;
  z-index: 46;
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  vertical-align: middle;
  cursor: pointer;
}

.mm-firefly > span {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(255 255 231) 0 14%, rgb(231 242 196 / 0.76) 30%, transparent 72%);
  box-shadow:
    0 0 6px rgb(244 249 210 / 0.5),
    0 0 18px rgb(222 237 183 / 0.22);
  transform: translate3d(var(--magnet-x), var(--magnet-y), 0) scale(var(--mm-firefly-scale));
  transition:
    box-shadow 650ms ease,
    transform 320ms ease;
}

.mm-firefly.is-near > span {
  box-shadow:
    0 0 12px rgb(255 255 235),
    0 0 38px rgb(234 247 192 / 0.8),
    0 0 72px rgb(211 235 166 / 0.34);
  transform: translate3d(var(--magnet-x), var(--magnet-y), 0) scale(calc(var(--mm-firefly-scale) * 1.48));
}

.mm-firefly.is-hidden {
  opacity: 0;
  pointer-events: none;
  animation: none;
}

.mm-motion--orbit {
  animation: mm-firefly-orbit 16s -3s linear infinite;
}

.mm-motion--line {
  animation: mm-firefly-line 15s -7s ease-in-out infinite;
}

.mm-motion--arc {
  animation: mm-firefly-arc 18s -11s ease-in-out infinite;
}

.mm-motion--vertical {
  animation: mm-firefly-vertical 17s -5s ease-in-out infinite;
}

.mm-motion--mini {
  animation: mm-firefly-mini-orbit 10s -4s linear infinite;
}

.mm-motion--spiral {
  animation: mm-firefly-spiral 20s -6s ease-in-out infinite;
}

/* ---------- phrase overlay ---------- */

.mm-phrase-backdrop {
  position: fixed;
  inset: 0;
  z-index: 92;
  display: grid;
  place-items: center;
  padding: 24px;
  border: 0;
  background: rgb(226 233 233 / 0.035);
  opacity: 0;
  pointer-events: none;
  transition: opacity 700ms ease;
}

.mm-phrase-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.mm-phrase-backdrop.is-fading {
  opacity: 0;
  pointer-events: none;
}

.mm-phrase {
  position: relative;
  isolation: isolate;
  display: flex;
  width: min(620px, calc(100vw - 48px));
  min-height: 310px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 74px;
  border: 0;
  border-radius: 50%;
  background: rgb(239 244 244 / 0.64);
  box-shadow:
    0 0 42px 22px rgb(239 244 244 / 0.25),
    inset 0 0 45px rgb(255 255 255 / 0.2);
  color: var(--mm-c-phrase);
  text-align: center;
  animation: mm-mist-life 7.8s ease both;
}

.theme-night .mm-phrase {
  background: rgb(116 122 121 / 0.66);
  box-shadow:
    0 0 44px 24px rgb(154 160 158 / 0.16),
    inset 0 0 48px rgb(230 232 226 / 0.08);
  color: var(--mm-c-phrase);
}

.mm-phrase q {
  position: relative;
  z-index: 2;
  max-width: 420px;
  opacity: var(--mm-txt-opacity, 0.78);
  animation: mm-scar-appear 7.7s ease both;
}

/* ---------- hero ---------- */

.mm-hero {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.mm-kicker {
  margin: 0 0 var(--mm-hero-gap-kicker, 44px);
  opacity: var(--mm-txt-opacity, 0.56);
}

.mm-hero h1 {
  position: relative;
  display: flex;
  flex-direction: column;
  margin: 0;
}

.mm-hero__echo {
  display: none;
}

.mm-invitation {
  margin: var(--mm-hero-gap-invitation, 44px) 0 0;
}

.mm-scroll-cue {
  position: absolute;
  bottom: 14vh;
  left: 36px;
  opacity: 0.5;
  writing-mode: vertical-rl;
}

/* ---------- passages + portals ---------- */

.mm-passages {
  position: relative;
  z-index: 3;
  padding-bottom: 28vh;
}

.mm-passage {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 125svh;
  align-items: center;
  padding: 15vh clamp(28px, 8vw, 130px);
  contain-intrinsic-size: 1000px;
  content-visibility: auto;
}

.mm-portal-block {
  position: relative;
  z-index: 3;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--mm-portal-gap-caption, 5vw);
}

.mm-portal {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: clamp(18px, 3vw, 40px);
  border: 1px solid transparent;
  border-radius: 50%;
  background:
    linear-gradient(var(--portal-color), var(--portal-color)) padding-box,
    radial-gradient(ellipse at 35% 24%, rgb(255 255 255 / 0.38), rgb(255 255 255 / 0.05) 58%, transparent 76%) border-box;
  box-shadow:
    inset 0 0 48px var(--oval-inner),
    0 0 14px var(--oval-edge),
    0 24px 70px rgb(75 89 97 / 0.08);
  cursor: pointer;
  isolation: isolate;
  contain: paint;
  text-align: center;
  transition: box-shadow 1s ease;
}

body.mm-memoir:not(.theme-night) .mm-portal::before,
body.mm-memoir:not(.theme-night) .mm-oval::before,
body.mm-memoir:not(.theme-night) .mm-word::before {
  position: absolute;
  inset: 5%;
  z-index: 3;
  border-radius: inherit;
  box-shadow:
    inset 0 0 3px 1px rgb(255 255 255 / 0.3),
    inset 12px 0 18px rgb(224 181 203 / 0.12),
    inset -12px 0 18px rgb(172 198 218 / 0.14),
    0 0 9px rgb(255 255 255 / 0.12);
  content: "";
  opacity: 0;
  pointer-events: none;
  transition: opacity 900ms ease;
}

body.mm-memoir:not(.theme-night) .mm-portal:hover::before,
body.mm-memoir:not(.theme-night) .mm-portal:focus-visible::before,
body.mm-memoir:not(.theme-night) .mm-oval:hover::before,
body.mm-memoir:not(.theme-night) .mm-oval:focus-visible::before,
body.mm-memoir:not(.theme-night) .mm-word:hover::before,
body.mm-memoir:not(.theme-night) .mm-word:focus-visible::before {
  opacity: 0.9;
}

body.mm-memoir:not(.theme-night) .mm-portal:hover::after,
body.mm-memoir:not(.theme-night) .mm-portal:focus-visible::after {
  opacity: 0.28;
}

.mm-portal::after {
  position: absolute;
  inset: 5%;
  border: 0;
  border-radius: 50%;
  box-shadow:
    inset 0 0 13px rgb(255 255 255 / 0.3),
    0 0 11px rgb(255 255 255 / 0.14);
  content: "";
  opacity: 0;
  transition: opacity 1s ease;
}

.mm-portal:hover,
.mm-portal:focus-visible {
  box-shadow:
    inset 0 0 68px rgb(255 255 255 / 0.17),
    0 0 22px rgb(255 255 255 / 0.23),
    0 25px 72px rgb(75 89 97 / 0.1);
  transform: none;
}

.mm-portal:hover::after,
.mm-portal:focus-visible::after {
  opacity: 0.72;
}

.mm-portal__surface {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(ellipse at 25% 35%, rgb(236 198 216 / 0.18), transparent 29%),
    radial-gradient(ellipse at 76% 30%, rgb(190 215 224 / 0.19), transparent 31%),
    radial-gradient(ellipse at 58% 78%, rgb(239 229 190 / 0.15), transparent 32%),
    linear-gradient(128deg, transparent 25%, rgb(255 255 255 / 0.17) 50%, transparent 72%);
  opacity: 0.76;
  transform: translate3d(-1.5%, 1%, 0) scale(1.01);
  animation: mm-pearl-drift 13s ease-in-out infinite alternate;
  transition: opacity 1.2s ease;
}

.mm-portal:hover .mm-portal__surface,
.mm-portal:focus-visible .mm-portal__surface {
  opacity: 0.9;
}

.mm-portal__glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 72%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(255 255 255 / 0.32), rgb(255 255 255 / 0.1) 34%, transparent 72%);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.55);
  transition:
    opacity 1.2s ease,
    transform 1.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.mm-portal:hover .mm-portal__glow,
.mm-portal:focus-visible .mm-portal__glow {
  opacity: 0.5;
  transform: translate(-50%, -50%) scale(0.95);
}

.mm-portal__number {
  position: absolute;
  top: var(--mm-portal-gap-number, 25px);
  left: 50%;
  z-index: 2;
  transform: translateX(-50%);
}

.mm-portal__title {
  position: relative;
  z-index: 2;
  text-align: center;
}

.mm-portal__caption {
  position: relative;
  z-index: 2;
  margin-top: var(--mm-portal-gap-caption, 15px);
  text-align: center;
  opacity: var(--mm-txt-opacity, 0.65);
}

.mm-caption {
  width: 175px;
}

.mm-caption p {
  margin: 0 0 13px;
  opacity: var(--mm-txt-opacity, 0.65);
}

.mm-caption__enter {
  display: inline-block;
  padding: 0 0 3px;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
}

.mm-shape--wide {
  width: calc(min(54vw, 760px) * var(--mm-portal-scale, 1));
  aspect-ratio: 1.9;
}

.mm-shape--tall {
  width: calc(min(29vw, 410px) * var(--mm-portal-scale, 1));
  aspect-ratio: 0.76;
}

.mm-shape--soft {
  width: calc(min(44vw, 630px) * var(--mm-portal-scale, 1));
  aspect-ratio: 1.08;
}

.mm-shape--small {
  width: calc(min(27vw, 390px) * var(--mm-portal-scale, 1));
  aspect-ratio: 1;
}

.mm-shape--low {
  width: calc(min(48vw, 680px) * var(--mm-portal-scale, 1));
  aspect-ratio: 2.3;
}

.mm-shape--thin {
  width: calc(min(20vw, 290px) * var(--mm-portal-scale, 1));
  aspect-ratio: 0.62;
}

.mm-shape--round {
  width: calc(min(32vw, 480px) * var(--mm-portal-scale, 1));
  aspect-ratio: 1;
}

.mm-shape--oval {
  width: calc(min(32vw, 560px) * var(--mm-portal-scale, 1));
  min-height: calc(280px * var(--mm-portal-scale, 1));
  border-radius: 50%;
}

.mm-portal--silence { --portal-color: var(--mm-a-portal-silence); }
.mm-portal--weight { --portal-color: var(--mm-a-portal-weight); color: var(--mm-c-pale); }
.mm-portal--love { --portal-color: var(--mm-a-portal-love); }
.mm-portal--grief { --portal-color: var(--mm-a-portal-grief); color: var(--mm-c-pale); }
.mm-portal--body { --portal-color: var(--mm-a-portal-body); }
.mm-portal--memory { --portal-color: var(--mm-a-portal-memory); }
.mm-portal--threshold { --portal-color: var(--mm-a-portal-threshold); }

.theme-night .mm-portal,
.theme-night .mm-page-field {
  background:
    radial-gradient(ellipse at 30% 22%, rgb(255 255 250 / 0.25), transparent 34%) padding-box,
    linear-gradient(145deg, var(--portal-color), rgb(220 222 219 / 0.13)) padding-box,
    radial-gradient(ellipse at 34% 18%, rgb(239 238 232 / 0.32), transparent 82%) border-box;
  box-shadow:
    inset 0 0 68px rgb(255 252 242 / 0.08),
    0 0 18px rgb(218 226 226 / 0.13);
}

.mm-oval { --pearl-color: var(--mm-a-oval); }
.mm-word { --pearl-color: var(--mm-a-word); }
.mm-oval--1 { --pearl-color: var(--mm-a-oval-1); }
.mm-oval--2 { --pearl-color: var(--mm-a-oval-2); }
.mm-word--one { --pearl-color: var(--mm-a-word-one); }
.mm-word--two { --pearl-color: var(--mm-a-word-two); }
.mm-word--three { --pearl-color: var(--mm-a-word-three); }
.mm-word--four { --pearl-color: var(--mm-a-word-four); }
.mm-word--five { --pearl-color: var(--mm-a-word-five); }
.mm-word--six { --pearl-color: var(--mm-a-word-six); }

.theme-night .mm-oval,
.theme-night .mm-word {
  background:
    radial-gradient(ellipse at 30% 22%, rgb(255 255 250 / 0.2), transparent 36%) padding-box,
    linear-gradient(145deg, var(--pearl-color), rgb(216 218 215 / 0.1)) padding-box,
    radial-gradient(ellipse at 34% 18%, rgb(239 238 232 / 0.28), transparent 82%) border-box;
  box-shadow:
    inset 0 0 58px rgb(255 252 242 / 0.07),
    0 0 16px rgb(218 226 226 / 0.11);
}

.theme-night .mm-reading {
  background:
    radial-gradient(ellipse at 28% 20%, rgb(255 250 240 / 0.16), transparent 35%) padding-box,
    linear-gradient(145deg, rgb(111 119 123 / 0.94), rgb(46 51 53 / 0.97)) padding-box,
    radial-gradient(ellipse at 34% 18%, rgb(239 238 232 / 0.3), transparent 82%) border-box;
  color: var(--ink);
}

.mm-passage--1 {
  justify-content: flex-end;
  gap: 5vw;
  padding-right: 10vw;
}

.mm-passage--2 {
  gap: 7vw;
  padding-left: 15vw;
}

.mm-passage--2 .mm-caption,
.mm-passage--5 .mm-caption {
  order: -1;
  text-align: right;
}

.mm-passage--3 {
  justify-content: center;
  gap: 6vw;
  padding-left: 21vw;
}

.mm-passage--4 {
  gap: 8vw;
  padding-left: 11vw;
}

.mm-passage--5 {
  justify-content: flex-end;
  gap: 5vw;
  padding-right: 14vw;
}

.mm-passage--6 {
  gap: 7vw;
  padding-left: 22vw;
}

.mm-passage--7 {
  justify-content: center;
  gap: 8vw;
  padding-right: 16vw;
}

.mm-passage:nth-child(2n) .mm-portal__surface {
  animation-delay: -4.5s;
  animation-duration: 15s;
}

.mm-passage:nth-child(3n) .mm-portal__surface {
  animation-delay: -8s;
  animation-duration: 17s;
}

/* ---------- home footer + other spaces ---------- */

.mm-home-footer {
  position: relative;
  z-index: 3;
  display: flex;
  min-height: 110svh;
  align-items: flex-start;
  justify-content: space-between;
  padding: 17vh clamp(30px, 12vw, 190px) 0;
}

.mm-home-footer p:last-child {
  margin-top: 17vh;
}

.mm-other {
  position: relative;
  z-index: 3;
  display: grid;
  min-height: 150svh;
  grid-template-columns: 1fr 1fr;
  align-content: center;
  gap: 10vw;
  padding: 20vh 13vw;
}

.mm-other__label {
  grid-column: 1 / -1;
  margin: 0 0 11vh;
  text-align: center;
}

.mm-oval {
  position: relative;
  display: inline-flex;
  width: calc(min(32vw, 560px) * var(--mm-oval-scale, 1));
  min-height: calc(280px * var(--mm-oval-scale, 1));
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  border: 1px solid transparent;
  border-radius: 50%;
  background:
    linear-gradient(var(--pearl-color), var(--pearl-color)) padding-box,
    radial-gradient(ellipse at 30% 20%, rgb(255 255 255 / 0.32), transparent 76%) border-box;
  box-shadow:
    inset 0 0 48px var(--oval-inner),
    0 0 14px var(--oval-edge);
  cursor: pointer;
  isolation: isolate;
  overflow: hidden;
  text-decoration: none;
  transition: box-shadow 900ms ease;
}

.mm-oval::after,
.mm-word::after {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 0;
  width: 74%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(255 255 255 / 0.28), rgb(255 255 255 / 0.07) 40%, transparent 72%);
  content: "";
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.72);
  transition:
    opacity 900ms ease,
    transform 1.1s ease;
}

.mm-oval:hover,
.mm-oval:focus-visible {
  box-shadow:
    inset 0 0 68px rgb(255 255 255 / 0.17),
    0 0 22px rgb(255 255 255 / 0.2);
  transform: none;
}

.mm-oval:hover::after,
.mm-oval:focus-visible::after,
.mm-word:hover::after,
.mm-word:focus-visible::after {
  opacity: 0.52;
  transform: translate(-50%, -50%) scale(1);
}

.mm-oval > strong,
.mm-oval > small,
.mm-word > span {
  position: relative;
  z-index: 2;
}

.mm-oval > strong {
  font: inherit;
}

.mm-oval > span {
  position: absolute;
  top: var(--mm-oval-gap-number, 25px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
}

.mm-oval > small {
  margin-top: var(--mm-oval-gap-subtitle, 15px);
  opacity: var(--mm-txt-opacity, 0.55);
}

/* ---------- room page ---------- */

.mm-room-page {
  position: relative;
  z-index: 3;
  min-height: 100vh;
}

.mm-room-nav {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 36px;
}

.mm-room-nav > :first-child { justify-self: start; }
.mm-room-nav > :last-child  { justify-self: end; }

.mm-room-nav__arrow {
  display: inline-block;
  font-size: var(--mm-room-nav-arrow-size, 1em);
  line-height: 1;
  vertical-align: middle;
  transform: translateY(calc(-0.16em - 1px));
}

.mm-room-nav a,
.mm-room-nav button {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  letter-spacing: inherit;
  text-decoration: none;
}

.mm-room-hero {
  --mm-field-w: min(66vw, 940px);
  --mm-field-ar: 1.92;
  position: relative;
  display: flex;
  min-height: calc(var(--mm-field-w) / var(--mm-field-ar));
  align-items: center;
  justify-content: center;
}

.mm-room-hero > p {
  position: absolute;
  top: calc(23% + var(--mm-room-hero-gap-kicker, 0px));
  left: 14%;
  margin: 0;
}

.mm-room-hero h1 {
  position: relative;
  z-index: 4;
  margin: 0;
}

.mm-page-field {
  position: absolute;
  top: 50%;
  left: 50%;
  width: calc(var(--mm-field-w, min(66vw, 940px)) * var(--mm-field-scale, 1));
  aspect-ratio: var(--mm-field-ar, 1.92);
  border: 1px solid transparent;
  border-radius: 50%;
  background:
    linear-gradient(var(--portal-color), var(--portal-color)) padding-box,
    radial-gradient(ellipse at 36% 22%, rgb(255 255 255 / 0.36), transparent 76%) border-box;
  box-shadow:
    inset 0 0 48px var(--oval-inner),
    0 0 14px var(--oval-edge),
    0 30px 90px rgb(65 79 87 / 0.1);
  contain: paint;
  overflow: hidden;
  transform: translate(-50%, -50%);
}

.mm-page-field span {
  position: absolute;
  inset: -14%;
  border-radius: inherit;
  background:
    radial-gradient(ellipse at 27% 34%, rgb(236 198 216 / 0.18), transparent 30%),
    radial-gradient(ellipse at 73% 28%, rgb(186 211 224 / 0.19), transparent 32%),
    radial-gradient(ellipse at 58% 76%, rgb(239 226 187 / 0.15), transparent 33%),
    linear-gradient(132deg, transparent 26%, rgb(255 255 255 / 0.18), transparent 72%);
  opacity: 0.78;
  transform: translate3d(-1.5%, 1%, 0) scale(1.01);
  animation: mm-pearl-drift 15s -3s ease-in-out infinite alternate-reverse;
}

.mm-fragments {
  position: relative;
  min-height: 210svh;
  padding: 28vh 10vw;
}

.mm-fragment {
  max-width: 390px;
  margin: 0;
}

.mm-fragment--first {
  margin-left: 11%;
}

.mm-fragment--second {
  margin: 88vh 8% 0 auto;
  text-align: right;
}

.mm-script {
  margin: 68vh 0 0 45%;
}

.mm-next {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.mm-next p {
  margin: 0 0 var(--mm-next-gap-kicker, 28px);
}

.mm-next a,
.mm-next button {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
}

.mm-next a span,
.mm-next button span {
  margin-top: 0.7em;
}

/* ---------- subpages ---------- */

.mm-intro {
  position: relative;
  display: flex;
  min-height: 125svh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.mm-intro > p {
  margin: 0 0 42px;
}

.mm-intro h1 {
  max-width: 900px;
  margin: 0;
}

.mm-intro > span {
  margin-top: 55px;
  opacity: 0.55;
}

/* ---------- date point ---------- */

.mm-date-point {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.mm-date-point i {
  width: 5px;
  height: 5px;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: var(--ground);
  box-shadow: 0 0 0 0 rgb(255 255 255 / 0.3);
  transition:
    background 600ms ease,
    box-shadow 600ms ease,
    transform 600ms ease;
}

.mm-date-point:hover i,
.mm-date-point:focus-visible i {
  background: rgb(255 255 255 / 0.82);
  box-shadow: 0 0 30px 12px rgb(255 255 255 / 0.42);
  transform: scale(1.5);
}

.mm-date-point small {
  opacity: 0;
  transition: opacity 500ms ease;
}

.mm-date-point:hover small,
.mm-date-point:focus-visible small {
  opacity: var(--mm-txt-opacity, 0.58);
}

/* ---------- word ---------- */

.mm-word {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 20px 34px;
  border: 1px solid transparent;
  border-radius: 50%;
  background:
    linear-gradient(var(--pearl-color), var(--pearl-color)) padding-box,
    radial-gradient(ellipse at 32% 20%, rgb(255 255 255 / 0.3), transparent 77%) border-box;
  box-shadow:
    inset 0 0 48px var(--oval-inner),
    0 0 14px var(--oval-edge);
  cursor: pointer;
  isolation: isolate;
  overflow: hidden;
  transition:
    background 500ms ease,
    color 500ms ease,
    box-shadow 700ms ease;
}

.mm-word:hover,
.mm-word:focus-visible {
  box-shadow:
    inset 0 0 62px rgb(255 255 255 / 0.15),
    0 0 20px rgb(255 255 255 / 0.18);
}

/* ---------- readings / modals ---------- */

.mm-reading {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 90;
  width: min(540px, calc(100vw - 46px));
  min-height: 320px;
  padding: 42px 48px;
  border: 1px solid transparent;
  border-radius: 50%;
  background:
    linear-gradient(rgb(218 226 228 / 0.9), rgb(218 226 228 / 0.9)) padding-box,
    radial-gradient(ellipse at 34% 18%, rgb(255 255 255 / 0.42), transparent 77%) border-box;
  box-shadow:
    inset 0 0 48px rgb(255 255 255 / 0.16),
    0 0 18px rgb(255 255 255 / 0.2),
    0 28px 90px rgb(51 64 72 / 0.25);
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transform: translate(-50%, -46%) scale(0.92);
  transition: 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.mm-reading.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.mm-reading__close {
  position: absolute;
  top: 27px;
  left: 50%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transform: translateX(-50%);
}

.mm-reading__date {
  margin: 40px 0 30px;
}

.mm-reading--date blockquote {
  max-width: 390px;
  margin: 0 auto;
}

.mm-reading__note {
  display: block;
  margin-top: 25px;
}

.mm-reading--word {
  min-height: 430px;
  background:
    linear-gradient(rgb(223 226 216 / 0.92), rgb(223 226 216 / 0.92)) padding-box,
    radial-gradient(ellipse at 34% 18%, rgb(255 255 255 / 0.42), transparent 77%) border-box;
  cursor: pointer;
}

.mm-reading__origin {
  margin: 48px 0 13px;
}

.mm-reading h2 {
  margin: 0;
}

.mm-word-meaning {
  max-width: 360px;
  margin: 25px auto 0;
}

.mm-reading--word blockquote {
  max-width: 350px;
  margin: 28px auto 0;
  opacity: var(--mm-txt-opacity, 0.65);
}

.mm-word-again {
  margin: 22px 0 0;
  opacity: 0.5;
}

.mm-popup {
  width: min(640px, calc(100vw - 46px));
  min-height: 0;
  border-radius: 45% 45% 47% 47%;
}

.mm-popup__body {
  margin-top: 34px;
}

.mm-popup-trigger {
  padding: 0 0 3px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.mm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 89;
  display: block;
  padding: 0;
  border: 0;
  background: rgb(190 202 207 / 0.08);
  opacity: 0;
  pointer-events: none;
  transition: opacity 500ms ease;
}

.mm-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.mm-subpage-end {
  min-height: 115svh;
}

/* ---------- oval mask ---------- */

.mm-portal,
.mm-page-field,
.mm-oval,
.mm-word,
.mm-reading {
  -webkit-mask-image: radial-gradient(
    ellipse at center,
    #000 0%,
    #000 58%,
    rgb(0 0 0 / 0.88) 70%,
    rgb(0 0 0 / 0.42) 86%,
    transparent 100%
  );
  mask-image: radial-gradient(
    ellipse at center,
    #000 0%,
    #000 58%,
    rgb(0 0 0 / 0.88) 70%,
    rgb(0 0 0 / 0.42) 86%,
    transparent 100%
  );
}

body.mm-memoir:not(.theme-night) .mm-portal,
body.mm-memoir:not(.theme-night) .mm-page-field,
body.mm-memoir:not(.theme-night) .mm-oval,
body.mm-memoir:not(.theme-night) .mm-word {
  box-shadow:
    inset 0 0 58px rgb(255 255 255 / 0.15),
    0 0 18px rgb(255 255 255 / 0.2),
    0 22px 62px rgb(75 89 97 / 0.075);
}

body.mm-memoir:not(.theme-night) .mm-portal:hover,
body.mm-memoir:not(.theme-night) .mm-portal:focus-visible,
body.mm-memoir:not(.theme-night) .mm-oval:hover,
body.mm-memoir:not(.theme-night) .mm-oval:focus-visible,
body.mm-memoir:not(.theme-night) .mm-word:hover,
body.mm-memoir:not(.theme-night) .mm-word:focus-visible {
  box-shadow:
    inset 0 0 76px rgb(255 255 255 / 0.21),
    0 0 27px rgb(255 255 255 / 0.29),
    0 24px 68px rgb(75 89 97 / 0.085);
}

/* ---------- transitions ---------- */

.mm-transition {
  min-height: 100svh;
}

.mm-route-fade {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  background: var(--ground);
  animation: mm-route-fade 420ms ease both;
}

/* ---------- word detail ---------- */

.mm-word-hero {
  position: relative;
  display: flex;
  min-height: 135svh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 120px 30px;
  text-align: center;
}

.mm-word-hero > a,
.mm-word-hero > button {
  position: absolute;
  top: 105px;
  left: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
}

.mm-word-hero > p {
  margin: 0 0 38px;
}

.mm-word-hero h1 {
  margin: 0;
}

.mm-word-hero > span {
  max-width: 480px;
  margin-top: 55px;
}

.mm-languages {
  padding: 20vh 12vw 35vh;
}

.mm-languages article {
  position: relative;
  display: grid;
  min-height: 95svh;
  grid-template-columns: 0.7fr 1.4fr;
  grid-template-rows: auto auto auto;
  align-content: center;
  column-gap: 8vw;
  contain-intrinsic-size: 800px;
  content-visibility: auto;
}

.mm-languages article > span {
  position: absolute;
  top: 17%;
  left: 0;
}

.mm-languages article > p:first-of-type {
  align-self: end;
  margin: 0 0 15px;
}

.mm-languages h2 {
  grid-row: 2 / 4;
  margin: 0;
}

.mm-languages h3 {
  align-self: end;
  margin: 0 0 15px;
}

.mm-languages__nuance {
  max-width: 390px;
  margin: 0;
}

.mm-center {
  display: flex;
  min-height: 150svh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20vh 25px;
  text-align: center;
}

.mm-center > p {
  margin: 0 0 50px;
}

.mm-center blockquote {
  max-width: 720px;
  margin: 0;
}

.mm-center > span {
  max-width: 470px;
  margin-top: 90px;
}

/* ---------- scroll reveal (toggleable) ---------- */

html.mm-reveal-ready body.mm-memoir [data-mm-reveal] {
  opacity: 0;
  translate: 0 18px;
}

html.mm-reveal-ready body.mm-memoir [data-mm-reveal].is-visible {
  opacity: var(--mm-txt-opacity, 1);
  translate: none;
  transition: opacity 900ms ease, translate 900ms ease;
}

/* per-element text opacity (default 1) — composes with scroll reveal */
.mm-memoir .mm-hero h1,
.mm-memoir .mm-invitation,
.mm-memoir .mm-room-hero > p,
.mm-memoir .mm-room-hero h1,
.mm-memoir .mm-portal__title,
.mm-memoir .mm-oval > span,
.mm-memoir .mm-oval > strong,
.mm-memoir .mm-word > span,
.mm-memoir .mm-reading h2,
.mm-memoir .mm-reading__origin,
.mm-memoir .mm-word-meaning,
.mm-memoir .mm-date-point span,
.mm-memoir .mm-reading__date,
.mm-memoir .mm-reading__note,
.mm-memoir .mm-reading--date blockquote,
.mm-memoir .mm-popup-trigger,
.mm-memoir .mm-popup__body {
  opacity: var(--mm-txt-opacity, 1);
}

/* ---------- keyframes ---------- */

@keyframes mm-route-fade {
  from {
    opacity: 1;
    visibility: visible;
  }
  to {
    opacity: 0;
    visibility: hidden;
  }
}

@keyframes mm-pearl-drift {
  0% {
    opacity: 0.74;
    transform: translate3d(-1.5%, 1%, 0) scale(1.01);
  }
  48% {
    opacity: 0.88;
    transform: translate3d(0.8%, -1.2%, 0) scale(1.018);
  }
  100% {
    opacity: 0.78;
    transform: translate3d(1.6%, 0.5%, 0) scale(1.012);
  }
}

@keyframes mm-firefly-orbit {
  0% { opacity: 0; transform: translate3d(0, -36px, 0); }
  12% { opacity: 0.9; }
  25% { transform: translate3d(40px, 0, 0); }
  50% { opacity: 1; transform: translate3d(0, 36px, 0); }
  75% { transform: translate3d(-40px, 0, 0); }
  100% { opacity: 0; transform: translate3d(0, -36px, 0); }
}

@keyframes mm-firefly-line {
  0% { opacity: 0; transform: translate3d(-58px, 7px, 0); }
  15% { opacity: 0.9; }
  50% { opacity: 1; transform: translate3d(58px, -7px, 0); }
  85% { opacity: 0.75; }
  100% { opacity: 0; transform: translate3d(-58px, 7px, 0); }
}

@keyframes mm-firefly-arc {
  0% { opacity: 0; transform: translate3d(-48px, 28px, 0); }
  14% { opacity: 0.85; }
  34% { transform: translate3d(-18px, -34px, 0); }
  58% { opacity: 1; transform: translate3d(28px, -48px, 0); }
  78% { transform: translate3d(50px, 4px, 0); }
  100% { opacity: 0; transform: translate3d(-48px, 28px, 0); }
}

@keyframes mm-firefly-vertical {
  0% { opacity: 0; transform: translate3d(6px, 48px, 0); }
  18% { opacity: 0.88; }
  48% { opacity: 1; transform: translate3d(-9px, -48px, 0); }
  76% { opacity: 0.76; }
  100% { opacity: 0; transform: translate3d(6px, 48px, 0); }
}

@keyframes mm-firefly-mini-orbit {
  0% { opacity: 0; transform: translate3d(0, -13px, 0); }
  16% { opacity: 0.9; }
  25% { transform: translate3d(15px, 0, 0); }
  50% { opacity: 1; transform: translate3d(0, 13px, 0); }
  75% { transform: translate3d(-15px, 0, 0); }
  100% { opacity: 0; transform: translate3d(0, -13px, 0); }
}

@keyframes mm-firefly-spiral {
  0% { opacity: 0; transform: translate3d(-80px, 18px, 0); }
  12% { opacity: 0.88; }
  22% { transform: translate3d(-42px, -48px, 0); }
  42% { opacity: 1; transform: translate3d(30px, -62px, 0); }
  60% { transform: translate3d(88px, -8px, 0); }
  76% { opacity: 0.82; transform: translate3d(35px, 52px, 0); }
  90% { transform: translate3d(-52px, 38px, 0); }
  100% { opacity: 0; transform: translate3d(-80px, 18px, 0); }
}

@keyframes mm-glow-breathe {
  0%,
  100% {
    text-shadow:
      0 0 var(--mm-glow-rn1, 14px) color-mix(in srgb, var(--mm-glow-color) var(--mm-glow-sn1, 100%), transparent),
      0 0 var(--mm-glow-rn2, 40px) color-mix(in srgb, var(--mm-glow-color) var(--mm-glow-sn2, 72%), transparent),
      0 0 var(--mm-glow-rn3, 88px) color-mix(in srgb, var(--mm-glow-color) var(--mm-glow-sn3, 42%), transparent);
  }
  50% {
    text-shadow:
      0 0 calc(var(--mm-glow-rn1, 14px) * 1.21) color-mix(in srgb, var(--mm-glow-color) var(--mm-glow-sn1, 100%), transparent),
      0 0 calc(var(--mm-glow-rn2, 40px) * 1.2) color-mix(in srgb, var(--mm-glow-color) var(--mm-glow-sn2, 72%), transparent),
      0 0 calc(var(--mm-glow-rn3, 88px) * 1.18) color-mix(in srgb, var(--mm-glow-color) var(--mm-glow-sn3, 42%), transparent);
  }
}

@keyframes mm-mist-life {
  0% { opacity: 0; }
  12%, 88% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes mm-scar-appear {
  0%, 10% { opacity: 0; }
  20%, 84% { opacity: var(--mm-txt-opacity, 0.82); }
  100% { opacity: 0; }
}

/* ---------- responsive ---------- */

@media (max-width: 720px) {
  .mm-masthead { padding: 20px 18px; }
  .mm-controls { padding-left: 4px; }
  .mm-wordmark { top: 27px; display: block; }
  .mm-hero h1 { text-align: center; }
  .mm-mover--down { left: 12px; }
  .mm-mover--up { right: 12px; }

  .mm-phrase { min-height: 250px; padding: 45px 38px; }

  .mm-passage {
    min-height: 115svh;
    padding: 15vh 22px;
    flex-direction: column;
    justify-content: center;
    gap: 30px;
  }

  .mm-passage--2 .mm-caption,
  .mm-passage--5 .mm-caption { order: initial; text-align: left; }
  .mm-caption { width: min(75vw, 280px); }

  .mm-shape--wide,
  .mm-shape--soft,
  .mm-shape--low { width: calc(82vw * var(--mm-portal-scale, 1)); }
  .mm-shape--tall,
  .mm-shape--small { width: calc(62vw * var(--mm-portal-scale, 1)); }
  .mm-shape--thin { width: calc(50vw * var(--mm-portal-scale, 1)); }

  .mm-home-footer {
    min-height: 110svh;
    flex-direction: column;
    justify-content: flex-start;
    gap: 12vh;
    padding: 14vh 25px 0;
  }
  .mm-home-footer p:last-child { margin-top: 0; }

  .mm-other {
    min-height: 175svh;
    grid-template-columns: 1fr;
    gap: 45px;
    padding: 24vh 36px;
  }
  .mm-other__label { margin-bottom: 8vh; }
  .mm-oval { width: calc(min(86vw, 560px) * var(--mm-oval-scale, 1)); min-height: 250px; }

  .mm-room-nav { padding: 0 22px; }
  .mm-room-hero > p { top: 21%; left: 22px; }
  .mm-room-hero { --mm-field-w: 86vw; --mm-field-ar: 1.55; }

  .mm-fragments { min-height: 190svh; padding: 25vh 25px; }
  .mm-fragment { max-width: 280px; }
  .mm-fragment--first { margin-left: 0; }
  .mm-fragment--second { margin-top: 75vh; }
  .mm-script { margin: 55vh 0 0 12%; }

  .mm-intro { min-height: 115svh; padding: 0 30px; }

  .mm-reading { min-height: 340px; padding: 40px 30px; border-radius: 44% 44% 48% 48%; }

  .mm-word { padding: 17px 25px; }

  .mm-word-hero > a,
  .mm-word-hero > button { top: 90px; left: 22px; }

  .mm-languages { padding: 15vh 25px 25vh; }
  .mm-languages article {
    min-height: 105svh;
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    align-content: center;
  }
  .mm-languages article > span { top: 18%; }
  .mm-languages article > p:first-of-type { margin-bottom: 28px; }
  .mm-languages h2 { grid-row: auto; margin-bottom: 32px; }
  .mm-languages h3 { margin-bottom: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  body.mm-memoir *,
  body.mm-memoir *::before,
  body.mm-memoir *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (pointer: fine) {
  body.mm-cursor,
  body.mm-cursor * {
    cursor: none !important;
  }
}

@media (pointer: coarse) {
  .mm-light-follow {
    display: none;
  }
}

/* ---------- back link to the menu's main page ---------- */

.mm-back {
  display: inline-block;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
}

/* ---------- prev/next switcher (mot précédent / mot suivant) ---------- */

.mm-switch {
  display: flex;
  min-height: 55svh;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  padding: 15vh 8vw;
}

.mm-switch--no-prev { justify-content: flex-end; }
.mm-switch--no-next { justify-content: flex-start; }

.mm-switch__item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 16px 0;
  color: inherit;
  text-decoration: none;
  opacity: 0.6;
  text-align: left;
  transition: opacity 400ms ease;
}

.mm-switch__item--next {
  align-items: flex-end;
  text-align: right;
}

.mm-switch__item:hover,
.mm-switch__item:focus-visible {
  opacity: 1;
}

.mm-switch__item span {
  margin-bottom: 20px;
  opacity: var(--mm-txt-opacity, 0.55);
}

.mm-switch__item strong {
  opacity: var(--mm-txt-opacity, 1);
}

@media (max-width: 720px) {
  .mm-switch {
    gap: 30px;
    min-height: 40svh;
    padding: 10vh 25px;
  }
}

/* ---------- opt-in opacity fade for interactive text ---------- */

.mm-memoir .mm-fade {
  opacity: 0.5;
  transition: opacity 0.4s ease;
}

.mm-memoir .mm-fade:hover,
.mm-memoir .mm-fade:focus-visible,
.mm-memoir .mm-fade:active {
  opacity: 1;
}

/* ---------- accordion fragment ---------- */

.mm-accordion-stage {
  position: relative;
  width: 100%;
  overflow: visible;
  overflow-anchor: none;
}

.mm-accordion {
  display: grid;
  width: 100%;
  grid-template-columns: 0 minmax(0, 650px) 72px 1fr;
  color: var(--ink);
}

.mm-accordion--brizy {
  position: relative;
  display: block;
}

.mm-accordion--brizy .mm-accordion__panel {
  grid-column: auto;
}

.mm-accordion--brizy .mm-accordion__reading {
  --mm-acc-reading-pad-x: clamp(24px, 4vw, 72px);
  margin-top: clamp(32px, 6vh, 96px);
}

.mm-accordion-arrow-portal {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 72;
  width: 100%;
  height: 0;
  pointer-events: none;
}

.mm-accordion-arrow-portal .mm-accordion__toggle {
  position: sticky;
  top: var(--mm-admin-bar-height, 0px);
  grid-column: auto;
  margin: 0 var(--mm-acc-arrow-offset, 3vw) 0 auto;
  pointer-events: auto;
}

.mm-accordion-arrow-portal.is-expanded .mm-accordion__toggle {
  top: calc(50vh + var(--mm-admin-bar-height, 0px) * 0.5);
}

.mm-accordion__trigger {
  cursor: pointer;
}

.mm-accordion__trigger:focus-visible {
  outline: 1px solid color-mix(in srgb, var(--ink) 28%, transparent);
  outline-offset: 7px;
}

.mm-accordion__bar {
  display: contents;
}

.mm-accordion__preview {
  white-space: pre-line;
}

.mm-accordion__preview {
  grid-column: 2;
  max-width: 590px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-family: "Newsreader", serif;
  font-size: clamp(21px, 2.25vw, 32px);
  font-weight: 300;
  line-height: 1.46;
  text-align: left;
}

.mm-accordion__preview:focus-visible {
  outline: 1px solid color-mix(in srgb, var(--ink) 28%, transparent);
  outline-offset: 7px;
}

:root {
  --mm-acc-dot-size: min(var(--mm-acc-arrow-size, 24px), 11vw);
}

.mm-accordion__toggle {
  position: relative;
  z-index: 12;
  display: grid;
  width: calc(var(--mm-acc-dot-size, 24px) * 2.3);
  height: calc(var(--mm-acc-dot-size, 24px) * 3);
  grid-column: 3;
  place-items: center;
  align-self: start;
  margin-top: 0;
  padding: 0;
  border: 0;
  background: transparent;
  --mm-acc-glow: var(--mm-acc-arrow-color, rgb(255 252 236));
  color: var(--mm-acc-arrow-color, var(--ink));
  cursor: pointer;
  font-family: "Manrope", sans-serif;
  font-size: var(--mm-acc-arrow-size, 24px);
  font-weight: 300;
  line-height: 1;
  opacity: 0.72;
  text-shadow:
    0 0 5px color-mix(in srgb, var(--mm-acc-glow) 68%, transparent),
    0 0 14px color-mix(in srgb, var(--mm-acc-glow) 42%, transparent),
    0 0 28px color-mix(in srgb, var(--mm-acc-glow) 20%, transparent);
  transition:
    opacity 300ms ease,
    text-shadow 420ms ease;
}

.mm-accordion__toggle-dot {
  --mm-acc-dot: var(--mm-acc-arrow-color, rgb(255 252 236));
  --mm-acc-magnet-x: 0px;
  --mm-acc-magnet-y: 0px;
  display: block;
  width: var(--mm-acc-dot-size, 24px);
  height: var(--mm-acc-dot-size, 24px);
  border-radius: 50%;
  background: radial-gradient(
    circle,
    #fff 0 12%,
    color-mix(in srgb, var(--mm-acc-dot) 82%, #fff 18%) 30%,
    transparent 72%
  );
  box-shadow:
    0 0 6px color-mix(in srgb, var(--mm-acc-dot) 60%, transparent),
    0 0 18px color-mix(in srgb, var(--mm-acc-dot) 30%, transparent),
    0 0 38px color-mix(in srgb, var(--mm-acc-dot) 14%, transparent);
  transform: translate3d(var(--mm-acc-magnet-x), var(--mm-acc-magnet-y), 0);
  transition:
    box-shadow 420ms ease,
    transform 320ms ease;
}

.mm-accordion__toggle.is-near .mm-accordion__toggle-dot,
.mm-accordion__toggle:hover .mm-accordion__toggle-dot,
.mm-accordion__toggle:focus-visible .mm-accordion__toggle-dot,
.mm-accordion-arrow-portal.is-expanded .mm-accordion__toggle-dot {
  box-shadow:
    0 0 10px color-mix(in srgb, var(--mm-acc-dot) 82%, transparent),
    0 0 30px color-mix(in srgb, var(--mm-acc-dot) 48%, transparent),
    0 0 60px color-mix(in srgb, var(--mm-acc-dot) 22%, transparent);
  transform: translate3d(var(--mm-acc-magnet-x), var(--mm-acc-magnet-y), 0) scale(1.12);
}

.mm-accordion__toggle:hover,
.mm-accordion__toggle:focus-visible {
  opacity: 1;
  text-shadow:
    0 0 6px color-mix(in srgb, currentColor 92%, transparent),
    0 0 18px color-mix(in srgb, currentColor 58%, transparent),
    0 0 34px color-mix(in srgb, currentColor 30%, transparent);
}

.mm-accordion__toggle:focus-visible {
  outline: none;
}

.mm-accordion__panel {
  display: grid;
  grid-column: 1 / -1;
  grid-template-rows: 0fr;
  opacity: 0;
  visibility: hidden;
  transition:
    grid-template-rows 520ms cubic-bezier(0.22, 0.76, 0.25, 1),
    opacity 380ms ease,
    visibility 0s linear 520ms;
}

.mm-accordion.is-expanded .mm-accordion__panel {
  grid-template-rows: 1fr;
  opacity: 1;
  visibility: visible;
  transition:
    grid-template-rows 520ms cubic-bezier(0.22, 0.76, 0.25, 1),
    opacity 520ms ease 100ms,
    visibility 0s linear;
}

.mm-accordion.is-instant .mm-accordion__panel {
  transition: none !important;
}

.mm-accordion__inner {
  min-height: 0;
  overflow: hidden;
}

.mm-accordion.is-expanded:not(.is-closing) .mm-accordion__inner {
  overflow: visible;
}

.mm-accordion__reading {
  --mm-acc-reading-pad-x: clamp(32px, 7vw, 110px);
  position: relative;
  isolation: isolate;
  width: min(calc(var(--mm-acc-body-width, 920px) + 2 * var(--mm-acc-reading-pad-x)), 100%);
  margin: 18vh auto 0;
  padding: clamp(52px, 6vw, 96px) var(--mm-acc-reading-pad-x) clamp(64px, 7vw, 110px);
}

.mm-accordion__backdrop {
  position: absolute;
  inset: -10% -8%;
  z-index: -1;
  border-radius: 50%;
  background:
    radial-gradient(ellipse 76% 34% at 38% 18%, rgb(255 255 242 / 0.32), transparent 62%),
    radial-gradient(ellipse 70% 32% at 72% 48%, rgb(211 232 238 / 0.16), transparent 68%),
    radial-gradient(ellipse 78% 30% at 34% 78%, rgb(245 216 230 / 0.14), transparent 70%),
    radial-gradient(
      ellipse 100% 100% at 50% 50%,
      var(--mm-acc-color, var(--mm-a-oval)) 0%,
      var(--mm-acc-color, var(--mm-a-oval)) 48%,
      transparent 96%
    );
  opacity: var(--mm-acc-opacity-day, var(--mm-acc-opacity, 0.5));
  filter: blur(clamp(0px, var(--mm-acc-blur, 28px), 80px));
  transform: scale(var(--mm-acc-scale-x, var(--mm-acc-scale, 1)), var(--mm-acc-scale-y, var(--mm-acc-scale, 1)));
  pointer-events: none;
}

html.theme-night .mm-accordion__backdrop,
body.mm-memoir.theme-night .mm-accordion__backdrop {
  opacity: var(--mm-acc-opacity-night, var(--mm-acc-opacity-day, var(--mm-acc-opacity, 0.5)));
}

.mm-accordion--rect .mm-accordion__backdrop {
  inset: 2% 2%;
  border-radius: var(--mm-acc-radius, clamp(10px, 1.8vw, 28px));
}

.mm-accordion--simple .mm-accordion__backdrop {
  background: radial-gradient(
    ellipse 100% 100% at 50% 50%,
    var(--mm-acc-color, var(--mm-a-oval)) 0%,
    var(--mm-acc-color, var(--mm-a-oval)) 70%,
    transparent 100%
  );
}

.mm-accordion__body {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: none;
  margin: 0;
  font-family: "Manrope", sans-serif;
  font-size: clamp(14px, 1.15vw, 17px);
  font-weight: 300;
  letter-spacing: 0.012em;
  line-height: 1.82;
  font-synthesis: weight style;
  user-select: text;
}

.mm-accordion__body :is(strong, b) {
  font-weight: 700;
}

.mm-accordion__body :is(em, i) {
  font-style: italic;
}

.mm-accordion__body p {
  margin: 0 0 var(--mm-accordion-body-gap, 0.85em);
}

.mm-accordion__body p:last-child {
  margin-bottom: 0;
}

.mm-accordion__footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: 58px;
}

.mm-accordion__link {
  display: flex;
  align-items: center;
  gap: 9px;
  color: inherit;
  font-family: "Manrope", sans-serif;
  font-size: 7px;
  letter-spacing: 0.14em;
  opacity: var(--mm-txt-opacity, 0.58);
  text-decoration: none;
  text-transform: uppercase;
  transition: opacity 300ms ease;
}

.mm-accordion__link:hover,
.mm-accordion__link:focus-visible {
  opacity: 1;
}

.mm-accordion.is-expanded .mm-accordion__body,
.mm-accordion.is-expanded .mm-accordion__footer {
  animation: mm-accordion-emerge 620ms cubic-bezier(0.22, 0.76, 0.25, 1) both;
}

/* Preview iframe: emulate the front-end arrow rail. */
.mmk-el-preview .mm-accordion {
  position: relative;
  display: flex;
  min-height: calc(100vh - 132px);
  flex-direction: column;
  justify-content: center;
  padding-right: calc(var(--mm-acc-dot-size, 24px) * 2.3 + var(--mm-acc-arrow-offset, 3vw));
}

.mmk-el-preview .mm-accordion__bar {
  display: block;
}

.mmk-el-preview .mm-accordion__preview {
  max-width: min(650px, 100%);
}

.mmk-el-preview .mm-accordion__reading {
  margin: 0 auto;
}

.mmk-el-preview .mm-accordion__toggle {
  position: absolute;
  top: 0;
  right: var(--mm-acc-arrow-offset, 3vw);
  margin: 0;
  transition:
    top 520ms cubic-bezier(0.22, 0.76, 0.25, 1),
    opacity 300ms ease,
    text-shadow 420ms ease;
}

.mmk-el-preview .mm-accordion.is-expanded .mm-accordion__toggle {
  top: calc(50vh - 48px);
}

@keyframes mm-accordion-emerge {
  from {
    filter: blur(2px);
    opacity: 0;
  }

  to {
    filter: blur(0);
    opacity: 1;
  }
}

/* ---------- global history back ---------- */

.mm-history-back {
  display: grid;
  width: 24px;
  height: 31px;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-family: "Manrope", sans-serif;
  font-size: 12px;
  line-height: 1;
  opacity: 0.52;
  text-decoration: none;
  transition: opacity 300ms ease;
}

.mm-history-back:hover,
.mm-history-back:focus-visible {
  opacity: 1;
}

.mm-history-back:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: 4px;
}

@media (max-width: 720px) {
  .mm-accordion {
    grid-template-columns: 0 minmax(0, 1fr) 72px 0;
  }

  .mm-accordion__preview {
    font-size: 22px;
  }

  .mm-accordion__reading,
  .mm-accordion--brizy .mm-accordion__reading {
    --mm-acc-reading-pad-x: 22px;
    width: min(calc(var(--mm-acc-body-width, 920px) + 44px), calc(100vw - 32px));
    margin-top: 14vh;
    padding: 52px var(--mm-acc-reading-pad-x) 64px;
  }

  .mm-accordion--brizy .mm-accordion__reading {
    margin-top: clamp(24px, 5vh, 64px);
  }

  .mm-accordion__backdrop {
    inset: -8% -6%;
  }

  .mm-accordion__body {
    font-size: 14px;
    line-height: 1.78;
  }

  .mm-accordion__footer {
    margin-top: 42px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mm-accordion__panel,
  .mm-accordion.is-expanded .mm-accordion__panel {
    transition: none;
  }

  .mm-accordion.is-expanded .mm-accordion__body,
  .mm-accordion.is-expanded .mm-accordion__footer {
    animation: none;
  }
}

/* ---------- current page title label ---------- */

.mm-page-title {
  display: inline-block;
  max-width: 100%;
}
