/* The home page's own pieces (site/index.html, with home.js), on top of hub.css and the story kit (story.css):
   the hero's rotating role texts and the agents "sprawl" map (the Landscape's market in dots is site/assets/landscape/market.css). */

/* ---------- hero: the story kit's .hero (story.css), plus the role texts ---------- */
/* the role tabs: the active one's red underline fills over 10 seconds while the texts rotate (home.js), over a light track */
@property --tab-fill{syntax:"<percentage>";inherits:false;initial-value:0%}
.roles{display:flex;flex-wrap:wrap;align-items:baseline;gap:6px 18px}
.roles__tabs{display:flex;flex-wrap:wrap;gap:4px 18px}
.roles__tabs button{--tab-fill:0%;background:none;border:0;padding:8px 0;min-height:44px;font:500 clamp(17px,1.5vw,19px) var(--font);color:var(--ink3);cursor:pointer;
  background-image:linear-gradient(var(--stamp),var(--stamp)),linear-gradient(var(--rule),var(--rule));background-repeat:no-repeat;
  background-position:0 calc(100% - 6px);background-size:var(--tab-fill) 2px,0 2px;transition:color .2s,--tab-fill .35s}
.roles__tabs button:hover{color:var(--ink)}
.roles__tabs button[aria-pressed="true"]{--tab-fill:100%;color:var(--ink);background-size:var(--tab-fill) 2px,100% 2px}
.roles.is-auto button[aria-pressed="true"]{animation:home-tab-fill 10s linear forwards}
.roles.is-auto.is-paused button[aria-pressed="true"],.hero__in:hover .roles.is-auto button[aria-pressed="true"],
.hero__in:focus-within .roles.is-auto button[aria-pressed="true"]{animation-play-state:paused}
@keyframes home-tab-fill{from{--tab-fill:0%}to{--tab-fill:100%}}
/* the three texts share one cell, so the block is as tall as the longest and nothing below moves */
.hero__subs{display:grid;font-size:clamp(19px,1.9vw,24px)}
.hero__sub{grid-area:1 / 1;max-width:45rem;font-size:1em;line-height:1.55;color:var(--ink2);
  transition:opacity .45s ease,transform .45s ease,visibility 0s linear .45s}
.hero__sub:not(.is-on){opacity:0;transform:translateY(8px);visibility:hidden}
.hero__sub.is-on{transition-delay:.15s,.15s,0s}

/* ---------- agents: the sprawl map (home.js draws it; it adds p1, p2 and p3 to #agents as it plays) ---------- */
html.js .field .stat-list li{opacity:.2;transition:opacity .6s ease}
html.js .p1 li[data-phase="1"],html.js .p2 li[data-phase="2"],html.js .p3 li[data-phase="3"]{opacity:1}
.sprawl circle{fill:var(--ground);stroke:#C9CFD6;stroke-width:1.5;transition:fill .35s ease var(--t,0s),stroke .35s ease var(--t,0s)}
.p1 .sprawl circle.on{fill:var(--ink);stroke:var(--ink)}
.p3 .sprawl circle.ctl{fill:var(--stamp);stroke:var(--stamp)}
.sprawl .tangle line{stroke:var(--ink3);stroke-width:1;opacity:.45;stroke-dasharray:1;stroke-dashoffset:1;transition:stroke-dashoffset .9s ease var(--t,0s)}
.p2 .sprawl .tangle line{stroke-dashoffset:0}
.sprawl .ctrl line{stroke:var(--stamp);stroke-width:1.6;stroke-dasharray:1;stroke-dashoffset:1;transition:stroke-dashoffset .8s cubic-bezier(.4,.1,.2,1) var(--t,0s)}
.p3 .sprawl .ctrl line{stroke-dashoffset:0}
.sprawl .hub rect{fill:var(--stamp)}
.sprawl .hub text{font:600 11px var(--mono);letter-spacing:.08em;fill:var(--stamp);text-anchor:middle;paint-order:stroke;stroke:var(--ground);stroke-width:5px;stroke-linejoin:round}
.sprawl .hub{opacity:0;transform-box:fill-box;transform-origin:center;transform:scale(.3);transition:opacity .4s,transform .6s cubic-bezier(.3,.7,.2,1.4)}
.p3 .sprawl .hub{opacity:1;transform:none}
/* once the sprawl is drawn, the unmanaged dots drift a little */
.p2 .sprawl circle.on:not(.ctl){transform-box:fill-box;transform-origin:center;animation:home-drift var(--dur,5s) ease-in-out var(--t,0s) 8 alternate}
@keyframes home-drift{from{transform:translate(0,0)}to{transform:translate(var(--dx,2px),var(--dy,-2px))}}
html:not(.js) .sprawl{display:none}

.page-sources{padding-bottom:8px}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion:reduce){
  .sprawl circle,.sprawl line,.sprawl .hub,html.js .field .stat-list li{transition:none}
  .p2 .sprawl circle.on:not(.ctl){animation:none}
}
