/* MOTION: site-wide animation layer on top of styles.css. Gold leads; Heritage accents
   (copper, champagne, garnet) appear only in glows, gradients and borders.
   motion.js adds the fx-* classes on <html>; without JS none of this applies. */
:root { --a1: #C8743A; --a2: #EAD7AE; --a3: #C2505A; }   /* copper, champagne, garnet */
@property --a { syntax: "<angle>"; inherits: false; initial-value: 0deg; }

/* 1. Aurora: gold lead blob, accent blobs around it. */
.fx-aurora .aura i:nth-child(2) { background: radial-gradient(circle, color-mix(in srgb, var(--a1) 16%, transparent), transparent 62%); }
.fx-aurora .aura i:nth-child(3) { background: radial-gradient(circle, color-mix(in srgb, var(--a2) 8%, transparent), transparent 62%); }
.aura i:nth-child(n+4) { display: none; }
.fx-aurora .aura i:nth-child(n+4) { display: block; }
.aura i:nth-child(4) { width: 45vmax; height: 45vmax; left: 45vw; top: -20vmax; background: radial-gradient(circle, color-mix(in srgb, var(--a3) 11%, transparent), transparent 62%); animation-duration: 42s; animation-direction: alternate-reverse; }
.aura i:nth-child(5) { width: 40vmax; height: 40vmax; left: -10vmax; top: 55vh; background: radial-gradient(circle, color-mix(in srgb, var(--a1) 9%, transparent), transparent 62%); animation-duration: 58s; }
.aura i { transition: background .8s; }

/* 2. Split letters: each letter rises in turn; ORA carries a slow sheen. */
.fx-letters .hero-name .line { transform: none !important; transition: none !important; }
.hero-name .ch { display: inline-block; }
.hero-name .chi { display: inline-block; transition: transform .5s var(--ease-out); }
.fx-letters .hero-name .ch { animation: ch-rise 1s var(--ease-out) both; animation-delay: calc(var(--i) * 55ms + 150ms); }
@keyframes ch-rise { from { transform: translateY(110%) rotate(8deg); opacity: 0; } to { transform: none; opacity: 1; } }
.fx-letters .hero-name .gold .chi {
  color: transparent;
  background: linear-gradient(100deg, var(--gold) 0 34%, var(--a2) 46%, var(--a1) 54%, var(--gold) 66% 100%) 0 0 / 300% 100%;
  -webkit-background-clip: text; background-clip: text;
  animation: sheen 6s linear infinite; animation-delay: calc(var(--j) * -0.25s);
}
@keyframes sheen { from { background-position: 100% 0; } to { background-position: -200% 0; } }

/* 3. Particle field canvas: sits with the orbit, behind the hero text.
   Needs .hero > to beat styles.css `.hero > :not(.orbit) { position: relative }`. */
.hero > .fx-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; opacity: 0; transition: opacity 1.2s; }
.fx-particles .hero > .fx-canvas, .fx-particles .profile > .fx-canvas { opacity: 1; }
/* Profile page: dots sit behind the profile content. */
.profile { position: relative; }
.profile > .fx-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; opacity: 0; transition: opacity 1.2s; }
.profile > :not(.fx-canvas) { position: relative; z-index: 1; }

/* 4. Cursor: gold dot plus a lagging ring that swells over links. Mouse only. */
.fx-dot, .fx-ring { position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none; border-radius: 50%; display: none; }
@media (hover: hover) and (pointer: fine) {
  .fx-cursor .fx-dot, .fx-cursor .fx-ring { display: block; }
  .fx-cursor, .fx-cursor a, .fx-cursor button { cursor: none; }
}
/* A modal dialog renders in the top layer, above any z-index, so the custom cursor would hide
   behind it. While the popup is open, hide it and give back the normal cursor. */
html:has(dialog[open]) .fx-dot, html:has(dialog[open]) .fx-ring { display: none !important; }
html:has(dialog[open]), html:has(dialog[open]) a, html:has(dialog[open]) button { cursor: auto !important; }
html:has(dialog[open]) a, html:has(dialog[open]) button { cursor: pointer !important; }
.fx-dot { width: 8px; height: 8px; margin: -4px 0 0 -4px; background: var(--gold); }
.fx-ring { width: 40px; height: 40px; margin: -20px 0 0 -20px; border: 1.5px solid rgba(255, 194, 26, .7); transition: width .3s var(--ease-out), height .3s var(--ease-out), margin .3s var(--ease-out), background-color .3s, border-color .3s; }
.fx-ring.hot { width: 72px; height: 72px; margin: -36px 0 0 -36px; background: rgba(255, 194, 26, .1); border-color: var(--a1); }

