/* Math Powa showcase site. Dark first like the game (light when the system
   asks for it), sticker look of the game's promo pictures: thick ink borders,
   flat offset shadows, Baloo 2 titles. */

/* Baloo 2 (SIL OFL 1.1, see fonts/OFL.txt), self-hosted like the game. */
@font-face { font-family: 'Baloo 2'; font-weight: 700; font-display: swap; src: url('../fonts/baloo-2-latin-ext-700-normal.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Baloo 2'; font-weight: 700; font-display: swap; src: url('../fonts/baloo-2-latin-700-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Baloo 2'; font-weight: 800; font-display: swap; src: url('../fonts/baloo-2-latin-ext-800-normal.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Baloo 2'; font-weight: 800; font-display: swap; src: url('../fonts/baloo-2-latin-800-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
	color-scheme: dark;
	/* Colours */
	--bg: #17141f;
	--bg-alt: #1f1a2b;
	--panel: #251f33;
	--line: #3a3348;
	--ink: #0b0910;
	--text: #f7f0e4;
	--muted: #b8afc2;
	--accent: #ff6b1a;
	--accent-hover: #ff8540;
	--on-accent: #1f1a2e;
	--gold: #ffcf33;
	--focus: #ffcf33;
	--hero-veil: linear-gradient(180deg, rgb(23 20 31 / 0.55) 0%, rgb(23 20 31 / 0.82) 55%, var(--bg) 100%);
	/* Type, ratio 1.25 */
	--font-title: 'Baloo 2', system-ui, sans-serif;
	--font-text: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
	--fs-small: 0.875rem;
	--fs-body: 1.0625rem;
	--fs-h3: 1.3rem;
	--fs-h2: clamp(1.75rem, 1.2rem + 2.4vw, 2.6rem);
	--fs-h1: clamp(2.3rem, 1.5rem + 4vw, 4rem);
	/* Space, 8 px base */
	--s1: 4px;
	--s2: 8px;
	--s3: 16px;
	--s4: 24px;
	--s5: 32px;
	--s6: 48px;
	--s7: 72px;
	--s8: 112px;
	--wrap: 1120px;
	--gutter: 16px;
	/* Finish */
	--r1: 12px;
	--r2: 20px;
	--r3: 28px;
	--border: 2px solid var(--ink);
	--sticker: 4px 4px 0 var(--ink);
	--sticker-big: 6px 6px 0 var(--ink);
	--ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-color-scheme: light) {
	:root {
		color-scheme: light;
		--bg: #fff5e3;
		--bg-alt: #ffeccc;
		--panel: #ffffff;
		--line: #e6d6bd;
		--ink: #1f1a2e;
		--text: #1f1a2e;
		--muted: #5e566a;
		--accent-hover: #ff8540;
		--focus: #1f6fe0;
		--hero-veil: linear-gradient(180deg, rgb(23 20 31 / 0.5) 0%, rgb(23 20 31 / 0.78) 60%, #241d33 100%);
	}
}

@media (min-width: 720px) {
	:root { --gutter: 32px; }
}

* { box-sizing: border-box; }

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

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font: var(--fs-body)/1.55 var(--font-text);
	-webkit-font-smoothing: antialiased;
	overflow-x: hidden;
}

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

h1, h2, h3 { font-family: var(--font-title); line-height: 1.12; margin: 0; text-wrap: balance; }
h1 { font-size: var(--fs-h1); font-weight: 800; }
h2 { font-size: var(--fs-h2); font-weight: 800; }
h3 { font-size: var(--fs-h3); font-weight: 700; }
p { margin: 0; }
a { color: inherit; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

.skip { position: absolute; left: var(--s3); top: -60px; z-index: 30; padding: var(--s2) var(--s3); background: var(--gold); color: var(--on-accent); border-radius: var(--r1); font-weight: 700; }
.skip:focus { top: var(--s3); }

.kicker { font: 800 var(--fs-small)/1.2 var(--font-title); letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); margin-bottom: var(--s2); }
@media (prefers-color-scheme: light) {
	.section .kicker, .section-paper .kicker { color: #c24a00; }
}
.lead { font-size: 1.15rem; color: var(--muted); max-width: 62ch; margin-top: var(--s3); }

/* ---------- Buttons ---------- */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
	min-height: 48px; padding: 0 var(--s4);
	border: var(--border); border-radius: var(--r1);
	font: 700 1.05rem/1 var(--font-title); text-decoration: none; cursor: pointer;
	transition: transform 150ms var(--ease-out), box-shadow 150ms var(--ease-out), background-color 150ms;
}
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--sticker); }
.btn-primary:hover { background: var(--accent-hover); transform: translate(-2px, -2px); box-shadow: var(--sticker-big); }
.btn-primary:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--text); }
.btn-big { min-height: 56px; padding: 0 var(--s5); font-size: 1.2rem; }
.btn-small { min-height: 44px; padding: 0 var(--s3); font-size: 0.95rem; }
.btn-icon { width: 22px; height: 22px; }

