/* Hefesto motion kit: tokens follow the brand book (gold mark, charcoal, Greek-key grey). */
:root {
  --hf-line: #2b2b2b;
  --hf-paper: #fbf8f2;
  --hf-gold: #c98a45;
  --hf-glow: #f0b46a;
  --hf-key: #c5d3d3;
  --hf-night: #0b0b0b;
  --hf-ease: cubic-bezier(.65, 0, .35, 1);
  --hf-ease-out: cubic-bezier(.16, 1, .3, 1);
}
.hf-marble, [data-hf-palette="marble"] {
  --hf-line: #efe9df;
  --hf-paper: #121212;
  --hf-key: #4c5757;
}

/* ---------- sprites & stage ---------- */
.hf-sprite { position: absolute; left: 0; bottom: 0; background-repeat: no-repeat; transform-origin: 50% 95%; will-change: transform, background-position; pointer-events: none; }
.hf-stage { position: relative; min-height: 140px; overflow: hidden; }
.hf-stage__layer, .hf-stage__fx { position: absolute; inset: 0 0 17px 0; }
.hf-stage__anvil { position: absolute; left: 0; bottom: 0; background-size: 100% 100%; }
.hf-stage__ground { position: absolute; left: 0; right: 0; bottom: 0; height: 20px; opacity: .9; }
.hf-stage__ground svg, .hf-divider__line svg, .hf-enter-band svg { width: 100%; height: 100%; display: block; }
.hf-particle { position: absolute; pointer-events: none; animation: hf-particle var(--d, 800ms) var(--hf-ease-out) forwards; }
.hf-spark { width: 3px; height: 9px; margin: -4px 0 0 -1px; border-radius: 2px; background: var(--hf-glow); box-shadow: 0 0 6px var(--hf-gold); }
.hf-note, .hf-glyph { font: 600 18px/1 Georgia, "Times New Roman", serif; color: var(--hf-gold); margin: -9px 0 0 -6px; }
.hf-bubble { position: absolute; transform: translate(-50%, -100%); padding: 2px 10px; border: 1.5px solid var(--hf-line); border-radius: 999px; background: var(--hf-paper); color: var(--hf-line); font: 600 13px/1.6 Georgia, serif; white-space: nowrap; animation: hf-bubble 1.8s var(--hf-ease-out) forwards; }
@keyframes hf-particle { from { transform: translate(0, 0) rotate(0); opacity: 1; } to { transform: translate(var(--dx), var(--dy)) rotate(40deg); opacity: 0; } }
@keyframes hf-bubble { 0% { opacity: 0; translate: 0 6px; } 15%, 75% { opacity: 1; translate: 0 0; } 100% { opacity: 0; translate: 0 -6px; } }

