/* PFeng Studio — pfengstudio.com root page.
   A file rather than an inline <style> so the CSP in _headers can keep
   style-src at 'self'. Nunito is the Todofun site's self-hosted copy. */

@font-face {
	font-family: 'Nunito';
	font-style: normal;
	font-display: swap;
	font-weight: 200 1000;
	src: url('/todofun/fonts/nunito-latin.woff2') format('woff2-variations');
	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;
}

/* Layout: words left, a field of everyday doodles right; a ribbon of tiny
   chores; a tickable list that grows a tree; then the apps. Every drawn
   thing uses the Todofun check's fat rounded gradient stroke. */
:root {
	--paper: #fcfaf6;
	--card: #ffffff;
	--ink: #241b33;
	--muted: #645a72;
	--soft: #cdc1da;
	--line: rgba(36, 27, 51, 0.12);

	/* the Todofun check: grape → pink → tangerine, plus its sparkle and dot */
	--grape: #b98be0;
	--pink: #ff5c9e;
	--tang: #ff9f45;
	--sun: #ffc23d;
	--leaf: #5fbf77;

	/* deeper stops for gradient text, so it holds contrast on paper */
	--t1: #8e5bd0;
	--t2: #e2337c;
	--t3: #e0650f;

	--btn-ink: #1f1426;
	--shadow: 0 18px 40px rgba(36, 27, 51, 0.1);

	--font: 'Nunito', ui-rounded, system-ui, -apple-system, 'Segoe UI', sans-serif;
	--spring: cubic-bezier(0.34, 1.56, 0.64, 1);
	--ease: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme='light']) {
		--paper: #14101b;
		--card: #1e1828;
		--ink: #f5f0fa;
		--muted: #aea4bb;
		--soft: #4c4160;
		--line: rgba(245, 240, 250, 0.12);
		--t1: #c9a2f0;
		--t2: #ff7ab0;
		--t3: #ffb066;
		--shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
		color-scheme: dark;
	}
}
:root[data-theme='dark'] {
	--paper: #14101b;
	--card: #1e1828;
	--ink: #f5f0fa;
	--muted: #aea4bb;
	--soft: #4c4160;
	--line: rgba(245, 240, 250, 0.12);
	--t1: #c9a2f0;
	--t2: #ff7ab0;
	--t3: #ffb066;
	--shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
	color-scheme: dark;
}

* { box-sizing: border-box; }

body {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font-family: var(--font);
	font-size: 1.0625rem;
	line-height: 1.6;
	overflow-x: hidden;
	-webkit-font-smoothing: antialiased;
}

a { color: inherit; }
:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; border-radius: 8px; }

.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.s1 { stop-color: var(--grape); }
.s2 { stop-color: var(--pink); }
.s3 { stop-color: var(--tang); }

.wrap {
	max-width: 1160px;
	margin-inline: auto;
	padding-inline: clamp(16px, 4vw, 40px);
}

.eyebrow {
	margin: 0;
	font-size: 0.8rem;
	font-weight: 800;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--muted);
}

h1, h2, h3 { margin: 0; font-weight: 900; text-wrap: balance; }
h2 { font-size: clamp(2rem, 4.6vw, 3.2rem); line-height: 1.02; letter-spacing: -0.025em; }
h3 { font-size: 1.6rem; letter-spacing: -0.01em; }

/* ---------- top bar ---------- */

.top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding-block: 22px;
}
.brand {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	font-weight: 900;
	font-size: 1.1rem;
	text-decoration: none;
	letter-spacing: -0.01em;
}
.brand-mark { width: 26px; height: 26px; fill: var(--sun); transition: transform 0.6s var(--spring); }
.brand:hover .brand-mark { transform: rotate(90deg) scale(1.15); }
.top-links { display: flex; gap: 22px; font-weight: 700; }
.top-links a { text-decoration: none; color: var(--muted); white-space: nowrap; }
.top-links a:hover { color: var(--ink); }

/* Language menu, right after the logo. The same chip as the Todofun nav
   (.lang-menu in src/styles/global.css), in this page's colours. */
