/* ---------- Design tokens ---------- */
:root {
	--color-primary: #aa0839;
	--color-primary-dark: #82062b;
	--color-primary-bright: #ff4d6d;
	--color-page-bg: #1e222f;
	--color-surface: #ffffff;
	--color-surface-alt: #f4f4f7;
	--color-text: #1e222f;
	--color-text-muted: #6b6f7d;
	--color-text-inverse: #f5f5f7;
	--color-text-inverse-muted: #b7bac4;
	--color-border: #e4e4ea;
	--color-accent: var(--color-primary);
	--font-sans:
		'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
	--radius: 14px;
	--wrap-width: 1100px;
	--wrap-width-narrow: 760px;
	--shadow-card: 0 1px 2px rgba(20, 20, 30, 0.06), 0 8px 24px rgba(20, 20, 30, 0.06);
	--shadow-card-hover: 0 2px 4px rgba(20, 20, 30, 0.08), 0 16px 32px rgba(20, 20, 30, 0.1);
}

/* ---------- Dark theme ---------- */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme='light']) {
		--color-page-bg: #0d0f16;
		--color-surface: #1c2030;
		--color-surface-alt: #262b3d;
		--color-text: #f2f2f5;
		--color-text-muted: #a7abb8;
		--color-border: #363c50;
		--color-accent: var(--color-primary-bright);
		--shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
		--shadow-card-hover: 0 2px 4px rgba(0, 0, 0, 0.5), 0 16px 32px rgba(0, 0, 0, 0.45);
	}
}

:root[data-theme='dark'] {
	--color-page-bg: #0d0f16;
	--color-surface: #1c2030;
	--color-surface-alt: #262b3d;
	--color-text: #f2f2f5;
	--color-text-muted: #a7abb8;
	--color-border: #363c50;
	--color-accent: var(--color-primary-bright);
	--shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
	--shadow-card-hover: 0 2px 4px rgba(0, 0, 0, 0.5), 0 16px 32px rgba(0, 0, 0, 0.45);
}

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

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

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

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

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

ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

h1,
h2,
h3,
h4 {
	line-height: 1.2;
	margin: 0 0 0.5em;
	font-weight: 700;
}

h1 {
	font-size: clamp(2rem, 4vw, 2.75rem);
}

h2 {
	font-size: clamp(1.5rem, 3vw, 2rem);
}

h3 {
	font-size: 1.25rem;
}

p {
	margin: 0 0 1em;
}

.wrap {
	width: 100%;
	max-width: var(--wrap-width);
	margin: 0 auto;
	padding: 0 1.5rem;
}

.wrap-narrow {
	max-width: var(--wrap-width-narrow);
}

.eyebrow {
	text-transform: uppercase;
	letter-spacing: 0.08em;
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--color-accent);
	margin: 0 0 0.5em;
}

.text-link {
	color: var(--color-accent);
	font-weight: 600;
}

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

.note {
	background: var(--color-surface-alt);
	border-left: 3px solid var(--color-accent);
	padding: 0.75rem 1rem;
	border-radius: 6px;
	color: var(--color-text-muted);
	font-size: 0.95rem;
}

/* ---------- Buttons ---------- */
.btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.7rem 1.4rem;
	border-radius: 999px;
	font-weight: 600;
	font-size: 0.95rem;
	transition:
		transform 150ms ease,
		background-color 150ms ease,
		border-color 150ms ease;
	border: 1px solid transparent;
}

.btn:hover {
	transform: translateY(-1px);
}

.btn-primary {
	background: var(--color-primary);
	color: #fff;
}

.btn-primary:hover {
	background: var(--color-primary-dark);
}

.btn-outline {
	border-color: currentColor;
}

.btn-small {
	padding: 0.45rem 1rem;
	font-size: 0.85rem;
}

.hero-cta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-top: 1.5rem;
}

/* ---------- Header / nav ---------- */
.site-header {
	background: var(--color-page-bg);
	color: var(--color-text-inverse);
	position: sticky;
	top: 0;
	z-index: 20;
}

