/**
 * GVA — global stylesheet foundation: tokens, reset, base typography, the
 * shared layout primitive, buttons, and a11y/reduced-motion helpers.
 * Section-specific styling arrives with the template that needs it.
 *
 * Reconciles the prototype's two competing `:root` token sets and two
 * competing `.btn` definitions; mapping and deviations in docs/REFERENCE.md.
 *
 * Enqueued as `gva-main` from inc/enqueue.php. Never linked directly.
 */

/* ==========================================================================
   1. Fonts — self-hosted, no external font host
   Provenance, weights and licences: assets/fonts/README.md
   ========================================================================== */

/* Satoshi — interface and body. Latin + Latin Extended, no subset split. */
@font-face {
	font-family: "Satoshi";
	src: url("../fonts/satoshi/satoshi-400-normal.woff2") format("woff2");
	font-weight: 400;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: "Satoshi";
	src: url("../fonts/satoshi/satoshi-500-normal.woff2") format("woff2");
	font-weight: 500;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: "Satoshi";
	src: url("../fonts/satoshi/satoshi-700-normal.woff2") format("woff2");
	font-weight: 700;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: "Satoshi";
	src: url("../fonts/satoshi/satoshi-900-normal.woff2") format("woff2");
	font-weight: 900;
	font-style: normal;
	font-display: swap;
}

/* Space Mono — eyebrows, metadata, numerals. Subset split preserved from the
   source so a page downloads only the ranges it actually uses. */
