/*
 * Hashi — the motion layer.
 *
 * Carried over from .design/index.html, with three deliberate changes:
 *
 *  1. Class names are namespaced `hs-`. The reference uses bare `.row`,
 *     `.band`, `.office`, `.count` and `.track`, which here share a page with
 *     core block styles, the chassis and sfp-blocks.
 *  2. The count-up is driven from JS, not `counter()` over an @property
 *     integer, so the figures are real text (see site.js).
 *  3. Scroll reveals keep `animation-timeline: view()` where supported and
 *     fall back to an IntersectionObserver elsewhere.
 */

/* ---------------- keyframes ---------------- */
@keyframes hs-rise { from { opacity: 0; transform: translateY(60px); } to { opacity: 1; transform: none; } }
@keyframes hs-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes hs-ink { 0% { stroke-dashoffset: 2400; fill-opacity: 0; } 70% { stroke-dashoffset: 0; fill-opacity: 0; } 100% { stroke-dashoffset: 0; fill-opacity: 1; } }
@keyframes hs-stamp {
	0% { opacity: 0; transform: scale(1.8) rotate(-12deg); }
	60% { opacity: 1; transform: scale(0.94) rotate(3deg); }
	100% { opacity: 1; transform: scale(1) rotate(0); }
}
@keyframes hs-draw { to { stroke-dashoffset: 0; } }
@keyframes hs-comet { from { stroke-dashoffset: 1400; } to { stroke-dashoffset: 0; } }
@keyframes hs-marquee { to { transform: translateX(-50%); } }
@keyframes hs-kenburns { 0% { transform: scale(1.04); } 100% { transform: scale(1.16) translate(-2%, 1%); } }
@keyframes hs-unveil { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes hs-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0.2; } }
@keyframes hs-ping { 0% { transform: scale(0.6); opacity: 0.8; } 100% { transform: scale(2.6); opacity: 0; } }
@keyframes hs-spin { to { transform: rotate(360deg); } }
@keyframes hs-line-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------------- entrance ---------------- */
.hs-w { display: inline-block; opacity: 0; animation: hs-rise 1s var(--hs-ease) forwards; }
.hs-fade { opacity: 0; animation: hs-fade 1.2s ease forwards; }
/* The reference staggers these inline; as blocks they carry a modifier class
   so the editor cannot strip the timing. */
.hs-fade--1 { animation-delay: 0.9s; }
.hs-fade--2 { animation-delay: 1.1s; }

.hs-rule-line { transform-origin: left; animation: hs-line-grow 1.2s var(--hs-ease-draw) both; }

/* The 橋 draws its own strokes, then fills. */
.hs-kanji-draw {
	stroke-dasharray: 2400;
	stroke-dashoffset: 2400;
	fill-opacity: 0;
	animation: hs-ink 3.4s 0.4s cubic-bezier(0.6, 0, 0.2, 1) forwards;
}
.hs-stamp { opacity: 0; animation: hs-stamp 0.7s 3.2s var(--hs-ease) forwards; }