.nav-start { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand { white-space: nowrap; }
.lang-menu { position: relative; font-weight: 800; font-size: 0.85rem; }
.lang-menu summary {
	display: flex;
	align-items: center;
	gap: 5px;
	padding: 5px 10px 5px 8px;
	border: 1.5px solid var(--line);
	border-radius: 999px;
	background: rgba(185, 139, 224, 0.12);
	color: var(--muted);
	cursor: pointer;
	list-style: none;
}
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary:hover, .lang-menu[open] summary { color: var(--ink); }
.lang-menu summary::after {
	content: '';
	width: 0.36em;
	height: 0.36em;
	margin-left: 2px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: translateY(-0.12em) rotate(45deg);
}
.lang-menu[open] summary::after { transform: translateY(0.1em) rotate(-135deg); }
.lang-menu svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.lang-menu ul {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	z-index: 60;
	min-width: 10.5rem;
	margin: 0;
	padding: 6px;
	list-style: none;
	font-size: 0.95rem;
	font-weight: 700;
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: 14px;
	box-shadow: var(--shadow);
}
.lang-menu ul a {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	padding: 7px 11px;
	border-radius: 9px;
	text-decoration: none;
}
.lang-menu ul a:hover, .lang-menu ul a[aria-current='page'] { background: rgba(185, 139, 224, 0.14); }
.lang-menu ul a[aria-current='page']::after { content: '✓'; color: var(--pink); }

.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* ---------- hero ---------- */

.hero {
	display: grid;
	grid-template-columns: 1.05fr 1fr;
	align-items: center;
	gap: clamp(24px, 5vw, 72px);
	padding-block: clamp(16px, 5vw, 64px) clamp(40px, 6vw, 88px);
}
.hero-copy { display: flex; flex-direction: column; gap: 22px; min-width: 0; }

h1 {
	font-size: clamp(3.1rem, 7.4vw, 6.2rem);
	line-height: 0.95;
	letter-spacing: -0.035em;
}
h1 .line { display: block; }
.w {
	display: inline-block;
	animation: drop 0.9s var(--spring) both;
	transform-origin: 50% 100%;
}
.w1 { animation-delay: 0.05s; }
.w2 { animation-delay: 0.15s; }
.w3 { animation-delay: 0.28s; }
.w4 { animation-delay: 0.4s; }
@keyframes drop {
	from { transform: translateY(-0.45em) rotate(-6deg) scaleY(1.08); }
	60% { transform: translateY(0.04em) rotate(1deg) scaleY(0.94); }
	to { transform: none; }
}

.fun {
	position: relative;
	background: linear-gradient(100deg, var(--t1), var(--t2) 55%, var(--t3));
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
	padding-right: 0.06em;
}
.swoosh {
	position: absolute;
	left: -2%;
	bottom: -0.16em;
	width: 96%;
	height: 0.3em;
	overflow: visible;
}
.swoosh path {
	fill: none;
	stroke: url(#g-line);
	stroke-width: 9;
	stroke-linecap: round;
	stroke-dasharray: 1;
	animation: draw 0.7s var(--ease) 1s both;
}
.fun-star {
	position: absolute;
	right: -0.32em;
	top: -0.12em;
	width: 0.42em;
	height: 0.42em;
	fill: var(--sun);
	animation: pop 0.6s var(--spring) 1.55s both, twinkle 3.2s ease-in-out 2.4s infinite;
}
@keyframes pop { from { transform: scale(0) rotate(-90deg); } to { transform: none; } }
@keyframes twinkle { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(0.72) rotate(45deg); } }

.lede { margin: 0; max-width: 34rem; font-size: 1.2rem; color: var(--muted); }

.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 0.8rem 1.5rem;
	border-radius: 999px;
	font: inherit;
	font-weight: 800;
	text-decoration: none;
	cursor: pointer;
	transition: transform 0.35s var(--spring), box-shadow 0.25s ease, background-color 0.2s ease;
}
.btn:hover { transform: translateY(-3px) rotate(-1.5deg); }
.btn:active { transform: translateY(1px) scale(0.97); }
.btn-primary {
	border: 0;
	background: linear-gradient(120deg, var(--pink), var(--tang));
	color: var(--btn-ink);
	box-shadow: 0 10px 24px rgba(255, 92, 158, 0.3);
}
.btn-primary:hover { box-shadow: 0 14px 30px rgba(255, 92, 158, 0.42); }
.btn-quiet { border: 2px solid var(--line); background: var(--card); color: var(--ink); }
.btn-quiet:hover { border-color: var(--soft); }
.btn-small { padding: 0.5rem 1.1rem; font-size: 0.95rem; }

