/*
 * Typing Practice Pro - core styles.
 *
 * Design tokens first, then layout, then components. Colour values that an
 * administrator can change are injected as custom properties from PHP
 * (see tpp_inline_tokens) and only defaulted here.
 */

/* ==========================================================================
   1. Tokens
   ========================================================================== */

:root {
	--tpp-primary: #2563eb;
	--tpp-primary-dark: #1d4ed8;
	--tpp-primary-soft: #dbeafe;
	--tpp-accent: #0f766e;
	--tpp-correct: #15803d;
	--tpp-incorrect: #b91c1c;

	--tpp-radius: 10px;
	--tpp-radius-sm: calc(var(--tpp-radius) * 0.6);
	--tpp-radius-lg: calc(var(--tpp-radius) * 1.6);
	--tpp-content: 1180px;
	--tpp-type-size: 24px;
	--tpp-type-line: 1.9;
	--tpp-type-width: 900px;

	--tpp-font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--tpp-font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

	--tpp-space-1: 0.25rem;
	--tpp-space-2: 0.5rem;
	--tpp-space-3: 0.75rem;
	--tpp-space-4: 1rem;
	--tpp-space-5: 1.5rem;
	--tpp-space-6: 2rem;
	--tpp-space-7: 3rem;
	--tpp-space-8: 4.5rem;

	--tpp-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
	--tpp-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);

	--tpp-transition: 160ms ease;
}

:root[data-theme="light"],
:root:not([data-theme]) {
	--tpp-bg: #ffffff;
	--tpp-bg-alt: #f6f8fb;
	--tpp-bg-sunken: #eef2f7;
	--tpp-surface: #ffffff;
	--tpp-text: #111827;
	--tpp-text-muted: #4b5563;
	--tpp-border: #d9e0ea;
	--tpp-border-strong: #b9c3d1;
}

:root[data-theme="dark"] {
	--tpp-bg: #0f1620;
	--tpp-bg-alt: #141d2a;
	--tpp-bg-sunken: #1a2432;
	--tpp-surface: #16202d;
	--tpp-text: #eef2f7;
	--tpp-text-muted: #a8b4c4;
	--tpp-border: #2a3648;
	--tpp-border-strong: #3d4c63;
	--tpp-primary-soft: #1e3a8a;
	--tpp-correct: #4ade80;
	--tpp-incorrect: #fca5a5;
	--tpp-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
	--tpp-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

/* High-contrast mode: stronger borders and text, no soft greys. */
:root[data-contrast="high"] {
	--tpp-text-muted: var(--tpp-text);
	--tpp-border: currentColor;
	--tpp-border-strong: currentColor;
}

/* ==========================================================================
   2. Base
   ========================================================================== */

*,
*::before,
*::after {
	box-sizing: border-box;
}

/*
 * The HTML `hidden` attribute must always win.
 *
 * Several components (the workspace overlay, the settings drawer, modal
 * dialogs) are toggled by setting `element.hidden = true`. The browser's own
 * `[hidden] { display: none }` comes from the user-agent stylesheet, so any
 * author rule that sets `display` on those components silently defeats it and
 * leaves them permanently on screen. This rule restores the expected
 * behaviour for every component at once.
 */
[hidden] {
	display: none !important;
}

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
}

body {
	margin: 0;
	background: var(--tpp-bg);
	color: var(--tpp-text);
	font-family: var(--tpp-font-sans);
	font-size: 1rem;
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
	}
}

:root[data-motion="reduced"] * {
	animation: none !important;
	transition: none !important;
}

h1, h2, h3, h4, h5, h6 {
	margin: 0 0 var(--tpp-space-3);
	line-height: 1.22;
	font-weight: 700;
	letter-spacing: -0.015em;
	text-wrap: balance;
}

h1 { font-size: clamp(1.9rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.4rem); }
h4 { font-size: 1.1rem; }

p, ul, ol, dl, table, figure, pre, blockquote {
	margin: 0 0 var(--tpp-space-4);
}

a {
	color: var(--tpp-primary);
	text-decoration-thickness: 1px;
	text-underline-offset: 2px;
}

a:hover { color: var(--tpp-primary-dark); }

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

code, kbd, pre, samp {
	font-family: var(--tpp-font-mono);
	font-size: 0.92em;
}

code {
	background: var(--tpp-bg-sunken);
	padding: 0.12em 0.35em;
	border-radius: var(--tpp-radius-sm);
}

pre {
	background: var(--tpp-bg-sunken);
	padding: var(--tpp-space-4);
	border-radius: var(--tpp-radius);
	overflow-x: auto;
}