/* ---------- section backgrounds ---------- */
[data-hf-bg] { position: relative; isolation: isolate; }
.hf-bg { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; color: var(--hf-key); }
.hf-bg__svg { width: 100%; height: 100%; display: block; }
.hf-bg__svg path, .hf-bg__svg circle:not(.hf-ember) { fill: none; stroke: var(--hf-key); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.hf-bg__svg .hf-thin { stroke-width: 1; }
/* pathLength-based drawing needs real (scaling) strokes */
.hf-bg__svg [pathLength] { vector-effect: none; }
.hf-bg--forge [pathLength] { stroke-width: 1.2; }
.hf-bg__svg .hf-gold { stroke: var(--hf-gold); }
/* meander: bands drift in opposite directions, rings turn slowly */
.hf-band__fill { animation: hf-drift 14s linear infinite; }
.hf-band--r .hf-band__fill { animation-direction: reverse; }
.hf-rings { animation: hf-turn 60s linear infinite; transform-box: fill-box; transform-origin: center; }
.hf-tilde { stroke-dasharray: 1 0; animation: hf-breathe 4s ease-in-out infinite; }
@keyframes hf-drift { to { transform: translateX(-40px); } }
@keyframes hf-turn { to { rotate: 360deg; } }
@keyframes hf-breathe { 50% { opacity: .35; } }
/* temple: drawn line by line, rays turn behind the pediment */
.hf-bg--temple .hf-draw, .hf-bg--temple .hf-col path, .hf-bg--forge .hf-draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: hf-draw 2.4s var(--hf-ease) forwards; }
.hf-bg--temple .hf-col path { animation-delay: calc(var(--col, 0) * 120ms + .4s); }
.hf-col.hf-d1 { --col: 1; } .hf-col.hf-d2 { --col: 2; } .hf-col.hf-d3 { --col: 3; } .hf-col.hf-d4 { --col: 4; } .hf-col.hf-d5 { --col: 5; }
.hf-rays { opacity: .5; animation: hf-turn 90s linear infinite; transform-box: view-box; }
.hf-rays path { stroke-dasharray: 4 10; }
@keyframes hf-draw { to { stroke-dashoffset: 0; } }
/* forge: embers rise from the anvil, heat shimmers */
.hf-ember { fill: var(--hf-glow); animation: hf-ember var(--d) linear var(--delay) infinite; }
.hf-heat path { animation: hf-shimmer 2.6s ease-in-out infinite alternate; transform-box: fill-box; }
.hf-heat path:nth-child(2) { animation-delay: -.9s; } .hf-heat path:nth-child(3) { animation-delay: -1.7s; }
.hf-glow-line { stroke-width: 4 !important; filter: drop-shadow(0 0 6px var(--hf-gold)); animation: hf-breathe 1.6s ease-in-out infinite; }
@keyframes hf-ember { 0% { transform: translate(0, 0); opacity: 0; } 10% { opacity: 1; } 100% { transform: translate(var(--x), -420px); opacity: 0; } }
@keyframes hf-shimmer { from { transform: translateY(0) skewX(-6deg); opacity: .25; } to { transform: translateY(-14px) skewX(6deg); opacity: .8; } }
/* sea: three rows of Vitruvian waves at different speeds, a ship rocks across */
.hf-wave rect { animation: hf-sea 9s linear infinite; }
.hf-wave--2 rect { animation-duration: 13s; animation-direction: reverse; opacity: .7; }
.hf-wave--3 rect { animation-duration: 7s; opacity: .5; }
.hf-ship { animation: hf-sail 38s linear infinite; }
.hf-ship > * { animation: hf-rock 3s ease-in-out infinite alternate; transform-box: view-box; transform-origin: 35px 470px; }
@keyframes hf-sea { to { transform: translateX(-80px); } }
@keyframes hf-sail { from { translate: -120px 0; } to { translate: 1700px 0; } }
@keyframes hf-rock { from { rotate: -3deg; } to { rotate: 3deg; } }
/* agora: a stage glued to the bottom of the section */
.hf-bg--agora .hf-bg__stage { position: absolute; left: 0; right: 0; bottom: 0; height: min(200px, 50%); }

