/*
Theme Name: PrettyJaded
Theme URI: https://prettyjaded.co.uk/
Author: Jamie
Description: A reading-first theme for PrettyJaded. Five stage colours for the five PANDA stages, a ribbon that fills as you read, and XP, levels and badges for signed-in readers.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: prettyjaded
*/

/* ---------- Tokens ---------- */
:root {
	--ink: #14161f;
	--paper: #fbfbfd;
	--white: #ffffff;
	--mist: #eef1f7;
	--line: #d9dee9;
	--muted: #4a5266;

	--prepare: #3b4bdb;      --on-prepare: #ffffff;
	--activate: #ff7a1a;     --on-activate: #14161f;
	--navigate: #0fa3a3;     --on-navigate: #14161f;
	--demonstrate: #d6307e;  --on-demonstrate: #ffffff;
	--articulate: #f2b705;   --on-articulate: #14161f;

	--stage: var(--ink);
	--on-stage: #ffffff;

	--f-ui: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", sans-serif;
	--f-read: "Newsreader", Georgia, "Times New Roman", serif;

	--wrap: 1180px;
	--read: 68ch;
	--gutter: clamp(1.1rem, 4vw, 2rem);
}

.stage-prepare     { --stage: var(--prepare);     --on-stage: var(--on-prepare); }
.stage-activate    { --stage: var(--activate);    --on-stage: var(--on-activate); }
.stage-navigate    { --stage: var(--navigate);    --on-stage: var(--on-navigate); }
.stage-demonstrate { --stage: var(--demonstrate); --on-stage: var(--on-demonstrate); }
.stage-articulate  { --stage: var(--articulate);  --on-stage: var(--on-articulate); }
.stage-multi       { --stage: var(--ink);         --on-stage: #ffffff; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font-family: var(--f-read);
	font-size: 1.1875rem;
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
}
img, video, svg { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, h4 { font-family: var(--f-ui); line-height: 1.1; letter-spacing: -0.01em; margin: 0 0 0.5em; font-weight: 700; }
p { margin: 0 0 1.1em; }

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

.screen-reader-text {
	position: absolute !important; width: 1px; height: 1px; overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px); white-space: nowrap;
}
.skip-link {
	position: absolute; left: 1rem; top: -4rem; z-index: 200;
	background: var(--ink); color: #fff; padding: 0.7rem 1rem; font-family: var(--f-ui);
}
.skip-link:focus { top: 1rem; }

.pj-wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; }
.pj-section { padding-block: clamp(2.75rem, 7vw, 5.5rem); }
.pj-lead { font-size: 1.3rem; max-width: 52ch; }

/* ---------- Ribbon: five stage colours, fills as you read ---------- */
.pj-ribbon {
	position: fixed; inset: 0 0 auto 0; height: 5px; z-index: 120;
	display: grid; grid-template-columns: repeat(5, 1fr); background: transparent;
}
.pj-ribbon span {
	background: var(--stage); transform: scaleX(var(--f, 1)); transform-origin: left center;
}
.pj-ribbon--static { position: static; height: 5px; }
.pj-ribbon--static span { transform: none; }

/* ---------- Header ---------- */
.pj-header {
	position: sticky; top: 0; z-index: 100; padding-top: 5px;
	background: rgba(251, 251, 253, 0.94); backdrop-filter: blur(8px);
	border-bottom: 1px solid var(--line);
}
.pj-header__in { display: flex; align-items: center; gap: 1.5rem; min-height: 68px; }
.pj-brand { text-decoration: none; display: inline-flex; align-items: center; }
.pj-brand img { max-height: 40px; width: auto; }
.pj-brand__name { font-family: var(--f-ui); font-weight: 800; font-size: 1.45rem; letter-spacing: -0.015em; }

.pj-nav { margin-left: auto; display: flex; align-items: center; gap: 1.25rem; }
.pj-menu { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.2rem 1.35rem; }
.pj-menu a { font-family: var(--f-ui); font-weight: 500; font-size: 1rem; text-decoration: none; padding: 0.35rem 0; border-bottom: 2px solid transparent; }
.pj-menu a:hover, .pj-menu .current-menu-item > a, .pj-menu .current_page_item > a { border-bottom-color: var(--ink); }
.pj-menu .sub-menu { list-style: none; margin: 0; padding: 0 0 0 1rem; }

