/*
 * Header condiviso Grappling Italia (design system Gitalia).
 * Tutto è sotto .gih con token propri: non tocca e non dipende dal CSS del sito che lo ospita.
 * Il tema scuro scatta solo se il sito lo supporta (html[data-gih-dark], vedi README.md).
 */

@font-face { font-family: 'GIH Fraunces'; font-style: normal; font-weight: 300 700; font-display: swap; src: url('fonts/fraunces-latin-full-normal.woff2') format('woff2'); }
@font-face { font-family: 'GIH Geist'; font-style: normal; font-weight: 300 700; font-display: swap; src: url('fonts/geist-latin-wght-normal.woff2') format('woff2'); }

.gih {
	--gih-bg: oklch(98.5% 0.005 280);
	--gih-ink: oklch(18% 0.02 280); --gih-ink-2: oklch(38% 0.02 280);
	--gih-line: oklch(22% 0.02 280 / 0.08); --gih-chip: oklch(22% 0.02 280 / 0.05);
	--gih-accent: oklch(58% 0.2 25);
	--gih-glass-bg: oklch(100% 0 0 / 0.55); --gih-glass-border: oklch(100% 0 0 / 0.7);
	--gih-display: 'GIH Fraunces', 'Fraunces', 'Times New Roman', serif;
	--gih-sans: 'GIH Geist', 'Geist', 'Helvetica Neue', Arial, sans-serif;
	position: sticky; top: 0; z-index: 9990;
	display: block; margin: 0; padding: 0;
	font: 400 15px/1.5 var(--gih-sans); letter-spacing: -0.005em; color: var(--gih-ink);
	-webkit-font-smoothing: antialiased;
}
html[data-theme="dark"][data-gih-dark] .gih {
	--gih-bg: oklch(16% 0.015 280);
	--gih-ink: oklch(96% 0.01 280); --gih-ink-2: oklch(78% 0.015 280);
	--gih-line: oklch(100% 0 0 / 0.08); --gih-chip: oklch(100% 0 0 / 0.06);
	--gih-accent: oklch(70% 0.18 25);
	--gih-glass-bg: oklch(22% 0.02 280 / 0.55); --gih-glass-border: oklch(100% 0 0 / 0.08);
}
@media (prefers-color-scheme: dark) {
	html[data-gih-dark]:not([data-theme="light"]) .gih {
		--gih-bg: oklch(16% 0.015 280);
		--gih-ink: oklch(96% 0.01 280); --gih-ink-2: oklch(78% 0.015 280);
		--gih-line: oklch(100% 0 0 / 0.08); --gih-chip: oklch(100% 0 0 / 0.06);
		--gih-accent: oklch(70% 0.18 25);
		--gih-glass-bg: oklch(22% 0.02 280 / 0.55); --gih-glass-border: oklch(100% 0 0 / 0.08);
	}
}
body.admin-bar .gih { top: 32px; }
@media (max-width: 782px) { body.admin-bar .gih { top: 46px; } }
@media (max-width: 600px) { body.admin-bar .gih { top: 0; } }

.gih *, .gih *::before, .gih *::after { box-sizing: border-box; }
.gih a { color: inherit; text-decoration: none; }
.gih svg { display: block; flex-shrink: 0; }
.gih :focus-visible { outline: 2px solid var(--gih-accent); outline-offset: 2px; }

.gih-wrap { max-width: 1360px; margin: 0 auto; padding: 12px max(clamp(16px, 3vw, 40px), env(safe-area-inset-right, 0px)) 0 max(clamp(16px, 3vw, 40px), env(safe-area-inset-left, 0px)); }
.gih-nav { display: flex; align-items: center; gap: 18px; margin: 0; padding: 8px 8px 8px 18px; background: var(--gih-glass-bg); -webkit-backdrop-filter: blur(18px) saturate(1.2); backdrop-filter: blur(18px) saturate(1.2); border: 1px solid var(--gih-glass-border); border-radius: 999px; }

.gih-logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; padding-right: 14px; border-right: 1px solid var(--gih-line); font: 500 22px/1 var(--gih-display); letter-spacing: -.03em; }
.gih-logo-mark { width: 28px; height: 28px; border-radius: 10px; background: var(--gih-ink); color: var(--gih-bg); display: grid; place-items: center; font-size: 17px; font-weight: 400; }

.gih-links { flex: 1; min-width: 0; display: flex; gap: 2px; margin: 0; padding: 0; list-style: none; overflow-x: auto; scrollbar-width: none; }
.gih-links::-webkit-scrollbar { display: none; }
.gih-links li { margin: 0; padding: 0; list-style: none; }
.gih-links li::before, .gih-links li::marker { content: none; }
.gih-links a { display: block; padding: 8px 14px; border-radius: 999px; color: var(--gih-ink-2); font-size: 14px; font-weight: 500; line-height: 1.5; white-space: nowrap; transition: background .15s, color .15s; }
.gih-links a:hover, .gih-links a[aria-current] { background: var(--gih-chip); color: var(--gih-ink); }

.gih-right { display: flex; gap: 2px; flex-shrink: 0; }
.gih-btn { width: 38px; height: 38px; flex-shrink: 0; margin: 0; padding: 0; border: 0; border-radius: 999px; background: none; display: grid; place-items: center; color: var(--gih-ink-2); cursor: pointer; transition: background .15s, color .15s; }
.gih-btn[hidden] { display: none; }
.gih-btn:hover { background: var(--gih-chip); color: var(--gih-ink); }
.gih .gih-sun { display: none; }
html[data-theme="dark"][data-gih-dark] .gih .gih-sun { display: block; }
html[data-theme="dark"][data-gih-dark] .gih .gih-moon { display: none; }
@media (prefers-color-scheme: dark) {
	html[data-gih-dark]:not([data-theme="light"]) .gih-sun { display: block; }
	html[data-gih-dark]:not([data-theme="light"]) .gih-moon { display: none; }
}

@media (max-width: 640px) {
	.gih-nav { gap: 8px; padding-left: 12px; }
	.gih-logo { padding-right: 10px; }
	.gih-logo-text { display: none; }
}
@media (prefers-reduced-motion: reduce) { .gih * { transition: none; } }