/* ---------- section transitions ---------- */
[data-hf-enter] { position: relative; }
[data-hf-enter] .hf-enter-item { opacity: 0; translate: 0 28px; transition: opacity .8s var(--hf-ease-out), translate .9s var(--hf-ease-out); transition-delay: calc(var(--i, 0) * 90ms + var(--hf-enter-delay, 0ms)); }
[data-hf-enter].hf-in .hf-enter-item { opacity: 1; translate: 0 0; }
/* draw: every stroke marked data-hf-draw (or inside it) traces itself */
[data-hf-enter="draw"] [data-hf-draw] path, [data-hf-enter="draw"] path[data-hf-draw] { stroke-dasharray: var(--hf-len, 1200); stroke-dashoffset: var(--hf-len, 1200); transition: stroke-dashoffset 1.8s var(--hf-ease) .2s; }
[data-hf-enter="draw"].hf-in [data-hf-draw] path, [data-hf-enter="draw"].hf-in path[data-hf-draw] { stroke-dashoffset: 0; }
/* columns: two Ionic columns part like temple doors */
[data-hf-enter="columns"] { --hf-enter-delay: 450ms; overflow: hidden; }
.hf-curtain { position: absolute; inset: 0; z-index: 3; pointer-events: none; display: flex; }
.hf-curtain__half { flex: 1; display: flex; background: var(--hf-paper); transition: transform 1.1s var(--hf-ease), opacity .4s linear 1s; }
.hf-curtain__half--l { justify-content: flex-end; }
.hf-curtain__half svg { height: 100%; width: auto; max-width: 70px; }
.hf-curtain__half path { fill: none; stroke: var(--hf-line); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.hf-curtain__half .hf-gold { stroke: var(--hf-gold); }
.hf-in .hf-curtain__half--l { transform: translateX(-101%); }
.hf-in .hf-curtain__half--r { transform: translateX(101%); }
.hf-in .hf-curtain { visibility: hidden; transition: visibility 0s 1.2s; }
/* meander: a gold Greek key runs across the top edge, then content rises */
[data-hf-enter="meander"] { --hf-enter-delay: 500ms; }
.hf-enter-band { position: absolute; left: 0; right: 0; top: 0; height: 20px; transform: scaleX(0); transform-origin: left; transition: transform 1s var(--hf-ease); }
.hf-in > .hf-enter-band { transform: scaleX(1); }
/* unroll: the section opens like a papyrus scroll between two rods */
/* clip the children, not the section: a fully clipped target never reports an intersection */
[data-hf-enter="unroll"] { --hf-enter-delay: 600ms; }
[data-hf-enter="unroll"] > :not(.hf-rod) { clip-path: inset(0 50% 0 50%); transition: clip-path 1.2s var(--hf-ease), opacity .8s var(--hf-ease-out), translate .9s var(--hf-ease-out); }
[data-hf-enter="unroll"].hf-in > :not(.hf-rod) { clip-path: inset(0 0 0 0); }
.hf-rod { position: absolute; top: 0; bottom: 0; width: 8px; border-radius: 4px; background: var(--hf-gold); z-index: 3; left: calc(50% - 4px); transition: left 1.2s var(--hf-ease), opacity .4s 1.2s; }
.hf-in > .hf-rod--l { left: 0; opacity: 0; }
.hf-in > .hf-rod--r { left: calc(100% - 8px); opacity: 0; }

/* divider walker */
.hf-divider { position: relative; height: calc(var(--hf-divider-h, 110px) + 20px); overflow: hidden; }
.hf-divider__line { position: absolute; left: 0; right: 0; bottom: 0; height: 20px; }
.hf-divider .hf-sprite { bottom: 17px; }

/* ---------- page transitions ---------- */
html.hf-pt-pending body { visibility: hidden; }
html.hf-pt-pending::after { content: ""; position: fixed; inset: 0; z-index: 9999; background: var(--hf-night); }
.hf-pt { position: fixed; inset: 0; z-index: 10000; pointer-events: none; overflow: hidden; --hf-ox: 50vw; --hf-oy: 50vh; }
.hf-pt.is-out, .hf-pt.is-covered { pointer-events: all; }
/* gates: two bronze doors with a Greek-key frame close over the page, the mark seals them */
.hf-pt__door { position: absolute; top: 0; bottom: 0; width: 50.5%; background:
    linear-gradient(var(--hf-night), var(--hf-night)) padding-box,
    repeating-linear-gradient(90deg, var(--hf-gold) 0 2px, transparent 2px 10px);
  border: 10px solid transparent; outline: 1px solid var(--hf-gold); outline-offset: -18px; transition: transform .8s var(--hf-ease); }
.hf-pt__door--l { left: 0; transform: translateX(-101%); }
.hf-pt__door--r { right: 0; transform: translateX(101%); }
.hf-pt__seal { position: absolute; left: 50%; top: 50%; width: 120px; height: 120px; translate: -50% -50%; scale: .6; opacity: 0; transition: opacity .3s, scale .5s var(--hf-ease-out); }
.hf-pt__seal svg { width: 100%; height: 100%; }
.hf-pt__seal path, .hf-pt__seal circle { fill: none; stroke: var(--hf-key); stroke-width: 2; stroke-linecap: round; }
.hf-pt__seal .hf-thin { stroke-width: 1; } .hf-pt__seal .hf-gold { stroke: var(--hf-gold); stroke-width: 5; }
.hf-pt--gates.is-out .hf-pt__door { transform: none; }
.hf-pt--gates.is-out .hf-pt__seal { opacity: 1; scale: 1; transition-delay: .55s; }
.hf-pt--gates.is-in .hf-pt__seal { transition-delay: 0s; }
.hf-pt--gates.is-in .hf-pt__door { transition-delay: .15s; }
/* meander: a night band with a gold Greek-key edge sweeps across while Hefesto walks */
.hf-pt__sweep { position: absolute; inset: 0 -40px; background: var(--hf-night); transform: translateX(-105%); transition: transform .75s var(--hf-ease); }
.hf-pt__edge { position: absolute; right: 0; top: 0; height: 100%; width: 22px; }
.hf-pt--meander.is-out .hf-pt__sweep { transform: none; }
.hf-pt--meander.is-in .hf-pt__sweep { transform: translateX(105%); transition-delay: .1s; }
.hf-pt__walker { position: absolute; left: 50%; bottom: 18vh; height: 0; }
.hf-pt__walker .hf-sprite { left: 0; }
.hf-pt--meander .hf-pt__walker { animation: hf-cross 2s linear both; }
@keyframes hf-cross { from { translate: -18vw 0; } to { translate: 18vw 0; } }
/* forge: night closes in from the click point, Hefesto strikes, a flash opens the next page */
.hf-pt__furnace { position: absolute; inset: 0; background: radial-gradient(circle at var(--hf-ox) var(--hf-oy), #2a1407 0, var(--hf-night) 55%); clip-path: circle(0 at var(--hf-ox) var(--hf-oy)); transition: clip-path .7s var(--hf-ease); }
.hf-pt--forge.is-out .hf-pt__furnace { clip-path: circle(150% at var(--hf-ox) var(--hf-oy)); }
.hf-pt--forge.is-in .hf-pt__furnace { clip-path: circle(0 at 50% 60%); transition-delay: .25s; }
.hf-pt__flash { position: absolute; inset: 0; background: radial-gradient(circle at 50% 70%, var(--hf-glow), transparent 60%); opacity: 0; }
.hf-pt--forge.is-in .hf-pt__flash { animation: hf-flash .5s ease-out; }
@keyframes hf-flash { 30% { opacity: .9; } }
.hf-pt--forge .hf-pt__walker { left: 50%; translate: -50% 0; opacity: 0; transition: opacity .3s .35s; }
.hf-pt--forge.is-out .hf-pt__walker, .hf-pt--forge.is-covered .hf-pt__walker { opacity: 1; }
.hf-pt--forge.is-in .hf-pt__walker { opacity: 0; transition-delay: 0s; }

/* ---------- reduced motion: everything static, content visible ---------- */
@media (prefers-reduced-motion: reduce) {
  .hf-bg *, .hf-particle, .hf-bubble { animation: none !important; }
  .hf-bg--temple .hf-draw, .hf-bg--temple .hf-col path, .hf-bg--forge .hf-draw { stroke-dashoffset: 0; }
  [data-hf-enter] .hf-enter-item { opacity: 1; translate: none; transition: none; }
  [data-hf-enter="unroll"] > * { clip-path: none !important; }
  .hf-curtain, .hf-rod, .hf-pt { display: none; }
  .hf-enter-band { transform: none; }
}
html.hf-reduced .hf-bg * { animation: none !important; }
html.hf-reduced .hf-bg--temple .hf-draw, html.hf-reduced .hf-bg--temple .hf-col path, html.hf-reduced .hf-bg--forge .hf-draw { stroke-dashoffset: 0; }
