/* Mizan, the first model of MENC, presented in a window (D-097): a navy announcement
   where the scales weigh the passages while loose lines become a page behind them, then
   sheets on the ground of the page. The weighing is the one sequence; below it, each part
   answers the scroll that reaches it. Everything is whole without motion: initial states
   exist only under .mz-anime, which the script sets when the reader accepts motion. */

/* ---------- the window ---------- */
dialog.mz-fenetre { width: min(1180px, calc(100vw - 40px)); height: min(900px, calc(100dvh - 40px)); max-width: none; max-height: none;
                    padding: 0; border: 0; border-radius: 18px; overflow: hidden; background: var(--sable); color: var(--encre);
                    box-shadow: 0 2px 6px rgba(6, 12, 18, .3), 0 44px 110px -24px rgba(6, 12, 18, .7); }
dialog.mz-fenetre[open] { display: flex; flex-direction: column; }
dialog.mz-fenetre::backdrop { background: rgba(13, 22, 31, .64); backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px); }
.mz-defile { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: #5B7389 transparent; }
.mz-defile:focus { outline: none; }
/* a ring that holds on navy and on the light sheets alike */
.mz-defile:focus-visible { outline: 2px solid #1A8F7A; outline-offset: -2px; }
.mz-avance { position: absolute; z-index: 3; top: 0; left: 0; right: 0; height: 3px; background: var(--menthe);
             transform-origin: left; transform: scaleX(var(--lu, 0)); pointer-events: none; }
.mz-fermer { position: absolute; z-index: 3; top: 14px; right: 16px; width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer;
             border: 1px solid rgba(228, 234, 239, .28); border-radius: 50%; background: rgba(20, 33, 46, .72); color: #fff;
             transition: background-color .15s, border-color .15s, transform .12s ease-out; }
.mz-fermer:hover { background: #25384A; border-color: var(--menthe); }
.mz-fermer:active { transform: scale(.94); }
.mz-fermer:focus-visible { outline: 2px solid #1A8F7A; outline-offset: 2px; }
.mz-pied { display: flex; align-items: center; justify-content: space-between; gap: 10px 20px; padding: 12px 22px;
           border-top: 1px solid var(--filet); background: var(--page); }
.mz-pied p { margin: 0; font: 400 14.5px/1.4 var(--sans); color: var(--encre-2); }
.mz-pied button.principal { flex: none; }
.mizan { --mz-nuit: #14212E; --mz-trait: rgba(228, 234, 239, .06); color: var(--encre); }
.mizan p { margin: 0; }

/* ---------- the announcement ---------- */
.mz-tete { position: relative; overflow: hidden; isolation: isolate; color: var(--sur-marine);
           background: var(--mz-nuit) repeating-linear-gradient(to bottom, transparent 0 31px, var(--mz-trait) 31px 32px);
           padding: clamp(36px, 7vh, 84px) clamp(20px, 5vw, 72px) clamp(36px, 6vh, 72px);
           display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; align-items: center; }
.mz-champ { position: absolute; z-index: -1; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: .62; }
.mz-arabe { position: absolute; z-index: -1; right: -.04em; top: -.34em; font: 400 clamp(220px, 34vw, 520px)/1 var(--arabe);
            color: var(--menthe); opacity: .06; pointer-events: none; user-select: none; white-space: nowrap;
            translate: calc(var(--mx, 0) * -26px) calc(var(--my, 0) * -16px); transition: translate .7s var(--sortie); }
.mz-annonce { max-width: 34rem; }
.mz-nom { margin: 0; font: 600 clamp(64px, 9vw, 96px)/.95 var(--titre); letter-spacing: -.025em; color: #fff; }
.mz-lettre { display: inline-block; }
.mizan .mz-devise { margin: 14px 0 0 -.18em; padding: 0 .18em; width: fit-content; font: 600 clamp(22px, 2.6vw, 30px)/1.25 var(--titre); color: var(--menthe);
                    background: linear-gradient(rgba(111, 208, 184, .16), rgba(111, 208, 184, .16)) no-repeat 0 88% / 100% .42em; }
.mizan .mz-chapeau { margin-top: 26px; font: 400 clamp(18px, 1.5vw, 20.5px)/1.6 var(--serif); color: var(--sur-marine); text-wrap: pretty; }
.mizan .mz-sens { margin-top: 18px; font: 400 15.5px/1.55 var(--sans); color: var(--sur-marine-2); }

.mz-scene { margin: 0; min-width: 0; max-width: 700px; width: 100%; justify-self: center; }
.mz-pesee { display: block; width: 100%; height: auto; overflow: visible;
            translate: calc(var(--mx, 0) * 10px) calc(var(--my, 0) * 7px); transition: translate .7s var(--sortie); }
.mz-aura { opacity: 0; transition: opacity 1.4s ease-out; }
.mz-pesee-finie .mz-aura { opacity: .55; }
.mz-onde { fill: none; stroke: var(--menthe); stroke-width: 1.5; opacity: 0; transform-box: fill-box; transform-origin: center; }
.mz-eclat { pointer-events: none; }
.mz-fut, .mz-fleau, .mz-fil, .mz-coupe { fill: none; stroke: var(--sur-marine); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.mz-fut { stroke-dasharray: 1; }
.mz-fleau { stroke: #fff; stroke-width: 2.5; }
.mz-fil { stroke: var(--sur-marine-2); stroke-width: 1.25; }
.mz-coupe { fill: var(--marine-2); }
.mz-axe { fill: var(--menthe); }
.mz-question rect { fill: #E9E7DF; }
.mz-question path { fill: none; stroke: #4A5868; stroke-width: 2.5; stroke-linecap: round; }
.mz-papier { fill: var(--marine-2); stroke: var(--marine-3); stroke-width: 1; transition: fill .5s, stroke .5s; }
.mz-rang { font: 600 21px/1 var(--serif); fill: var(--sur-marine-2); font-variant-numeric: tabular-nums; transition: fill .5s; }
.mz-ligne { fill: none; stroke: var(--sur-marine-2); stroke-opacity: .5; stroke-width: 3; stroke-linecap: round; }
.mz-jauge-fond { fill: none; stroke: var(--marine-3); stroke-width: 5; stroke-linecap: round; }
.mz-jauge { fill: none; stroke: var(--menthe); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 0 1; }
.mz-fiche.mz-tete .mz-papier { fill: #1F4A47; stroke: var(--menthe); filter: drop-shadow(0 0 9px rgba(111, 208, 184, .5)); }
.mz-fiche.mz-tete .mz-rang { fill: var(--menthe); }
.mz-fiche.mz-tete .mz-ligne { stroke: #fff; stroke-opacity: .7; }
.mz-scene-pied { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px; margin-top: 14px; min-height: 38px; }
.mz-legende { font: 600 15.5px/1.4 var(--sans); color: #fff; }
.mz-rejouer { height: 38px; padding: 0 16px; border: 1px solid #5B7389; border-radius: 999px; background: none; cursor: pointer;
              font: 600 14.5px/1 var(--sans); color: var(--sur-marine); transition: border-color .15s, background-color .15s, transform .12s ease-out; }
.mz-rejouer:hover { border-color: var(--menthe); background: var(--marine-2); color: #fff; }
.mz-rejouer:active { transform: scale(.97); }
.mz-rejouer:disabled { visibility: hidden; }
.mz-note { margin-top: 8px; font: italic 400 14.5px/1.5 var(--serif); color: var(--sur-marine-2); }

@media (min-width: 1080px) {
  .mz-tete { grid-template-columns: minmax(0, 27rem) minmax(0, 1fr); gap: clamp(32px, 4vw, 60px); padding-left: 56px; padding-right: 56px; min-height: 600px; }
  .mz-scene { justify-self: end; }
  /* the lines stay faint behind the words, and come forward around the scales */
  .mz-champ { opacity: 1; -webkit-mask-image: linear-gradient(100deg, rgba(0, 0, 0, .42) 0 36%, #000 64%); mask-image: linear-gradient(100deg, rgba(0, 0, 0, .42) 0 36%, #000 64%); }
}

/* ---------- the sections ---------- */
.mz-section { max-width: 1010px; margin: 0 auto; padding: clamp(56px, 9vh, 96px) clamp(20px, 5vw, 48px) 0; }
.mz-titre { margin: 0 0 22px; font: 600 clamp(27px, 3.1vw, 38px)/1.14 var(--titre); letter-spacing: -.012em; text-wrap: balance; max-width: 22ch; }
.mz-titre::before { content: ""; display: block; width: 44px; height: 7px; margin-bottom: 16px; background: var(--emeraude); border-radius: 999px; opacity: .85; }

/* what it is: the margin key of the annotated code */
.mz-fiche-liste { margin: 0; border-top: 1px solid var(--filet-fort); }
.mz-rang-fiche { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 4px 28px; padding: 16px 0; border-bottom: 1px solid var(--filet); }
.mz-rang-fiche dt { font: 600 12.5px/1.5 var(--sans); letter-spacing: .09em; text-transform: uppercase; color: var(--encre-2); padding-top: 5px; }
.mz-rang-fiche dd { margin: 0; font: 400 18px/1.55 var(--serif); max-width: 40rem; }





/* what it changes: one sentence, and two strokes of the highlighter */
.mz-grand { font: 600 clamp(25px, 3vw, 36px)/1.22 var(--titre); letter-spacing: -.012em; max-width: 24ch; text-wrap: balance; color: var(--emeraude); }
.mz-duo { margin-top: 34px; display: grid; gap: 18px; max-width: 760px; }
.mz-duo-rang { display: grid; grid-template-columns: 210px minmax(0, 1fr) 3.2em; gap: 8px 20px; align-items: center; }
.mz-duo-nom { font: 600 16px/1.3 var(--sans); color: var(--encre-2); }
.mz-duo-mizan .mz-duo-nom { color: var(--encre); }
.mz-trait { height: 22px; }
.mz-trait i { display: block; height: 100%; width: calc(var(--part) * 100%); border-radius: 999px; background: var(--encre-2); opacity: .6; }
.mz-duo-mizan .mz-trait i { background: var(--emeraude); opacity: 1; }
.mz-fois { font: 600 22px/1 var(--serif); color: var(--emeraude); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mizan .mz-source { margin-top: 26px; max-width: 40rem; font: italic 400 15.5px/1.55 var(--serif); color: var(--encre-2); }

/* one sentence for what comes next, on navy again */
.mz-suite { margin-top: clamp(56px, 9vh, 96px); padding: clamp(44px, 8vh, 80px) clamp(20px, 5vw, 48px); color: var(--sur-marine); text-align: center;
            background: var(--mz-nuit) repeating-linear-gradient(to bottom, transparent 0 31px, var(--mz-trait) 31px 32px); }
.mz-fin { font: 600 clamp(24px, 2.8vw, 34px)/1.2 var(--titre); color: #fff; text-wrap: balance; }
.mizan .mz-signature { margin-top: 12px; font: italic 400 17px/1.5 var(--serif); color: var(--menthe); }

/* ---------- motion: one sequence, then two answers to the scroll ---------- */
@keyframes mz-lettre { from { opacity: 0; filter: blur(16px); transform: translateY(.42em) scale(1.08); } to { opacity: 1; filter: blur(0); transform: none; } }
@keyframes mz-ouvre { from { opacity: 0; transform: translateY(28px) scale(.93); clip-path: inset(10% 16% round 44px); }
                      to { opacity: 1; transform: none; clip-path: inset(0 round 18px); } }
dialog.mz-fenetre[open] { animation: mz-ouvre .75s var(--sortie) backwards; }  /* no fill: the clip is released, the shadow shows */
dialog.mz-fenetre[open]::backdrop { animation: mz-voile .5s ease-out both; }
dialog.mz-fenetre.mz-part::backdrop { animation: none; opacity: 0; transition: opacity .45s ease-in; }
@keyframes mz-voile { from { opacity: 0; } to { opacity: 1; } }
@keyframes mz-calame { from { clip-path: inset(-20% 0 -20% 100%); } to { clip-path: inset(-20% 0 -20% -10%); } }
@keyframes mz-trace { from { background-size: 0 .42em; } to { background-size: 100% .42em; } }
@keyframes mz-dessin { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.mz-anime .mz-arabe { animation: mz-calame 2.2s var(--sortie) .15s both; }
.mz-anime .mz-lettre { animation: mz-lettre 1s var(--sortie) calc(.3s + var(--i) * 75ms) both; }
.mz-anime .mz-devise { animation: mz-voile .5s ease-out .8s both, mz-trace .9s var(--sortie) 1.05s both; }
.mz-anime .mz-chapeau { animation: mz-voile .7s ease-out 1.05s both; }
.mz-anime .mz-sens { animation: mz-voile .7s ease-out 1.25s both; }
.mz-anime .mz-champ { animation: mz-voile 1.2s ease-out .2s both; }
.mz-anime .mz-fut { animation: mz-dessin .8s var(--sortie) .35s both; }
.mz-anime .mz-fleau, .mz-anime .mz-plateau, .mz-anime .mz-axe { animation: mz-voile .6s ease-out .8s both; }
.mz-anime .mz-fiche { animation: mz-voile .45s ease-out both; }
/* the passages are the third to eighth children of the drawing */
.mz-anime .mz-fiche:nth-child(3) { animation-delay: .55s; } .mz-anime .mz-fiche:nth-child(4) { animation-delay: .63s; }
.mz-anime .mz-fiche:nth-child(5) { animation-delay: .71s; } .mz-anime .mz-fiche:nth-child(6) { animation-delay: .79s; }
.mz-anime .mz-fiche:nth-child(7) { animation-delay: .87s; } .mz-anime .mz-fiche:nth-child(8) { animation-delay: .95s; }
.mz-anime .mz-scene-pied, .mz-anime .mz-note { animation: mz-voile .6s ease-out 1.1s both; }
.mz-anime .mz-titre::before { transform: scaleX(0); transform-origin: left; transition: transform .8s var(--sortie) .1s; }
.mz-anime .mz-vu > .mz-titre::before { transform: none; }
.mz-anime .mz-trait i { clip-path: inset(0 100% 0 0 round 999px); }
.mz-anime .mz-duo.mz-vu .mz-trait i { clip-path: inset(0 0 0 0 round 999px); transition: clip-path 1.3s var(--sortie) calc(var(--i) * 420ms + 150ms); }
.mz-anime .mz-fois { opacity: 0; transform: scale(.6); transform-origin: left center; }
.mz-anime .mz-duo.mz-vu .mz-fois { opacity: 1; transform: none; transition: opacity .5s ease-out 1.5s, transform .9s var(--sortie) 1.5s; }
.mz-anime .mz-rang-fiche { opacity: 0; }
.mz-anime .mz-fiche-liste.mz-vu .mz-rang-fiche { opacity: 1; transition: opacity .7s ease-out calc(var(--i) * 160ms); }
.mz-anime .mz-fin { opacity: 0; filter: blur(10px); }
.mz-anime .mz-suite.mz-vu .mz-fin { opacity: 1; filter: blur(0); transition: opacity .9s ease-out, filter .9s var(--sortie); }
.mz-anime .mz-signature { opacity: 0; }
.mz-anime .mz-suite.mz-vu .mz-signature { opacity: 1; transition: opacity .8s ease-out .5s; }
@media (prefers-reduced-motion: reduce) {
  .mizan *, .mizan *::before, .mizan *::after { animation: none !important; transition: none !important; }
  dialog.mz-fenetre[open], dialog.mz-fenetre[open]::backdrop { animation: none; }
  .mz-fermer, .mz-rejouer { transition: none; }
}

/* ---------- in the rail ---------- */
.vers-mizan { margin: -8px 14px 18px; height: 38px; display: flex; align-items: center; gap: 10px; padding: 0 14px; border: 0;
              border-radius: 999px; background: none; color: var(--sur-marine); cursor: pointer; font: 600 15px/1 var(--sans); }
.vers-mizan:hover { background: var(--marine-2); }
.vers-mizan[aria-current="true"] { background: var(--marine-2); color: #fff; box-shadow: inset 3px 0 0 var(--menthe); }
.vers-mizan .mz-neuf { margin-left: auto; padding: 3px 8px; border-radius: 999px; background: rgba(111, 208, 184, .16); color: var(--menthe);
                       font: 600 11.5px/1.2 var(--sans); letter-spacing: .06em; text-transform: uppercase; }

@media (max-width: 720px) {
  .mz-rang-fiche { grid-template-columns: minmax(0, 1fr); }
  .mz-rang-fiche dd { font-size: 17px; }
  .mz-duo-rang { grid-template-columns: minmax(0, 1fr) 3.2em; }
  .mz-duo-nom { grid-column: 1 / -1; }
  dialog.mz-fenetre { width: 100vw; height: 100dvh; border-radius: 0; }
  dialog.mz-fenetre::backdrop { backdrop-filter: none; -webkit-backdrop-filter: none; }  /* fully covered: nothing to blur */
  @keyframes mz-ouvre { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
  .mz-pied { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
  .mz-pied { justify-content: flex-end; }
  .mz-pied p { display: none; }
  .mz-fermer { top: 10px; right: 10px; }
}
