/* Fernandeno Community Health: motion layer.
 * Everything here is gated twice: the visitor must not have asked for reduced motion, and
 * motion-init.js must have added html.motion (so content is never hidden if scripts fail).
 * Print and reduced motion users get the plain static site from styles.css.
 */
@property --ra { syntax: "<angle>"; inherits: false; initial-value: 360deg; }

@media screen and (prefers-reduced-motion: no-preference) {

@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out .26s ease both; }
::view-transition-new(root) { animation: vt-in .55s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }

html.motion { --eo: cubic-bezier(.16, 1, .3, 1); --eio: cubic-bezier(.65, 0, .35, 1); }

/* ---------- Landscape: sunrise on load, sunset in the footer, depth on scroll ---------- */
html.motion .pano .pl-sun { transition: transform 3.4s var(--eo) .35s; }
html.motion .pano:not(.play) .pl-sun { transform: translateY(74%); }
html.motion .pano.foot:not(.play) .pl-sun { transform: translateY(-36%); }
html.motion .pano.foot .pl-sun { transition-duration: 3.8s; transition-delay: .1s; }

html.motion .pano:not(.foot) .pl-r { transition: transform 2.8s var(--eo); }
html.motion .pano:not(.foot):not(.play) .pl-r0 { transform: translateY(9%); }
html.motion .pano:not(.foot):not(.play) .pl-r1 { transform: translateY(7%); }
html.motion .pano:not(.foot):not(.play) .pl-r2 { transform: translateY(5%); }
html.motion .pano:not(.foot):not(.play) .pl-r3 { transform: translateY(3%); }
html.motion .pano:not(.foot):not(.play) .pl-r4 { transform: translateY(1.5%); }
html.motion .pano .pl-r1 { transition-delay: .06s; }
html.motion .pano .pl-r2 { transition-delay: .12s; }
html.motion .pano .pl-r3 { transition-delay: .18s; }
html.motion .pano .pl-r4 { transition-delay: .24s; }

html.motion .pano:not(.foot):not(.m-night) .pl-dawn { transition: opacity 3.4s ease .3s; }
html.motion .pano:not(.foot):not(.m-night):not(.play) .pl-dawn { opacity: .58; }

html.motion .pl-rings circle { transform-box: fill-box; transform-origin: center; transition: opacity 1.6s ease, scale 2.6s var(--eo); }
html.motion .pano:not(.play) .pl-rings circle { opacity: 0; scale: .78; }
html.motion .pl-rings g > g:nth-child(1) circle { transition-delay: 1.1s; }
html.motion .pl-rings g > g:nth-child(2) circle { transition-delay: 1.22s; }
html.motion .pl-rings g > g:nth-child(3) circle { transition-delay: 1.34s; }
html.motion .pl-rings g > g:nth-child(4) circle { transition-delay: 1.46s; }
html.motion .pl-rings g > g:nth-child(5) circle { transition-delay: 1.58s; }
html.motion .pl-rings g > g:nth-child(6) circle { transition-delay: 1.7s; }
html.motion .pl-rings g > g:nth-child(7) circle { transition-delay: 1.82s; }
html.motion .pl-rings g > g:nth-child(8) circle { transition-delay: 1.94s; }

html.motion .pl-stars { animation: twinkle 5.5s ease-in-out infinite alternate; }
@keyframes twinkle { from { opacity: 1; } to { opacity: .45; } }

/* Depth: far layers sink a little behind near ones as the scene scrolls past. --p runs 0 to 1. */
html.motion .pano:not(.foot) .pl-sun, html.motion .pano:not(.foot) .pl-rings { translate: 0 calc(var(--p, 0) * 17%); }
html.motion .pano:not(.foot) .pl-r0 { translate: 0 calc(var(--p, 0) * 10%); }
html.motion .pano:not(.foot) .pl-r1 { translate: 0 calc(var(--p, 0) * 7.5%); }
html.motion .pano:not(.foot) .pl-r2 { translate: 0 calc(var(--p, 0) * 5%); }
html.motion .pano:not(.foot) .pl-r3 { translate: 0 calc(var(--p, 0) * 2.5%); }
html.motion .pano:not(.foot) .pl-r4 { translate: 0 calc(var(--p, 0) * 1%); }