blockquote {
	border-left: 4px solid var(--tpp-primary);
	padding-left: var(--tpp-space-4);
	color: var(--tpp-text-muted);
}

hr {
	border: 0;
	border-top: 1px solid var(--tpp-border);
	margin: var(--tpp-space-6) 0;
}

/* ---- Focus -------------------------------------------------------------- */

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

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 999;
	padding: var(--tpp-space-3) var(--tpp-space-4);
	background: var(--tpp-primary);
	color: #fff;
	border-radius: 0 0 var(--tpp-radius) 0;
	font-weight: 600;
}

.skip-link:focus {
	left: 0;
	color: #fff;
}

/* ==========================================================================
   3. Layout
   ========================================================================== */

.tpp-container {
	width: min(100% - 2rem, var(--tpp-content));
	margin-inline: auto;
}

.tpp-container-narrow {
	width: min(100% - 2rem, 760px);
	margin-inline: auto;
}

.tpp-section {
	padding-block: var(--tpp-space-7);
}

.tpp-section-alt {
	background: var(--tpp-bg-alt);
}

.tpp-section-head {
	max-width: 62ch;
	margin-bottom: var(--tpp-space-6);
}

.tpp-section-head p {
	color: var(--tpp-text-muted);
	font-size: 1.05rem;
	margin-bottom: 0;
}

.tpp-grid {
	display: grid;
	gap: var(--tpp-space-4);
}

.tpp-grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.tpp-grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.tpp-grid-4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

.tpp-layout {
	display: grid;
	gap: var(--tpp-space-6);
	padding-block: var(--tpp-space-6);
	grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 900px) {
	.tpp-layout.has-sidebar {
		grid-template-columns: minmax(0, 1fr) 300px;
	}
}

body.tpp-no-sidebar .tpp-layout.has-sidebar {
	grid-template-columns: minmax(0, 1fr);
}

/* ==========================================================================
   4. Header
   ========================================================================== */

.tpp-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: color-mix(in srgb, var(--tpp-bg) 92%, transparent);
	backdrop-filter: saturate(180%) blur(8px);
	border-bottom: 1px solid var(--tpp-border);
	transition: box-shadow var(--tpp-transition);
}

.tpp-header.is-stuck {
	box-shadow: var(--tpp-shadow);
}

.tpp-header-inner {
	display: flex;
	align-items: center;
	gap: var(--tpp-space-4);
	min-height: 64px;
	padding-block: var(--tpp-space-2);
}

.tpp-site-title {
	margin: 0;
	font-size: 1.15rem;
	font-weight: 700;
	letter-spacing: -0.02em;
}

.tpp-site-title a {
	color: var(--tpp-text);
	text-decoration: none;
}

.custom-logo-link img {
	max-height: 44px;
	width: auto;
}

.tpp-header-actions {
	display: flex;
	align-items: center;
	gap: var(--tpp-space-2);
	margin-left: auto;
}

.tpp-nav-toggle {
	display: none;
	align-items: center;
	gap: var(--tpp-space-2);
	background: none;
	border: 1px solid var(--tpp-border);
	border-radius: var(--tpp-radius-sm);
	color: inherit;
	padding: 0.5rem 0.75rem;
	font: inherit;
	cursor: pointer;
}

.tpp-nav {
	margin-left: var(--tpp-space-4);
}

.tpp-nav ul {
	display: flex;
	align-items: center;
	gap: var(--tpp-space-1);
	list-style: none;
	margin: 0;
	padding: 0;
}

.tpp-nav li { position: relative; }

.tpp-nav a {
	display: block;
	padding: 0.5rem 0.7rem;
	border-radius: var(--tpp-radius-sm);
	color: var(--tpp-text);
	text-decoration: none;
	font-weight: 500;
	font-size: 0.95rem;
	white-space: nowrap;
}

.tpp-nav a:hover,
.tpp-nav .current-menu-item > a {
	background: var(--tpp-bg-sunken);
	color: var(--tpp-primary);
}

.tpp-nav .sub-menu {
	position: absolute;
	top: 100%;
	left: 0;
	display: none;
	flex-direction: column;
	align-items: stretch;
	min-width: 220px;
	padding: var(--tpp-space-2);
	background: var(--tpp-surface);
	border: 1px solid var(--tpp-border);
	border-radius: var(--tpp-radius);
	box-shadow: var(--tpp-shadow);
	z-index: 10;
}

.tpp-nav li:hover > .sub-menu,
.tpp-nav li:focus-within > .sub-menu,
.tpp-nav li.is-open > .sub-menu {
	display: flex;
}

