/*
Theme Name: Fun Phil
Theme URI: https://funphilworld.com
Author: Fun Phil World
Description: Lightweight custom theme for Fun Phil World — fun learning adventures for kids.
Version: 1.0.0
Requires at least: 6.4
Requires PHP: 8.0
License: Proprietary
Text Domain: funphil
*/

/* ---------- Fonts (self-hosted, no third-party requests) ---------- */
@font-face {
	font-family: "Baloo 2";
	src: url("assets/fonts/baloo-2-latin-wght-normal.woff2") format("woff2");
	font-weight: 400 800;
	font-style: normal;
	font-display: swap;
}
@font-face {
	font-family: "Nunito";
	src: url("assets/fonts/nunito-latin-wght-normal.woff2") format("woff2");
	font-weight: 200 1000;
	font-style: normal;
	font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
	--plum: #2b1247;
	--plum-2: #3a1a5e;
	--purple: #85449a;
	--purple-dark: #6b3480;
	--sun: #fdd20c;
	--sun-soft: #ffe873;
	--tangerine: #ff7a3d;
	--mist: #f5effb;
	--white: #ffffff;
	--ink: #2b1247;
	--ink-soft: #5b4a70;

	--display: "Baloo 2", ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
	--body: "Nunito", ui-rounded, system-ui, -apple-system, "Segoe UI", sans-serif;

	--wrap: 1180px;
	--gutter: clamp(16px, 4vw, 40px);
	--r-lg: 32px;
	--r-md: 20px;
	--r-sm: 12px;
	--space: clamp(64px, 9vw, 120px);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
	margin: 0;
	background: var(--white);
	color: var(--ink);
	font-family: var(--body);
	font-size: 1.125rem;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	overflow-x: hidden;
}
img, svg, video, iframe { max-width: 100%; height: auto; display: block; }
a { color: var(--purple); text-underline-offset: 3px; }
a:hover { color: var(--purple-dark); }
h1, h2, h3, h4 {
	font-family: var(--display);
	line-height: 1.08;
	margin: 0 0 .5em;
	letter-spacing: -0.01em;
	color: inherit;
}
h1 { font-size: clamp(2.6rem, 6.2vw, 4.75rem); font-weight: 800; }
h2 { font-size: clamp(2rem, 4.2vw, 3.1rem); font-weight: 800; }
h3 { font-size: clamp(1.3rem, 2vw, 1.6rem); font-weight: 700; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; border-radius: 6px; }
.screen-reader-text {
	position: absolute !important; width: 1px; height: 1px; overflow: hidden;
	clip: rect(1px,1px,1px,1px); white-space: nowrap;
}
.skip-link:focus {
	clip: auto; width: auto; height: auto; z-index: 999; top: 12px; left: 12px;
	background: var(--sun); color: var(--plum); padding: 10px 16px; border-radius: 999px; font-weight: 800;
}
.wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; }

/* ---------- Buttons ---------- */
.btn {
	display: inline-flex; align-items: center; gap: .55em;
	font-family: var(--display); font-weight: 700; font-size: 1.15rem; line-height: 1;
	padding: .95em 1.5em .85em; border-radius: 999px; text-decoration: none;
	border: 3px solid transparent; transition: transform .15s ease, background-color .15s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 1.2em; height: 1.2em; flex: none; }
.btn--sun { background: var(--sun); color: var(--plum); }
.btn--sun:hover { background: var(--sun-soft); color: var(--plum); }
.btn--ghost { border-color: rgba(255,255,255,.55); color: var(--white); }
.btn--ghost:hover { border-color: var(--white); color: var(--white); }
.btn--plum { background: var(--plum); color: var(--white); }
.btn--plum:hover { background: var(--plum-2); color: var(--white); }

/* ---------- Header ---------- */
.site-header { background: var(--plum); color: var(--white); position: relative; z-index: 20; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-block: 14px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--white); }
.brand img { width: 64px; height: 64px; border-radius: 50%; }
.brand__name { font-family: var(--display); font-weight: 800; font-size: 1.45rem; line-height: 1; }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 4px; }
.main-nav a {
	display: block; padding: 10px 14px; border-radius: 999px; color: var(--white);
	text-decoration: none; font-weight: 700; font-size: 1.02rem;
}
.main-nav a:hover, .main-nav .current-menu-item > a, .main-nav a[aria-current="page"] { background: rgba(255,255,255,.12); color: var(--white); }
.header-cta { display: flex; align-items: center; gap: 10px; }
.header-cta .btn { font-size: 1rem; padding: .8em 1.2em .72em; }
.nav-toggle {
	display: none; background: transparent; border: 2px solid rgba(255,255,255,.4); color: var(--white);
	width: 46px; height: 46px; border-radius: 50%; cursor: pointer; padding: 0;
}
.nav-toggle svg { width: 22px; height: 22px; margin: auto; }