/* 5. Topic chapters: "What I post" pinned on screen; scrolling steps through one topic at a time. */
.fx-chap { display: none; position: relative; height: calc(var(--n) * 65svh + 100svh); margin-top: 2rem; }
.fx-chapters .fx-chap { display: block; }
.fx-chapters .post-list, .fx-chapters .post > .sec-title-sm { display: none; }
.chap-pin { position: sticky; top: 0; height: 100svh; display: grid; grid-template-columns: auto 1fr; align-content: center; gap: 1.5rem clamp(1.5rem, 4vw, 4rem); padding-top: var(--nav-h); }
.chap-kick { grid-column: 1 / -1; font-size: var(--step-small); color: var(--muted); letter-spacing: .14em; text-transform: uppercase; }
.chap-num { font: 800 clamp(1rem, 1.4vw, 1.25rem)/1 var(--brand); color: var(--muted); letter-spacing: .08em; font-variant-numeric: tabular-nums; padding-top: 1.2em; }
.chap-num b { color: var(--acc); transition: color .5s; }
.chap-stage { position: relative; font: 800 clamp(3rem, 10vw, 9rem)/1.05 var(--display); height: 1.2em; overflow: hidden; }
.chap-word { position: absolute; left: 0; top: 0; letter-spacing: -0.04em; white-space: nowrap; color: var(--ink); transform: translateY(130%); transition: transform .8s var(--ease-out), color .8s; }
.chap-word.past { transform: translateY(-130%); }
.chap-word.on { transform: none; color: var(--acc); }
/* All lines share one grid cell, so the block is as tall as the longest line and nothing clips. */
.chap-desc { grid-column: 2; display: grid; font-size: var(--step-lead); line-height: 1.4; color: var(--muted); }
.chap-desc span { grid-area: 1 / 1; opacity: 0; transform: translateY(.6em); transition: opacity .5s, transform .6s var(--ease-out); }
.chap-desc span.on { opacity: 1; transform: none; transition-delay: .15s; }
.chap-bar { grid-column: 2; display: flex; gap: .5rem; }
.chap-bar i { flex: 1; height: 3px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.chap-bar i::after { content: ""; display: block; height: 100%; background: var(--acc); transform: scaleX(var(--f, 0)); transform-origin: left; transition: background-color .5s; }
@media (max-width: 640px) { .chap-pin { grid-template-columns: 1fr; } .chap-desc, .chap-bar { grid-column: 1; } }

/* 6. Holo: rotating accent edge on tree cards, 3D tilt and glare on the portrait. */
.fx-holo .t-kids .t-node::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; padding: 1.5px;
  background: conic-gradient(from var(--a), var(--gold), var(--a1), var(--a2), var(--a3), var(--gold));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: .5; animation: spin-a 7s linear infinite; transition: opacity .3s;
}
.fx-holo .t-kids .t-node:hover::before { opacity: 1; animation-duration: 2.5s; }
@keyframes spin-a { to { --a: 360deg; } }
.about-photo, .pf-photo { position: relative; }
.fx-holo :is(.about-photo, .pf-photo) { transform: perspective(900px) rotateX(calc(var(--ry, 0) * 1deg)) rotateY(calc(var(--rx, 0) * 1deg)); transition: transform .6s var(--ease-out); }
.fx-holo :is(.about-photo, .pf-photo)::after {
  content: ""; position: absolute; inset: 0; border-radius: var(--r); pointer-events: none; mix-blend-mode: soft-light;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, .55), color-mix(in srgb, var(--a1) 25%, transparent) 35%, transparent 75%);
  opacity: var(--go, 0); transition: opacity .4s;
}

/* ---------- Home extras (9-16) ---------- */

/* 9. About text: words light up as the paragraph scrolls through; bold words turn gold. */
.about-text .w { transition: opacity .35s, color .35s; }
.fx-words .about-text .w { opacity: .18; }
.fx-words .about-text .w.lit { opacity: 1; }
.fx-words .about-text strong .w.lit { color: var(--gold); }

/* 10. Odometer stats: each digit is a column of numbers that rolls to its value. */
.odo { display: inline-flex; height: 1em; overflow: hidden; line-height: 1; vertical-align: bottom; }
.odo-col { display: flex; flex-direction: column; transform: translateY(calc(var(--to, 0) * -1em)); }
.fx-odo .odo-col { transition: transform 1.8s cubic-bezier(.2, .9, .2, 1); transition-delay: calc(var(--k, 0) * 120ms); }
.fx-odo .odo:not(.run) .odo-col { transform: none; transition: none; }
/* .stat span in styles.css sizes the label; the odometer digits must keep the number size. */
.stat .odo, .stat .odo span { font-size: inherit; color: inherit; }
.odo-col span { height: 1em; }

