/*
Theme Name: Coloring
Theme URI: https://example.com
Author: Brock Taylor
Description: Hub-page theme for a free printable coloring pages site.
Version: 0.2.0
Requires at least: 6.7
Requires PHP: 8.2
Text Domain: coloring
*/

/*
 * Concept: coloring outside the lines. Every page thumbnail has a line-art
 * outline with a solid crayon color offset behind it. Everything else is quiet.
 * Fonts are self-hosted variable woff2 (latin subset), OFL licensed, see assets/fonts/.
 */

@font-face {
	font-family: "Atkinson Hyperlegible Next";
	font-style: normal;
	font-weight: 200 800;
	font-display: swap;
	src: url("assets/fonts/atkinson-hyperlegible-next-latin.woff2") format("woff2");
}
@font-face {
	font-family: "Grandstander";
	font-style: normal;
	font-weight: 100 900;
	font-display: swap;
	src: url("assets/fonts/grandstander-latin.woff2") format("woff2");
}

:root {
	--ink: #1c2a4a;        /* navy graphite: text, outlines */
	--ink-soft: #4a5875;   /* secondary text */
	--paper: #ffffff;      /* page background, same white as the printed sheet */
	--wash: #eaf3fb;       /* pale sky: footer and FAQ band */
	--line: #cdd9e8;       /* hairlines */
	--action: #2458c6;     /* buttons and links, 6.4:1 on white */
	--action-dark: #1a439c;

	/* crayon box, used only for the offset behind thumbnails */
	--crayon-red: #ef5a4c;
	--crayon-yellow: #ffc233;
	--crayon-blue: #4aa3ec;
	--crayon-green: #3cb872;
	--crayon-purple: #9a7ae0;

	--font-display: "Grandstander", "Trebuchet MS", sans-serif;
	--font-body: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, sans-serif;

	--max: 1200px;
	--content: 68ch;
	--gutter: clamp(16px, 4vw, 40px);
	--radius: 10px;
	--outline: 3px;
}

* { box-sizing: border-box; }

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

img { max-width: 100%; }

a { color: var(--action); text-underline-offset: .15em; }
a:hover { color: var(--action-dark); }

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

h1, h2, h3 {
	font-family: var(--font-display);
	font-weight: 700;
	line-height: 1.15;
	letter-spacing: -.01em;
	margin: 0 0 .5em;
}
h1 { font-size: clamp(2.25rem, 5.5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 1.875rem); margin-top: 1.6em; }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }

/* ---------- header ---------- */

.site-header,
.site-footer > * {
	max-width: var(--max);
	margin: 0 auto;
	padding: 20px var(--gutter);
}
.site-header {
	display: flex;
	gap: 24px;
	align-items: center;
	justify-content: space-between;
}
.site-title {
	font-family: var(--font-display);
	font-weight: 800;
	font-size: 1.5rem;
	color: var(--ink);
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	gap: 10px;
}
/* three-crayon mark next to the wordmark, pure CSS */
.site-title::before {
	content: "";
	width: 30px;
	height: 22px;
	background:
		linear-gradient(var(--crayon-red), var(--crayon-red)) 0 0 / 100% 6px no-repeat,
		linear-gradient(var(--crayon-yellow), var(--crayon-yellow)) 0 8px / 78% 6px no-repeat,
		linear-gradient(var(--crayon-blue), var(--crayon-blue)) 0 16px / 90% 6px no-repeat;
	border-radius: 2px;
}
.site-header nav ul {
	list-style: none;
	display: flex;
	gap: 28px;
	margin: 0;
	padding: 0;
}
.site-header nav a {
	color: var(--ink);
	font-weight: 700;
	text-decoration: none;
}
.site-header nav a:hover { text-decoration: underline; text-decoration-thickness: 3px; text-decoration-color: var(--crayon-yellow); }

/* ---------- layout ---------- */

main {
	max-width: var(--max);
	margin: 0 auto;
	padding: 16px var(--gutter) 64px;
}
.prose { max-width: var(--content); }
.prose h2 { font-size: 1.5rem; }