/* ---------- Language offer ---------- */
.lang-suggest { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--s2) var(--s3); padding: var(--s2) var(--gutter); background: var(--gold); color: var(--on-accent); font-weight: 600; }
.lang-suggest[hidden] { display: none; }
.lang-suggest .btn-ghost { color: var(--on-accent); border-color: var(--on-accent); }

/* ---------- Top bar ---------- */
.topbar {
	position: sticky; top: 0; z-index: 20;
	display: flex; align-items: center; gap: var(--s3);
	padding: var(--s2) var(--gutter);
	background: color-mix(in srgb, var(--bg) 86%, transparent);
	backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: var(--s2); text-decoration: none; font: 800 1.3rem/1 var(--font-title); }
.brand img { width: 52px; }
.topnav { display: none; gap: var(--s1); margin-left: auto; }
.topnav a, .langs a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s2); border-radius: var(--r1); text-decoration: none; color: var(--muted); font-weight: 600; }
.topnav a:hover, .langs a:hover { color: var(--text); }
.topbar .langs { display: none; margin-left: auto; }
.topbar .langs a { font-size: var(--fs-small); padding: 0 6px; }
.langs a[aria-current="page"] { color: var(--text); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 3px; text-underline-offset: 6px; }
.topbar-play { margin-left: auto; }
@media (min-width: 560px) {
	.topbar .langs { display: flex; }
	.topbar-play { margin-left: 0; }
}
@media (min-width: 980px) {
	.topnav { display: flex; }
	.topbar .langs { margin-left: 0; }
}

