* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

:root {
	--bg: #070814;
	--text: #f6f2ea;
	--muted: rgba(246, 242, 234, 0.68);
	--soft: rgba(246, 242, 234, 0.12);
	--line: rgba(246, 242, 234, 0.14);
	--accent: #9c7cff;
	--accent-2: #e7b86f;
	--panel: rgba(7, 8, 20, 0.42);
	--panel-strong: rgba(7, 8, 20, 0.68);
	--font-body: Inter, system-ui, sans-serif;
	--font-display: Oswald, Inter, system-ui, sans-serif;
	--font-ui: Sora, Inter, system-ui, sans-serif;

	--bg-image: url("assets/backgrounds/home-bg.png");
	--bg-position: center center;
	--bg-size: cover;
	--bg-opacity: 1;
	--shade-left: rgba(7, 8, 20, 0.95);
	--shade-mid: rgba(7, 8, 20, 0.55);
	--shade-right: rgba(7, 8, 20, 0.18);
}

body[data-section="home"] {
	--bg-image: url("assets/backgrounds/home-bg.png");
	--bg-position: center center;
	--shade-left: rgba(7, 8, 20, 0.96);
	--shade-mid: rgba(7, 8, 20, 0.58);
	--shade-right: rgba(7, 8, 20, 0.18);
}

body[data-section="games"] {
	--bg-image: url("assets/backgrounds/games-bg.png");
	--bg-position: center top;
	--shade-left: rgba(7, 8, 20, 0.95);
	--shade-mid: rgba(7, 8, 20, 0.66);
	--shade-right: rgba(7, 8, 20, 0.32);
}

body[data-section="about"] {
	--bg-image: url("assets/backgrounds/about-bg.png");
	--bg-position: center center;
	--shade-left: rgba(7, 8, 20, 0.95);
	--shade-mid: rgba(7, 8, 20, 0.60);
	--shade-right: rgba(7, 8, 20, 0.24);
}

body[data-section="contact"] {
	--bg-image: url("assets/backgrounds/contact-bg.png");
	--bg-position: center bottom;
	--shade-left: rgba(7, 8, 20, 0.96);
	--shade-mid: rgba(7, 8, 20, 0.62);
	--shade-right: rgba(7, 8, 20, 0.28);
}

html {
	scroll-behavior: smooth;
	scroll-snap-type: y mandatory;
}

body {
	min-height: 100vh;
	background: var(--bg);
	color: var(--text);
	font-family: var(--font-body);
	overflow-x: hidden;
}

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

button {
	font: inherit;
}

.background-layer {
	position: fixed;
	inset: 0;
	z-index: -10;
	overflow: hidden;
	background: #070814;
}

.background-image {
	position: absolute;
	inset: 0;
	background-image: var(--bg-image);
	background-size: var(--bg-size);
	background-position: var(--bg-position);
	background-repeat: no-repeat;
	opacity: var(--bg-opacity);
	transform: scale(1.035);
	filter: saturate(0.95) contrast(1.06);
	transition:
		background-image 0.55s ease,
		background-position 0.7s ease,
		filter 0.7s ease,
		transform 0.7s ease;
}

.background-wash {
	position: absolute;
	inset: 0;
	background:
		linear-gradient(90deg, var(--shade-left) 0%, var(--shade-mid) 43%, var(--shade-right) 100%),
		radial-gradient(circle at 84% 34%, rgba(156, 124, 255, 0.18), transparent 25%),
		linear-gradient(180deg, rgba(7,8,20,0.18), rgba(7,8,20,0.72) 76%, rgba(7,8,20,0.92));
	transition: background 0.7s ease;
}

.side-rail {
	position: fixed;
	inset: 0 auto 0 0;
	width: 108px;
	z-index: 20;
	border-right: 1px solid var(--line);
	background: rgba(7, 8, 20, 0.36);
	backdrop-filter: blur(18px);
	display: grid;
	grid-template-rows: 96px 1fr auto auto;
	justify-items: center;
}

.rail-logo {
	width: 42px;
	height: 42px;
	margin-top: 28px;
	display: grid;
	place-items: center;
	border-radius: 12px;
	background: rgba(156, 124, 255, 0.12);
	border: 1px solid rgba(156, 124, 255, 0.34);
	color: #b39cff;
	font-family: var(--font-ui);
	font-weight: 900;
}