@media (max-width: 900px) {
	.nav-toggle { display: grid; place-items: center; }
	.main-nav {
		position: absolute; inset: 100% 0 auto 0; background: var(--plum);
		padding: 8px var(--gutter) 24px; display: none; border-top: 1px solid rgba(255,255,255,.1);
	}
	.main-nav.is-open { display: block; }
	.main-nav ul { flex-direction: column; align-items: stretch; }
	.main-nav a { font-size: 1.15rem; padding: 14px 16px; }
	.header-cta .btn span { display: none; }
	.header-cta .btn { padding: .75em; }
	.brand img { width: 52px; height: 52px; }
}
@media (max-width: 420px) { .brand__name { display: none; } }

/* ---------- Hero ---------- */
.hero {
	position: relative; background: var(--plum); color: var(--white);
	background-image:
		radial-gradient(circle at 20% 30%, rgba(255,255,255,.55) 0 1.2px, transparent 1.6px),
		radial-gradient(circle at 70% 60%, rgba(255,255,255,.35) 0 1px, transparent 1.4px),
		radial-gradient(circle at 40% 80%, rgba(253,210,12,.5) 0 1.3px, transparent 1.8px);
	background-size: 140px 140px, 90px 90px, 210px 210px;
	padding-top: clamp(24px, 4vw, 48px);
	overflow: hidden;
}
.hero__grid {
	display: grid; grid-template-columns: 1.05fr 1fr; align-items: center; gap: clamp(16px, 4vw, 56px);
	min-height: min(78vh, 720px);
}
.hero__copy { padding-bottom: clamp(48px, 8vw, 110px); position: relative; z-index: 2; }
.hero__copy p { font-size: clamp(1.1rem, 1.6vw, 1.3rem); max-width: 34em; color: rgba(255,255,255,.88); }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.planet { position: relative; align-self: end; aspect-ratio: 1 / 1.08; width: 100%; max-width: 560px; justify-self: center; }
.planet__ball {
	position: absolute; left: 6%; right: 6%; bottom: -18%; aspect-ratio: 1;
	border-radius: 50%;
	background:
		radial-gradient(circle at 32% 28%, #fff3a6 0 8%, transparent 30%),
		radial-gradient(circle at 70% 75%, rgba(255,122,61,.35) 0 18%, transparent 45%),
		var(--sun);
	box-shadow: inset -24px -30px 0 rgba(255,122,61,.25);
}
.planet__ring {
	position: absolute; left: -4%; right: -4%; top: 34%; aspect-ratio: 2.6 / 1;
	border: 3px dashed rgba(255,255,255,.4); border-radius: 50%; transform: rotate(-14deg);
	pointer-events: none;
}
.planet__rocket {
	position: absolute; width: 54px; height: 54px; top: 6%; right: 6%;
	transform: rotate(48deg);
}
.planet__phil {
	position: absolute; bottom: -14%; left: 50%; transform: translateX(-50%);
	width: 74%; z-index: 1; filter: drop-shadow(0 18px 24px rgba(20,6,40,.35));
}
.planet__sticker {
	position: absolute; z-index: 3; top: 16%; left: 0;
	width: clamp(108px, 13vw, 150px); aspect-ratio: 1; border-radius: 50%;
	background: var(--tangerine); color: var(--white);
	display: grid; place-items: center; text-align: center;
	font-family: var(--display); font-weight: 800; font-size: clamp(.95rem, 1.35vw, 1.2rem); line-height: 1.05;
	padding: 14px; transform: rotate(-10deg);
	box-shadow: 0 0 0 6px var(--plum);
}
/* One moment of motion: Phil "lands" and pops up out of his planet when the page opens. */
@media (prefers-reduced-motion: no-preference) {
	.planet__phil { animation: land .9s cubic-bezier(.2, 1.4, .4, 1) .15s both; }
	.planet__sticker { animation: pop .5s cubic-bezier(.2, 1.6, .4, 1) .85s both; }
}
@keyframes land { from { transform: translate(-50%, 28%); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes pop { from { transform: rotate(-10deg) scale(0); } to { transform: rotate(-10deg) scale(1); } }

.hero__wave { display: block; width: 100%; height: clamp(40px, 6vw, 90px); margin-top: -1px; color: var(--mist); position: relative; z-index: 2; }

@media (max-width: 860px) {
	.hero__grid { grid-template-columns: 1fr; min-height: 0; text-align: left; }
	.hero__copy { padding-bottom: 8px; }
	.planet { max-width: 420px; margin-top: -36px; }
}

/* ---------- Sections ---------- */
.section { padding-block: var(--space); }
.section--mist { background: var(--mist); }
.section--purple { background: var(--purple); color: var(--white); }
.section--sun { background: var(--sun); color: var(--plum); }
.section__head { max-width: 46rem; margin-bottom: clamp(28px, 4vw, 48px); }
.section__head p { color: var(--ink-soft); font-size: 1.2rem; }
.section--purple .section__head p { color: rgba(255,255,255,.88); }

/* ---------- Video rows ---------- */
.shelf { margin-bottom: clamp(36px, 5vw, 56px); }
.shelf:last-child { margin-bottom: 0; }
.shelf__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.shelf__head h3 { margin: 0; display: flex; align-items: center; gap: 12px; }
.shelf__dot { width: 18px; height: 18px; border-radius: 50%; flex: none; }
.shelf__more { font-weight: 800; white-space: nowrap; }
.shelf__track {
	display: grid; grid-auto-flow: column; grid-auto-columns: clamp(250px, 28vw, 340px);
	gap: clamp(14px, 2vw, 22px); overflow-x: auto; scroll-snap-type: x mandatory;
	padding: 6px 4px 18px; margin-inline: -4px; scrollbar-width: thin; scrollbar-color: var(--purple) transparent;
	overscroll-behavior-x: contain;
}
.tile { scroll-snap-align: start; margin: 0; }
.tile__screen {
	position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; padding: 0; cursor: pointer;
	border-radius: var(--r-md); overflow: hidden; background: var(--plum);
	box-shadow: 0 0 0 4px var(--white);
}
.tile__screen img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.tile__screen:hover img { transform: scale(1.04); }
.tile__play {
	position: absolute; right: 12px; bottom: 12px; width: 52px; height: 52px; border-radius: 50%;
	background: var(--sun); display: grid; place-items: center; box-shadow: 0 4px 0 rgba(43,18,71,.35);
}
.tile__play svg { width: 22px; height: 22px; margin-left: 3px; color: var(--plum); }
.tile__screen iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.tile figcaption { font-weight: 800; font-size: 1.05rem; line-height: 1.3; margin-top: 12px; padding-inline: 2px; }

/* ---------- Places collage ---------- */
.places { display: grid; grid-template-columns: 1.4fr 1fr; grid-template-rows: auto auto; gap: clamp(14px, 2vw, 22px); }
.place { position: relative; margin: 0; border-radius: var(--r-lg); overflow: hidden; background: var(--mist); }
.place img { width: 100%; height: 100%; object-fit: cover; }
.place--big { grid-row: span 2; }
.place figcaption {
	position: absolute; left: 16px; bottom: 16px; background: var(--white); color: var(--plum);
	font-weight: 800; padding: 8px 14px; border-radius: 999px; font-size: 1rem;
}
.places__text { max-width: 40rem; }
@media (max-width: 760px) {
	.places { grid-template-columns: 1fr; }
	.place--big { grid-row: auto; }
}

/* ---------- Story ---------- */
.story { display: grid; grid-template-columns: minmax(220px, 380px) 1fr; gap: clamp(28px, 5vw, 72px); align-items: center; }
.story__logo { width: 100%; max-width: 380px; border-radius: 50%; box-shadow: 0 0 0 10px rgba(255,255,255,.14); }
.story p { font-size: 1.2rem; color: rgba(255,255,255,.92); max-width: 36em; }
.story .tile { max-width: 520px; margin-top: 24px; }
.story .tile__screen { box-shadow: 0 0 0 4px var(--sun); }
@media (max-width: 760px) {
	.story { grid-template-columns: 1fr; }
	.story__logo { max-width: 220px; }
}

/* ---------- Grown-ups ---------- */
.grownups { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 5vw, 72px); align-items: start; }
.promises { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.promises li { display: grid; grid-template-columns: 36px 1fr; gap: 14px; align-items: start; }
.promises svg { width: 36px; height: 36px; }
.promises strong { display: block; font-family: var(--display); font-size: 1.25rem; line-height: 1.2; margin-bottom: 2px; }
.promises span { color: var(--ink-soft); }
@media (max-width: 760px) { .grownups { grid-template-columns: 1fr; } }

/* ---------- Subscribe band ---------- */
.band { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.band h2 { margin: 0 0 .2em; }
.band p { margin: 0; font-size: 1.2rem; max-width: 34em; }

/* ---------- Page header + content ---------- */
.page-hero { background: var(--plum); color: var(--white); padding-block: clamp(48px, 7vw, 96px) clamp(40px, 5vw, 64px); }
.page-hero h1 { font-size: clamp(2.4rem, 5.4vw, 4rem); margin: 0; }
.page-hero p { font-size: 1.25rem; color: rgba(255,255,255,.88); max-width: 38em; margin: 14px 0 0; }
.prose { max-width: 72ch; }
.prose h2 { font-size: clamp(1.7rem, 3vw, 2.3rem); margin-top: 1.6em; }
.prose h3 { margin-top: 1.4em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: .4em; }
.prose img { border-radius: var(--r-md); }
.prose .wp-block-button__link { background: var(--sun); color: var(--plum); border-radius: 999px; font-family: var(--display); font-weight: 700; }

/* ---------- Footer ---------- */
.site-footer { background: var(--plum); color: rgba(255,255,255,.85); padding-block: clamp(48px, 6vw, 80px) 28px; }
.site-footer a { color: var(--white); text-decoration: none; }
.site-footer a:hover { color: var(--sun); }
.footer__grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 32px; }
.footer__brand img { width: 84px; height: 84px; border-radius: 50%; margin-bottom: 14px; }
.footer__brand p { max-width: 26em; }
.site-footer h2 { font-size: 1.25rem; color: var(--sun); margin-bottom: 12px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.socials a { display: inline-flex; align-items: center; gap: 10px; }
.socials svg { width: 22px; height: 22px; }
.footer__small {
	margin-top: 40px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.12);
	display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; font-size: .95rem;
}
@media (max-width: 760px) { .footer__grid { grid-template-columns: 1fr; } }

/* ---------- Brain Box meter ---------- */
.brainbox {
	width: 100%; max-width: 400px; justify-self: center;
	background: var(--plum); border-radius: var(--r-lg); padding: 14px;
	box-shadow: 0 0 0 6px rgba(255,255,255,.14), 0 18px 0 -6px rgba(43,18,71,.45);
}
.brainbox__screen {
	border-radius: 22px; padding: 26px 24px 22px;
	background: radial-gradient(120% 90% at 50% 0%, #3d1d63 0%, #1d0b33 100%);
	border: 2px solid rgba(253,210,12,.35); color: var(--white); text-align: center;
}
.brainbox .brainbox__label { font-family: var(--display); font-weight: 700; font-size: 1.15rem; color: var(--sun); margin: 0; }
.brainbox .brainbox__pct { font-family: var(--display); font-weight: 800; font-size: clamp(3.6rem, 8vw, 5rem); line-height: 1; margin: 6px 0 14px; }
.brainbox__bar { display: grid; grid-template-columns: repeat(20, 1fr); gap: 4px; margin-bottom: 14px; }
.brainbox__bar span { height: 18px; border-radius: 4px; background: rgba(255,255,255,.12); }
.brainbox__bar span.is-on { background: var(--sun); box-shadow: 0 0 10px rgba(253,210,12,.55); }
.brainbox .brainbox__note { font-size: .98rem; color: rgba(255,255,255,.8); margin: 0; }
.story .brainbox { margin: 0 auto; }

/* ---------- Crew ---------- */
.cast { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(16px, 2.4vw, 28px); }
.cast__card { margin: 0; }
.cast__badge {
	display: grid; place-items: center; width: 120px; height: 120px; border-radius: 50%;
	margin-bottom: 16px; overflow: hidden;
}
.cast__badge svg { width: 60px; height: 60px; }
.cast__phil { width: 100%; height: 100%; object-fit: cover; object-position: 50% 8%; transform: scale(1.35) translateY(14%); }
.cast__card h3 { margin-bottom: .3em; }
.cast__card p { color: var(--ink-soft); font-size: 1.05rem; }
@media (max-width: 980px) { .cast { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .cast { grid-template-columns: 1fr; } .cast__card { display: grid; grid-template-columns: 88px 1fr; gap: 0 16px; } .cast__badge { width: 88px; height: 88px; grid-row: span 2; } .cast__badge svg { width: 44px; height: 44px; } }

/* ---------- Story chapters ---------- */
.page-hero--story { background-image: radial-gradient(circle at 20% 30%, rgba(255,255,255,.5) 0 1.2px, transparent 1.6px), radial-gradient(circle at 70% 60%, rgba(253,210,12,.45) 0 1.2px, transparent 1.7px); background-size: 140px 140px, 210px 210px; }
.chapters { list-style: none; margin: 0 auto; padding: 0; max-width: 820px; position: relative; }
.chapters::before { content: ""; position: absolute; left: 43px; top: 20px; bottom: 20px; border-left: 3px dashed #d9c8ec; }
.chapter { position: relative; display: grid; grid-template-columns: 88px 1fr; gap: clamp(18px, 3vw, 32px); align-items: start; padding-bottom: clamp(32px, 5vw, 56px); }
.chapter:last-child { padding-bottom: 0; }
.chapter__icon {
	position: relative; z-index: 1; width: 88px; height: 88px; border-radius: 50%;
	background: var(--mist); display: grid; place-items: center; box-shadow: 0 0 0 6px var(--white);
}
.chapter__icon svg { width: 52px; height: 52px; }
.chapter__icon--rocket { background: var(--plum); }
.chapter__num { font-family: var(--display); font-weight: 700; color: var(--purple); margin: 10px 0 2px; }
.chapter__body h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin-bottom: .35em; }
.chapter__body p:last-child { font-size: 1.15rem; max-width: 40em; }
@media (max-width: 520px) {
	.chapter { grid-template-columns: 56px 1fr; gap: 14px; }
	.chapter__icon { width: 56px; height: 56px; box-shadow: 0 0 0 4px var(--white); }
	.chapter__icon svg { width: 32px; height: 32px; }
	.chapters::before { left: 27px; }
	.chapter__num { margin-top: 4px; }
	.chapter__body p:last-child { font-size: 1.05rem; }
}

/* ---------- 404 ---------- */
.lost { text-align: center; padding-block: var(--space); }
.lost img { width: 220px; margin: 0 auto 24px; border-radius: 50%; }
.lost img.lost__art { width: min(380px, 80vw); border-radius: 0; filter: drop-shadow(0 14px 18px rgba(43,18,71,.22)); }
@media (prefers-reduced-motion: no-preference) {
	.lost__art { animation: boing 2.4s ease-in-out infinite; transform-origin: 50% 100%; }
}
@keyframes boing { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg) translateY(-6px); } }

/* ---------- Real artwork (photo cut-outs and 2D art) ---------- */
.places__head { display: grid; grid-template-columns: 1fr minmax(220px, 360px); gap: clamp(16px, 3vw, 40px); align-items: center; margin-bottom: clamp(20px, 3vw, 36px); }
.places__head .section__head { margin-bottom: 0; }
.places__cutout { width: 100%; height: auto; filter: drop-shadow(0 16px 20px rgba(43,18,71,.22)); }
@media (max-width: 760px) {
	.places__head { grid-template-columns: 1fr; }
	.places__cutout { max-width: 300px; justify-self: center; }
}
.cast__face { width: 82%; height: auto; margin-top: 10%; }
.page-hero--art .wrap { display: grid; grid-template-columns: 1fr minmax(200px, 340px); gap: clamp(20px, 4vw, 56px); align-items: end; }
.page-hero--art { padding-bottom: 0; overflow: hidden; }
.page-hero--art .wrap > div { padding-bottom: clamp(40px, 5vw, 64px); }
.page-hero__art { width: 100%; height: auto; margin-bottom: -6%; filter: drop-shadow(0 12px 20px rgba(0,0,0,.3)); }
@media (max-width: 760px) {
	.page-hero--art .wrap { grid-template-columns: 1fr; }
	.page-hero--art .wrap > div { padding-bottom: 8px; }
	.page-hero__art { max-width: 260px; justify-self: center; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