.tpp-submenu-toggle {
	display: none;
	background: none;
	border: 0;
	color: inherit;
	cursor: pointer;
	padding: 0.4rem;
}

/* Secondary header links collapse away on narrow screens. */
@media (max-width: 767px) {
	.tpp-hide-sm { display: none !important; }
}

.tpp-theme-toggle {
	display: inline-flex;
	align-items: center;
	gap: var(--tpp-space-2);
	background: none;
	border: 1px solid var(--tpp-border);
	border-radius: var(--tpp-radius-sm);
	color: inherit;
	padding: 0.45rem 0.7rem;
	font: inherit;
	font-size: 0.85rem;
	cursor: pointer;
}

.tpp-announcement {
	background: var(--tpp-primary-soft);
	color: var(--tpp-text);
	text-align: center;
	padding: var(--tpp-space-2) var(--tpp-space-4);
	font-size: 0.92rem;
}

:root[data-theme="dark"] .tpp-announcement { color: #fff; }

@media (max-width: 979px) {
	.tpp-nav-toggle { display: inline-flex; }
	.tpp-submenu-toggle { display: inline-block; }

	.tpp-nav {
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		margin: 0;
		background: var(--tpp-surface);
		border-bottom: 1px solid var(--tpp-border);
		box-shadow: var(--tpp-shadow);
		max-height: 0;
		overflow: hidden;
		visibility: hidden;
	}

	.tpp-nav.is-open {
		max-height: 80vh;
		overflow-y: auto;
		visibility: visible;
		padding: var(--tpp-space-3) var(--tpp-space-4);
	}

	.tpp-nav ul {
		flex-direction: column;
		align-items: stretch;
		gap: 0;
	}

	.tpp-nav a { padding: 0.7rem 0.5rem; }

	.tpp-nav .sub-menu {
		position: static;
		display: none;
		box-shadow: none;
		border: 0;
		border-left: 2px solid var(--tpp-border);
		border-radius: 0;
		margin-left: var(--tpp-space-3);
	}

	.tpp-nav li.is-open > .sub-menu { display: flex; }
}

/* ==========================================================================
   5. Buttons and forms
   ========================================================================== */

.tpp-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--tpp-space-2);
	padding: 0.7rem 1.25rem;
	border: 1px solid var(--tpp-primary);
	border-radius: var(--tpp-radius);
	background: var(--tpp-primary);
	color: #fff;
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: background var(--tpp-transition), border-color var(--tpp-transition), transform var(--tpp-transition);
}

.tpp-btn:hover {
	background: var(--tpp-primary-dark);
	border-color: var(--tpp-primary-dark);
	color: #fff;
}

.tpp-btn:active { transform: translateY(1px); }

.tpp-btn[disabled],
.tpp-btn.is-disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.tpp-btn-secondary {
	background: transparent;
	color: var(--tpp-primary);
}

.tpp-btn-secondary:hover {
	background: var(--tpp-primary-soft);
	color: var(--tpp-primary-dark);
}

.tpp-btn-ghost {
	background: transparent;
	border-color: var(--tpp-border);
	color: var(--tpp-text);
}

.tpp-btn-ghost:hover {
	background: var(--tpp-bg-sunken);
	border-color: var(--tpp-border-strong);
	color: var(--tpp-text);
}

.tpp-btn-sm {
	padding: 0.45rem 0.85rem;
	font-size: 0.9rem;
}

.tpp-btn-lg {
	padding: 0.9rem 1.75rem;
	font-size: 1.05rem;
}

body.tpp-btn-outline .tpp-btn:not(.tpp-btn-ghost) {
	background: transparent;
	color: var(--tpp-primary);
}

body.tpp-btn-outline .tpp-btn:not(.tpp-btn-ghost):hover {
	background: var(--tpp-primary);
	color: #fff;
}

.tpp-link-button {
	background: none;
	border: 0;
	padding: 0;
	color: var(--tpp-primary);
	font: inherit;
	text-decoration: underline;
	cursor: pointer;
}

.tpp-button-row {
	display: flex;
	flex-wrap: wrap;
	gap: var(--tpp-space-3);
	align-items: center;
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="date"],
select,
textarea {
	width: 100%;
	padding: 0.6rem 0.75rem;
	border: 1px solid var(--tpp-border-strong);
	border-radius: var(--tpp-radius-sm);
	background: var(--tpp-surface);
	color: var(--tpp-text);
	font: inherit;
	font-size: 1rem;
}

input:focus,
select:focus,
textarea:focus {
	border-color: var(--tpp-primary);
}