.rail-word {
	align-self: center;
	writing-mode: vertical-rl;
	transform: rotate(180deg);
	color: var(--muted);
	font-family: var(--font-ui);
	font-size: 0.72rem;
	letter-spacing: 0.48em;
	text-transform: uppercase;
}

.rail-nav {
	display: grid;
	gap: 18px;
	align-self: center;
	margin-bottom: 40px;
}

.rail-dot {
	width: 9px;
	height: 9px;
	border-radius: 999px;
	background: rgba(246,242,234,0.28);
	transition: transform 0.2s ease, background 0.2s ease;
}

.rail-dot.active,
.rail-dot:hover {
	background: var(--accent);
	transform: scale(1.55);
}

.rail-social {
	display: grid;
	gap: 18px;
	margin-bottom: 28px;
	color: rgba(246,242,234,0.48);
	font-family: var(--font-ui);
	font-weight: 900;
	font-size: 0.74rem;
}

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

.topbar {
	position: fixed;
	z-index: 18;
	left: 108px;
	right: 0;
	top: 0;
	min-height: 86px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 52px;
	pointer-events: none;
}

.mobile-brand,
.topnav,
.language-switcher {
	pointer-events: auto;
}

.mobile-brand {
	display: none;
	font-family: var(--font-ui);
	font-weight: 900;
}

.topnav {
	display: flex;
	align-items: center;
	gap: 28px;
	color: rgba(246,242,234,0.70);
	font-family: var(--font-ui);
	font-size: 0.82rem;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: 0.12em;
}

.topnav a {
	transition: color 0.2s ease, transform 0.2s ease;
}

.topnav a:hover {
	color: var(--text);
	transform: translateY(-2px);
}

.language-switcher {
	display: inline-flex;
	padding: 4px;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: rgba(7,8,20,0.36);
	backdrop-filter: blur(16px);
}

.language-button {
	cursor: pointer;
	border: 0;
	padding: 8px 11px;
	border-radius: 999px;
	background: transparent;
	color: var(--muted);
	font-family: var(--font-ui);
	font-size: 0.74rem;
	font-weight: 900;
}

.language-button.active,
.language-button:hover {
	background: var(--text);
	color: var(--bg);
}

.chapters {
	margin-left: 108px;
}

.chapter {
	position: relative;
	min-height: 100vh;
	scroll-snap-align: start;
	display: flex;
	align-items: center;
	padding: 120px 7vw;
}

.chapter-content {
	max-width: 800px;
	animation: chapterIn 0.85s cubic-bezier(.2,.8,.2,1) both;
}