/* 11. Platform rows: accent sweep fills the row, icon pops, each row its own accent. */
.fx-plat .plat a::before { opacity: 1; background: linear-gradient(90deg, color-mix(in srgb, var(--acc) 26%, transparent), color-mix(in srgb, var(--acc) 6%, transparent) 70%, transparent); transform: scaleX(0); transform-origin: left; transition: transform .6s var(--ease-out); }
.fx-plat .plat a:hover::before, .fx-plat .plat a:focus-visible::before { transform: none; }
.fx-plat .plat a:hover svg, .fx-plat .plat a:focus-visible svg { transform: scale(1.25) rotate(-8deg); color: var(--acc); }
.fx-plat .plat a:hover, .fx-plat .plat a:focus-visible { color: var(--ink); }
.fx-plat .plat a:hover .plat-go, .fx-plat .plat a:focus-visible .plat-go { color: var(--acc); }
.plat:nth-child(1) { --acc: var(--gold); } .plat:nth-child(2) { --acc: var(--a1); } .plat:nth-child(3) { --acc: var(--a2); }
.plat:nth-child(4) { --acc: var(--a3); } .plat:nth-child(5) { --acc: var(--gold); }

/* 12. Say hello: round button pulls toward the cursor; click sends a ripple. */
.c-hello .round { position: relative; overflow: hidden; translate: var(--mx2, 0) var(--my2, 0); transition: transform .35s var(--ease-out), translate .5s var(--ease-out); }
.ripple { position: absolute; inset: 0; border-radius: 50%; background: var(--gold); opacity: .6; animation: ripple .6s ease-out forwards; pointer-events: none; }
@keyframes ripple { from { transform: scale(0); } to { transform: scale(2.4); opacity: 0; } }