.pj-menu-btn {
	display: none; margin-left: auto; font-family: var(--f-ui); font-weight: 700; font-size: 0.95rem;
	background: var(--ink); color: #fff; border: 0; padding: 0.55rem 1rem; border-radius: 999px; cursor: pointer;
}

@media (max-width: 900px) {
	.pj-header__in { flex-wrap: wrap; }
	.pj-menu-btn { display: inline-block; }
	.pj-nav { display: none; width: 100%; flex-direction: column; align-items: flex-start; padding: 0.5rem 0 1.25rem; margin: 0; }
	.pj-header.is-open .pj-nav { display: flex; }
	.pj-menu { flex-direction: column; gap: 0.1rem; }
	.pj-menu a { font-size: 1.15rem; padding: 0.5rem 0; }
}

/* Signed-in users get a small avatar cluster at the top right; keep the menu button clear of it. */
body.logged-in .pj-header__in { padding-right: 6rem; }

/* ---------- Buttons and links ---------- */
.pj-btn {
	display: inline-block; font-family: var(--f-ui); font-weight: 700; font-size: 1rem; text-decoration: none;
	padding: 0.85rem 1.4rem; border-radius: 999px; border: 2px solid var(--ink); cursor: pointer; line-height: 1.2;
}
.pj-btn--ink { background: var(--ink); color: #fff; }
.pj-btn--ink:hover { background: var(--prepare); border-color: var(--prepare); text-decoration: none; }
.pj-btn--line { background: transparent; color: var(--ink); }
.pj-btn--line:hover { background: var(--ink); color: #fff; text-decoration: none; }
.pj-btn--paper { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.pj-btn--paper:hover { background: var(--articulate); border-color: var(--articulate); text-decoration: none; }
.pj-link { font-family: var(--f-ui); font-weight: 700; }

/* ---------- Hero ---------- */
.pj-hero { padding-block: clamp(2.5rem, 7vw, 6rem) clamp(2.5rem, 6vw, 5rem); background: var(--white); border-bottom: 1px solid var(--line); }
.pj-hero__in { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: clamp(2rem, 5vw, 5rem); align-items: center; }
.pj-hero h1 { font-size: clamp(2.6rem, 6.2vw, 5.1rem); font-weight: 800; letter-spacing: -0.02em; line-height: 0.98; margin-bottom: 0.45em; }
.pj-hero__lead { font-size: 1.3rem; max-width: 46ch; color: var(--muted); }
.pj-hero__cta { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.75rem; }

/* The staircase: the one memorable thing on the page. */
.pj-steps { display: grid; gap: 10px; }
.pj-step {
	display: block; text-decoration: none; background: var(--stage); color: var(--on-stage);
	padding: 1rem 1.5rem 1.05rem; border-radius: 4px 40px 40px 4px;
	margin-left: calc(var(--i) * clamp(6px, 2.6vw, 34px));
	transition: transform 0.18s ease;
	animation: pj-climb 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
	animation-delay: calc(var(--i) * 90ms + 150ms);
}
.pj-step:hover, .pj-step:focus-visible { transform: translateX(8px); text-decoration: none; }
.pj-step:focus-visible { outline-color: var(--ink); }
.pj-step__name { display: block; font-family: var(--f-ui); font-weight: 800; font-size: 1.65rem; letter-spacing: -0.015em; line-height: 1.1; }
.pj-step__blurb { display: block; font-family: var(--f-ui); font-size: 0.98rem; font-weight: 500; line-height: 1.35; margin-top: 0.15rem; opacity: 0.92; }
@keyframes pj-climb { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }

@media (max-width: 860px) {
	.pj-hero__in { grid-template-columns: 1fr; }
}

/* ---------- Section heads ---------- */
.pj-sechead { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; border-bottom: 2px solid var(--ink); padding-bottom: 0.6rem; }
.pj-sechead h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin: 0; }

/* ---------- Cards ---------- */
.pj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: clamp(1.25rem, 2.5vw, 2rem); }
.pj-feature { margin-bottom: clamp(1.25rem, 2.5vw, 2rem); }

.pj-card {
	position: relative; display: flex; flex-direction: column; background: var(--white);
	border: 1px solid var(--line); border-left: 0; border-radius: 4px 14px 14px 4px; overflow: hidden;
}
.pj-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 6px; background: var(--spine, var(--stage)); z-index: 1; }
.pj-card__media { display: block; aspect-ratio: 3 / 2; overflow: hidden; background: var(--mist); }
.pj-card__media img { width: 100%; height: 100%; object-fit: cover; }
.pj-card__body { padding: 1.1rem 1.25rem 1.35rem; display: flex; flex-direction: column; flex: 1; }
.pj-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; font-family: var(--f-ui); font-size: 0.9rem; font-weight: 500; color: var(--muted); margin-bottom: 0.55rem; }
.pj-tag { background: var(--stage); color: var(--on-stage); padding: 0.1rem 0.6rem; border-radius: 999px; font-weight: 700; }
.pj-card__title { font-size: 1.35rem; margin-bottom: 0.45rem; }
.pj-card__title a { text-decoration: none; }
.pj-card__title a::after { content: ""; position: absolute; inset: 0; }
.pj-card:hover .pj-card__title a { text-decoration: underline; text-decoration-thickness: 2px; }
.pj-card__excerpt { font-size: 1.02rem; line-height: 1.5; color: var(--muted); margin: 0; }