label {
	display: inline-block;
	font-weight: 600;
	font-size: 0.92rem;
	margin-bottom: var(--tpp-space-1);
}

.tpp-field {
	margin-bottom: var(--tpp-space-4);
}

.tpp-field-hint {
	display: block;
	margin-top: var(--tpp-space-1);
	font-size: 0.85rem;
	font-weight: 400;
	color: var(--tpp-text-muted);
}

.tpp-checkbox {
	display: flex;
	align-items: flex-start;
	gap: var(--tpp-space-2);
	font-weight: 400;
}

.tpp-checkbox input { width: auto; margin-top: 0.25rem; }

.tpp-form-error {
	color: var(--tpp-incorrect);
	font-size: 0.9rem;
	font-weight: 600;
}

/* ==========================================================================
   6. Components
   ========================================================================== */

.tpp-card {
	display: flex;
	flex-direction: column;
	gap: var(--tpp-space-2);
	padding: var(--tpp-space-5);
	background: var(--tpp-surface);
	border: 1px solid var(--tpp-border);
	border-radius: var(--tpp-radius);
	box-shadow: var(--tpp-shadow-sm);
}

.tpp-card-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--tpp-space-2);
	font-size: 0.82rem;
	color: var(--tpp-text-muted);
}

.tpp-card-title {
	margin: 0;
	font-size: 1.12rem;
}

.tpp-card-title a {
	color: var(--tpp-text);
	text-decoration: none;
}

.tpp-card-title a:hover {
	color: var(--tpp-primary);
	text-decoration: underline;
}

.tpp-card-text {
	margin: 0;
	color: var(--tpp-text-muted);
	font-size: 0.95rem;
}

.tpp-card-meta {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: var(--tpp-space-1) var(--tpp-space-4);
	font-size: 0.85rem;
	color: var(--tpp-text-muted);
}

.tpp-card .tpp-btn { align-self: flex-start; margin-top: auto; }

.tpp-lesson-card.is-complete {
	border-color: var(--tpp-correct);
}

.tpp-complete-flag {
	color: var(--tpp-correct);
	font-weight: 700;
}

.tpp-badge {
	display: inline-block;
	padding: 0.15rem 0.55rem;
	border-radius: 999px;
	background: var(--tpp-bg-sunken);
	border: 1px solid var(--tpp-border);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--tpp-text-muted);
}