.hint { margin: 0; font-size: 0.95rem; font-weight: 700; color: var(--muted); }

/* ---------- doodle field ---------- */

.field {
	position: relative;
	width: 100%;
	max-width: 540px;
	aspect-ratio: 1;
	justify-self: center;
	touch-action: manipulation;
}
.doodle {
	position: absolute;
	left: var(--x);
	top: var(--y);
	width: var(--size);
	cursor: pointer;
	will-change: transform;
}
.float { animation: bob var(--bob, 6s) ease-in-out var(--delay) infinite alternate; transform: rotate(var(--tilt)); }
@keyframes bob {
	from { transform: translateY(-7px) rotate(calc(var(--tilt) - 3deg)); }
	to { transform: translateY(7px) rotate(calc(var(--tilt) + 3deg)); }
}
.doodle svg { display: block; width: 100%; height: auto; overflow: visible; }
.doodle svg.boing { animation: boing 0.7s var(--spring); }
@keyframes boing {
	0% { transform: scale(1); }
	25% { transform: scale(1.28, 0.8); }
	55% { transform: scale(0.88, 1.16) rotate(-8deg); }
	100% { transform: scale(1); }
}

.doodle :is(path, circle, rect) {
	fill: none;
	stroke: url(#g-ink);
	stroke-width: 7;
	stroke-linecap: round;
	stroke-linejoin: round;
}
.doodle .c-soft { stroke: var(--soft); }
.doodle .c-sun { stroke: var(--sun); }
.doodle .c-leaf { stroke: var(--leaf); }

/* each stroke draws itself in on load; at rest it is fully drawn */
.doodle .dr { stroke-dasharray: 1; animation: draw 1.1s var(--ease) var(--delay) both; }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

.d-mug   { --x: 3%;  --y: 5%;  --size: 24%; --tilt: -8deg; --delay: 0.5s; --bob: 5.2s; }
.d-plane { --x: 38%; --y: 0%;  --size: 22%; --tilt: 6deg;  --delay: 0.6s; --bob: 6.4s; }
.d-sun   { --x: 73%; --y: 4%;  --size: 24%; --tilt: 0deg;  --delay: 0.7s; --bob: 7s; }
.d-key   { --x: 0%;  --y: 40%; --size: 24%; --tilt: -22deg; --delay: 0.8s; --bob: 5.8s; }
.d-check { --x: 33%; --y: 33%; --size: 33%; --tilt: -4deg; --delay: 0.9s; --bob: 4.6s; }
.d-plant { --x: 73%; --y: 35%; --size: 25%; --tilt: 4deg;  --delay: 1s;   --bob: 6.6s; }
.d-toast { --x: 6%;  --y: 72%; --size: 23%; --tilt: 8deg;  --delay: 1.1s; --bob: 5.4s; }
.d-sock  { --x: 40%; --y: 72%; --size: 22%; --tilt: 14deg; --delay: 1.2s; --bob: 6.2s; }
.d-milk  { --x: 75%; --y: 70%; --size: 22%; --tilt: -6deg; --delay: 1.3s; --bob: 5s; }

.steam { animation: steam 2.6s ease-in-out infinite; }
@keyframes steam { 0%, 100% { transform: translateY(0); opacity: 1; } 50% { transform: translateY(-5px); opacity: 0.55; } }
.rays { transform-origin: 60px 60px; animation: spin 18s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.leaves { transform-origin: 60px 74px; animation: sway 3.4s ease-in-out infinite alternate; }
@keyframes sway { from { transform: rotate(-7deg); } to { transform: rotate(7deg); } }

/* the centre checkbox ticks itself on a loop (studio.js adds .ticked) */
.d-check .tick {
	stroke-width: 11;
	stroke-dasharray: 1;
	stroke-dashoffset: 1;
	transition: stroke-dashoffset 0.3s ease-in;
}
.d-check.ticked .tick { stroke-dashoffset: 0; transition: stroke-dashoffset 0.45s var(--ease); }
.d-check .star,
.d-check .dot {
	stroke: none;
	transform-box: fill-box;
	transform-origin: center;
	transform: scale(0);
	transition: transform 0.25s ease-in;
}
.d-check .star { fill: var(--sun); }
.d-check .dot { fill: var(--leaf); }
.d-check.ticked .star { transform: scale(1); transition: transform 0.5s var(--spring) 0.35s; }
.d-check.ticked .dot { transform: scale(1); transition: transform 0.5s var(--spring) 0.5s; }

/* the sprout from the app icon pushes up after each tick */
.d-check .sprout :is(path, ellipse) { fill: var(--leaf); stroke: none; }
.d-check .sprout .stem { fill: none; stroke: var(--leaf); stroke-width: 4; }
.d-check .sprout {
	transform-box: fill-box;
	transform-origin: 50% 100%;
	transform: scale(0.2, 0);
	transition: transform 0.25s ease-in;
}
.d-check.ticked .sprout { transform: none; transition: transform 0.6s var(--spring) 0.7s; }

/* ---------- ribbon ---------- */

.ribbon {
	overflow: hidden;
	border-block: 2px solid var(--line);
	background: var(--card);
	padding-block: 18px;
	transform: rotate(-1.2deg);
	margin-inline: -2%;
}
.ribbon-track {
	display: flex;
	width: max-content;
	animation: slide 38s linear infinite;
}
.ribbon:hover .ribbon-track { animation-play-state: paused; }
.ribbon span {
	display: inline-flex;
	align-items: center;
	gap: 28px;
	padding-right: 28px;
	font-size: clamp(1.2rem, 2.4vw, 1.6rem);
	font-weight: 900;
	letter-spacing: -0.01em;
	white-space: nowrap;
}
.ribbon span::after {
	content: '';
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--grape), var(--pink), var(--tang));
}
@keyframes slide { to { transform: translateX(-50%); } }