/* ---------------- ambient ---------------- */
.hs-spin { animation: hs-spin 30s linear infinite; transform-origin: 50% 50%; }
.hs-kb { animation: hs-kenburns 18s ease-in-out infinite alternate; }
.hs-unv { animation: hs-unveil 1.6s 0.2s var(--hs-ease-draw) both; }
.hs-colon { animation: hs-blink 1s steps(1) infinite; }
.hs-ping { animation: hs-ping 2.2s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.hs-track { display: flex; width: max-content; animation: hs-marquee 40s linear infinite; }

/* The three bridge arcs, and the lights that run along them. */
.hs-arc { stroke-dasharray: 1400; stroke-dashoffset: 1400; animation: hs-draw 2.4s cubic-bezier(0.6, 0, 0.2, 1) forwards; }
.hs-a2 { animation-delay: 0.5s; }
.hs-a3 { animation-delay: 1s; }
.hs-comet { stroke-dasharray: 60 1340; animation: hs-comet 3.6s linear infinite; }
.hs-cm2 { animation-delay: -1.2s; animation-duration: 4.2s; }
.hs-cm3 { animation-delay: -2.4s; animation-duration: 5s; }

/* ---------------- hover ---------------- */
.hs-office { transition: transform 0.6s var(--hs-ease); }
.hs-office:hover { transform: translateY(-10px); }
.hs-office__photo img { transition: transform 1.2s var(--hs-ease), filter 0.8s; }
.hs-office:hover .hs-office__photo img { transform: scale(1.07); }
.hs-office__bar { transform: scaleX(0.18); transform-origin: left; transition: transform 0.7s var(--hs-ease); }
.hs-office:hover .hs-office__bar { transform: scaleX(1); }

.hs-row { transition: padding 0.45s var(--hs-ease), color 0.3s; }
.hs-row:hover, .hs-row:focus-visible { padding-left: 20px; }
.hs-row__arrow { transition: transform 0.45s var(--hs-ease); }
.hs-row:hover .hs-row__arrow, .hs-row:focus-visible .hs-row__arrow { transform: translateX(8px) rotate(-45deg); }

/* The case-study preview wipes in behind the list. */
.hs-pv { position: absolute; inset: 0; clip-path: inset(0 0 100% 0); transition: clip-path 0.9s var(--hs-ease-draw); }
.hs-pv.is-on { clip-path: inset(0 0 0 0); z-index: 2; }
.hs-pv img { transform: scale(1.15); transition: transform 1.6s var(--hs-ease); }
.hs-pv.is-on img { transform: scale(1); }

.hs-btn { transition: transform 0.25s, background 0.25s, color 0.25s; }
.hs-btn:hover { transform: translateY(-2px); }

/*
 * The count-up. The reference rendered each figure as CSS generated content —
 * `counter()` over an @property integer — which means no real text for a
 * screen reader or a crawler, and a literal 0 wherever @property is not
 * supported. Here the number is real text in the markup and site.js animates
 * it in place, so the figure is always readable and the count cannot fail
 * closed. It matters more than usual here: all four come from the site's own
 * copy (twelve people, three offices, four disciplines, founded 2017).
 */

/* ---------------- scroll reveal ---------------- */
@supports (animation-timeline: view()) {
	.hs-reveal {
		animation: hs-rise linear both;
		animation-timeline: view();
		animation-range: entry 0% entry 45%;
	}
	.hs-wipe {
		animation: hs-unveil linear both;
		animation-timeline: view();
		animation-range: entry 0% cover 35%;
	}
}

/* IntersectionObserver fallback; site.js sets .hs-js and marks .is-seen. */
@supports not (animation-timeline: view()) {
	.hs-js .hs-reveal { opacity: 0; }
	.hs-js .hs-reveal.is-seen { animation: hs-rise 1s var(--hs-ease) both; }
	.hs-js .hs-wipe { clip-path: inset(0 0 100% 0); }
	.hs-js .hs-wipe.is-seen { animation: hs-unveil 1.3s var(--hs-ease-draw) both; }
}

/* ---------------- motion off ---------------- */
/*
 * `.hs-still` freezes everything at its end state. The capture scripts reach
 * it over the wire with `?still=1` — a full-page screenshot is taken from a
 * scroll position, and scroll-driven reveals are wherever that position left
 * them, which photographs as whole sections missing (platform gotcha 60).
 */
.hs-still *,
.hs-still *::before,
.hs-still *::after {
	animation-duration: 0s !important;
	animation-delay: 0s !important;
	animation-iteration-count: 1 !important;
	transition-duration: 0s !important;
}
.hs-still .hs-reveal,
.hs-still .hs-wipe { animation: none !important; opacity: 1 !important; clip-path: none !important; }
.hs-still .hs-kanji-draw { animation: none !important; stroke-dashoffset: 0 !important; fill-opacity: 1 !important; }
.hs-still .hs-arc { animation: none !important; stroke-dashoffset: 0 !important; }
.hs-still .hs-stamp { animation: none !important; opacity: 1 !important; }

/* A capture that resizes the viewport rather than scrolling. */
@media (min-height: 2000px) {
	.hs-reveal, .hs-wipe { animation: none !important; opacity: 1 !important; clip-path: none !important; }
	.hs-kanji-draw { animation: none !important; stroke-dashoffset: 0 !important; fill-opacity: 1 !important; }
	.hs-arc { animation: none !important; stroke-dashoffset: 0 !important; }
	.hs-stamp { animation: none !important; opacity: 1 !important; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation-duration: 0s !important;
		animation-delay: 0s !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0s !important;
	}
	.hs-reveal, .hs-wipe { animation: none !important; opacity: 1 !important; clip-path: none !important; }
	.hs-js .hs-reveal { opacity: 1; }
	.hs-js .hs-wipe { clip-path: none; }
	.hs-kanji-draw { stroke-dashoffset: 0 !important; fill-opacity: 1 !important; }
	.hs-arc { stroke-dashoffset: 0 !important; }
	.hs-stamp { opacity: 1 !important; }
	html { scroll-behavior: auto; }
}