.nav-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1rem 1.5rem;
	gap: 1rem;
}

.brand {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	font-weight: 700;
	color: var(--color-text-inverse);
	white-space: nowrap;
}

.brand-logo {
	border-radius: 50%;
}

.site-nav {
	display: flex;
	align-items: center;
	gap: 1.5rem;
}

.site-nav > a:not(.btn) {
	color: var(--color-text-inverse-muted);
	font-weight: 500;
}

.site-nav > a:not(.btn):hover,
.site-nav > a.active {
	color: var(--color-text-inverse);
}

.lang-switch {
	border: 1px solid var(--color-text-inverse-muted);
	border-radius: 999px;
	padding: 0.25rem 0.65rem;
	font-size: 0.8rem;
	font-weight: 700;
}

.lang-switch:hover {
	border-color: var(--color-text-inverse);
	color: var(--color-text-inverse);
}

.theme-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	background: none;
	border: 1px solid var(--color-text-inverse-muted);
	border-radius: 999px;
	color: var(--color-text-inverse);
	cursor: pointer;
}

.theme-toggle:hover {
	border-color: var(--color-text-inverse);
}

.theme-toggle .icon-sun {
	display: none;
}

:root[data-theme='dark'] .theme-toggle .icon-sun {
	display: block;
}

:root[data-theme='dark'] .theme-toggle .icon-moon {
	display: none;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme='light']) .theme-toggle .icon-sun {
		display: block;
	}

	:root:not([data-theme='light']) .theme-toggle .icon-moon {
		display: none;
	}
}

.mobile-nav .theme-toggle {
	align-self: flex-start;
}

.nav-toggle {
	display: none;
	flex-direction: column;
	gap: 4px;
	background: none;
	border: none;
	padding: 0.5rem;
	cursor: pointer;
}

.nav-toggle span {
	width: 22px;
	height: 2px;
	background: var(--color-text-inverse);
	display: block;
}

.mobile-nav {
	display: none;
	flex-direction: column;
	padding: 0 1.5rem 1.5rem;
	gap: 1rem;
}

.mobile-nav a {
	color: var(--color-text-inverse-muted);
	font-weight: 500;
}

body.nav-open .mobile-nav {
	display: flex;
}

@media (max-width: 780px) {
	.site-nav {
		display: none;
	}

	.nav-toggle {
		display: flex;
	}
}

/* ---------- Sections / layout ---------- */
.section {
	padding: 3.5rem 0;
	background: var(--color-surface);
}

.section:first-of-type {
	border-top-left-radius: 24px;
	border-top-right-radius: 24px;
}

main {
	background: var(--color-surface);
	border-top-left-radius: 24px;
	border-top-right-radius: 24px;
	overflow: hidden;
}

.section-heading {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 1rem;
	margin-bottom: 2rem;
}

.page-header {
	padding-bottom: 1.5rem;
}

/* ---------- Hero ---------- */
.hero {
	position: relative;
	overflow: hidden;
	isolation: isolate;
	background:
		radial-gradient(ellipse 640px 420px at 12% -15%, rgba(255, 77, 109, 0.28), transparent 60%),
		radial-gradient(ellipse 520px 520px at 92% 0%, rgba(170, 8, 57, 0.4), transparent 60%),
		var(--color-page-bg);
	color: var(--color-text-inverse);
	padding: 4rem 0 5rem;
	text-align: center;
}

.hero::before {
	content: '';
	position: absolute;
	inset: -10% -10% 40% -10%;
	background-image:
		linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
		linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
	background-size: 44px 44px;
	mask-image: radial-gradient(ellipse 70% 90% at 50% 0%, black 35%, transparent 100%);
	-webkit-mask-image: radial-gradient(ellipse 70% 90% at 50% 0%, black 35%, transparent 100%);
	z-index: -1;
}

.hero::after {
	content: '';
	position: absolute;
	top: -160px;
	right: -80px;
	width: 420px;
	height: 420px;
	border-radius: 50%;
	background: radial-gradient(circle, rgba(255, 77, 109, 0.35), transparent 72%);
	filter: blur(4px);
	z-index: -1;
	animation: hero-float 11s ease-in-out infinite;
}