@font-face {
	font-family: "Space Mono";
	src: url("../fonts/space-mono/space-mono-latin-400-normal.woff2") format("woff2");
	font-weight: 400;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
	font-family: "Space Mono";
	src: url("../fonts/space-mono/space-mono-latin-ext-400-normal.woff2") format("woff2");
	font-weight: 400;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
	font-family: "Space Mono";
	src: url("../fonts/space-mono/space-mono-vietnamese-400-normal.woff2") format("woff2");
	font-weight: 400;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
	font-family: "Space Mono";
	src: url("../fonts/space-mono/space-mono-latin-700-normal.woff2") format("woff2");
	font-weight: 700;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
	font-family: "Space Mono";
	src: url("../fonts/space-mono/space-mono-latin-ext-700-normal.woff2") format("woff2");
	font-weight: 700;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
	font-family: "Space Mono";
	src: url("../fonts/space-mono/space-mono-vietnamese-700-normal.woff2") format("woff2");
	font-weight: 700;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* ==========================================================================
   2. Design tokens
   ========================================================================== */

:root {
	/* Brand */
	--red: #EE2737;
	--red-dark: #B81E2A;

	/* Neutrals */
	--black: #121212;
	--black-warm: #140101;
	--bone: #FAF8F8;
	--white: #FFFFFF;
	--cool: #DAD9D6;
	--grey-sec: #EFEFEF;
	--line: #E6E6E6;

	/* Text */
	--text: var(--black);
	--text-muted: #8C8C8C;

	/* Type stacks. The prototype declares two Satoshi aliases and two Space
	   Mono stacks; the longer fallback chains are kept. */
	--font-sans: "Satoshi", "Avenir Next", "Helvetica Neue", Arial, system-ui, sans-serif;
	--font-mono: "Space Mono", "SFMono-Regular", Consolas, monospace;

	/* Layout */
	--container-max: 1320px;
	--container-pad: 32px;

	/* Motion — both curves are taken from the prototype. */
	--ease: cubic-bezier(0.2, 0.7, 0.2, 1);
	--ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ==========================================================================
   3. Reset
   Narrowed from the prototype's blanket `* { margin: 0; padding: 0 }` so it
   doesn't flatten editorial content from the block editor. Unclassed lists
   keep native indentation; the design's own lists set `list-style` locally.
   ========================================================================== */

*,
*::before,
*::after {
	box-sizing: border-box;
}

body,
h1,
h2,
h3,
h4,
h5,
h6,
p,
figure,
blockquote,
dl,
dd {
	margin: 0;
}

img,
svg,
video,
canvas,
picture {
	display: block;
	max-width: 100%;
}

img,
video {
	height: auto;
}

input,
button,
textarea,
select {
	font: inherit;
	color: inherit;
}

/* ==========================================================================
   4. Base document and typography
   ========================================================================== */

html {
	scroll-behavior: smooth;
	-webkit-text-size-adjust: 100%;
}

body {
	background: var(--bone);
	color: var(--text);
	font-family: var(--font-sans);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
h5,
h6 {
	font-weight: 700;
	letter-spacing: -0.025em;
	text-wrap: balance;
}

/* The monospace voice of the design: eyebrows, metadata, tags, numerals. */
.mono {
	font-family: var(--font-mono);
}

/* ==========================================================================
   5. Links
   ========================================================================== */

a {
	color: var(--red);
	text-decoration: none;
}

a:hover {
	color: var(--red-dark);
}

/* The prototype ships no visible focus style. Deliberate a11y addition,
   reusing the design's own `:focus-visible` idiom — see docs/REFERENCE.md. */
:focus-visible {
	outline: 1.5px solid var(--red);
	outline-offset: 3px;
}

/* ==========================================================================
   6. Layout primitive
   The prototype alternates `.inner`/`.container` for the same rule set;
   production uses `.container` only.
   ========================================================================== */

.container {
	width: 100%;
	max-width: var(--container-max);
	margin-inline: auto;
	padding-inline: var(--container-pad);
}

/* ==========================================================================
   7. Buttons
   The prototype defines `.btn` twice with conflicting geometry/weight; this
   is the resolved result (later block's box, earlier block's type).
   ========================================================================== */

.btn {
	--btn-bg: transparent;
	--btn-fg: var(--black);
	--btn-border: transparent;

	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	min-height: 48px;
	padding: 12px 20px;
	border: 1.5px solid var(--btn-border);
	border-radius: 999px;
	background: var(--btn-bg);
	color: var(--btn-fg);
	font-family: var(--font-sans);
	font-size: 15px;
	font-weight: 700;
	letter-spacing: -0.01em;
	text-decoration: none;
	cursor: pointer;
	transition:
		transform 0.2s var(--ease),
		background 0.2s var(--ease),
		border-color 0.2s var(--ease),
		color 0.2s var(--ease);
}

.btn:hover {
	color: var(--btn-fg);
}

.btn:active {
	transform: scale(0.98);
}

.btn--lg {
	min-height: 54px;
	padding: 16px 30px;
	font-size: 16px;
}

.btn--primary {
	--btn-bg: var(--red);
	--btn-fg: var(--white);
	--btn-border: var(--red);
}

.btn--primary:hover {
	--btn-bg: var(--red-dark);
	--btn-border: var(--red-dark);
}

/* On light backgrounds. */
.btn--outline {
	--btn-border: rgba(18, 18, 18, 0.22);
}

.btn--outline:hover {
	--btn-border: var(--black);
}

.btn--dark {
	--btn-bg: var(--black);
	--btn-fg: var(--white);
	--btn-border: var(--black);
}

.btn--dark:hover {
	--btn-bg: #000;
}

.btn--quiet {
	--btn-border: var(--line);
}

.btn--quiet:hover {
	--btn-border: var(--black);
}

/* On dark backgrounds. */
.btn--ghost {
	--btn-fg: var(--white);
	--btn-border: rgba(255, 255, 255, 0.4);
}

.btn--ghost:hover {
	--btn-border: var(--white);
}

/* The trailing arrow that nudges on hover — used by every call to action. */
.btn .arrow {
	display: inline-block;
	font-family: var(--font-mono);
	transition: transform 0.2s var(--ease);
}

.btn:hover .arrow {
	transform: translateX(3px);
}

/* ==========================================================================
   8. Shared section heading and reveal system
   Used by both the front page and the Case Study template. Eyebrow spacing
   follows the prototype's effective cascade, not its first declaration —
   see docs/REFERENCE.md §3.
   ========================================================================== */

.eyebrow { display: inline-flex; align-items: center; gap: 12px; margin: 0 0 22px; color: var(--red); font-family: var(--font-mono); font-size: 13px; line-height: 1.4; letter-spacing: 0.12em; text-transform: uppercase; }
.eyebrow::before { width: 38px; height: 1.5px; background: currentColor; content: ""; }
.section-head { max-width: 820px; margin-bottom: 60px; }
.section-title { margin-top: 20px; font-size: clamp(34px, 4.2vw, 48px); line-height: 1.12; letter-spacing: -0.025em; }
.section-title em { color: var(--red); font-style: normal; }
.section-lede { max-width: 56ch; margin-top: 18px; color: #4a4a4a; font-size: 20px; line-height: 1.55; }

/* The one shared reveal system (docs/REFERENCE.md §3): without JavaScript the
 * base rule leaves every `.reveal` visible; `assets/js/reveal.js` adds
 * `has-gva-reveal` only once every element is under a live observer. */
.reveal { opacity: 1; transform: none; }
html.has-gva-reveal .reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out); }
html.has-gva-reveal .reveal.is-revealed { opacity: 1; transform: none; }

/* ==========================================================================
   9. Shared Case Study card
   One component (template-parts/case-study/card.php) serving both the Home
   Track Record grid and Related Cases — see docs/CASE-STUDIES.md §14/§20.
   Scope strip covers five ISA-95 levels (L0-L4).
   ========================================================================== */

.cases {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 24px;
}

.case {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--line);
	border-radius: 10px;
	background: var(--white);
}

.case__cover {
	position: relative;
	aspect-ratio: 5 / 3;
	overflow: hidden;
	border-bottom: 1px solid var(--line);
	background: var(--black);
}

.case__cover-link {
	position: absolute;
	inset: 0;
	z-index: 1;
	display: block;
}

.case__image {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	filter: grayscale(1) contrast(1.06) brightness(0.92);
}

/* Duotone: the red-to-black wash multiplied over the desaturated photograph. */
.case__cover::after {
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(238, 39, 55, 0.16), rgba(18, 18, 18, 0.34) 62%, rgba(18, 18, 18, 0.78));
	mix-blend-mode: multiply;
	pointer-events: none;
	content: "";
}

