/* ============================================================
   Sebastian Östlund — portfolio
   Modern dark theme. Mobile-first, no frameworks.
   ============================================================ */

:root {
	--bg:        #0b0f17;
	--bg-alt:    #0f1521;
	--surface:   #141b2a;
	--surface-2: #1a2233;
	--border:    rgba(255, 255, 255, 0.08);
	--text:      #e8edf6;
	--muted:     #9aa7bd;
	--faint:     #6b778c;

	--accent:    #34c6e8;   /* cyan */
	--accent-2:  #8b7bf6;   /* violet */
	--accent-3:  #f27aa8;   /* pink */

	--radius:    16px;
	--radius-sm: 10px;
	--maxw:      1180px;
	--shadow:    0 18px 50px -20px rgba(0, 0, 0, 0.75);
	--font:      'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
	margin: 0;
	font-family: var(--font);
	background: var(--bg);
	color: var(--text);
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	overflow-x: hidden;
}

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	* { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

a { color: var(--accent); text-decoration: none; }
img { display: block; max-width: 100%; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 0.4em; font-weight: 250; letter-spacing: -0.02em; }

.grad {
	background: linear-gradient(120deg, var(--accent), var(--accent-2) 55%, var(--accent-3));
	-webkit-background-clip: text; background-clip: text;
	-webkit-text-fill-color: transparent; color: transparent;
}

/* ---------- Navigation ---------- */
.nav {
	position: sticky; top: 0; z-index: 100;
	transition: background 0.25s ease, box-shadow 0.25s ease, border-color 0.25s;
	border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
	background: rgba(11, 15, 23, 0.82);
	backdrop-filter: saturate(160%) blur(12px);
	-webkit-backdrop-filter: saturate(160%) blur(12px);
	border-bottom-color: var(--border);
}
.nav__inner {
	max-width: var(--maxw); margin: 0 auto; padding: 14px 22px;
	display: flex; align-items: center; justify-content: space-between; gap: 18px;
}
.nav__brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; }
.nav__brand-mark {
	display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
	background: linear-gradient(135deg, var(--accent), var(--accent-2));
	color: #06121a; font-size: 13px; font-weight: 800; letter-spacing: 0.02em;
}
.nav__brand-name { font-size: 15px; }
.nav__links { display: flex; align-items: center; gap: 6px; }
.nav__links a {
	color: var(--muted); font-size: 14px; font-weight: 500;
	padding: 8px 12px; border-radius: 8px; transition: color 0.2s, background 0.2s;
}
.nav__links a:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.nav__cta {
	color: #06121a !important; background: linear-gradient(135deg, var(--accent), var(--accent-2));
	font-weight: 600 !important; margin-left: 6px;
}
.nav__cta:hover { filter: brightness(1.08); background: linear-gradient(135deg, var(--accent), var(--accent-2)) !important; }