.hero .wrap {
	position: relative;
}

.hero .wrap::before {
	content: '';
	position: absolute;
	bottom: -140px;
	left: -60px;
	width: 320px;
	height: 320px;
	border-radius: 50%;
	background: radial-gradient(circle, rgba(130, 6, 43, 0.5), transparent 72%);
	filter: blur(4px);
	z-index: -1;
	pointer-events: none;
	animation: hero-float 13s ease-in-out infinite reverse;
}

@keyframes hero-float {
	0%,
	100% {
		transform: translate(0, 0);
	}
	50% {
		transform: translate(-24px, 24px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.hero::after,
	.hero .wrap::before {
		animation: none;
	}
}

.hero h1 {
	color: var(--color-text-inverse);
}

.hero .eyebrow {
	color: var(--color-primary-bright);
}

.hero-rotating {
	display: inline-block;
	color: var(--color-primary-bright);
	font-weight: 700;
	font-size: clamp(1.1rem, 2.5vw, 1.4rem);
	min-height: 1.6em;
	padding: 0.2em 0.9em;
	border-radius: 999px;
	background: rgba(255, 77, 109, 0.12);
	border: 1px solid rgba(255, 77, 109, 0.3);
}

.hero-subtitle {
	color: var(--color-text-inverse-muted);
	max-width: 640px;
	margin: 0 auto;
	font-size: 1.05rem;
}

.section .hero-subtitle,
.post-header .hero-subtitle,
.page-header .hero-subtitle {
	color: var(--color-text-muted);
	margin: 0;
}

.hero-cta {
	justify-content: center;
}

/* ---------- Cards ---------- */
.card-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 1.75rem;
}

.card-grid-1 {
	grid-template-columns: minmax(260px, 480px);
}

.card {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
	overflow: hidden;
	box-shadow: var(--shadow-card);
	transition:
		transform 150ms ease,
		box-shadow 150ms ease;
	display: flex;
	flex-direction: column;
}

.card:hover {
	transform: translateY(-3px);
	box-shadow: var(--shadow-card-hover);
}

.card-media {
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: var(--color-surface-alt);
}

.card-media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.card-body {
	padding: 1.25rem 1.4rem 1.5rem;
	flex: 1;
	display: flex;
	flex-direction: column;
}

.card-body time {
	font-size: 0.8rem;
	color: var(--color-text-muted);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.card-body h3 {
	margin-top: 0.35em;
}

.card-subtitle {
	color: var(--color-text-muted);
	margin: 0;
	font-size: 0.95rem;
}

/* ---------- About ---------- */
.about {
	background: var(--color-surface-alt);
	padding: 3.5rem 0;
}

.about-grid {
	display: grid;
	grid-template-columns: 220px 1fr;
	gap: 2.5rem;
	align-items: start;
}

.about-photo {
	width: 100%;
	border-radius: var(--radius);
	object-fit: cover;
	aspect-ratio: 1 / 1;
}

.stack-list {
	display: grid;
	gap: 0.4rem;
	margin: 1rem 0 1.5rem;
}

.stack-list li {
	padding-left: 1.25rem;
	position: relative;
}

.stack-list li::before {
	content: '';
	position: absolute;
	left: 0;
	top: 0.55em;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--color-accent);
}

@media (max-width: 720px) {
	.about-grid {
		grid-template-columns: 1fr;
	}

	.about-photo {
		width: 140px;
	}
}

/* ---------- Post / article ---------- */
.back-link {
	display: inline-block;
	margin-bottom: 1.5rem;
}

.post-header {
	margin-bottom: 1.5rem;
}

.post-header time {
	display: inline-block;
	margin-top: 0.75rem;
	color: var(--color-text-muted);
	font-size: 0.9rem;
}

.post-hero-image {
	width: 100%;
	aspect-ratio: 16 / 8;
	object-fit: cover;
	border-radius: var(--radius);
	margin: 1.5rem 0;
}

.post-content {
	font-size: 1.05rem;
}

.post-content h2 {
	margin-top: 1.75em;
}

.post-content img {
	width: 100%;
	border-radius: 10px;
	margin: 1rem 0;
	object-fit: cover;
}

.post-content figcaption {
	text-align: center;
	color: var(--color-text-muted);
	font-size: 0.9rem;
	margin-top: -0.5rem;
	margin-bottom: 1.5rem;
}

.post-content a {
	color: var(--color-accent);
	text-decoration: underline;
}

.post-content table {
	width: 100%;
	border-collapse: collapse;
	margin: 1.5rem 0;
	font-size: 0.95rem;
}

.post-content th,
.post-content td {
	border: 1px solid var(--color-border);
	padding: 0.5rem 0.75rem;
	text-align: left;
}

/* ---------- Legal pages ---------- */
.legal h2 {
	margin-top: 1.75em;
}

.legal h3,
.legal h4 {
	margin-top: 1.25em;
}

/* ---------- Footer ---------- */
.site-footer {
	background: var(--color-page-bg);
	color: var(--color-text-inverse-muted);
	padding: 3rem 0;
}

.footer-grid {
	display: grid;
	grid-template-columns: 2fr 1fr 1fr;
	gap: 2rem;
}

.footer-tagline {
	font-weight: 700;
	color: var(--color-text-inverse);
	margin-bottom: 1rem;
}

.social-links {
	display: flex;
	gap: 0.9rem;
}

.social-links a {
	color: var(--color-text-inverse-muted);
}

.social-links a:hover {
	color: var(--color-text-inverse);
}

.footer-col {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
}

.footer-heading {
	font-weight: 700;
	color: var(--color-text-inverse);
	margin-bottom: 0.3rem;
}

.footer-col a:hover {
	color: var(--color-text-inverse);
}

@media (max-width: 720px) {
	.footer-grid {
		grid-template-columns: 1fr;
	}
}

/* ---------- 404 ---------- */
.not-found h1 {
	font-size: 5rem;
	color: var(--color-accent);
}

/* ---------- Starship project page ---------- */
body.starship-body main {
	background: none;
	border-radius: 0;
	overflow: visible;
}

.starship-page {
	background: #05060a;
	color: #f5f5f7;
	position: relative;
	overflow: hidden;
	padding-bottom: 4rem;
}

.starship-scene {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

.starship-sprite {
	position: absolute;
	image-rendering: pixelated;
	opacity: 0.9;
}

.destroyer {
	top: 4%;
	left: 55%;
	width: 90px;
	transform: rotate(35deg);
}

.carrier {
	top: 62%;
	left: 8%;
	width: 90px;
	transform: rotate(150deg);
}

.sniper {
	top: 46%;
	left: 78%;
	width: 90px;
}

.planet-1 {
	top: 55%;
	left: 3%;
	width: 70px;
}

.planet-2 {
	top: 22%;
	left: 15%;
	width: 110px;
}

.planet-3 {
	top: 68%;
	left: 60%;
	width: 70px;
}

.starship-content {
	position: relative;
	padding-top: 3rem;
}

.starship-content .back-link {
	color: #f5f5f7;
}

.starship-columns {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 2.5rem;
	align-items: center;
	margin-top: 2rem;
}

.starship-text h1 {
	color: #fff;
}

.starship-text .hero-subtitle {
	color: #bbbbbb;
}

.starship-text p {
	color: #d5d5d9;
}

.starship-text .note {
	background: rgba(255, 255, 255, 0.08);
	border-left-color: var(--color-primary-bright);
	color: #f5f5f7;
}

.starship-video-wrap video {
	width: 100%;
	border-radius: var(--radius);
}

@media (max-width: 860px) {
	.starship-columns {
		grid-template-columns: 1fr;
	}

	.starship-sprite {
		display: none;
	}
}

/* ---------- Responsive tweaks ---------- */
@media (max-width: 720px) {
	.section,
	.about {
		padding: 2.5rem 0;
	}

	.hero {
		padding: 3rem 0 3.5rem;
	}
}