/* ---------- Headlines: lines rise from behind a mask ---------- */
html.motion :is(h1, h2, .statement, .site-footer .big):not(.split) { opacity: 0; }
html.motion .w { display: inline-block; clip-path: inset(-.12em -.4em -.3em -.4em); }
html.motion .wi { display: inline-block; transform: translateY(140%); transition: transform 1.15s var(--eo); transition-delay: calc(var(--l, 0) * 95ms); }
html.motion .split.in .wi { transform: none; }
html.motion .statement .wi { transition-duration: 1s; transition-delay: calc(var(--l, 0) * 70ms); }

/* ---------- Small labels: the marker pops, the text slides in ---------- */
html.motion .label { transition: opacity .8s ease, transform 1s var(--eo); }
html.motion .label:not(.in) { opacity: 0; transform: translateX(-16px); }
html.motion .label::before { transition: transform .7s var(--eo) .25s; }
html.motion .label:not(.in)::before { transform: scale(0) rotate(45deg); }

/* ---------- Hairline rules draw across, row content follows ---------- */
html.motion :is(.index, .anatomy, .hotlines, .roles, .plain, .valleys) > li, html.motion .faq details {
  --lc: var(--rule); border-color: transparent;
  background-image: linear-gradient(var(--lc), var(--lc)), linear-gradient(var(--lc), var(--lc));
  background-repeat: no-repeat; background-position: left bottom, left top; background-size: 0 1px, 0 0;
  transition: background-size 1.15s var(--eio) calc(var(--i, 0) * var(--step, 80ms));
}
html.motion :is(.index, .anatomy, .hotlines, .roles, .plain, .valleys) > li:first-child, html.motion .faq details:first-child { background-size: 0 1px, 0 1px; }
html.motion :is(.index, .anatomy, .hotlines, .roles, .plain, .valleys).in > li, html.motion .faq.in details { background-size: 100% 1px, 100% 0; }
html.motion :is(.index, .anatomy, .hotlines, .roles, .plain, .valleys).in > li:first-child, html.motion .faq.in details:first-child { background-size: 100% 1px, 100% 1px; }
html.motion .valleys > li { --lc: var(--rule-inv); }
html.motion .block:not(.navy) .valleys > li { --lc: var(--rule); }

html.motion :is(.index, .anatomy, .hotlines, .roles, .plain) > li > *, html.motion .faq details > :is(summary, .a),
html.motion .facts > div > *, html.motion .col-head > *, html.motion .team > li, html.motion .ticker .words > span {
  transition: opacity .85s ease, transform 1.05s var(--eo), color .3s ease;
  transition-delay: calc(var(--i, 0) * var(--step, 80ms) + 140ms);
}
html.motion :is(.index, .anatomy, .hotlines, .roles, .plain):not(.in) > li > *, html.motion .faq:not(.in) details > :is(summary, .a),
html.motion .facts:not(.in) > div > *, html.motion .col-head:not(.in) > *, html.motion .team:not(.in) > li, html.motion .ticker .words:not(.in) > span {
  opacity: 0; transform: translateY(14px);
}
html.motion .anatomy { --step: 600ms; }
html.motion .ticker .words { --step: 140ms; }