.case__tag {
	position: absolute;
	z-index: 2;
	bottom: 12px;
	left: 12px;
	padding: 5px 9px;
	border: 1px solid rgba(255, 255, 255, 0.22);
	background: rgba(18, 18, 18, 0.62);
	backdrop-filter: blur(4px);
	color: var(--white);
	font-family: var(--font-mono);
	font-size: 10px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.case__tag b { color: var(--red); }

.case__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 18px;
	padding: 24px;
}

.case__title {
	font-size: 19px;
	line-height: 1.25;
	letter-spacing: -0.015em;
	text-wrap: pretty;
}

.case__title a {
	color: inherit;
	text-decoration: none;
}

.case__title a:hover,
.case__title a:focus-visible {
	color: var(--red);
	text-decoration: underline;
}

/* Challenge / Approach — the client's own condensed card copy. */
.case__dl {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.case__dl div {
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.case__dl dt {
	color: var(--text-muted);
	font-family: var(--font-mono);
	font-size: 10px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.case__dl dd {
	color: #4a4a4a;
	font-size: 14px;
	line-height: 1.45;
}

/* The ISA-95 scope strip: which levels the project touched, drawn the same
 * way on every card so the three are comparable at a glance. Five cells
 * (L0-L4) so a range like Case 03's L0-L2 renders cleanly. */
.case__scope {
	display: flex;
	flex-direction: column;
	gap: 11px;
	padding-top: 4px;
	border-top: 1px solid var(--line);
}

.case__scope-lbl {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
	margin: 0;
	color: var(--text-muted);
	font-family: var(--font-mono);
	font-size: 10px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.case__levels {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 4px;
}

.case__levels span {
	padding: 5px 0;
	border: 1px solid var(--line);
	background: var(--bone);
	color: var(--text-muted);
	font-family: var(--font-mono);
	font-size: 10px;
	letter-spacing: 0.02em;
	text-align: center;
}

.case__levels span.is-on {
	border-color: var(--black);
	background: var(--black);
	color: var(--white);
}

.case__levels span.is-main {
	border-color: var(--red);
	background: var(--red);
	color: var(--white);
}

/* The compact facts line — card.tags[], one semantic line separated by "·". */
.case__facts {
	display: flex;
	flex-wrap: wrap;
	column-gap: 8px;
	row-gap: 2px;
	margin: 0;
	padding: 0;
	list-style: none;
	color: var(--black);
	font-family: var(--font-mono);
	font-size: 10px;
	letter-spacing: 0.04em;
}

.case__facts li:not(:first-child)::before {
	margin-right: 8px;
	color: var(--text-muted);
	content: "·";
}

.case__result {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	column-gap: 12px;
	row-gap: 4px;
	margin-top: auto;
	padding-top: 18px;
	border-top: 1px solid var(--line);
}

.case__result-value {
	color: var(--red);
	font-size: 44px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	line-height: 1;
	letter-spacing: -0.03em;
}

.case__result-label {
	color: var(--text-muted);
	font-family: var(--font-mono);
	font-size: 11px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

@media (max-width: 960px) {
	.cases { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 620px) {
	.cases { grid-template-columns: 1fr; }
	.case__levels { grid-template-columns: repeat(5, 1fr); }
}

@media (max-width: 360px) {
	.case__levels span { font-size: 9px; padding: 4px 0; }
}

/* ==========================================================================
   10. Accessibility helpers
   ========================================================================== */

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* Pinned above the fixed header (z-index 50) so a keyboard user actually sees
   it — `position: static` dropped it into the flow behind the header. */
.skip-link:focus {
	position: fixed !important;
	top: 8px;
	left: 8px;
	z-index: 100;
	width: auto;
	height: auto;
	margin: 0;
	padding: 10px 16px;
	overflow: visible;
	clip-path: none;
	border-radius: 6px;
	background: var(--black);
	color: var(--white);
	font-weight: 700;
}

/* ==========================================================================
   11. Reduced motion
   Global floor. Section modules stay free to add their own rules on top.
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}

	/* Restates the reveal's resolved state explicitly (already covered by the
	 * transition-duration floor above). */
	.reveal,
	html.has-gva-reveal .reveal {
		opacity: 1;
		transform: none;
	}
}
