/* 18xx 'n Chill: teaser site. Colours from the game (scripts/ui/ui_kit.gd) and the logo. */
:root {
	--paper: #f7f0e3;
	--card: #fffaf0;
	--border: #e3d5bd;
	--ink: #2a211c;
	--muted: #5e5046;
	--gold: #e3a43a;
	--accent: #94590f;
	--peach: #f6b596;
	--mint: #a6dcbc;
	--lavender: #c9b6e4;
	--outline: #4a3a35;
	--sea: #3d5878;
	--sea-deep: #2f4663;
	--sky: #a9c9e2;
	--yellow: #f2cf6a;
	--green: #9cc98a;
	--brown: #c99a6b;
	--rail: #6b4f3f;
	--radius: 18px;
	--shadow: 0 18px 40px -18px rgba(42, 33, 28, 0.45);
	color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font-family: "Nunito", system-ui, sans-serif;
	font-size: 18px;
	line-height: 1.6;
	overflow-x: hidden;
}
img, video, svg { display: block; max-width: 100%; }
a { color: var(--accent); }
h2 { font-size: clamp(30px, 4.4vw, 48px); line-height: 1.1; margin: 0 0 16px; font-weight: 900; letter-spacing: -0.01em; }
h3 { margin: 0 0 6px; font-size: 20px; }
p { margin: 0 0 14px; }
.kicker {
	display: inline-block;
	margin-bottom: 10px;
	padding: 4px 14px;
	border-radius: 999px;
	background: var(--card);
	border: 1.5px solid var(--border);
	color: var(--accent);
	font-weight: 800;
	font-size: 14px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

/* ------------------------------------------------------------------ hero */
.hero {
	position: relative;
	min-height: 100svh;
	display: grid;
	place-items: center;
	overflow: hidden;
	background: linear-gradient(180deg, #d7e7f3 0%, var(--sky) 60%, #9dbedb 100%);
}
.hero-inner { position: relative; z-index: 2; text-align: center; padding: 96px 16px 120px; max-width: 760px; }
.logo { width: min(560px, 82vw); height: auto; margin: 0 auto 10px; filter: drop-shadow(0 10px 18px rgba(42, 33, 28, 0.25)); animation: bob 6s ease-in-out infinite; }
.logo.small { width: 220px; animation: none; }
.tagline { font-size: clamp(22px, 3vw, 30px); font-weight: 900; margin: 6px 0; color: var(--outline); }
.tagline .soft { color: #7a5fa6; }
.lede { font-size: 19px; color: var(--outline); max-width: 520px; margin: 0 auto 26px; }
.cta-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.btn {
	display: inline-flex; align-items: center; gap: 10px;
	padding: 14px 24px;
	border-radius: 999px;
	font-weight: 800; font-size: 18px; text-decoration: none;
	transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.btn svg { width: 24px; height: 24px; fill: currentColor; }
.btn.steam { background: var(--outline); color: var(--paper); box-shadow: var(--shadow); }
.btn.steam:hover { transform: translateY(-2px); background: #2a211c; }
.btn.steam.soon { cursor: default; }
.btn.ghost { background: rgba(255, 250, 240, 0.85); color: var(--outline); border: 2px solid var(--outline); }
.btn.ghost:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

/* Clouds: soft puffs from radial gradients, drifting apart as you scroll (main.js). */
.sky { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.cloud {
	position: absolute;
	width: 520px; height: 220px;
	background:
		radial-gradient(circle at 25% 60%, #fff 0 22%, transparent 23%),
		radial-gradient(circle at 45% 42%, #fff 0 28%, transparent 29%),
		radial-gradient(circle at 68% 55%, #fff 0 24%, transparent 25%),
		radial-gradient(circle at 50% 72%, #f4f1ff 0 30%, transparent 31%);
	filter: drop-shadow(0 12px 0 rgba(169, 189, 214, 0.9));
	opacity: 0.96;
	transform: translateX(var(--dx, 0px)) scale(var(--s, 1));
	will-change: transform;
}
.c1 { top: 4%; left: -8%; --s: 1.2; }
.c2 { top: 10%; right: -10%; }
.c3 { top: 46%; left: -14%; --s: 1.4; }
.c4 { top: 58%; right: -12%; --s: 1.3; }
.c5 { bottom: -6%; left: 10%; --s: 1.6; }
.c6 { bottom: -8%; right: 6%; --s: 1.5; }
.scroll-hint { position: absolute; bottom: 22px; left: 50%; z-index: 3; width: 30px; height: 48px; margin-left: -15px; border: 3px solid var(--outline); border-radius: 16px; }
.scroll-hint span { position: absolute; left: 50%; top: 9px; width: 6px; height: 10px; margin-left: -3px; border-radius: 3px; background: var(--outline); animation: wheel 1.8s ease-in-out infinite; }

@keyframes bob { 50% { transform: translateY(-8px) rotate(-0.6deg); } }
@keyframes wheel { 0% { transform: translateY(0); opacity: 1; } 80% { transform: translateY(16px); opacity: 0; } 100% { opacity: 0; } }

/* -------------------------------------------------------------- chapters */
main { position: relative; }
.chapter {
	display: grid;
	grid-template-columns: 1fr 1.1fr;
	align-items: center;
	gap: 56px;
	max-width: 1180px;
	margin: 0 auto;
	padding: 120px 24px;
	min-height: 90vh;
}
.chapter.flip .copy { order: 2; }
.copy { max-width: 520px; }
.copy.center { margin: 0 auto 40px; text-align: center; max-width: 680px; }
.copy p { color: var(--muted); font-size: 19px; }
.stage { position: relative; }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(36px); transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1); }
.reveal.in { opacity: 1; transform: none; }

/* Track: tiles pop in, then turn green and brown as you scroll through. */
.hexes { width: 100%; height: auto; overflow: visible; }
.tile { --fill: #efe4cf; }
.tile use { fill: var(--fill); stroke: #fffaf0; stroke-width: 5; transition: fill 0.6s ease; }
.tile { opacity: 0; transform-box: fill-box; transform-origin: center; }
.hexes.in .tile { animation: pop 0.6s cubic-bezier(0.3, 1.4, 0.5, 1) forwards; animation-delay: calc(var(--i) * 90ms); }
.hexes .tile.laid { --fill: var(--yellow); }
.hexes[data-phase="green"] .tile.laid { --fill: var(--green); }
.hexes[data-phase="brown"] .tile.laid { --fill: var(--brown); }
.tile .city { fill: #fff; stroke: var(--outline); stroke-width: 3; }
.tile .town { fill: var(--outline); }
.rail { fill: none; stroke: var(--rail); stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.ties { fill: none; stroke: var(--rail); stroke-width: 20; stroke-dasharray: 3 11; opacity: 0; transition: opacity 0.6s ease 0.3s; }
.station circle { fill: #2f6b3f; stroke: #fff; stroke-width: 3; }
.station text { fill: #fff; font: 900 12px Nunito, sans-serif; text-anchor: middle; }
.station { opacity: 0; transition: opacity 0.5s ease; }
.hexes.drawn .ties { opacity: 0.55; }
.hexes.drawn .station { opacity: 1; }
.phase-pills { display: flex; gap: 10px; justify-content: center; margin-top: 10px; }
.phase-pills .p { padding: 4px 14px; border-radius: 999px; font-weight: 800; font-size: 14px; border: 2px solid transparent; opacity: 0.35; transition: opacity 0.4s ease, border-color 0.4s ease; }
.p.y { background: var(--yellow); } .p.g { background: var(--green); } .p.b { background: var(--brown); }
.phase-pills .p.on { opacity: 1; border-color: var(--outline); }
@keyframes pop { from { opacity: 0; transform: scale(0.4) rotate(-20deg); } to { opacity: 1; transform: scale(1) rotate(0); } }

/* Trains: the engine follows the route as you scroll. */
.route { width: 100%; height: auto; overflow: visible; }
.route .land { fill: #efe4cf; stroke: #fffaf0; stroke-width: 6; }
.route .track { fill: none; stroke: var(--rail); stroke-width: 8; stroke-linecap: round; }
.route .track-ties { fill: none; stroke: var(--rail); stroke-width: 18; stroke-dasharray: 3 11; opacity: 0.5; }
.stop circle { fill: #fff; stroke: var(--outline); stroke-width: 3; transition: fill 0.3s ease, transform 0.3s ease; }
.stop.small circle { fill: var(--outline); }
.stop.hit circle { fill: var(--gold); }
.stop text { font: 800 15px Nunito, sans-serif; text-anchor: middle; fill: var(--outline); }
.train { --red: #c0392b; }
.train .boiler { fill: var(--red); stroke: var(--outline); stroke-width: 2; }
.train .band { fill: #e3a43a; }
.train .dome { fill: #e3a43a; stroke: var(--outline); stroke-width: 2; }
.train .stack { fill: var(--outline); }
.train .cab { fill: #8f2a20; stroke: var(--outline); stroke-width: 2; }
.train .roof { fill: var(--outline); }
.train .window { fill: #fbe6a7; }
.train .lamp { fill: #fbe6a7; stroke: var(--outline); stroke-width: 1.5; }
.train .pilot { fill: var(--outline); }
.train .frame { fill: var(--outline); }
.train .tender { fill: #8f2a20; stroke: var(--outline); stroke-width: 2; }
.train .coal { fill: #3b302b; }
.train .wheel { fill: #3b302b; stroke: #e3a43a; stroke-width: 1.6; }
.train .wheel.small { stroke-width: 1.2; }
.train .hub { fill: #e3a43a; }
.train .rod { fill: #d9d2c5; animation: rod 0.5s linear infinite; transform-box: fill-box; }
.train .num { fill: #fbe6a7; font: 900 9px Nunito, sans-serif; }
.train .loco { animation: chug 0.5s ease-in-out infinite; }
.train .smoke circle { fill: #fff; stroke: #d9d2c5; stroke-width: 1; opacity: 0; transform-box: fill-box; transform-origin: center; animation: puff 1.6s ease-out infinite; }
.train .smoke circle:nth-child(2) { animation-delay: 0.53s; }
.train .smoke circle:nth-child(3) { animation-delay: 1.06s; }
@keyframes chug { 50% { transform: translateY(-1px); } }
@keyframes rod { 0% { transform: translate(0, 0); } 25% { transform: translate(1.5px, -1.5px); } 50% { transform: translate(0, -3px); } 75% { transform: translate(-1.5px, -1.5px); } 100% { transform: translate(0, 0); } }
@keyframes puff { 0% { opacity: 0.9; transform: translate(0, 4px) scale(0.5); } 100% { opacity: 0; transform: translate(-14px, -10px) scale(1.4); } }
.ticker {
	display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
	width: fit-content; margin: 18px auto 0;
	padding: 12px 22px; border-radius: var(--radius);
	background: var(--card); border: 1.5px solid var(--border); box-shadow: var(--shadow);
}
.ticker .label { font-weight: 800; color: var(--muted); font-size: 14px; text-transform: uppercase; letter-spacing: 0.05em; }
.ticker .money { font-weight: 900; font-size: 32px; color: #457a33; font-variant-numeric: tabular-nums; }
.ticker .per { color: var(--muted); font-variant-numeric: tabular-nums; }

/* Market: a token climbs the price grid. */
.market {
	display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px;
	padding: 14px; border-radius: var(--radius);
	background: var(--card); border: 1.5px solid var(--border); box-shadow: var(--shadow);
}
.market .cell {
	position: relative;
	aspect-ratio: 1.25;
	display: grid; place-items: center;
	border-radius: 6px; background: #f3e9d6;
	font-weight: 800; font-size: clamp(10px, 1.2vw, 14px); color: var(--muted);
	transition: background 0.3s ease, color 0.3s ease, transform 0.3s ease;
}
.market .cell.yz { background: #f6e7b0; }
.market .cell.on { background: var(--gold); color: var(--ink); transform: scale(1.08); }
.market .token {
	position: absolute; width: 62%; aspect-ratio: 1; border-radius: 50%;
	display: grid; place-items: center;
	background: #2f6b3f; color: #fff; font-size: clamp(9px, 1vw, 12px); font-weight: 900;
	border: 2px solid #fff; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}
.chart { width: 100%; height: auto; margin-top: 16px; overflow: visible; }
.chart path { fill: none; stroke: #457a33; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }

/* ------------------------------------------------------------- showcase */
.showcase, .maps, .features, .watch { padding: 110px 24px; }
.showcase { background: linear-gradient(180deg, var(--paper), #efe6d4); }
.shots { position: relative; max-width: 1100px; margin: 0 auto; min-height: 520px; }
.shot { position: absolute; margin: 0; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 6px solid var(--card); background: var(--card); }
.shot img { width: 100%; height: auto; }
.shot.s1 { width: 68%; left: 0; top: 0; }
.shot.s1.in { transform: rotate(-2deg); }
.shot.s2 { width: 42%; right: 0; top: 90px; }
.shot.s2.in { transform: rotate(3deg); }

/* ------------------------------------------------------------------ maps */
.maps { background: var(--sea); color: var(--paper); position: relative; overflow: hidden; }
.maps .copy p { color: #d9e3ee; }
.maps .kicker { background: rgba(255, 250, 240, 0.12); border-color: rgba(255, 250, 240, 0.3); color: var(--yellow); }
.map-cards {
	list-style: none; margin: 0 auto; padding: 0;
	max-width: 1120px;
	display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px;
}
.map-cards li {
	position: relative;
	padding: 18px 20px 16px;
	border-radius: 16px;
	background: var(--card); color: var(--ink);
	font-weight: 800; font-size: 19px; line-height: 1.25;
	box-shadow: 0 10px 0 -2px rgba(0, 0, 0, 0.18);
}
.map-cards li.in { transition-delay: calc(var(--n, 0) * 60ms); }
.map-cards b { display: block; font-size: 15px; color: var(--accent); letter-spacing: 0.04em; }
.map-cards small { display: block; font-weight: 600; font-size: 15px; color: var(--muted); margin-top: 2px; }
.lvl { position: absolute; top: 14px; right: 14px; font-style: normal; font-size: 12px; font-weight: 900; padding: 2px 10px; border-radius: 999px; }
.lvl.basic { background: #dcefd4; color: #2f6a24; }
.lvl.adv { background: #fbe6bf; color: #8a5308; }
.lvl.pro { background: #f3d0d6; color: #8d2b3c; }

/* ----------------------------------------------------------------- rules */
.rules { padding: 110px 24px; }
.rule-groups {
	max-width: 1180px; margin: 0 auto;
	display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; align-items: start;
}
.rule-group { padding: 22px 22px 10px; border-radius: var(--radius); background: var(--tint, var(--card)); border: 1.5px solid var(--border); }
.rule-group h3 { font-size: 15px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin-bottom: 12px; }
.rule-group ul { list-style: none; margin: 0; padding: 0; }
.rule-group li { padding: 10px 0; border-top: 1px dashed rgba(94, 80, 70, 0.25); }
.rule-group li:first-child { border-top: 0; padding-top: 0; }
.rule-group li b { display: block; font-size: 17px; }
.rule-group li span { display: block; color: var(--muted); font-size: 15px; line-height: 1.45; }
.rule-group.in li { animation: rise 0.5s ease both; }
.rule-group.in li:nth-child(2) { animation-delay: 0.08s; }
.rule-group.in li:nth-child(3) { animation-delay: 0.16s; }
.rule-group.in li:nth-child(4) { animation-delay: 0.24s; }
.rule-group.in li:nth-child(5) { animation-delay: 0.32s; }
.rule-group.in li:nth-child(6) { animation-delay: 0.4s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* -------------------------------------------------------------- features */
.feature-grid {
	list-style: none; margin: 0 auto; padding: 0; max-width: 1080px;
	display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px;
}
.feature-grid li { padding: 26px; border-radius: var(--radius); background: var(--card); border: 1.5px solid var(--border); }
.feature-grid li:nth-child(3n + 1) { background: #fdf0e8; }
.feature-grid li:nth-child(3n + 2) { background: #eef7f0; }
.feature-grid li:nth-child(3n + 3) { background: #f4effb; }
.feature-grid .ic { font-size: 34px; display: block; margin-bottom: 8px; }
.feature-grid p { color: var(--muted); margin: 0; font-size: 17px; }

/* ----------------------------------------------------------------- watch */
.watch { background: linear-gradient(180deg, var(--paper), #e8dcc5); }
.screen { max-width: 1080px; margin: 0 auto; border-radius: 22px; overflow: hidden; border: 10px solid var(--outline); box-shadow: var(--shadow); background: var(--outline); }
.screen video { width: 100%; height: auto; aspect-ratio: 16 / 9; }

/* ------------------------------------------------------------- timelapses */
.timelapses { padding: 110px 24px; background: var(--sea); color: var(--paper); }
.timelapses .copy p { color: #d9e3ee; }
.timelapses .kicker { background: rgba(255, 250, 240, 0.12); border-color: rgba(255, 250, 240, 0.3); color: var(--yellow); }
.lapse-grid { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.lapse { margin: 0; border-radius: var(--radius); overflow: hidden; background: var(--outline); box-shadow: 0 12px 0 -2px rgba(0, 0, 0, 0.2); }
.lapse video { width: 100%; height: auto; aspect-ratio: 16 / 9; }
.lapse figcaption { padding: 10px 16px 12px; font-weight: 800; color: var(--paper); }
.lapse figcaption b { color: var(--yellow); margin-right: 6px; }
.lapse:nth-child(2).in { transition-delay: 0.1s; }
.lapse:nth-child(3).in { transition-delay: 0.2s; }
.screen.small { border-width: 8px; }

/* ---------------------------------------------------------------- finale */
.finale {
	position: relative; overflow: hidden;
	min-height: 80vh; display: grid; place-items: center;
	background: linear-gradient(180deg, #8fb3d3 0%, var(--sky) 40%, #cfe1ef 100%);
	text-align: center;
}
.finale .sky.low .cloud { opacity: 0.8; }
.finale-inner { position: relative; z-index: 2; padding: 90px 16px; }
.finale-inner .logo { margin-bottom: 18px; }
.finale-inner p { color: var(--outline); font-size: 20px; }
.byline { margin-top: 28px; font-size: 16px !important; }

/* ---------------------------------------------------------------- phones */
@media (max-width: 860px) {
	body { font-size: 17px; }
	.chapter { grid-template-columns: 1fr; gap: 28px; padding: 80px 16px; min-height: 0; }
	.chapter.flip .copy { order: 0; }
	.copy { max-width: none; }
	.showcase, .maps, .features, .watch, .rules, .timelapses { padding: 80px 16px; }
	.lapse-grid { grid-template-columns: 1fr; }
	.shots { min-height: 0; display: grid; gap: 18px; }
	.shot { position: static; width: 100% !important; }
	.cloud { width: 320px; height: 140px; }
	.screen { border-width: 6px; }
}

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	.logo, .scroll-hint span { animation: none; }
	.reveal { opacity: 1; transform: none; transition: none; }
	.tile { opacity: 1; animation: none !important; }
	.rail, .chart path { stroke-dashoffset: 0; }
	.ties { opacity: 0.55; } .station { opacity: 1; }
	.train .loco, .train .rod, .train .smoke circle { animation: none; }
	.rule-group.in li { animation: none; }
}