@keyframes chapterIn {
	from {
		opacity: 0;
		transform: translateY(28px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.kicker {
	color: #aa91ff;
	font-family: var(--font-ui);
	font-size: 0.78rem;
	font-weight: 900;
	letter-spacing: 0.42em;
	text-transform: uppercase;
	margin-bottom: 24px;
}

h1,
h2 {
	font-family: var(--font-display);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.035em;
	line-height: 0.94;
	text-shadow: 0 18px 60px rgba(0,0,0,0.42);
}

h1 {
	font-size: clamp(4.2rem, 9vw, 9.7rem);
	max-width: 980px;
	margin-bottom: 28px;
}

h2 {
	font-size: clamp(3.3rem, 7vw, 7.2rem);
	max-width: 920px;
	margin-bottom: 28px;
}

.chapter-text {
	color: rgba(246,242,234,0.78);
	max-width: 650px;
	font-size: 1.12rem;
	line-height: 1.85;
	margin-bottom: 34px;
}

.chapter-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 20px;
}

.action-link {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 14px;
	color: #b39cff;
	font-family: var(--font-ui);
	font-size: 0.82rem;
	font-weight: 900;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	padding-bottom: 12px;
}

.action-link::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: 0;
	width: 100%;
	height: 1px;
	background: currentColor;
	opacity: 0.45;
	transition: width 0.2s ease;
}

.action-link:hover::after {
	width: 130%;
}

.action-link.primary::before {
	content: "→";
	order: 2;
	font-size: 1.05rem;
}

.chapter-index {
	position: absolute;
	right: 52px;
	bottom: 46px;
	display: grid;
	gap: 4px;
	text-align: right;
	color: rgba(246,242,234,0.46);
	font-family: var(--font-ui);
	text-transform: uppercase;
	letter-spacing: 0.16em;
}

.chapter-index span {
	font-size: 0.78rem;
}

.chapter-index strong {
	color: rgba(246,242,234,0.82);
	font-size: 0.82rem;
}

.game-stage {
	display: grid;
	grid-template-columns: minmax(280px, 440px) minmax(320px, 560px);
	gap: 34px;
	align-items: stretch;
}

.game-selector {
	display: grid;
	gap: 14px;
}

.game-card {
	cursor: pointer;
	border: 1px solid var(--line);
	background: rgba(7,8,20,0.46);
	backdrop-filter: blur(14px);
	border-radius: 22px;
	padding: 14px;
	color: var(--text);
	display: grid;
	grid-template-columns: 64px auto;
	gap: 14px;
	align-items: center;
	text-align: left;
	transition: transform 0.22s ease, background 0.22s ease, border-color 0.22s ease;
}

.game-card:hover,
.game-card.active {
	transform: translateX(10px);
	background: rgba(156,124,255,0.14);
	border-color: rgba(156,124,255,0.42);
}

.game-card img {
	width: 64px;
	height: 64px;
	border-radius: 16px;
	object-fit: cover;
	grid-row: span 2;
}

.game-card span {
	color: var(--muted);
	font-family: var(--font-ui);
	font-size: 0.72rem;
	font-weight: 900;
}

.game-card strong {
	font-family: var(--font-ui);
	font-size: 0.92rem;
}

.game-detail {
	border: 1px solid var(--line);
	background: rgba(7,8,20,0.44);
	backdrop-filter: blur(18px);
	border-radius: 28px;
	padding: 32px;
	min-height: 320px;
	display: flex;
	flex-direction: column;
	justify-content: center;
}

.game-genre {
	color: #aa91ff;
	font-family: var(--font-ui);
	font-size: 0.78rem;
	font-weight: 900;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	margin-bottom: 14px;
}

.game-detail h3 {
	font-family: var(--font-display);
	font-size: clamp(2.6rem, 5vw, 5.6rem);
	text-transform: uppercase;
	letter-spacing: 0.03em;
	line-height: 0.95;
	margin-bottom: 20px;
}

.game-detail p:not(.game-genre) {
	color: rgba(246,242,234,0.74);
	font-size: 1.05rem;
	line-height: 1.8;
	margin-bottom: 28px;
}

.principles {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 18px;
	margin-top: 36px;
}

.principles div {
	border: 1px solid var(--line);
	background: rgba(7,8,20,0.42);
	backdrop-filter: blur(14px);
	border-radius: 24px;
	padding: 22px;
}

.principles span {
	display: block;
	color: #aa91ff;
	font-family: var(--font-ui);
	font-weight: 900;
	margin-bottom: 12px;
}

.principles strong {
	display: block;
	font-family: var(--font-ui);
	font-size: 1rem;
	margin-bottom: 10px;
}

.principles p {
	color: rgba(246,242,234,0.68);
	line-height: 1.7;
}



/* About section tuning: keep the "principles" cards inside one chapter screen */
.about-content {
	max-width: min(980px, 100%);
}

#about .chapter-text {
	max-width: 760px;
	margin-bottom: 24px;
}

#about h2 {
	font-size: clamp(2.75rem, 5.7vw, 5.8rem);
	max-width: 980px;
	margin-bottom: 22px;
}

#about .principles {
	max-width: 980px;
	gap: 14px;
	margin-top: 24px;
}

#about .principles div {
	padding: 18px;
	min-height: 0;
}

#about .principles strong {
	font-size: 0.92rem;
	margin-bottom: 6px;
}

#about .principles p {
	font-size: 0.9rem;
	line-height: 1.55;
}

#about .principles span {
	margin-bottom: 8px;
}