/* ---------- try it ---------- */

.try {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: clamp(32px, 6vw, 88px);
	align-items: center;
	padding-block: clamp(72px, 10vw, 128px) clamp(48px, 8vw, 96px);
}
.try-copy { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.try-copy p:not(.eyebrow) { margin: 0; max-width: 32rem; color: var(--muted); font-size: 1.15rem; }

.today {
	background: var(--card);
	border: 2px solid var(--line);
	border-radius: 32px;
	padding: clamp(20px, 3vw, 32px);
	box-shadow: var(--shadow);
	min-width: 0;
}
.today-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.today-title { font-size: 1.5rem; font-weight: 900; }
.today-count { font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }

.tree { position: relative; width: min(220px, 70%); aspect-ratio: 1; margin: 4px auto 8px; }
.tree img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	opacity: 0;
	transform: scale(0.85);
	transform-origin: 50% 85%;
	transition: opacity 0.35s ease, transform 0.6s var(--spring);
}
.tree img.on { opacity: 1; transform: none; }

.tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.task {
	position: relative;
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 10px 12px;
	border-radius: 16px;
	cursor: pointer;
	font-weight: 700;
	font-size: 1.1rem;
	transition: background-color 0.2s ease;
}
.task:hover { background: color-mix(in srgb, var(--soft) 22%, transparent); }
.task input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.box {
	flex: none;
	width: 34px;
	height: 34px;
	border-radius: 11px;
	border: 3px solid var(--soft);
	display: grid;
	place-items: center;
	transition: transform 0.4s var(--spring), border-color 0.2s ease, background-color 0.2s ease;
}
.box svg { width: 100%; height: 100%; overflow: visible; }
.box path {
	fill: none;
	stroke: var(--btn-ink);
	stroke-width: 5;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-dasharray: 1;
	stroke-dashoffset: 1;
	transition: stroke-dashoffset 0.35s var(--ease) 0.08s;
}
.task input:checked + .box {
	border-color: transparent;
	background: linear-gradient(135deg, var(--grape), var(--pink) 55%, var(--tang));
	transform: scale(1.12) rotate(-6deg);
}
.task input:checked + .box path { stroke-dashoffset: 0; }
.task input:focus-visible + .box { outline: 3px solid var(--pink); outline-offset: 3px; }
.txt { position: relative; min-width: 0; transition: color 0.3s ease; }
.txt::after {
	content: '';
	position: absolute;
	left: -2px;
	right: -2px;
	top: 55%;
	height: 3px;
	border-radius: 3px;
	background: linear-gradient(90deg, var(--grape), var(--pink), var(--tang));
	transform: scaleX(0);
	transform-origin: left;
	transition: transform 0.4s var(--ease);
}
.task input:checked ~ .txt { color: var(--muted); }
.task input:checked ~ .txt::after { transform: scaleX(1); }