.nav__toggle { display: none; flex-direction: column; gap: 5px; background: none; border: 0; cursor: pointer; padding: 8px; }
.nav__toggle span { width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: transform 0.25s, opacity 0.25s; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; }
.hero__glow {
	position: absolute; inset: -20% -10% auto -10%; height: 620px; pointer-events: none;
	background:
		radial-gradient(40% 60% at 20% 20%, rgba(52, 198, 232, 0.20), transparent 70%),
		radial-gradient(40% 60% at 80% 10%, rgba(139, 123, 246, 0.20), transparent 70%);
	filter: blur(10px);
}
.hero__inner {
	position: relative; max-width: var(--maxw); margin: 0 auto;
	padding: clamp(48px, 9vw, 110px) 22px clamp(40px, 7vw, 90px);
	display: grid; grid-template-columns: 1.3fr 0.9fr; gap: clamp(28px, 5vw, 64px); align-items: center;
}
.hero__eyebrow {
	text-transform: uppercase; letter-spacing: 0.22em; font-size: 12px; font-weight: 600;
	color: var(--accent); margin: 0 0 14px;
}
.hero__title { font-size: clamp(34px, 6vw, 58px); margin-bottom: 22px; }
.hero__lead { font-size: clamp(16px, 1.6vw, 19px); color: #cdd6e6; max-width: 56ch; }
.hero__lead--muted { color: var(--muted); }
.hero__lead strong { color: var(--text); font-weight: 600; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.btn {
	display: inline-flex; align-items: center; gap: 8px;
	padding: 11px 20px; border-radius: 999px; font-weight: 600; font-size: 14px;
	border: 1px solid transparent; cursor: pointer; transition: transform 0.15s, filter 0.2s, background 0.2s, border-color 0.2s;
}
.btn:hover { transform: translateY(-2px); }
.btn--primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #06121a; }
.btn--primary:hover { filter: brightness(1.08); }
.btn--ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn--ghost:hover { border-color: var(--accent); }

.hero__portrait { justify-self: center; }
.hero__portrait img {
	width: clamp(220px, 30vw, 380px); aspect-ratio: 1; object-fit: cover;
	border-radius: 24px; border: 1px solid var(--border);
	box-shadow: var(--shadow);
}

/* ---------- Sections ---------- */
.section { max-width: var(--maxw); margin: 0 auto; padding: clamp(56px, 9vw, 100px) 22px; }
.section--alt { max-width: none; background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section--alt > * { max-width: var(--maxw); margin-left: auto; margin-right: auto; }
.section__head { margin-bottom: 36px; }
.section__title { font-size: clamp(26px, 4vw, 38px); }
.section__title::after {
	content: ""; display: block; width: 54px; height: 3px; margin-top: 14px; border-radius: 3px;
	background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.section__sub { color: var(--muted); max-width: 60ch; margin: 0; }

/* ---------- Profile narrative with tag rail ---------- */
.section--profile {
	padding-top: 0;
	padding-bottom: clamp(34px, 5vw, 56px);
}

.profile-block {
	display: grid;
	grid-template-columns: minmax(170px, 220px) 1fr;
	gap: 18px 24px;
	align-items: start;
	padding: 18px 0;
	border-top: 1px solid var(--border);
}

.profile-block:last-child {
	border-bottom: 1px solid var(--border);
}

.profile-block__tags {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-content: start;
	padding-top: 3px;
}

.profile-tag {
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.01em;
	padding: 4px 9px;
	border-radius: 999px;
	border: 1px solid var(--border);
	background: var(--surface-2);
	color: #b9c4d8;
	white-space: nowrap;
}

.profile-block__text {
	margin: 0;
	font-size: clamp(15px, 1.35vw, 17px);
	line-height: 1.72;
	color: #cfd8e7;
	max-width: 84ch;
}

@media (max-width: 780px) {
	.profile-block {
		grid-template-columns: 1fr;
		gap: 12px;
	}

	.profile-block__tags {
		padding-top: 0;
	}
}

/* ---------- Filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 30px; }
.filter {
	padding: 7px 15px; border-radius: 999px; font-size: 13px; font-weight: 500;
	background: var(--surface); color: var(--muted); border: 1px solid var(--border);
	cursor: pointer; transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.filter:hover { color: var(--text); border-color: var(--accent); }
.filter.is-active { color: #06121a; background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; }

/* ---------- Project grid + cards ---------- */
.grid {
	display: grid; gap: 26px;
	grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}
.card {
	display: flex; flex-direction: column;
	background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
	overflow: hidden; transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
}
.card:hover { transform: translateY(-4px); border-color: rgba(52, 198, 232, 0.4); box-shadow: var(--shadow); }
.card.is-hidden { display: none; }
.card--featured {
	grid-column: 1 / -1;
	background:
		linear-gradient(180deg, rgba(52, 198, 232, 0.06), transparent 40%), var(--surface);
	border-color: rgba(52, 198, 232, 0.35);
}
@media (min-width: 760px) {
	.card--featured { flex-direction: row; }
	.card--featured .media { flex: 1 1 55%; }
	.card--featured .card__body { flex: 1 1 45%; }
}

.card__body { padding: 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card__title { font-size: 20px; margin: 0; }
.card__role { font-size: 13px; color: var(--accent); font-weight: 600; margin: 0; }
.card__desc { color: var(--muted); font-size: 14.5px; margin: 0; flex: 1; }

/* Small footnote (e.g. NDA), used in cards and slides */
.note { font-size: 12px; font-style: italic; color: var(--faint); margin: 0; }

.card__tags { list-style: none; display: flex; flex-wrap: wrap; gap: 7px; padding: 0; margin: 4px 0 0; }
.tag {
	font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em;
	padding: 4px 10px; border-radius: 999px;
	background: var(--surface-2); color: #b9c4d8; border: 1px solid var(--border);
}
.tag--skill { font-size: 13px; padding: 7px 14px; }

.card__links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.store-badge img { height: 40px; width: auto; border-radius: 6px; transition: transform 0.15s; }
.store-badge:hover img { transform: scale(1.04); }

/* ---------- Media (shared) ---------- */
.media {
	position: relative; aspect-ratio: 16 / 9; background: #060a12; overflow: hidden;
	border-bottom: 1px solid var(--border);
}
.media img, .media iframe, .media canvas { width: 100%; height: 100%; border: 0; display: block; }
.media img { object-fit: cover; }

/* YouTube + WebGL facades share the play button */
.video-preview, .webgl-preview { cursor: pointer; }
.video-preview__thumb { transition: transform 0.4s ease, filter 0.3s; }
.video-preview:hover .video-preview__thumb { transform: scale(1.05); filter: brightness(0.7); }
.video-preview::after, .webgl-preview:not(.is-live)::after {
	content: ""; position: absolute; inset: 0; pointer-events: none;
	background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, 0.45));
}
.video-preview__play {
	position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
	z-index: 2; width: 62px; height: 62px; border-radius: 50%; border: 0; cursor: pointer;
	display: grid; place-items: center; color: #fff;
	background: rgba(20, 27, 42, 0.7); backdrop-filter: blur(4px);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5); transition: transform 0.2s, background 0.2s;
}
.video-preview__play svg { margin-left: 3px; }
.video-preview:hover .video-preview__play,
.webgl-preview:hover .video-preview__play {
	transform: translate(-50%, -50%) scale(1.12);
	background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #06121a;
}

/* WebGL preview */
.webgl-preview {
	background:
		radial-gradient(60% 80% at 30% 20%, rgba(52, 198, 232, 0.25), transparent 60%),
		radial-gradient(60% 80% at 75% 80%, rgba(139, 123, 246, 0.30), transparent 60%),
		#0a1020;
}
.webgl-preview__overlay { position: absolute; inset: 0; }
.webgl-preview__badge {
	position: absolute; top: 12px; left: 12px; z-index: 2;
	font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
	padding: 4px 10px; border-radius: 6px; color: #06121a;
	background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.webgl-preview__label {
	position: absolute; left: 0; right: 0; bottom: 14px; z-index: 2; margin: 0;
	text-align: center; font-size: 12.5px; color: #cdd6e6;
}
.webgl-preview.is-live { cursor: grab; }
.webgl-preview.is-live:active { cursor: grabbing; }
.cube-canvas { width: 100%; height: 100%; display: block; }
.cube-fallback { color: var(--muted); text-align: center; padding: 20px; }

.image-media { cursor: pointer; }
.image-media img {
	object-fit: cover;
	transition: transform 0.4s ease, filter 0.3s ease;
}
.image-media:hover img,
.image-media:focus img {
	transform: scale(1.05);
	filter: brightness(0.7);
}

/* Clicked image overlay */
body.has-lightbox-open { overflow: hidden; }

.image-lightbox {
	position: fixed;
	inset: 0;
	z-index: 220;
	display: grid;
	place-items: center;
	padding: 4vh 4vw;
	background: rgba(5, 9, 16, 0.84);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	cursor: zoom-out;
}

.image-lightbox[hidden] { display: none; }

.image-lightbox__img {
	max-width: min(92vw, 1400px);
	max-height: 90vh;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 14px;
	border: 1px solid var(--border);
	box-shadow: var(--shadow);
}

/* ---------- Highlights slideshow ---------- */
.slideshow {
	position: relative;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	overflow: hidden;
	box-shadow: var(--shadow);
	outline: none;
}
.slideshow__viewport { display: grid; }
.slide {
	grid-area: 1 / 1;                 /* stack every slide in one cell -> crossfade + auto height */
	display: grid;
	grid-template-columns: 1fr;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.5s ease;
}
.slide.is-active { opacity: 1; visibility: visible; pointer-events: auto; }

.slide__media { overflow: hidden; background: #060a12; height: 240px; }
.slide__media img { width: 100%; height: 100%; object-fit: cover; display: block; }

.slide__content {
	padding: clamp(24px, 4vw, 42px);
	display: flex; flex-direction: column; justify-content: center; gap: 14px;
}
.slide__title { font-size: clamp(22px, 3vw, 30px); margin: 0; }
.slide__text { color: var(--muted); font-size: 15.5px; margin: 0; max-width: 52ch; }
.slide__tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 6px 0 0; }

@media (min-width: 760px) {
	.slide { grid-template-columns: 1.05fr 1fr; min-height: 440px; }
	.slide__media { height: auto; }    /* fills the row, governed by min-height */
}

/* Arrows */
.slideshow__nav {
	position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
	width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
	display: grid; place-items: center; font-size: 26px; line-height: 1; padding-bottom: 3px;
	color: #fff; background: rgba(11, 15, 23, 0.6);
	backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
	transition: background 0.2s, transform 0.2s, color 0.2s;
}
.slideshow__nav:hover {
	background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #06121a;
	transform: translateY(-50%) scale(1.08);
}
.slideshow__nav--prev { left: 14px; }
.slideshow__nav--next { right: 14px; }

/* Dots */
.slideshow__dots {
	position: absolute; left: 0; right: 0; bottom: 14px; z-index: 3;
	display: flex; justify-content: center; gap: 8px;
}
.slideshow__dot {
	width: 9px; height: 9px; border-radius: 50%; border: 0; cursor: pointer; padding: 0;
	background: rgba(255, 255, 255, 0.4); transition: background 0.2s, transform 0.2s;
}
.slideshow__dot:hover { background: rgba(255, 255, 255, 0.7); }
.slideshow__dot.is-active {
	background: linear-gradient(135deg, var(--accent), var(--accent-2)); transform: scale(1.3);
}

/* ---------- Interests ---------- */
.interests { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.interest {
	background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
	padding: 26px 22px; transition: transform 0.25s, border-color 0.25s;
}
.interest:hover { transform: translateY(-4px); border-color: rgba(139, 123, 246, 0.4); }
.interest__icon {
	display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; margin-bottom: 16px;
	background: rgba(52, 198, 232, 0.12); color: var(--accent);
}
.interest h3 { font-size: 17px; }
.interest p { color: var(--muted); font-size: 14px; margin: 0; }

/* ---------- Skills ---------- */
.skills { display: grid; gap: 30px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.skills__col h3 { font-size: 18px; color: var(--text); margin-bottom: 16px; }
.skills__list { list-style: none; display: flex; flex-wrap: wrap; gap: 9px; padding: 0; margin: 0; }
.skills__list .tag { transition: transform 0.15s, border-color 0.2s, color 0.2s; }
.skills__list .tag:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--text); }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); background: var(--bg-alt); padding: 48px 22px 36px; }
.footer__inner {
	max-width: var(--maxw); margin: 0 auto; display: flex; flex-wrap: wrap; gap: 20px;
	justify-content: space-between; align-items: center;
}
.footer__name { font-weight: 700; font-size: 18px; margin: 0; }
.footer__muted { color: var(--muted); font-size: 14px; margin: 4px 0 0; }
.footer__links { display: flex; gap: 22px; }
.footer__links a { color: var(--muted); font-weight: 500; transition: color 0.2s; }
.footer__links a:hover { color: var(--accent); }
.footer__copy { max-width: var(--maxw); margin: 28px auto 0; color: var(--faint); font-size: 12.5px; text-align: center; }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
	.hero__inner { grid-template-columns: 1fr; text-align: center; }
	.hero__lead { margin-left: auto; margin-right: auto; }
	.hero__actions { justify-content: center; }
	.hero__portrait { order: -1; }

	.nav__toggle { display: flex; }
	.nav__links {
		position: absolute; top: 100%; right: 14px; left: 14px;
		flex-direction: column; align-items: stretch; gap: 4px; padding: 12px;
		background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
		box-shadow: var(--shadow);
		opacity: 0; transform: translateY(-8px) scale(0.98); pointer-events: none; transition: opacity 0.2s, transform 0.2s;
	}
	.nav__links.is-open { opacity: 1; transform: none; pointer-events: auto; }
	.nav__links a { padding: 11px 14px; }
	.nav__cta { margin-left: 0; text-align: center; }
}

@media (max-width: 480px) {
	.grid { grid-template-columns: 1fr; }
	.nav__brand-name { display: none; }
}