html.motion .facts { --step: 120ms; }
html.motion .facts > div { --lc: var(--navy); border-top-color: transparent; background: linear-gradient(var(--lc), var(--lc)) left top / 0 3px no-repeat; transition: background-size 1.2s var(--eio) calc(var(--i, 0) * 120ms); }
html.motion .facts > div:nth-child(2) { --lc: var(--green); }
html.motion .facts > div:nth-child(3) { --lc: var(--gold); }
html.motion .facts > div:nth-child(4) { --lc: var(--black); }
html.motion .facts.in > div { background-size: 100% 3px; }
html.motion .col-head { --lc: var(--navy); border-top-color: transparent; background: linear-gradient(var(--lc), var(--lc)) left top / 0 10px no-repeat; transition: background-size 1.3s var(--eio); }
html.motion .col-head.green { --lc: var(--green); }
html.motion .col-head.in { background-size: 100% 10px; }

/* ---------- Valley names slide in ---------- */
html.motion .valleys > li { transition: opacity .9s ease, transform 1.25s var(--eo), background-size 1.25s var(--eio); transition-delay: calc(var(--i, 0) * 130ms + 80ms); }
html.motion .valleys:not(.in) > li { opacity: 0; transform: translateX(-36px); }

/* ---------- Steps: a line runs across, numbers arrive one after another ---------- */
html.motion .steps { position: relative; --step: 380ms; }
html.motion .steps > li > .num { clip-path: inset(-6% -6% -14% -6%); transition: clip-path 1.15s var(--eo), transform 1.25s var(--eo); transition-delay: calc(var(--i, 0) * var(--step) + 260ms); }
html.motion .steps:not(.in) > li > .num { clip-path: inset(0 0 100% 0); transform: translateY(34%); }
html.motion .steps > li > :is(h3, p) { transition: opacity .85s ease, transform 1.05s var(--eo); transition-delay: calc(var(--i, 0) * var(--step) + 560ms); }
html.motion .steps:not(.in) > li > :is(h3, p) { opacity: 0; transform: translateY(14px); }
@media (min-width: 801px) {
  html.motion .steps::before { content: ""; position: absolute; left: 0; right: 0; top: -30px; height: 2px; background: var(--gold); transform-origin: left; transition: transform 1.9s var(--eio) .1s; }
  html.motion .steps:not(.in)::before { transform: scaleX(0); }
  html.motion .steps > li + li { border-left-color: transparent; background: linear-gradient(var(--rule-inv), var(--rule-inv)) left top / 1px 0 no-repeat; transition: background-size 1.2s var(--eio) calc(var(--i, 0) * var(--step) + 200ms); }
  html.motion .steps.in > li + li { background-size: 1px 100%; }
}

/* ---------- Single elements settle into place ---------- */
html.motion :is(.lede, .hero .side p, .actions, .after-index, .notice, .marks, .photo, .crumbs, .prose) { transition: opacity .9s ease, transform 1.1s var(--eo); }
html.motion :is(.lede, .hero .side p, .actions, .after-index, .notice, .marks, .photo, .crumbs, .prose):not(.in) { opacity: 0; transform: translateY(16px); }
html.motion .hero .side p { transition-delay: .5s; }
html.motion .hero .actions { transition-delay: .7s; }
html.motion .page-hero .hero-lede { transition-delay: .45s; }

html.motion .form-card { transition: opacity .7s ease, transform 1.1s var(--eo), box-shadow 1.1s var(--eo) .3s; }
html.motion .form-card:not(.in) { opacity: 0; transform: translate(10px, 16px); box-shadow: 0 0 0 var(--gold); }