/* ---------- Hero ---------- */
.hero { position: relative; isolation: isolate; overflow: hidden; color: #f7f0e4; padding: var(--s6) 0 var(--s7); }
.hero-bg { position: absolute; inset: 0; z-index: -1; background: var(--hero-veil), url('../img/island-moon.webp') center 30% / cover no-repeat; }
.hero-grid { display: grid; gap: var(--s5); align-items: center; }
.hero h1 em { font-style: normal; color: var(--gold); }
.hero .kicker { color: var(--gold); }
.hero .lead { color: #e2d9ec; }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s5); }
.hero .btn-ghost { color: #f7f0e4; border-color: rgb(247 240 228 / 0.5); }
.hero .btn-ghost:hover { border-color: #f7f0e4; }
.hint { margin-top: var(--s2); font-size: var(--fs-small); color: #cfc6da; }
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); list-style: none; padding: 0; margin: var(--s4) 0 0; }
.chips li { padding: var(--s1) var(--s3); border-radius: 999px; background: rgb(255 255 255 / 0.1); border: 1px solid rgb(255 255 255 / 0.22); font-size: var(--fs-small); font-weight: 600; }
.hero-visual { position: relative; width: min(100%, 460px); margin: 0 auto; aspect-ratio: 1; }
.hero-circle { position: absolute; inset: 0; }
.hero-circle svg { width: 100%; height: 100%; overflow: visible; }
.hero-equation { position: absolute; left: 50%; bottom: -6px; translate: -50% 0; padding: var(--s1) var(--s4); border: var(--border); border-radius: var(--r1); background: #1f1a2e; box-shadow: var(--sticker); font: 800 clamp(1.4rem, 1rem + 2vw, 2rem)/1.3 var(--font-title); white-space: nowrap; color: #f7f0e4; }
.hero-equation b { color: #2fd67b; }
.hero-logo { display: block; width: 128px; margin: 0 0 var(--s3) -8px; filter: drop-shadow(0 8px 24px rgb(0 0 0 / 0.5)); }
@media (min-width: 900px) {
	.hero { padding: var(--s7) 0 var(--s8); }
	.hero-grid { grid-template-columns: 1.1fr 1fr; gap: var(--s6); }
}

/* Magic circle of the game (js/magic-circle.js): same animations as css/fight.css. */
.mc .draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: mc-trace var(--dur, 700ms) var(--ease-out) forwards; animation-delay: var(--d, 0ms); }
@keyframes mc-trace { to { stroke-dashoffset: 0; } }
.mc .turn { transform-origin: 150px 150px; animation: mc-turn var(--t, 40s) linear infinite; }
.mc .turn.is-back { animation-direction: reverse; }
@keyframes mc-turn { to { transform: rotate(360deg); } }
.mc .glow { opacity: 0; animation: mc-glow 600ms ease-out forwards; animation-delay: var(--d, 0ms); }
@keyframes mc-glow { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
	.mc .draw { animation-duration: 1ms; animation-delay: 0ms; }
	.mc .turn { animation: none; }
}

/* ---------- Sections ---------- */
.section { padding: var(--s7) 0; }
.section h2 { max-width: 22ch; }
.section-paper { background: var(--bg-alt); }
@media (min-width: 900px) {
	.section { padding: var(--s8) 0; }
}

/* Phone screenshots */
.phone { margin: 0; width: min(240px, 70vw); flex: none; border: 6px solid var(--ink); border-radius: var(--r3); overflow: hidden; background: var(--ink); box-shadow: var(--sticker-big), 0 24px 48px -16px rgb(0 0 0 / 0.5); }
.phone img { display: block; width: 100%; }

/* Features: phone and text, one way then the other on wide screens. */
.features { display: grid; gap: var(--s6); max-width: 880px; margin: var(--s6) auto 0; }
.feature { display: grid; justify-items: center; gap: var(--s4); text-align: center; }
.feature-text { max-width: 46ch; }
.feature-num { display: block; font: 800 1rem/1 var(--font-title); color: var(--accent); margin-bottom: var(--s2); }
.feature h3 { font-size: 1.6rem; }
.feature p { margin-top: var(--s2); color: var(--muted); }
@media (min-width: 760px) {
	.features { gap: var(--s7); }
	.feature { grid-template-columns: auto 1fr; justify-items: start; align-items: center; gap: var(--s6); text-align: left; }
	.feature.is-flip { grid-template-columns: 1fr auto; }
	.feature.is-flip .phone { order: 2; }
	.feature.is-flip .feature-text { justify-self: end; }
	.feature:nth-child(odd) .phone { rotate: -2deg; }
	.feature:nth-child(even) .phone { rotate: 2deg; }
}

/* ---------- Collection ---------- */
.section-collection { background: radial-gradient(ellipse 80% 60% at 70% 40%, rgb(255 107 26 / 0.14), transparent 70%), var(--bg); }
.collection-grid { display: grid; gap: var(--s6); align-items: center; }
.collection-count { display: inline-block; margin-top: var(--s4); padding: var(--s1) var(--s3); border: var(--border); border-radius: 999px; background: var(--panel); box-shadow: 3px 3px 0 var(--ink); font: 700 1.05rem/1.4 var(--font-title); }
.collection-count b { color: var(--accent); }
/* Fanned like the collection tile of the game's home screen. */
.fan { display: flex; justify-content: center; list-style: none; margin: 0; padding: var(--s4) 0; }
.gcard {
	position: relative; display: grid; grid-template-rows: auto auto 1fr auto; flex: none;
	width: clamp(104px, 29vw, 196px); aspect-ratio: 5 / 7; padding: 6px 6px var(--s2);
	border: 3px solid var(--rc, var(--ink)); border-radius: var(--r2);
	background: linear-gradient(160deg, color-mix(in srgb, var(--rc) 22%, var(--panel)), var(--panel) 60%);
	box-shadow: var(--sticker); overflow: hidden;
}
.gcard + .gcard { margin-left: clamp(-24px, -4vw, -10px); }
.fan .gcard:nth-child(1) { rotate: -8deg; translate: 0 10px; }
.fan .gcard:nth-child(3) { rotate: 8deg; translate: 0 10px; }
.fan .gcard:nth-child(2) { z-index: 1; }
.gcard-art { display: block; aspect-ratio: 1; border-radius: var(--r1); overflow: hidden; background: color-mix(in srgb, var(--rc) 30%, var(--ink)); }
.gcard-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gcard-name { margin-top: var(--s2); font: 800 clamp(0.95rem, 0.7rem + 1vw, 1.25rem)/1.1 var(--font-title); }
.gcard-title { margin-top: 2px; font-size: 0.8rem; color: var(--muted); line-height: 1.3; }
.gcard-rarity { justify-self: start; padding: 1px var(--s2); border-radius: 999px; background: var(--rc); color: #17141f; font: 700 0.72rem/1.4 var(--font-title); text-transform: uppercase; letter-spacing: 0.05em; }
@media (max-width: 559px) {
	.gcard-title { display: none; }
}
/* Face down, as in the game (css/cards.css .card-back). */
.gcard-back {
	display: grid; grid-template-rows: 1fr; place-items: center; padding: 0; border: 6px solid #14101f;
	background:
		radial-gradient(rgb(20 16 30 / 0.18) 1.2px, transparent 1.4px) 0 0 / 7px 7px,
		repeating-conic-gradient(from 0deg at 50% 50%, #ff6b1a 0 10deg, #ff8c42 10deg 20deg);
}
.gcard-back-logo { padding: 4px 10px; border: 2px solid #14101f; border-radius: 8px; background: #fff5e3; color: #1f1a2e; font: 800 clamp(0.95rem, 0.7rem + 1vw, 1.3rem)/1.2 var(--font-title); rotate: -6deg; box-shadow: 3px 3px 0 #14101f; }
.gcard-back-logo b { margin-left: 3px; color: #ff6b1a; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (min-width: 900px) {
	.collection-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- Parents ---------- */
.parents-grid { display: grid; gap: var(--s6); justify-items: center; margin-top: var(--s6); }
.tiles { display: grid; gap: var(--s3); list-style: none; padding: 0; margin: 0; width: 100%; }
.tile { padding: var(--s4); border: 1px solid var(--line); border-radius: var(--r2); background: var(--panel); }
.tile-icon { width: 36px; height: 36px; padding: 6px; border-radius: 10px; background: var(--accent); color: var(--on-accent); }
.tile h3 { margin-top: var(--s3); font-size: 1.2rem; }
.tile p { margin-top: var(--s2); color: var(--muted); }
.phone-paper { rotate: 2deg; }
@media (min-width: 640px) {
	.tiles { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1000px) {
	.parents-grid { grid-template-columns: 1fr auto; align-items: start; }
}

/* ---------- Teachers ---------- */
.columns { display: grid; gap: var(--s4); margin-top: var(--s5); }
.panel { padding: var(--s5) var(--s4); border: var(--border); border-radius: var(--r2); background: var(--panel); box-shadow: var(--sticker); }
.checks { display: grid; gap: var(--s3); list-style: none; padding: 0; margin: var(--s4) 0 0; }
.checks li { display: flex; gap: var(--s3); align-items: flex-start; }
.li-icon { flex: none; width: 24px; height: 24px; margin-top: 1px; padding: 3px; border-radius: 50%; background: #2fd67b; color: #17141f; }
.note { margin-top: var(--s5); max-width: 70ch; padding-left: var(--s3); border-left: 4px solid var(--gold); color: var(--muted); }
@media (min-width: 760px) {
	.columns { grid-template-columns: 1fr 1fr; }
}

/* Quote of a young player */
.quote-band { padding: var(--s6) 0; background: var(--accent); color: var(--on-accent); border-block: var(--border); }
.quote { margin: 0 auto; max-width: 48rem; text-align: center; }
.quote blockquote { margin: 0; font-family: var(--font-title); font-weight: 800; font-size: clamp(1.4rem, 1rem + 2vw, 2.1rem); line-height: 1.2; text-wrap: balance; }
.quote blockquote p::before { content: '«\00a0'; }
.quote blockquote p::after { content: '\00a0»'; }
:lang(en) .quote blockquote p::before, :lang(it) .quote blockquote p::before { content: '“'; }
:lang(en) .quote blockquote p::after, :lang(it) .quote blockquote p::after { content: '”'; }
:lang(de) .quote blockquote p::before { content: '„'; }
:lang(de) .quote blockquote p::after { content: '“'; }
.quote-aside { font-family: var(--font-text); font-weight: 600; font-size: 0.6em; font-style: italic; white-space: nowrap; }
.quote figcaption { margin-top: var(--s3); font-weight: 700; }
.quote figcaption::before { content: '- '; }
.story { max-width: 40rem; margin: var(--s5) auto 0; padding-top: var(--s4); border-top: 2px solid rgb(31 26 46 / 0.25); text-align: center; line-height: 1.6; }
.story-by { margin-top: var(--s2); font-family: var(--font-title); font-weight: 700; }

/* Legal notice page */
.legal-grid { display: grid; gap: var(--s4); margin-top: var(--s5); }
.legal .panel p { margin-top: var(--s3); }
.legal dl { display: grid; gap: var(--s3); margin: var(--s4) 0 0; }
.legal dt { font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.legal dd { margin: 0; overflow-wrap: anywhere; }
.legal-story { margin-top: var(--s4); }
.legal-story p { line-height: 1.6; }
@media (min-width: 760px) {
	.legal-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- Install ---------- */
.section-install { background: var(--bg-alt); }
.steps { display: grid; gap: var(--s4); list-style: none; padding: 0; margin: var(--s6) 0 0; }
.step { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: var(--s2); padding: var(--s5) var(--s4) var(--s4); border: 1px solid var(--line); border-radius: var(--r2); background: var(--panel); }
.step-num { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: var(--s2); border: var(--border); border-radius: 50%; background: var(--gold); color: #17141f; font: 800 1.3rem/1 var(--font-title); box-shadow: 3px 3px 0 var(--ink); }
.step p { color: var(--muted); flex: 1; }
.step .btn { margin-top: var(--s3); }
@media (min-width: 860px) {
	.steps { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Call to action ---------- */
.cta { padding: var(--s7) 0; background: linear-gradient(135deg, #ff6b1a, #ff3d7f); color: #1f1a2e; }
.cta-inner { display: grid; gap: var(--s4); justify-items: center; text-align: center; }
.cta img { width: 160px; border: 4px solid #1f1a2e; border-radius: 50%; background: #fff1a8; box-shadow: 6px 6px 0 #1f1a2e; }
.cta p { margin: var(--s2) 0 var(--s4); font-size: 1.15rem; font-weight: 600; }
.cta .btn-primary { background: #1f1a2e; color: #fff5e3; border-color: #1f1a2e; box-shadow: 4px 4px 0 rgb(31 26 46 / 0.35); }
.cta .btn-primary:hover { background: #2c2540; }
@media (min-width: 760px) {
	.cta-inner { grid-template-columns: auto 1fr; justify-items: start; text-align: left; gap: var(--s6); }
	.cta img { width: 200px; }
}

/* ---------- Footer ---------- */
.footer { padding: var(--s6) 0; border-top: 1px solid var(--line); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s4); }
.footer nav { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); }
.footer nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); }
.footer nav a:hover { color: var(--text); }
.footer .langs a { padding: 0; }