@media (max-width: 1100px) {
	h1 {
		font-size: clamp(3.5rem, 11vw, 7.5rem);
	}

	.game-stage {
		grid-template-columns: 1fr;
	}

	.principles {
		grid-template-columns: 1fr;
	}

	#about h2 {
		font-size: clamp(2.6rem, 9vw, 4.8rem);
	}

	#about .principles {
		grid-template-columns: 1fr;
		max-width: 720px;
	}

	#about .principles div {
		padding: 18px 20px;
	}

}

@media (max-width: 820px) {
	html {
		scroll-snap-type: none;
	}

	.side-rail {
		display: none;
	}

	.topbar {
		left: 0;
		min-height: 74px;
		padding: 0 20px;
		background: rgba(7,8,20,0.52);
		backdrop-filter: blur(18px);
		border-bottom: 1px solid var(--line);
	}

	.mobile-brand {
		display: block;
	}

	.topnav {
		display: none;
	}

	.chapters {
		margin-left: 0;
	}

	.chapter {
		min-height: auto;
		padding: 116px 24px 84px;
	}

	.chapter-index {
		display: none;
	}

	h1 {
		font-size: clamp(3.2rem, 16vw, 5.6rem);
	}

	h2 {
		font-size: clamp(2.8rem, 14vw, 4.8rem);
	}

	.background-image {
		background-position: center center;
	}

	.background-wash {
		background:
			linear-gradient(90deg, rgba(7,8,20,0.90), rgba(7,8,20,0.68)),
			linear-gradient(180deg, rgba(7,8,20,0.20), rgba(7,8,20,0.88));
	}
}

@media (max-width: 520px) {
	.game-card {
		grid-template-columns: 52px auto;
	}

	.game-card img {
		width: 52px;
		height: 52px;
		border-radius: 14px;
	}

	.game-detail {
		padding: 24px;
	}
}


@media (min-width: 1101px) {
	#about.chapter {
		padding-top: 96px;
		padding-bottom: 78px;
	}
}


/* Soft fix for the Games detail panel.
   Keeps the previous look, but prevents RunRunRule / descriptions from escaping the panel. */
.game-stage {
	grid-template-columns: minmax(280px, 420px) minmax(0, 560px);
	max-width: 1040px;
}

.game-detail {
	min-width: 0;
	max-width: 100%;
	overflow: hidden;
}

.game-detail h3 {
	max-width: 100%;
	font-size: clamp(2.45rem, 4.4vw, 5rem);
	line-height: 0.96;
	white-space: normal;
	overflow-wrap: break-word;
	word-break: normal;
}

.game-detail p:not(.game-genre) {
	max-width: 100%;
	overflow-wrap: break-word;
}

@media (max-width: 1100px) {
	.game-stage {
		grid-template-columns: 1fr;
		max-width: 760px;
	}

	.game-detail h3 {
		font-size: clamp(2.35rem, 8vw, 4.4rem);
	}
}

@media (max-width: 520px) {
	.game-detail h3 {
		font-size: clamp(2rem, 11vw, 3.35rem);
	}
}


/* Final Games panel width fix.
   The problem was not that the title needed to wrap:
   the Games chapter needed more horizontal room.
   This keeps the detail panel wide on desktop and prevents the title from pushing the panel down. */

.games-content {
	max-width: min(1180px, calc(100vw - 108px - 14vw));
	width: min(1180px, calc(100vw - 108px - 14vw));
}

.game-stage {
	grid-template-columns: minmax(280px, 420px) minmax(520px, 680px);
	max-width: none;
	width: 100%;
	align-items: stretch;
}

.game-detail {
	min-width: 0;
	max-width: 100%;
	overflow: hidden;
}

.game-detail h3 {
	max-width: 100%;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	font-size: clamp(2.35rem, 3.8vw, 4.55rem);
	line-height: 0.96;
}

.game-detail p:not(.game-genre) {
	max-width: 620px;
}

/* In medium screens, keep the horizontal layout a little longer,
   but make the title smaller instead of wrapping immediately. */
@media (max-width: 1280px) {
	.games-content {
		max-width: min(1040px, calc(100vw - 108px - 10vw));
		width: min(1040px, calc(100vw - 108px - 10vw));
	}

	.game-stage {
		grid-template-columns: minmax(260px, 360px) minmax(480px, 1fr);
	}

	.game-detail h3 {
		font-size: clamp(2.25rem, 3.6vw, 4rem);
	}
}

