/* ---- Tokens ---- */

:root {
	color-scheme: light dark;
	--bg: #fafafa;
	--card: #ffffff;
	--text: #1d1d1f;
	--muted: #6e6e73;
	--accent: #1a5fd0;
	--shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08);
	--shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.08), 0 12px 28px rgba(0, 0, 0, 0.14);
	--radius: 18px;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #111113;
		--card: #1c1c1f;
		--text: #f2f2f4;
		--muted: #a1a1a8;
		--accent: #6ea2ff;
		--shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
		--shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.6);
	}
}

/* ---- Base ---- */

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

body {
	max-width: 1100px;
	margin: 0 auto;
	padding: 0 16px;
	background-color: var(--bg);
	color: var(--text);
	font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

img { max-width: 100%; height: auto; }

h1, h2, p { margin: 0; }

a { color: var(--accent); }

/* ---- Header ---- */

.site-header {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 24px;
	padding: 48px 0 40px;
}

.title {
	font-size: clamp(2rem, 6vw, 3.25rem);
	font-weight: 200;
	letter-spacing: -0.01em;
}

.logo {
	width: clamp(64px, 12vw, 96px);
	height: auto;
	animation: logoforog 1.2s ease-out;
}

/* A differently named copy, so hovering restarts the spin */
.logo:hover { animation: logoforog-hover 1.2s ease-out; }

@keyframes logoforog {
	from { transform: rotate(0deg); }
	to   { transform: rotate(360deg); }
}

@keyframes logoforog-hover {
	from { transform: rotate(0deg); }
	to   { transform: rotate(360deg); }
}

@media (prefers-color-scheme: dark) {
	/* The logo is black on transparent: flip it to light, keep the blue segment blue */
	.logo { filter: invert(1) hue-rotate(180deg); }
}

.lang-switch {
	position: absolute;
	top: 16px;
	right: 0;
	padding: 4px 10px;
	border: 1px solid currentColor;
	border-radius: 999px;
	font-size: 0.85rem;
	font-weight: 500;
	letter-spacing: 0.05em;
	text-decoration: none;
}

@media (max-width: 600px) {
	.site-header { padding-top: 64px; }
}

.lang-switch:hover { background: var(--accent); border-color: var(--accent); color: var(--bg); }

/* ---- App grid ---- */

.apps {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 24px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.app-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	height: 100%;
	padding: 32px 24px 28px;
	background: var(--card);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	color: inherit;
	text-decoration: none;
	text-align: center;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Cards with a picture gallery: the app name is a button stretched over the card */
.app-card { position: relative; }

.app-open {
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	cursor: pointer;
}

.app-open::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: var(--radius);
}

.app-open:focus-visible { outline: none; }

.app-card:has(.app-open:focus-visible) {
	outline: 2px solid var(--accent);
	outline-offset: 4px;
}

a.app-card:hover,
.app-card:has(.app-open):hover {
	transform: translateY(-4px);
	box-shadow: var(--shadow-hover);
}

a.app-card:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 4px;
}

.app-icon {
	width: 140px;
	height: 140px;
	margin-bottom: 20px;
	padding: 12px;
	object-fit: contain;
	background: #fff;
	border-radius: 22%;
}

.app-text h2 {
	font-size: 1.3rem;
	font-weight: 500;
}

.app-award {
	margin-top: 6px;
	font-size: 0.9rem;
}

.app-client {
	margin-top: 6px;
	color: var(--muted);
	font-size: 0.9rem;
}

/* ---- Footer ---- */

.site-footer {
	padding: 56px 0 40px;
	text-align: center;
	color: var(--muted);
	font-size: 0.95rem;
}

.contact {
	font-size: 1.05rem;
	text-decoration: none;
}

.contact:hover { text-decoration: underline; }

.copyright { margin-top: 8px; }

/* ---- Picture gallery (JS/gallery.js) ---- */

html:has(.gallery[open]) { overflow: hidden; }

.gallery {
	width: 100%;
	height: 100%;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 16px;
	border: 0;
	background: rgba(12, 12, 14, 0.97);
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
	color: #f2f2f4;
}

.gallery[open] {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.gallery::backdrop { background: transparent; }

.gallery button {
	color: inherit;
	font: inherit;
	background: rgba(60, 60, 66, 0.75);
	border: 0;
	border-radius: 999px;
	cursor: pointer;
}

.gallery button:hover { background: rgba(110, 110, 118, 0.85); }

.gallery button:focus-visible { outline: 2px solid #6ea2ff; outline-offset: 2px; }

.gallery-bar {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	max-width: 1100px;
	margin: 0 auto;
}

.gallery-title {
	font-size: 1.2rem;
	font-weight: 500;
}

.gallery-count {
	color: #a1a1a8;
	font-size: 0.95rem;
}

.gallery-close {
	width: 40px;
	height: 40px;
	margin-left: auto;
	font-size: 1.05rem;
}

.gallery-stage {
	position: relative;
	flex: 1;
	min-height: 0;
	width: 100%;
	max-width: 1100px;
	margin: 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
}

.gallery-img {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	border-radius: 14px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
	user-select: none;
	touch-action: pan-y pinch-zoom;
}

.gallery-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 48px;
	height: 48px;
	font-size: 2rem;
	line-height: 1;
}

.gallery-prev { left: 0; }
.gallery-next { right: 0; }

.gallery-dots {
	display: flex;
	justify-content: center;
	gap: 10px;
}

.gallery .gallery-dots button {
	width: 10px;
	height: 10px;
	padding: 0;
	background: rgba(255, 255, 255, 0.3);
}

.gallery .gallery-dots button[aria-current="true"] { background: #fff; }

/* ---- Motion ---- */

@media (prefers-reduced-motion: reduce) {
	.app-card { transition: none; }
	a.app-card:hover,
	.app-card:has(.app-open):hover { transform: none; }
}