/* ---------- Emblem assembles: people, then the ground, then the sun rises inside the circle ---------- */
html.motion .emblem-stack .el-people { transition: opacity .9s ease .15s, transform 1.5s var(--eo) .15s; }
html.motion .emblem-stack:not(.in) .el-people { opacity: 0; transform: translateY(10%); }
html.motion .emblem-stack .el-mountains { clip-path: inset(0 -2% 0 0); transition: opacity .35s ease, clip-path 1.5s var(--eio) .75s; }
html.motion .emblem-stack:not(.in) .el-mountains { clip-path: inset(0 100% 0 0); }
html.motion .emblem-stack .el-sun { transition: opacity 1.2s ease 1.35s, transform 2.3s var(--eo) 1.35s; }
html.motion .emblem-stack:not(.in) .el-sun { opacity: 0; transform: translateY(18%) scale(.9); }
html.motion .emblem-stack .el-ring { -webkit-mask-image: conic-gradient(from 226deg, #000 var(--ra), transparent 0); mask-image: conic-gradient(from 226deg, #000 var(--ra), transparent 0); transition: opacity .35s ease, --ra 2.2s var(--eio) 1.7s; }
html.motion .emblem-stack:not(.in) .el-ring { --ra: 0deg; }
html.motion .emblem-stack.done .el { transition: opacity .35s ease; }

/* Once a group has finished arriving, hover responses should be immediate. */
html.motion .done, html.motion .done > *, html.motion .done > * > * { transition-delay: 0s !important; }

/* ---------- Hover and touch details ---------- */
html.motion .btn { background-image: linear-gradient(var(--fill, var(--green)), var(--fill, var(--green))); background-repeat: no-repeat; background-position: left center; background-size: 0% 100%; transition: background-size .55s var(--eo), border-color .35s ease, color .35s ease, transform .2s ease; }
html.motion .btn:hover, html.motion .btn:focus-visible { background-color: var(--navy); background-size: 100% 100%; }
html.motion .btn.gold { --fill: var(--card); }
html.motion .btn.gold:hover, html.motion .btn.gold:focus-visible { background-color: var(--gold); }
html.motion .btn.line { --fill: var(--navy); }
html.motion .btn.line:hover { background-color: transparent; }
html.motion .btn:active { transform: translateY(1px) scale(.985); }
html.motion .btn svg, html.motion .tlink svg { transition: transform .45s var(--eo); }

html.motion .tlink { text-decoration: none; padding-bottom: .26em; background: linear-gradient(var(--gold), var(--gold)) left bottom / 100% 2px no-repeat; }
html.motion .tlink:hover { animation: redraw .8s var(--eio); }
@keyframes redraw {
  0% { background-size: 100% 2px; background-position: right bottom; }
  45% { background-size: 0% 2px; background-position: right bottom; }
  46% { background-size: 0% 2px; background-position: left bottom; }
  100% { background-size: 100% 2px; background-position: left bottom; }
}

html.motion .navlink { border-bottom-color: transparent; background: linear-gradient(var(--gold), var(--gold)) left bottom / 0% 2px no-repeat; transition: background-size .5s var(--eo); }
html.motion .navlink:hover, html.motion .navlink[aria-current="page"] { background-size: 100% 2px; border-bottom-color: transparent; }

html.motion .site-header { transition: transform .55s var(--eo), box-shadow .3s ease; }
html.motion .site-header.scrolled { box-shadow: 0 10px 28px rgba(7, 44, 71, .08); }
html.motion .site-header.hide { transform: translateY(-102%); }

@media (hover: hover) {
  html.motion :is(.index, .roles).done > li:hover > h4 { transform: translateX(10px); color: var(--green); }
  html.motion .index.done > li:hover > .n { transform: translateX(4px); color: var(--navy); }
  html.motion .hotlines.done > li:hover > a { transform: translateX(10px); }
}

@keyframes nav-in { from { opacity: 0; transform: translateY(22px); } }
@media (max-width: 1060px) {
  html.motion .nav.open .navlink, html.motion .nav.open .btn { animation: nav-in .7s var(--eo) both; }
  html.motion .nav.open .navlink:nth-child(2) { animation-delay: .06s; }
  html.motion .nav.open .navlink:nth-child(3) { animation-delay: .12s; }
  html.motion .nav.open .navlink:nth-child(4) { animation-delay: .18s; }
  html.motion .nav.open .navlink:nth-child(5) { animation-delay: .24s; }
  html.motion .nav.open .btn { animation-delay: .32s; }
}

/* Background rings turn very slowly. */
html.motion .ringsbg { animation: ring-turn 280s linear infinite; }
@keyframes ring-turn { to { transform: rotate(360deg); } }

}