/* ---------- buttons ---------- */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 48px;
	padding: 10px 22px;
	border-radius: var(--radius);
	background: var(--action);
	color: #fff;
	font-weight: 700;
	font-size: 1rem;
	text-decoration: none;
	border: 0;
}
.btn:hover { background: var(--action-dark); color: #fff; }
.btn.secondary { background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.btn.secondary:hover { background: var(--wash); color: var(--ink); }

/* download glyph, drawn with CSS so the markup stays as-is */
.hub-card .btn::before {
	content: "";
	width: 18px;
	height: 18px;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12M6 10l6 6 6-6M4 20h16'/%3E%3C/svg%3E") center / contain no-repeat;
	        mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12M6 10l6 6 6-6M4 20h16'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---------- the signature: outlined sheet with a crayon offset ---------- */

.hub-card > a,
.set-card img,
.hero-sheets img {
	display: block;
	background: #fff;
	border: var(--outline) solid var(--ink);
	border-radius: 6px;
	box-shadow: 8px 8px 0 var(--sheet-color, var(--crayon-yellow));
}
.hub-card > a,
.set-card a { transition: transform .15s ease, box-shadow .15s ease; }

/* crayon rotation, five colors so neighbors never match in any column count */
.hub-card:nth-child(5n+1), .set-card:nth-child(5n+1) { --sheet-color: var(--crayon-yellow); }
.hub-card:nth-child(5n+2), .set-card:nth-child(5n+2) { --sheet-color: var(--crayon-blue); }
.hub-card:nth-child(5n+3), .set-card:nth-child(5n+3) { --sheet-color: var(--crayon-red); }
.hub-card:nth-child(5n+4), .set-card:nth-child(5n+4) { --sheet-color: var(--crayon-green); }
.hub-card:nth-child(5n+5), .set-card:nth-child(5n+5) { --sheet-color: var(--crayon-purple); }

/* ---------- hub page ---------- */

.hub article > header h1 { margin-top: .4em; }
.hub article > header > p:first-of-type { font-size: 1.25rem; }
.hub-more { margin-top: 24px; }
.hub-more > h2:first-child { margin-top: .6em; }

.hub-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
	gap: 44px 32px;
	margin: 48px 0 24px;
	padding-right: 8px; /* room for the offset */
}
.hub-card {
	margin: 0;
	display: flex;
	flex-direction: column;
}
.hub-card img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1103 / 1426;
	object-fit: contain;
	border-radius: 3px;
}
.hub-card > a:hover {
	transform: translate(3px, 3px);
	box-shadow: 5px 5px 0 var(--sheet-color);
}
.hub-card figcaption {
	margin: 18px 0 12px;
	font-weight: 700;
	line-height: 1.35;
	flex: 1;
}
.hub-card .downloads { display: flex; gap: 8px; }
.hub-card .downloads .btn { flex: 1; }

/* FAQ sits on a wash band so it reads as help, apart from the pages */
.faq {
	max-width: none;
	margin: 56px calc(var(--gutter) * -1) 0;
	padding: 8px var(--gutter) 32px;
	background: var(--wash);
	border-radius: 16px;
}
.faq > * { max-width: var(--content); }
.faq details { border-bottom: 2px solid var(--line); }
.faq summary {
	list-style: none;
	cursor: pointer;
	font-weight: 700;
	padding: 16px 40px 16px 0;
	position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
	content: "+";
	position: absolute;
	right: 4px;
	top: 50%;
	translate: 0 -50%;
	font-family: var(--font-display);
	font-size: 1.75rem;
	line-height: 1;
	color: var(--action);
	transition: rotate .15s ease;
}
.faq details[open] summary::after { rotate: 45deg; }
.faq details > div { padding-bottom: 8px; color: var(--ink-soft); }

.related { margin-top: 56px; }
.related h2 { margin-top: 0; }

.ad-slot { min-height: 90px; margin: 32px 0; }

/* ---------- set cards (home, archive, related) ---------- */

.set-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 44px 32px;
	padding-right: 8px;
}
.set-card a { display: block; color: inherit; text-decoration: none; }
.set-card img {
	width: 100%;
	height: auto;
	aspect-ratio: 17 / 22;
	object-fit: cover;
	object-position: top;
}
.set-card h3 { margin: 18px 0 2px; }
.set-card .count { margin: 0; color: var(--ink-soft); font-size: 1rem; }
.set-card a:hover img { transform: translate(3px, 3px); box-shadow: 5px 5px 0 var(--sheet-color); }
.set-card a:hover h3 { text-decoration: underline; text-decoration-thickness: 3px; text-decoration-color: var(--sheet-color); text-underline-offset: .2em; }
.set-card img { transition: transform .15s ease, box-shadow .15s ease; }

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

.home-hero {
	display: grid;
	grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
	gap: 48px;
	align-items: center;
	padding: 32px 0 72px;
}
.home-hero h1 { font-size: clamp(2.5rem, 5vw, 3.75rem); max-width: 15ch; }
.home-hero .lede { font-size: 1.25rem; color: var(--ink-soft); max-width: 34ch; }
.home-hero .btn { margin-top: 8px; }

.hero-sheets {
	position: relative;
	height: 420px;
}
.hero-sheets img {
	position: absolute;
	width: 58%;
	height: auto;
	aspect-ratio: 1103 / 1426;
	object-fit: contain;
}
.hero-sheets img:nth-child(1) { left: 0;   top: 40px; rotate: -7deg; --sheet-color: var(--crayon-blue); }
.hero-sheets img:nth-child(2) { left: 42%; top: 0;    rotate: 5deg;  --sheet-color: var(--crayon-red); }
.hero-sheets img:nth-child(3) { left: 20%; top: 110px; rotate: -1deg; --sheet-color: var(--crayon-yellow); z-index: 1; }

.home .section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.home .section-head h2 { margin: 0; }
.home > p:last-child { margin-top: 48px; }

/* ---------- archive ---------- */

.archive h1 { margin: .4em 0 1em; }
.pagination { margin-top: 48px; display: flex; gap: 8px; }

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

.site-footer {
	background: var(--wash);
	margin-top: 48px;
}
.site-footer p { margin: 0 auto; padding-top: 32px; padding-bottom: 32px; color: var(--ink-soft); font-size: 1rem; }
.site-footer a { color: var(--ink); font-weight: 700; }

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

@media (max-width: 760px) {
	.site-header { flex-wrap: wrap; gap: 8px 24px; }
	.home-hero { grid-template-columns: 1fr; gap: 24px; padding-bottom: 48px; }
	.hero-sheets { height: 300px; max-width: 420px; }
	.hub-grid, .set-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 20px; }
	.hub-card > a, .set-card img, .hero-sheets img { box-shadow: 5px 5px 0 var(--sheet-color, var(--crayon-yellow)); }
	.hub-card figcaption { font-size: 1rem; }
	.hub-card .btn { padding: 10px 12px; }
}

@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; }
}

@media print {
	.site-header nav, .site-footer, .faq, .related, .downloads { display: none; }
}