.tpp-badge-beginner { border-color: #16a34a; color: #16a34a; }
.tpp-badge-elementary { border-color: #0891b2; color: #0891b2; }
.tpp-badge-intermediate { border-color: #ca8a04; color: #ca8a04; }
.tpp-badge-advanced { border-color: #ea580c; color: #ea580c; }
.tpp-badge-professional { border-color: #9333ea; color: #9333ea; }

.tpp-stat {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	padding: var(--tpp-space-4);
	background: var(--tpp-surface);
	border: 1px solid var(--tpp-border);
	border-radius: var(--tpp-radius);
	text-align: center;
}

.tpp-stat-value {
	font-size: clamp(1.6rem, 3vw, 2.1rem);
	font-weight: 700;
	line-height: 1.1;
	font-variant-numeric: tabular-nums;
}

.tpp-stat-label {
	font-size: 0.85rem;
	color: var(--tpp-text-muted);
}

.tpp-stat-hint {
	font-size: 0.78rem;
	color: var(--tpp-text-muted);
}

.tpp-notice {
	padding: var(--tpp-space-4);
	border: 1px solid var(--tpp-border);
	border-left-width: 4px;
	border-radius: var(--tpp-radius-sm);
	background: var(--tpp-bg-alt);
	margin-bottom: var(--tpp-space-4);
}

.tpp-notice p:last-child { margin-bottom: 0; }
.tpp-notice-info { border-left-color: var(--tpp-primary); }
.tpp-notice-success { border-left-color: var(--tpp-correct); }
.tpp-notice-warning { border-left-color: #d97706; }
.tpp-notice-error { border-left-color: var(--tpp-incorrect); }

.tpp-empty {
	padding: var(--tpp-space-5);
	text-align: center;
	color: var(--tpp-text-muted);
	background: var(--tpp-bg-alt);
	border-radius: var(--tpp-radius);
}

.tpp-note {
	font-size: 0.9rem;
	color: var(--tpp-text-muted);
}

.tpp-mobile-note {
	display: none;
	font-size: 0.9rem;
	color: var(--tpp-text-muted);
	background: var(--tpp-bg-alt);
	border-radius: var(--tpp-radius-sm);
	padding: var(--tpp-space-3);
}

@media (max-width: 767px) {
	.tpp-mobile-note { display: block; }
}

/* ---- Tables -------------------------------------------------------------- */

.tpp-table-wrap {
	overflow-x: auto;
	border: 1px solid var(--tpp-border);
	border-radius: var(--tpp-radius);
}

.tpp-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.92rem;
}

.tpp-table th,
.tpp-table td {
	padding: 0.65rem 0.8rem;
	text-align: left;
	border-bottom: 1px solid var(--tpp-border);
	white-space: nowrap;
}

.tpp-table th {
	background: var(--tpp-bg-alt);
	font-weight: 700;
	font-size: 0.82rem;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.tpp-table tbody tr:last-child td { border-bottom: 0; }
.tpp-table tbody tr:hover { background: var(--tpp-bg-alt); }

.tpp-figure-list {
	display: grid;
	gap: var(--tpp-space-3);
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	margin: 0 0 var(--tpp-space-4);
}

.tpp-figure-list > div {
	padding: var(--tpp-space-3);
	background: var(--tpp-bg-alt);
	border-radius: var(--tpp-radius-sm);
}

.tpp-figure-list dt {
	font-size: 0.82rem;
	color: var(--tpp-text-muted);
}

.tpp-figure-list dd {
	margin: 0;
	font-size: 1.15rem;
	font-weight: 700;
}

/* ---- Breadcrumbs ---------------------------------------------------------- */

.tpp-breadcrumbs {
	padding-block: var(--tpp-space-3);
	font-size: 0.85rem;
	color: var(--tpp-text-muted);
}

.tpp-breadcrumbs ol {
	display: flex;
	flex-wrap: wrap;
	gap: var(--tpp-space-2);
	list-style: none;
	margin: 0;
	padding: 0;
}

.tpp-breadcrumbs li + li::before {
	content: "/";
	margin-right: var(--tpp-space-2);
	color: var(--tpp-border-strong);
}

/* ---- Pagination ------------------------------------------------------------ */

.tpp-pagination,
.nav-links {
	display: flex;
	flex-wrap: wrap;
	gap: var(--tpp-space-2);
	justify-content: center;
	margin-top: var(--tpp-space-6);
}

.tpp-page,
.page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.4rem;
	padding: 0.45rem 0.7rem;
	border: 1px solid var(--tpp-border);
	border-radius: var(--tpp-radius-sm);
	background: var(--tpp-surface);
	color: var(--tpp-text);
	font: inherit;
	text-decoration: none;
	cursor: pointer;
}

.tpp-page.is-current,
.page-numbers.current {
	background: var(--tpp-primary);
	border-color: var(--tpp-primary);
	color: #fff;
}

/* ---- Dialogs ---------------------------------------------------------------- */

.tpp-dialog {
	position: fixed;
	inset: 0;
	z-index: 100;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--tpp-space-4);
	background: rgba(15, 23, 42, 0.6);
}

.tpp-dialog-panel {
	width: min(100%, 560px);
	max-height: 85vh;
	overflow-y: auto;
	padding: var(--tpp-space-6);
	background: var(--tpp-surface);
	border-radius: var(--tpp-radius-lg);
	box-shadow: var(--tpp-shadow);
}

body.tpp-dialog-open { overflow: hidden; }

/* ---- Accordion (FAQ) --------------------------------------------------------- */

.tpp-accordion {
	border: 1px solid var(--tpp-border);
	border-radius: var(--tpp-radius);
	overflow: hidden;
	background: var(--tpp-surface);
}

.tpp-accordion-item + .tpp-accordion-item {
	border-top: 1px solid var(--tpp-border);
}

.tpp-accordion-trigger {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--tpp-space-3);
	width: 100%;
	padding: var(--tpp-space-4) var(--tpp-space-5);
	background: none;
	border: 0;
	color: inherit;
	font: inherit;
	font-weight: 600;
	font-size: 1.02rem;
	text-align: left;
	cursor: pointer;
}

.tpp-accordion-trigger:hover { background: var(--tpp-bg-alt); }

.tpp-accordion-trigger::after {
	content: "+";
	flex: none;
	font-size: 1.3rem;
	line-height: 1;
	color: var(--tpp-primary);
}

.tpp-accordion-trigger[aria-expanded="true"]::after { content: "−"; }

.tpp-accordion-panel {
	padding: 0 var(--tpp-space-5) var(--tpp-space-5);
	color: var(--tpp-text-muted);
}

.tpp-accordion-panel p:last-child { margin-bottom: 0; }

/* ==========================================================================
   7. Homepage
   ========================================================================== */

.tpp-hero {
	padding-block: var(--tpp-space-7) var(--tpp-space-6);
	background: linear-gradient(180deg, var(--tpp-bg-alt), var(--tpp-bg));
	border-bottom: 1px solid var(--tpp-border);
}

.tpp-hero-inner {
	display: grid;
	gap: var(--tpp-space-6);
	align-items: center;
	grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 900px) {
	.tpp-hero-inner { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); }
}

.tpp-hero-title { margin-bottom: var(--tpp-space-4); }

.tpp-hero-text {
	font-size: 1.12rem;
	color: var(--tpp-text-muted);
	max-width: 56ch;
}

.tpp-hero-note {
	font-size: 0.9rem;
	color: var(--tpp-text-muted);
	margin-top: var(--tpp-space-3);
}

.tpp-hero-card {
	padding: var(--tpp-space-5);
	background: var(--tpp-surface);
	border: 1px solid var(--tpp-border);
	border-radius: var(--tpp-radius-lg);
	box-shadow: var(--tpp-shadow);
}

.tpp-hero-demo {
	font-family: var(--tpp-font-mono);
	font-size: 1.05rem;
	line-height: 1.8;
	min-height: 5.4em;
	margin-bottom: var(--tpp-space-4);
	color: var(--tpp-text-muted);
}

.tpp-hero-demo .tpp-demo-typed { color: var(--tpp-correct); }

.tpp-hero-demo .tpp-demo-caret {
	display: inline-block;
	width: 2px;
	height: 1.1em;
	vertical-align: text-bottom;
	background: var(--tpp-primary);
	animation: tpp-blink 1s steps(2, start) infinite;
}

@keyframes tpp-blink {
	to { visibility: hidden; }
}

.tpp-hero-stats {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--tpp-space-2);
	text-align: center;
}

.tpp-hero-stats div {
	padding: var(--tpp-space-3) var(--tpp-space-2);
	background: var(--tpp-bg-alt);
	border-radius: var(--tpp-radius-sm);
}

.tpp-hero-stats strong {
	display: block;
	font-size: 1.35rem;
	font-variant-numeric: tabular-nums;
}

.tpp-hero-stats span {
	font-size: 0.78rem;
	color: var(--tpp-text-muted);
}

.tpp-mode-card {
	display: flex;
	flex-direction: column;
	gap: var(--tpp-space-2);
	padding: var(--tpp-space-5);
	background: var(--tpp-surface);
	border: 1px solid var(--tpp-border);
	border-radius: var(--tpp-radius);
	text-decoration: none;
	color: var(--tpp-text);
	transition: border-color var(--tpp-transition), transform var(--tpp-transition);
}

.tpp-mode-card:hover {
	border-color: var(--tpp-primary);
	transform: translateY(-2px);
	color: var(--tpp-text);
}

.tpp-mode-card h3 { margin: 0; font-size: 1.05rem; }

.tpp-mode-card p {
	margin: 0;
	font-size: 0.9rem;
	color: var(--tpp-text-muted);
}

.tpp-mode-icon {
	font-family: var(--tpp-font-mono);
	font-size: 1.4rem;
	font-weight: 700;
	color: var(--tpp-primary);
}

.tpp-steps {
	counter-reset: tpp-step;
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: var(--tpp-space-4);
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.tpp-steps li {
	counter-increment: tpp-step;
	padding: var(--tpp-space-5);
	padding-top: var(--tpp-space-6);
	position: relative;
	background: var(--tpp-surface);
	border: 1px solid var(--tpp-border);
	border-radius: var(--tpp-radius);
}

.tpp-steps li::before {
	content: counter(tpp-step);
	position: absolute;
	top: var(--tpp-space-4);
	left: var(--tpp-space-5);
	width: 1.9rem;
	height: 1.9rem;
	display: grid;
	place-items: center;
	border-radius: 50%;
	background: var(--tpp-primary);
	color: #fff;
	font-weight: 700;
	font-size: 0.9rem;
}

.tpp-steps h3 { margin-top: var(--tpp-space-4); font-size: 1.05rem; }
.tpp-steps p { margin: 0; color: var(--tpp-text-muted); font-size: 0.93rem; }

.tpp-benefits {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: var(--tpp-space-3);
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.tpp-benefits li {
	display: flex;
	gap: var(--tpp-space-3);
	align-items: flex-start;
	padding: var(--tpp-space-4);
	background: var(--tpp-surface);
	border: 1px solid var(--tpp-border);
	border-radius: var(--tpp-radius);
}

.tpp-benefits li::before {
	content: "✓";
	flex: none;
	color: var(--tpp-correct);
	font-weight: 700;
}

.tpp-benefits strong { display: block; }
.tpp-benefits span { font-size: 0.9rem; color: var(--tpp-text-muted); }

.tpp-level-path {
	display: grid;
	gap: var(--tpp-space-3);
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	counter-reset: tpp-level;
}

.tpp-level-step {
	position: relative;
	padding: var(--tpp-space-5);
	background: var(--tpp-surface);
	border: 1px solid var(--tpp-border);
	border-radius: var(--tpp-radius);
}

.tpp-level-step h3 { font-size: 1.05rem; margin-bottom: var(--tpp-space-2); }
.tpp-level-step p { font-size: 0.9rem; color: var(--tpp-text-muted); margin-bottom: var(--tpp-space-2); }

.tpp-level-target {
	font-size: 0.85rem;
	font-weight: 700;
	color: var(--tpp-primary);
}

.tpp-cta {
	padding-block: var(--tpp-space-7);
	background: var(--tpp-primary);
	color: #fff;
	text-align: center;
}

.tpp-cta .tpp-cta-title { color: #fff; }
.tpp-cta .tpp-cta-text { color: rgba(255, 255, 255, 0.9); max-width: 60ch; margin-inline: auto; }

.tpp-cta .tpp-btn {
	background: #fff;
	border-color: #fff;
	color: var(--tpp-primary);
}

.tpp-cta .tpp-btn:hover {
	background: var(--tpp-bg-alt);
	border-color: var(--tpp-bg-alt);
	color: var(--tpp-primary-dark);
}

/*
 * The secondary button on the blue call-to-action band. It has to be declared
 * after the rule above, and at the same specificity, or it inherits the solid
 * white fill and renders white-on-white.
 */
.tpp-cta .tpp-btn-ghost {
	background: transparent;
	border-color: rgba(255, 255, 255, 0.75);
	color: #fff;
}

.tpp-cta .tpp-btn-ghost:hover,
.tpp-cta .tpp-btn-ghost:focus-visible {
	background: rgba(255, 255, 255, 0.14);
	border-color: #fff;
	color: #fff;
}

.tpp-cta :focus-visible {
	outline-color: #fff;
}

/* ==========================================================================
   8. Blog and single content
   ========================================================================== */

.tpp-entry-header { margin-bottom: var(--tpp-space-5); }

.tpp-entry-meta {
	display: flex;
	flex-wrap: wrap;
	gap: var(--tpp-space-1) var(--tpp-space-4);
	font-size: 0.88rem;
	color: var(--tpp-text-muted);
	margin-bottom: var(--tpp-space-3);
}

.tpp-entry-content {
	font-size: 1.05rem;
}

.tpp-entry-content > * { max-width: 72ch; }
.tpp-entry-content > .alignwide,
.tpp-entry-content > .alignfull,
.tpp-entry-content > figure,
.tpp-entry-content > .wp-block-table { max-width: none; }

.tpp-entry-content h2 { margin-top: var(--tpp-space-6); }
.tpp-entry-content h3 { margin-top: var(--tpp-space-5); }

.tpp-entry-thumb img {
	width: 100%;
	border-radius: var(--tpp-radius);
	margin-bottom: var(--tpp-space-5);
}

.tpp-author-box {
	display: flex;
	gap: var(--tpp-space-4);
	padding: var(--tpp-space-5);
	margin-top: var(--tpp-space-6);
	background: var(--tpp-bg-alt);
	border-radius: var(--tpp-radius);
}

.tpp-author-box img { border-radius: 50%; flex: none; }
.tpp-author-box h2 { font-size: 1.05rem; margin-bottom: var(--tpp-space-1); }
.tpp-author-box p { margin: 0; font-size: 0.93rem; color: var(--tpp-text-muted); }

.tpp-share {
	display: flex;
	flex-wrap: wrap;
	gap: var(--tpp-space-2);
	align-items: center;
	margin-top: var(--tpp-space-5);
	font-size: 0.9rem;
}

.tpp-post-nav {
	display: grid;
	gap: var(--tpp-space-3);
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	margin-top: var(--tpp-space-6);
}

.tpp-post-nav a {
	display: block;
	padding: var(--tpp-space-4);
	background: var(--tpp-surface);
	border: 1px solid var(--tpp-border);
	border-radius: var(--tpp-radius);
	text-decoration: none;
	color: var(--tpp-text);
}

.tpp-post-nav a:hover { border-color: var(--tpp-primary); }
.tpp-post-nav span { display: block; font-size: 0.8rem; color: var(--tpp-text-muted); }
.tpp-post-nav strong { display: block; margin-top: var(--tpp-space-1); }

.tpp-lesson-nav {
	display: grid;
	gap: var(--tpp-space-3);
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	margin-block: var(--tpp-space-6);
}

.tpp-lesson-nav a {
	display: block;
	padding: var(--tpp-space-4);
	background: var(--tpp-surface);
	border: 1px solid var(--tpp-border);
	border-radius: var(--tpp-radius);
	text-decoration: none;
	color: var(--tpp-text);
}

.tpp-lesson-nav a:hover { border-color: var(--tpp-primary); }
.tpp-lesson-nav span { font-size: 0.8rem; color: var(--tpp-text-muted); }
.tpp-lesson-nav strong { display: block; margin-top: var(--tpp-space-1); }
.tpp-lesson-nav-next { text-align: right; }

/* ---- Comments ---------------------------------------------------------------- */

.comment-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.comment-list li { margin-bottom: var(--tpp-space-4); }

.comment-body {
	padding: var(--tpp-space-4);
	background: var(--tpp-bg-alt);
	border-radius: var(--tpp-radius);
}

.comment-list .children {
	list-style: none;
	margin-left: var(--tpp-space-5);
	padding: 0;
}

.comment-meta {
	font-size: 0.85rem;
	color: var(--tpp-text-muted);
	margin-bottom: var(--tpp-space-2);
}

/* ---- Sidebar and widgets --------------------------------------------------------- */

.tpp-sidebar .widget,
.tpp-widget-area .widget {
	padding: var(--tpp-space-5);
	margin-bottom: var(--tpp-space-4);
	background: var(--tpp-surface);
	border: 1px solid var(--tpp-border);
	border-radius: var(--tpp-radius);
}

.widget-title {
	font-size: 1rem;
	margin-bottom: var(--tpp-space-3);
}

.widget ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.widget li + li {
	margin-top: var(--tpp-space-2);
	padding-top: var(--tpp-space-2);
	border-top: 1px solid var(--tpp-border);
}

.tpp-widget-meta {
	display: block;
	font-size: 0.8rem;
	color: var(--tpp-text-muted);
}

.tpp-widget-progress strong {
	font-size: 1.2rem;
	font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   9. Footer
   ========================================================================== */

.tpp-footer {
	margin-top: var(--tpp-space-7);
	padding-block: var(--tpp-space-6) var(--tpp-space-4);
	background: var(--tpp-bg-alt);
	border-top: 1px solid var(--tpp-border);
	font-size: 0.93rem;
}

.tpp-footer-grid {
	display: grid;
	gap: var(--tpp-space-5);
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	margin-bottom: var(--tpp-space-5);
}

.tpp-footer-about p {
	color: var(--tpp-text-muted);
	max-width: 40ch;
}

.tpp-footer h2 {
	font-size: 0.9rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--tpp-text-muted);
	margin-bottom: var(--tpp-space-3);
}

.tpp-footer ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: var(--tpp-space-2);
}

.tpp-footer a {
	color: var(--tpp-text);
	text-decoration: none;
}

.tpp-footer a:hover {
	color: var(--tpp-primary);
	text-decoration: underline;
}

.tpp-footer-bottom {
	display: flex;
	flex-wrap: wrap;
	gap: var(--tpp-space-3);
	align-items: center;
	justify-content: space-between;
	padding-top: var(--tpp-space-4);
	border-top: 1px solid var(--tpp-border);
	color: var(--tpp-text-muted);
	font-size: 0.87rem;
}

.tpp-footer-bottom ul {
	display: flex;
	flex-wrap: wrap;
	gap: var(--tpp-space-4);
}

/* ==========================================================================
   10. Focus mode
   ========================================================================== */

:root.tpp-focus-mode .tpp-header,
:root.tpp-focus-mode .tpp-footer,
:root.tpp-focus-mode .tpp-breadcrumbs,
:root.tpp-focus-mode .tpp-widget-area,
:root.tpp-focus-mode .tpp-sidebar {
	display: none;
}

:root.tpp-focus-mode .tpp-layout { padding-block: var(--tpp-space-4); }

/* ==========================================================================
   11. Print
   ========================================================================== */

@media print {
	.tpp-header,
	.tpp-footer,
	.tpp-nav,
	.tpp-breadcrumbs,
	.tpp-sidebar,
	.tpp-widget-area,
	.tpp-button-row,
	.skip-link {
		display: none !important;
	}

	body {
		background: #fff;
		color: #000;
		font-size: 12pt;
	}

	a { text-decoration: none; color: #000; }
}