/* Once there is truly not enough room, then stack normally. */
@media (max-width: 980px) {
	.games-content {
		width: 100%;
		max-width: 760px;
	}

	.game-stage {
		grid-template-columns: 1fr;
		max-width: 760px;
	}

	.game-detail h3 {
		white-space: normal;
		overflow: visible;
		text-overflow: initial;
		font-size: clamp(2.35rem, 8vw, 4.4rem);
	}
}

@media (max-width: 820px) {
	.games-content {
		width: 100%;
		max-width: 100%;
	}
}

@media (max-width: 520px) {
	.game-detail h3 {
		font-size: clamp(2rem, 11vw, 3.35rem);
	}
}


/* Final layout fix after copy polish:
   keeps the home message inside the visible chapter without internal scrolling. */
#home .chapter-content {
	max-width: min(880px, 100%);
}

#home h1 {
	font-size: clamp(3.35rem, 7.4vw, 7.6rem);
	line-height: 0.96;
	margin-bottom: 22px;
}

#home .chapter-text {
	max-width: 680px;
	font-size: 1.04rem;
	line-height: 1.72;
	margin-bottom: 28px;
}

#home.chapter {
	padding-top: 104px;
	padding-bottom: 72px;
}

@media (max-height: 760px) and (min-width: 821px) {
	#home h1 {
		font-size: clamp(3rem, 6.4vw, 6.4rem);
	}

	#home .chapter-text {
		font-size: 0.98rem;
		line-height: 1.58;
		margin-bottom: 22px;
	}

	#home.chapter {
		padding-top: 92px;
		padding-bottom: 52px;
	}
}

@media (max-width: 820px) {
	#home h1 {
		font-size: clamp(2.75rem, 13vw, 4.8rem);
		line-height: 0.98;
	}

	#home .chapter-text {
		font-size: 1rem;
		line-height: 1.62;
	}
}


/* Contact title punctuation fix.
   Prevents the opening Spanish question mark from being clipped/cut by the large display font. */
#contact h2 {
	line-height: 1.04;
	letter-spacing: 0.025em;
	padding-left: 0.08em;
	overflow: visible;
}

#contact .chapter-content,
#contact .contact-content {
	overflow: visible;
}

@media (max-width: 820px) {
	#contact h2 {
		line-height: 1.08;
		padding-left: 0.04em;
	}
}


/* Shared-layout style selector animation for the Games section.
   This recreates the Motion "shared layout" feeling without adding a library. */
.game-selector {
	position: relative;
	isolation: isolate;
}

.shared-game-highlight {
	position: absolute;
	z-index: 0;
	left: 0;
	top: 0;
	width: 0;
	height: 0;
	border-radius: 22px;
	background:
		radial-gradient(circle at 18% 24%, rgba(246,242,234,0.16), transparent 32%),
		linear-gradient(135deg, rgba(156,124,255,0.22), rgba(231,184,111,0.10));
	border: 1px solid rgba(156,124,255,0.48);
	box-shadow:
		0 18px 48px rgba(0,0,0,0.28),
		0 0 36px rgba(156,124,255,0.20),
		inset 0 1px 0 rgba(255,255,255,0.14);
	opacity: 0;
	transform: translate3d(0, 0, 0);
	transition:
		transform 420ms cubic-bezier(.2,.8,.2,1),
		width 420ms cubic-bezier(.2,.8,.2,1),
		height 420ms cubic-bezier(.2,.8,.2,1),
		opacity 220ms ease;
	pointer-events: none;
}

.game-selector.has-shared-highlight .shared-game-highlight {
	opacity: 1;
}

.game-card {
	position: relative;
	z-index: 1;
}

.game-card.active {
	background: transparent;
	border-color: transparent;
}

.game-card:hover {
	background: rgba(156,124,255,0.08);
}

.game-card.active:hover {
	background: transparent;
}

.game-card img,
.game-card span,
.game-card strong {
	position: relative;
	z-index: 2;
}

.game-card.active img {
	box-shadow:
		0 18px 44px rgba(0,0,0,0.36),
		0 0 30px rgba(156,124,255,0.26);
}

@media (prefers-reduced-motion: reduce) {
	.shared-game-highlight {
		transition: none;
	}
}