/* 13. Footer wordmark rises as you reach the bottom; ORA fills with gold left to right. */
.fx-foot .foot-mark svg { overflow: hidden; }
.fx-foot .foot-mark text { transform: translateY(calc((1 - var(--fp, 1)) * 100%)); transform-box: fill-box; }
.fx-foot .foot-mark .ora { fill: url(#fx-ora); }

/* 14. Headings slide up from behind a mask instead of fading. */
.hm { display: block; overflow: hidden; padding-bottom: .12em; margin-bottom: -.12em; }
.hmi { display: block; }
.fx-heads .hm-on.reveal { opacity: 1; filter: none; transform: none; }
.fx-heads .hm-on .hmi { transform: translateY(110%); transition: transform 1s var(--ease-out); transition-delay: var(--d, 0ms); }
.fx-heads .hm-on.in .hmi { transform: none; }

/* 15. Format chips: a highlight walks from chip to chip. */
.formats li { transition: color .4s, box-shadow .4s, background-color .4s; }
.fx-chips .formats li.hl { color: var(--gold); background: var(--gold-soft); box-shadow: inset 0 0 0 1px rgba(255, 194, 26, .6); }

/* 16. Portrait turns from black-and-white to colour as it scrolls in.
   The timeline sits on .crop: .about-photo has overflow:hidden, which makes it its own
   (never-scrolling) scroll container, so view() on the img itself never advanced. */
@supports (animation-timeline: view()) {
  .fx-bw .crop { view-timeline-name: --pic; }
  .fx-bw .about-photo img { animation: bw linear both; animation-timeline: --pic; animation-range: entry 0% cover 45%; }
  @keyframes bw { from { filter: grayscale(1) brightness(.7); } to { filter: none; } }
}

/* 17. Say hello popup: springs out of the button, accent edge, rows stagger in, animates out on close. */
/* Rows slide in from the right; clip sideways so the dialog never shows a scrollbar. */
.fx-hellopop .hello { overflow-x: hidden; }
.fx-hellopop .hello[open] { animation: hp-in .6s cubic-bezier(.2, 1.25, .35, 1) both; }
.fx-hellopop .hello.closing { animation: hp-out .24s ease-in forwards; }
@keyframes hp-in { from { opacity: 0; transform: translate(var(--ox, 0), var(--oy, 0)) scale(.15); } }
@keyframes hp-out { to { opacity: 0; transform: translate(var(--ox, 0), var(--oy, 0)) scale(.15); } }
.fx-hellopop .hello[open]::backdrop { animation: bd-in .4s ease-out both; }
.fx-hellopop .hello.closing::backdrop { animation: bd-out .24s ease-in forwards; }
@keyframes bd-in { from { opacity: 0; } }
@keyframes bd-out { to { opacity: 0; } }
.fx-hellopop .hello::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none;
  background: conic-gradient(from var(--a), var(--gold), var(--a1), var(--a2), var(--a3), var(--gold));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: spin-a 5s linear infinite;
}
.fx-hellopop .hello[open] .hello-head, .fx-hellopop .hello[open] .hello-list li { animation: hl-in .55s var(--ease-out) both; animation-delay: calc(.12s + var(--i, 0) * 60ms); }
@keyframes hl-in { from { opacity: 0; transform: translateX(1.5rem); } }
.hello-list li:nth-child(1) { --i: 1; --acc: var(--gold); } .hello-list li:nth-child(2) { --i: 2; --acc: var(--a1); }
.hello-list li:nth-child(3) { --i: 3; --acc: var(--a2); } .hello-list li:nth-child(4) { --i: 4; --acc: var(--a3); }
.hello-list li:nth-child(5) { --i: 5; --acc: var(--gold); }
.fx-hellopop .hello-list a { position: relative; overflow: hidden; isolation: isolate; }
.fx-hellopop .hello-list a::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, color-mix(in srgb, var(--acc) 28%, transparent), transparent 85%); transform: scaleX(0); transform-origin: left; transition: transform .45s var(--ease-out); }
.fx-hellopop .hello-list a:hover::before, .fx-hellopop .hello-list a:focus-visible::before { transform: none; }
.fx-hellopop .hello-list a:hover, .fx-hellopop .hello-list a:focus-visible { border-color: var(--acc); background: var(--surface); color: var(--ink); }
.fx-hellopop .hello-list svg { transition: transform .45s var(--ease-out), color .3s; }
.fx-hellopop .hello-list a:hover svg, .fx-hellopop .hello-list a:focus-visible svg { transform: scale(1.2) rotate(-8deg); color: var(--acc); }
.fx-hellopop .hello-x svg { transition: transform .4s var(--ease-out); }
.fx-hellopop .hello-x:hover svg { transform: rotate(90deg); }
/* Phone: the dialog is a bottom sheet, so it slides up instead of springing from the button. */
@media (max-width: 600px) {
  .fx-hellopop .hello[open] { animation: sheet-in .5s var(--ease-out) both; }
  .fx-hellopop .hello.closing { animation: sheet-out .24s ease-in forwards; }
  @keyframes sheet-in { from { transform: translateY(100%); } }
  @keyframes sheet-out { to { transform: translateY(100%); } }
}

/* ---------- Inner pages: cards and rows ---------- */

/* 18. Cards (Arena topics, "What's covered", "Where to find it"): an accent ring spins on hover only,
   so nothing animates until the pointer arrives. */
.fx-cards .cat, .fx-cards .inside-grid li, .fx-cards .cover-grid li, .fx-cards .where-link { position: relative; isolation: isolate; }
.fx-cards :is(.cat, .inside-grid li, .cover-grid li, .where-link)::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; padding: 1.5px; pointer-events: none;
  background: conic-gradient(from var(--a), var(--gold), var(--a1), var(--a2), var(--a3), var(--gold));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0; animation: spin-a 3s linear infinite paused; transition: opacity .35s;
}
.fx-cards :is(.cat, .inside-grid li, .cover-grid li, .where-link):hover::before { opacity: 1; animation-play-state: running; }
.fx-cards :is(.inside-grid li, .cover-grid li) { transition: transform .4s var(--ease-out); }
.fx-cards :is(.inside-grid li, .cover-grid li):hover { transform: translateY(-4px); }

/* 19. Blog list rows: accent sweep fills the row on hover, each row its own accent. */
.fx-cards .kit-row { position: relative; isolation: isolate; }
.fx-cards .kit-row::before { content: ""; position: absolute; inset: 0 -0.75rem; z-index: -1; border-radius: 10px; background: linear-gradient(90deg, color-mix(in srgb, var(--acc) 22%, transparent), transparent 80%); transform: scaleX(0); transform-origin: left; transition: transform .55s var(--ease-out); }
.fx-cards .kit-row:hover::before { transform: none; }
.kit-row:nth-child(1) { --acc: var(--gold); } .kit-row:nth-child(2) { --acc: var(--a1); } .kit-row:nth-child(3) { --acc: var(--a2); } .kit-row:nth-child(4) { --acc: var(--a3); }
