/*
Theme Name:        Packet Quest
Theme URI:         https://example.com/packetquest
Author:            Packet Quest
Description:       Dark pixel-art block theme for an IT learning platform (networks, systems, cybersecurity).
Version:           1.1.0
Requires at least: 6.6
Tested up to:      6.9
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:       packetquest
Tags:              dark, block-patterns, full-site-editing, education
*/

/* ==========================================================================
   Base
   ========================================================================== */

:root {
	--pq-border: 1px solid var(--wp--preset--color--border);
	--pq-accent: var(--wp--preset--color--accent-primary);
}

body {
	-webkit-font-smoothing: antialiased;
}

::selection {
	background: var(--wp--preset--color--accent-primary);
	color: var(--wp--preset--color--bg-base);
}

a {
	text-underline-offset: 0.2em;
}

/* Reusable mono label (eyebrows, meta, small caps) */
.pq-label,
.pq-eyebrow,
.pq-meta,
.pq-strip p,
.wp-block-post-date {
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.7rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--wp--preset--color--text-muted);
}

.pq-eyebrow {
	color: var(--wp--preset--color--accent-primary);
}

.pq-eyebrow::before {
	content: "";
	display: inline-block;
	width: 6px;
	height: 6px;
	margin-right: 0.75em;
	vertical-align: middle;
	background: currentColor;
}

/* ==========================================================================
   Header
   ========================================================================== */

.pq-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: color-mix(in srgb, var(--wp--preset--color--bg-base) 88%, transparent);
	backdrop-filter: blur(8px);
	border-bottom: var(--pq-border);
}

.pq-header::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: -1px;
	height: 2px;
	background: linear-gradient(90deg,
		var(--wp--preset--color--accent-blue) 0 33.33%,
		var(--wp--preset--color--accent-green) 33.33% 66.66%,
		var(--wp--preset--color--accent-purple) 66.66% 100%);
	opacity: 0.7;
}

.admin-bar .pq-header {
	top: var(--wp-admin--admin-bar--height, 32px);
}

/* Terminal-style logo glyph in front of the site title */
.wp-block-site-title a {
	text-decoration: none;
}

.wp-block-site-title::before {
	content: "[>_]";
	margin-right: 0.6em;
	color: var(--wp--preset--color--accent-primary);
}

.pq-header .wp-block-navigation {
	font-size: 0.85rem;
}

.pq-header .wp-block-navigation a:hover {
	color: var(--wp--preset--color--accent-primary);
}

.pq-link-muted a {
	color: var(--wp--preset--color--text-secondary);
	text-decoration: none;
	font-size: 0.85rem;
}

.pq-link-muted a:hover {
	color: var(--wp--preset--color--text-primary);
}

.pq-btn-sm .wp-block-button__link {
	padding: 0.55em 1.1em;
	font-size: 0.8rem;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.wp-element-button,
.wp-block-button__link {
	transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.wp-block-button:not(.is-style-outline) .wp-block-button__link:hover {
	transform: translate(-2px, -2px);
	box-shadow: 4px 4px 0 var(--wp--preset--color--accent-green);
}

.wp-block-button.is-style-outline .wp-block-button__link {
	background: transparent;
	color: var(--wp--preset--color--text-primary);
	border: var(--pq-border);
}

.wp-block-button.is-style-outline .wp-block-button__link:hover {
	border-color: var(--wp--preset--color--accent-primary);
	color: var(--wp--preset--color--accent-primary);
}

/* ==========================================================================
   Hero
   ========================================================================== */

.pq-hero {
	background:
		radial-gradient(circle at 78% 35%, rgba(111, 168, 255, 0.10), transparent 40%),
		radial-gradient(circle at 60% 80%, rgba(180, 161, 240, 0.07), transparent 40%),
		var(--wp--preset--color--bg-surface);
	border-bottom: var(--pq-border);
}

.pq-hero__title {
	font-size: clamp(2.5rem, 6vw, 4.5rem);
}

.pq-hero__visual {
	position: relative;
}

.pq-hero__art img {
	width: 100%;
	height: auto;
	image-rendering: pixelated;
	animation: pq-float 6s ease-in-out infinite;
}

.pq-badge {
	border-left: 2px solid var(--wp--preset--color--accent-blue) !important;
	position: absolute;
	right: 0;
	bottom: 0;
	padding: 0.9rem 1.2rem !important;
	background: var(--wp--preset--color--bg-base);
	border: var(--pq-border);
}

.pq-badge p {
	margin: 0;
}

.pq-badge p:last-child {
	color: var(--wp--preset--color--text-primary);
	font-size: 0.9rem;
}

.pq-strip {
	border-top: var(--pq-border);
}

.pq-strip p {
	margin: 0;
}

@keyframes pq-float {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-10px); }
}

@media (prefers-reduced-motion: reduce) {
	.pq-hero__art img { animation: none; }
}

/* ==========================================================================
   Cards (tracks + posts)
   ========================================================================== */

.pq-card {
	height: 100%;
	padding: 1.5rem !important;
	background: var(--wp--preset--color--bg-surface);
	border: var(--pq-border);
	border-top: 2px solid var(--pq-accent);
	transition: transform 0.2s ease, border-color 0.2s ease;
}

.pq-card:hover {
	transform: translateY(-4px);
	border-color: var(--pq-accent);
}

