/* The Butterfly Framework — the luminous mark as the living map,
   and the passage from the threshold (home) into the Framework page. */

/* ---------- Passage between pages (cross-document View Transitions) ---------- */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

.site-header { view-transition-name: site-header; }
.threshold-mark, .mm-svg { view-transition-name: bf-mark; }

::view-transition { background: #0f1a30; }
::view-transition-old(root) { animation: mm-root-out .7s cubic-bezier(.4,0,.2,1) both; }
::view-transition-new(root) { animation: mm-root-in 1s .45s cubic-bezier(.22,1,.36,1) both; }
::view-transition-group(bf-mark) { animation-duration: 1.6s; animation-timing-function: cubic-bezier(.65,0,.2,1); }
::view-transition-image-pair(bf-mark) { isolation: isolate; }
::view-transition-old(bf-mark) { animation: mm-mark-out 1.1s cubic-bezier(.4,0,.2,1) both; }
::view-transition-new(bf-mark) { animation: mm-mark-in 1.6s cubic-bezier(.22,1,.36,1) both; }
@keyframes mm-root-out { to { opacity: 0; } }
@keyframes mm-root-in { from { opacity: 0; transform: translateY(.6rem); } }
@keyframes mm-mark-out { 0% { opacity: 1; } 100% { opacity: 0; filter: blur(2px) brightness(1.6); } }
@keyframes mm-mark-in {
  0%   { opacity: 0; filter: brightness(2.2) blur(3px); }
  45%  { opacity: 1; filter: brightness(1.6) drop-shadow(0 0 28px rgba(226,184,92,.7)); }
  100% { opacity: 1; filter: none; }
}

/* Fallback passage (browsers without cross-document transitions): set by mark-map.js */
.mm-leaving .threshold { overflow: visible; }
.mm-leaving .threshold .wrap > :not(.threshold-mark) { opacity: 0 !important; transition: opacity .5s ease; }
.mm-leaving .site-header, .mm-leaving .site-footer { opacity: 0; transition: opacity .6s ease; }

/* ---------- The Framework page: the mark, now large and central ---------- */
.page-hero.fw-hero { text-align: center; padding-top: clamp(1.5rem, 5vh, 3.5rem); padding-bottom: .25rem; }
.page-hero.fw-hero .lead { margin: 0 auto; }
.mm { margin-top: -1px; padding-block: 0 clamp(2.5rem, 7vw, 4.5rem); text-align: center; }
.mm .wrap { max-width: 56rem; }

.mm-svg { display: block; width: min(92vw, clamp(18rem, calc(100vh - 21rem), 40rem)); width: min(92vw, clamp(18rem, calc(100svh - 21rem), 40rem)); height: auto; margin: 0 auto; overflow: visible; }
.mm-svg text { font-family: inherit; pointer-events: none; user-select: none; }
.mm-label { fill: #f8efd6; font-size: 1.62px; text-anchor: middle; letter-spacing: .01em; opacity: .92; transition: opacity .4s ease, fill .4s ease; }
.mm-arc { fill: #e3c77a; font-size: 1.22px; letter-spacing: .12em; opacity: .9; }

.mm-region { cursor: pointer; outline: none; }
.mm-wing-shape { transition: fill-opacity .45s ease, stroke-width .45s ease; stroke: #fff4d2; stroke-opacity: 0; stroke-width: .35; }
.mm-wing:hover .mm-wing-shape, .mm-wing.is-active .mm-wing-shape { fill-opacity: .9; }
.mm-wing.is-active .mm-wing-shape { stroke-opacity: .85; stroke-width: .45; }
.mm-svg.has-wing .mm-wing:not(.is-active):not(:hover) .mm-wing-shape { fill-opacity: .28; }
.mm-svg.has-wing .mm-label { opacity: .55; }
.mm-svg.has-wing .mm-label.is-active { opacity: 1; fill: #fff4d2; }
.mm-region:focus-visible .mm-wing-shape { stroke-opacity: 1; stroke-width: .6; }
.mm-region:focus-visible .mm-heart-hit { stroke: #fff4d2; stroke-width: .3; }
.mm-region:focus-visible .mm-field-ring { stroke-width: .9; }

.mm-heart-hit { fill: transparent; }
.mm-heart:hover .th-heart, .mm-heart:focus-visible .th-heart { fill: #fff4d2; }
.mm-heart.is-active .th-heart { filter: drop-shadow(0 0 .9px #ffe9a8); }

.mm-field-ring { transition: stroke-width .45s ease; }
.mm-field.is-active .th-field, .mm-field:hover .th-field { opacity: 1; animation-play-state: paused; }
.mm-field.is-active .mm-field-ring { stroke-width: .8; }

/* irradiance — the same breath as the mark on the home page */
.mm-svg .th-wave, .mm-svg .th-halo, .mm-svg .th-heart { transform-box: fill-box; transform-origin: center; }
.mm-svg .th-wave { animation: th-wave 7s cubic-bezier(.22,1,.36,1) infinite; }
.mm-svg .th-halo { animation: th-halo 7s cubic-bezier(.22,1,.36,1) infinite; }
.mm-svg .th-heart { animation: th-heart 7s ease-in-out infinite; }
.mm-svg .th-field { animation: th-field 7s ease-in-out infinite; }
.mm-svg .th-field-line { animation: th-drift 60s linear infinite; }
@keyframes th-wave { 0% { transform: scale(.05); opacity: 0 } 6% { opacity: 1 } 60% { transform: scale(1.02); opacity: .9 } 78% { transform: scale(1.02); opacity: 0 } 100% { transform: scale(1.02); opacity: 0 } }
@keyframes th-halo { 0% { transform: scale(.1); opacity: 0 } 12% { opacity: .6 } 66% { transform: scale(1); opacity: .35 } 88% { transform: scale(1); opacity: 0 } 100% { transform: scale(1); opacity: 0 } }
@keyframes th-heart { 0%, 100% { transform: scale(1) } 5% { transform: scale(1.35) } 18% { transform: scale(1) } }
@keyframes th-field { 0%, 45%, 100% { opacity: .4 } 68% { opacity: 1 } }
@keyframes th-drift { to { stroke-dashoffset: -44 } }
@media (prefers-reduced-motion: reduce) {
  .mm-svg .th-wave { animation: none; opacity: .55 } .mm-svg .th-halo { animation: none; opacity: .3 }
  .mm-svg .th-heart, .mm-svg .th-field, .mm-svg .th-field-line { animation: none } .mm-svg .th-field { opacity: .7 }
}

.mm-caption { display: flex; justify-content: space-between; gap: 1rem; max-width: 40rem; margin: .6rem auto 0; font-size: .82rem; letter-spacing: .06em; color: var(--on-night-soft); }
.mm-hint { margin: .9rem auto 0; font-size: .92rem; color: var(--on-night-soft); }

/* the intro of each part: brief, pointing to its depth */
.mm-panel { max-width: 36rem; margin: 1.6rem auto 0; min-height: 11.5rem; }
.mm-entry { padding: 1.4rem clamp(1.2rem, 4vw, 2rem); border: 1px solid rgba(226,184,92,.28); border-radius: 10px; background: rgba(226,184,92,.06); margin-bottom: 1rem; }
.mm-kicker { margin: 0 0 .35rem; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-pale, #e3c77a); }
.mm-entry h3 { margin: 0 0 .6rem; color: var(--on-night); }
.mm-entry p { color: var(--on-night); margin: 0 0 .7rem; }
.mm-more { margin: 0 !important; }
.mm-more a { color: var(--gold-pale, #e3c77a); }
.js .mm-entry { display: none; }
.js .mm-entry.is-active { display: block; animation: mm-entry .55s cubic-bezier(.22,1,.36,1); }
@keyframes mm-entry { from { opacity: 0; transform: translateY(.4rem); } }
@media (prefers-reduced-motion: reduce) { .js .mm-entry.is-active { animation: none; } }
.mm .toc { justify-content: center; margin-top: 2rem; }