.done {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-top: 16px;
	padding-top: 16px;
	border-top: 2px dashed var(--line);
	animation: pop 0.5s var(--spring);
}
.done p { margin: 0; font-weight: 800; flex: 1 1 16rem; }

/* ---------- apps ---------- */

.apps { display: flex; flex-direction: column; gap: 32px; padding-block: clamp(24px, 4vw, 48px) clamp(64px, 9vw, 112px); }
.apps-head { display: flex; flex-direction: column; gap: 14px; max-width: 40rem; }
.apps-head p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 1.15rem; }

.app-grid { display: grid; gap: 20px; max-width: 760px; }
.app-card {
	display: flex;
	gap: 24px;
	align-items: flex-start;
	padding: clamp(22px, 3vw, 36px);
	border-radius: 32px;
	background: var(--card);
	border: 2px solid var(--line);
	min-width: 0;
}
.app-body { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.app-body p { margin: 0; color: var(--muted); }
.app-body .actions { margin-top: 6px; }
.app-icon {
	flex: none;
	width: 96px;
	height: 96px;
	border-radius: 24px;
	box-shadow: 0 10px 24px rgba(36, 27, 51, 0.16);
	transition: transform 0.5s var(--spring);
}
.app-card:hover .app-icon { transform: rotate(-8deg) scale(1.06); }

/* ---------- footer ---------- */

.foot {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 12px 24px;
	padding-block: 28px 40px;
	border-top: 2px solid var(--line);
	color: var(--muted);
	font-size: 0.95rem;
	font-weight: 600;
}
.foot-links { display: flex; gap: 20px; }
.foot-links a { text-decoration: none; }
.foot-links a:hover { color: var(--ink); text-decoration: underline; }

/* sparkle bursts are drawn on this canvas by studio.js */
.sparkles { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }

/* ---------- small screens ---------- */

@media (max-width: 860px) {
	.hero, .try { grid-template-columns: 1fr; }
	.field { max-width: 420px; }
	.app-card { flex-direction: column; }
}
/* On a phone the globe alone stands for the language menu. */
@media (max-width: 720px) {
	.lang-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (max-width: 480px) {
	.top { gap: 10px; }
	.nav-start { gap: 10px; }
	.top-links { gap: 14px; }
	.brand { flex-shrink: 0; }
	.app-icon { width: 80px; height: 80px; border-radius: 20px; }
}

/* The narrowest phones have no room for both links beside the logo and the
   language menu; Apps is one scroll down anyway. */
@media (max-width: 420px) {
	.top-apps { display: none; }
}

/* ---------- Japanese, Chinese and Korean ----------
   Nunito has no CJK glyphs, so these fall back to the system font, which
   wants its own spacing: no negative tracking, and lines that break at
   phrases rather than mid-word. */

:is(:lang(ja), :lang(zh), :lang(ko)) :is(h1, h2, h3, .eyebrow) { letter-spacing: normal; }
/* Smaller, so a line of six or seven characters still fits the hero column. */
:is(:lang(ja), :lang(zh), :lang(ko)) h1 { line-height: 1.12; font-size: clamp(2.4rem, 5.2vw, 4.2rem); }
:is(:lang(ja), :lang(zh)) body { line-break: strict; }
:lang(ja) :is(h1, h2, h3) { word-break: auto-phrase; }
:lang(ko) body { word-break: keep-all; }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation: none !important;
		transition: none !important;
	}
	.btn:hover { transform: none; }
}