/* One accent color per track. Blog posts pick it up from their category slug. */
.pq-card--net,
.category-reseaux { --pq-accent: var(--wp--preset--color--accent-blue); }

.pq-card--sys,
.category-systemes { --pq-accent: var(--wp--preset--color--accent-green); }

.pq-card--sec,
.category-cybersecurite { --pq-accent: var(--wp--preset--color--accent-purple); }

/* Subtle tinted glow on hover, matching the track color */
.pq-card:hover {
	box-shadow: 0 10px 30px -12px color-mix(in srgb, var(--pq-accent) 45%, transparent);
}

/* Category label inside blog cards uses the track color */
.pq-post-grid .wp-block-post-terms a {
	color: var(--pq-accent);
	text-decoration: none;
}

.pq-card__num {
	margin: 0;
	font-family: var(--wp--preset--font-family--pixel);
	font-size: 1.6rem;
	line-height: 1;
	color: var(--pq-accent);
}

.pq-card .wp-block-code {
	margin: 0;
	padding: 0.9rem 1rem;
	font-size: 0.75rem;
	border: 0;
}

.pq-tags,
.pq-card__link a {
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.75rem;
	color: var(--pq-accent);
}

.pq-card__link a {
	text-decoration: none;
	font-family: var(--wp--preset--font-family--body);
	font-weight: 600;
}

.pq-card__link a:hover {
	text-decoration: underline;
}

.pq-card__footer {
	margin-top: auto !important;
}

.pq-card__footer p {
	margin: 0;
	font-size: 0.75rem;
}

/* Blog cards */
.pq-post-grid .pq-card {
	display: flex;
	flex-direction: column;
}

.pq-post-grid .wp-block-post-title a {
	color: var(--wp--preset--color--text-primary);
	text-decoration: none;
}

.pq-post-grid .wp-block-post-title a:hover {
	color: var(--wp--preset--color--accent-primary);
}

/* ==========================================================================
   Steps
   ========================================================================== */

.pq-steps {
	border-top: var(--pq-border);
}

.pq-step__num {
	margin: 0;
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.75rem;
	color: var(--wp--preset--color--accent-primary);
}

.pq-steps .wp-block-column:nth-child(2) .pq-step__num { color: var(--wp--preset--color--accent-blue); }
.pq-steps .wp-block-column:nth-child(3) .pq-step__num { color: var(--wp--preset--color--accent-green); }
.pq-steps .wp-block-column:nth-child(4) .pq-step__num { color: var(--wp--preset--color--accent-purple); }

/* Three-color pixel bar under each step number */
.pq-step__num::after {
	content: "";
	display: block;
	width: 24px;
	height: 3px;
	margin-top: 0.6rem;
	background: currentColor;
}

/* ==========================================================================
   Call to action + quest card
   ========================================================================== */

.pq-cta {
	padding: clamp(1.5rem, 4vw, 2.5rem) !important;
	background: var(--wp--preset--color--bg-accent);
	border: 1px solid color-mix(in srgb, var(--wp--preset--color--accent-primary) 25%, transparent);
}

.pq-cta__note {
	margin: 0;
	font-size: 0.75rem;
	color: var(--wp--preset--color--text-muted);
}

.pq-quest {
	padding: 1.25rem !important;
	background: var(--wp--preset--color--bg-base);
	border: var(--pq-border);
}

.pq-quest .pq-xp {
	color: var(--wp--preset--color--accent-primary);
}

.pq-progress {
	height: 6px;
	background: var(--wp--preset--color--bg-elevated);
}

.pq-progress span {
	display: block;
	width: 12%;
	height: 100%;
	background: var(--wp--preset--color--accent-primary);
	animation: pq-fill 1.6s steps(8) forwards;
}

@keyframes pq-fill {
	from { width: 0; }
	to { width: 12%; }
}

/* ==========================================================================
   Footer
   ========================================================================== */

.pq-footer {
	border-top: var(--pq-border);
}

.pq-footer p {
	margin: 0;
	font-size: 0.8rem;
	color: var(--wp--preset--color--text-muted);
}

.pq-footer a {
	color: var(--wp--preset--color--text-muted);
	text-decoration: none;
}

.pq-footer a:hover {
	color: var(--wp--preset--color--accent-primary);
}

/* ==========================================================================
   Forms (comments, search)
   ========================================================================== */

input[type="text"],
input[type="email"],
input[type="url"],
input[type="search"],
input[type="password"],
textarea,
.wp-block-search__input {
	width: 100%;
	padding: 0.7rem 0.9rem;
	font: inherit;
	color: var(--wp--preset--color--text-primary);
	background: var(--wp--preset--color--bg-surface);
	border: var(--pq-border);
	border-radius: 2px;
}

input:focus,
textarea:focus {
	outline: 2px solid var(--wp--preset--color--accent-primary);
	outline-offset: 1px;
}

.comment-form label {
	font-size: 0.85rem;
	color: var(--wp--preset--color--text-muted);
}

input[type="checkbox"] {
	accent-color: var(--wp--preset--color--accent-primary);
}

.pq-strip a {
	text-decoration: none;
}

.wp-block-site-title {
	white-space: nowrap;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 781px) {
	.pq-header__actions {
		display: none !important;
	}

	.pq-badge {
		position: static;
		margin-top: 1rem !important;
	}
}