.pj-card--feature { flex-direction: row; }
.pj-card--feature::before { width: 10px; }
.pj-card--feature .pj-card__media { flex: 1.15; aspect-ratio: auto; min-height: 320px; }
.pj-card--feature .pj-card__body { flex: 1; justify-content: center; padding: clamp(1.4rem, 3vw, 2.5rem); }
.pj-card--feature .pj-card__title { font-size: clamp(1.8rem, 3.4vw, 2.8rem); letter-spacing: -0.015em; }
.pj-card--feature .pj-card__excerpt { font-size: 1.15rem; }
@media (max-width: 760px) {
	.pj-card--feature { flex-direction: column; }
	.pj-card--feature .pj-card__media { min-height: 0; aspect-ratio: 3 / 2; }
}

/* ---------- Tools ---------- */
.pj-tools__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 1.25rem; }
.pj-tool { display: block; text-decoration: none; background: var(--ink); color: #fff; padding: clamp(1.4rem, 3vw, 2.2rem); border-radius: 28px 4px 4px 28px; transition: background 0.18s ease; }
.pj-tool:nth-child(1):hover { background: var(--prepare); }
.pj-tool:nth-child(2):hover { background: var(--demonstrate); }
.pj-tool h3 { font-size: 1.8rem; letter-spacing: -0.015em; }
.pj-tool p { margin: 0; font-size: 1.05rem; opacity: 0.92; max-width: 46ch; }
.pj-tool:hover { text-decoration: none; }

/* ---------- Help band ---------- */
.pj-help { background: var(--ink); color: #fff; }
.pj-help__in { display: grid; grid-template-columns: 1fr auto; gap: 2rem; align-items: center; }
.pj-help h2 { font-size: clamp(1.8rem, 3.5vw, 2.6rem); }
.pj-help__list { margin: 0; padding-left: 1.2rem; max-width: 60ch; }
.pj-help__list li { margin-bottom: 0.45rem; }
@media (max-width: 760px) { .pj-help__in { grid-template-columns: 1fr; } }

/* ---------- Page heads ---------- */
.pj-pagehead { background: var(--stage); color: var(--on-stage); padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.pj-pagehead h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); font-weight: 800; letter-spacing: -0.02em; margin-bottom: 0.3em; }
.pj-pagehead__intro { max-width: 60ch; font-size: 1.2rem; }
.pj-pagehead__intro p:last-child { margin-bottom: 0; }

.pj-search { display: flex; gap: 0.5rem; max-width: 520px; margin-top: 1.25rem; }
.pj-search input { flex: 1; font: inherit; font-family: var(--f-ui); padding: 0.75rem 1rem; border: 2px solid var(--ink); border-radius: 999px; background: #fff; color: var(--ink); }
.pj-search button { font-family: var(--f-ui); font-weight: 700; border: 2px solid var(--ink); background: var(--ink); color: #fff; border-radius: 999px; padding: 0.75rem 1.2rem; cursor: pointer; }

.pj-empty { font-size: 1.2rem; }
.navigation.pagination { margin-top: 2.5rem; font-family: var(--f-ui); font-weight: 700; }
.navigation.pagination .nav-links { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.navigation.pagination .page-numbers { text-decoration: none; padding: 0.5rem 0.95rem; border: 2px solid var(--ink); border-radius: 999px; }
.navigation.pagination .current { background: var(--ink); color: #fff; }

/* ---------- Article ---------- */
.pj-articlehead { background: var(--stage); color: var(--on-stage); padding-block: clamp(2.5rem, 6vw, 5rem) clamp(2rem, 4vw, 3rem); }
.pj-articlehead__in { max-width: 920px; }
.pj-articlehead__stage { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; font-family: var(--f-ui); font-weight: 700; margin-bottom: 0.75rem; }
.pj-articlehead--multi { position: relative; padding-top: calc(clamp(2.5rem, 6vw, 5rem) + 10px); }
.pj-articlehead--multi::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 10px; background: var(--stripe); }
.pj-articlehead__stage a { text-decoration: none; border-bottom: 2px solid currentColor; }
.pj-articlehead h1 { font-size: clamp(2.2rem, 5.4vw, 4.2rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.02; margin-bottom: 0.5em; }
.pj-articlehead__meta { display: flex; gap: 1.1rem; font-family: var(--f-ui); font-weight: 500; margin: 0; }

.pj-articlehero { margin: 0 auto; width: min(100%, 1100px); padding-inline: var(--gutter); transform: translateY(-1.5rem); }
.pj-articlehero img { width: 100%; border-radius: 4px 24px 24px 4px; border: 1px solid var(--line); }
body:not(.stage-prepare):not(.stage-activate):not(.stage-navigate):not(.stage-demonstrate):not(.stage-articulate) .pj-articlehead { background: var(--ink); }

.pj-prose { width: min(100% - 2 * var(--gutter), var(--read)); margin-inline: auto; }
.pj-page .pj-prose { padding-block: clamp(2rem, 5vw, 4rem); }
.pj-prose > * { max-width: 100%; }
.pj-prose h2 { font-size: clamp(1.7rem, 3.2vw, 2.3rem); margin-top: 2.2em; }
.pj-prose h3 { font-size: 1.45rem; margin-top: 1.8em; }
.pj-prose h4 { font-size: 1.15rem; margin-top: 1.5em; }
.pj-prose ul, .pj-prose ol { padding-left: 1.4rem; margin: 0 0 1.2em; }
.pj-prose li { margin-bottom: 0.4em; }
.pj-prose a { text-decoration-thickness: 2px; text-decoration-color: var(--stage, var(--prepare)); }
body:not([class*="stage-"]) .pj-prose a { text-decoration-color: var(--prepare); }
.pj-prose blockquote { margin: 1.8em 0; padding: 0.2em 0 0.2em 1.4rem; border-left: 6px solid var(--stage, var(--ink)); font-size: 1.3rem; line-height: 1.45; font-style: italic; }
.pj-prose figure { margin: 2em 0; }
.pj-prose figcaption { font-family: var(--f-ui); font-size: 0.9rem; color: var(--muted); margin-top: 0.5rem; }
.pj-prose img { border-radius: 4px 14px 14px 4px; }
.pj-prose code { font-size: 0.88em; background: var(--mist); padding: 0.1em 0.35em; border-radius: 4px; }
.pj-prose pre { background: var(--ink); color: #f3f4f8; padding: 1.1rem 1.25rem; border-radius: 10px; overflow-x: auto; font-size: 0.95rem; line-height: 1.5; }
.pj-prose pre code { background: none; padding: 0; color: inherit; }
.pj-prose table { width: 100%; border-collapse: collapse; font-family: var(--f-ui); font-size: 0.98rem; margin: 1.8em 0; }
.pj-prose th, .pj-prose td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.pj-prose th { border-bottom: 2px solid var(--ink); }
.pj-prose .alignwide { width: min(100vw - 2 * var(--gutter), 1100px); max-width: none; margin-left: 50%; transform: translateX(-50%); }
.pj-prose .alignfull { width: 100vw; max-width: none; margin-left: 50%; transform: translateX(-50%); }
.pj-prose .wp-block-button__link { font-family: var(--f-ui); font-weight: 700; border-radius: 999px; }

.pj-related { background: var(--mist); margin-top: 4rem; }
.pj-comments-wrap { padding-block: 3rem; }
.pj-comments { width: min(100%, var(--read)); margin-inline: auto; font-family: var(--f-ui); }
.pj-comments__list { list-style: none; padding: 0; }
.pj-comments textarea, .pj-comments input[type="text"], .pj-comments input[type="email"], .pj-comments input[type="url"] { width: 100%; font: inherit; padding: 0.7rem 0.85rem; border: 1.5px solid var(--ink); border-radius: 8px; }
.pj-comments .submit { font-family: var(--f-ui); font-weight: 700; background: var(--ink); color: #fff; border: 0; border-radius: 999px; padding: 0.8rem 1.4rem; cursor: pointer; }

/* ---------- Footer ---------- */
.pj-footer { background: var(--ink); color: #fff; margin-top: 0; }
.pj-footer__in { display: grid; grid-template-columns: 1fr auto; gap: 1rem 2rem; padding-block: 2.5rem; align-items: start; }
.pj-footer__name { font-family: var(--f-ui); font-weight: 800; font-size: 1.5rem; margin: 0; letter-spacing: -0.015em; }
.pj-footer__tag { margin: 0.2rem 0 0; opacity: 0.8; }
.pj-footer__copy { grid-column: 1 / -1; margin: 0; font-family: var(--f-ui); font-size: 0.9rem; opacity: 0.7; }
.pj-footer :focus-visible { outline-color: #fff; }
.pj-footer .pj-menu a:hover { border-bottom-color: #fff; }
@media (max-width: 640px) { .pj-footer__in { grid-template-columns: 1fr; } }

/* ---------- LearnPress: light touch (markup varies by version) ---------- */
.learn-press-courses .course { border: 1px solid var(--line); border-left: 6px solid var(--ink); border-radius: 4px 14px 14px 4px; background: var(--white); }
.lp-button, .lp-btn, .learn-press-form .button, .lp-course-buttons .lp-button {
	font-family: var(--f-ui); font-weight: 700; background: var(--ink); color: #fff; border: 2px solid var(--ink); border-radius: 999px; padding: 0.7rem 1.3rem;
}
.lp-button:hover, .lp-btn:hover { background: var(--prepare); border-color: var(--prepare); color: #fff; }
.learn-press-breadcrumb, .course-curriculum, .lp-single-course { font-family: var(--f-ui); }

/* ---------- Elementor and block-editor friendliness ---------- */
.elementor-page .pj-prose, .elementor-page.pj-page .pj-wrap { max-width: none; }
.wp-block-image img { border-radius: 4px 14px 14px 4px; }

/* ---------- WordPress admin bar (only shown to staff) ---------- */
.admin-bar .pj-header, .admin-bar .pj-ribbon { top: 32px; }
@media (max-width: 782px) {
	.admin-bar .pj-header, .admin-bar .pj-ribbon { top: 46px; }
	/* Keep the bar to one row: drop plugin icons from the right-hand side, keep the account avatar. */
	#wpadminbar #wp-admin-bar-top-secondary > li:not(#wp-admin-bar-my-account) { display: none !important; }
}
@media (max-width: 600px) {
	/* The admin bar scrolls away on small screens, so the header sticks to the very top. */
	.admin-bar .pj-header, .admin-bar .pj-ribbon { top: 0; }
}

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	.pj-step { animation: none; }
	.pj-step, .pj-tool { transition: none; }
}
