/*
Theme Name: AntPress
Theme URI: https://github.com/lnant/AntPress
Author: lnant
Author URI: https://helyn.eu.org
Description: A light, modern hybrid WordPress theme for personal blogs. Design tokens live in theme.json; the Customizer only carries blog-specific switches. Light blue-and-white by default, dark-mode ready, zero jQuery.
Version: 1.1.0
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 8.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: antpress
Update URI: https://github.com/lnant/AntPress
Tags: blog, two-columns, right-sidebar, custom-colors, custom-menu, featured-images, threaded-comments, translation-ready, accessibility-ready

AntPress is free software released under the GNU General Public
License version 2 or later. Original code; feature design inspired
by the GPL-licensed CorePress theme and the publicly documented
feature set of AeroCore. No third-party theme code is included.

Design rules (see README.md):
- All colours come from theme.json presets (--wp--preset--color--*)
  or the semantic variables below. Components never hard-code hex.
- Dark mode only re-defines the semantic variables under
  html[data-theme="dark"]; the boot script in <head> sets the
  attribute before first paint, so there is no flash.
*/

/* ----------------------------------------------------------------
   Semantic variables
---------------------------------------------------------------- */
:root {
	--ap-bg: var(--wp--preset--color--base);
	--ap-surface: var(--wp--preset--color--surface);
	--ap-text: var(--wp--preset--color--contrast);
	--ap-muted: var(--wp--preset--color--muted);
	--ap-border: var(--wp--preset--color--border);
	--ap-accent: var(--wp--preset--color--accent);
	--ap-header-bg: color-mix(in srgb, var(--ap-bg) 88%, transparent);
	--ap-shadow: 0 2px 6px rgb(23 43 66 / 0.06), 0 14px 34px rgb(23 43 66 / 0.07);
	--ap-radius: 16px;
	--ap-radius-s: 10px;
	--ap-success: #1d9d74;
	--ap-warning: #d98a06;
	--ap-error: #d64541;
	--ap-code-bg: var(--ap-surface);
	--ap-code-text: var(--ap-text);
	--ap-code-comment: var(--ap-muted);
	--ap-code-keyword: var(--ap-primary, #2f7fe0);
	--ap-code-string: #1d7a3a;
	--ap-code-number: var(--ap-accent);
	--ap-code-function: #8a5cf6;
	--ap-code-operator: var(--ap-text);
	--ap-code-punct: var(--ap-muted);
	--ap-code-variable: var(--ap-accent);
}

html[data-theme="dark"] {
	--ap-bg: #10161f;
	--ap-surface: #182130;
	--ap-text: #dbe5f0;
	--ap-muted: #93a5ba;
	--ap-border: #2a3a4f;
	--ap-shadow: 0 2px 6px rgb(0 0 0 / 0.35), 0 14px 34px rgb(0 0 0 / 0.4);
	--ap-success: #35c48d;
	--ap-warning: #e5a73c;
	--ap-error: #ef6a64;
	--ap-code-string: #7ed492;
	--ap-code-function: #b79cff;
}

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

html {
	scroll-behavior: smooth;
}

body {
	margin: 0;
	background: var(--ap-bg);
	color: var(--ap-text);
	font-family: var(--wp--preset--font-family--base);
	font-size: var(--wp--preset--font-size--base);
	line-height: 1.7;
	-webkit-font-smoothing: antialiased;
}

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

a {
	color: var(--ap-primary, #2f7fe0);
}

::selection {
	background: var(--ap-primary, #2f7fe0);
	color: #fff;
}

/* ----------------------------------------------------------------
   Accessibility helpers
---------------------------------------------------------------- */
.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;
	top: -100px;
	left: 1rem;
	z-index: 200;
	padding: 0.6em 1.2em;
	border-radius: 0 0 var(--ap-radius-s) var(--ap-radius-s);
	background: var(--ap-primary, #2f7fe0);
	color: #fff;
	font-weight: 600;
}

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

:focus-visible {
	outline: 3px solid var(--ap-primary, #2f7fe0);
	outline-offset: 2px;
	border-radius: 4px;
}

/* ----------------------------------------------------------------
   Layout
---------------------------------------------------------------- */
.ap-wrap {
	width: min(100% - 2rem, var(--wp--style--global--wide-size, 1200px));
	margin-inline: auto;
}

.ap-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--wp--preset--spacing--xl);
	padding-block: var(--wp--preset--spacing--l) var(--wp--preset--spacing--xxl);
}

.ap-layout.has-sidebar {
	grid-template-columns: minmax(0, 1fr) 320px;
}

.ap-main {
	min-width: 0;
}

.ap-sidebar {
	min-width: 0;
}

/* ----------------------------------------------------------------
   Header
---------------------------------------------------------------- */
.ap-progress {
	position: fixed;
	inset: 0 auto auto 0;
	z-index: 300;
	width: 0;
	height: 4px;
	background: var(--ap-primary, #2f7fe0);
	box-shadow: 0 1px 6px rgb(47 127 224 / 0.55);
}

/* Keep the bar visible below the WordPress admin bar for logged-in users. */
.admin-bar .ap-progress {
	top: 32px;
}

@media (max-width: 782px) {
	.admin-bar .ap-progress {
		top: 46px;
	}
}

.ap-header {
	position: sticky;
	top: 0;
	z-index: 100;
	background: var(--ap-header-bg);
	backdrop-filter: blur(12px);
	border-bottom: 1px solid var(--ap-border);
}

.admin-bar .ap-header {
	top: 32px;
}

.ap-header-in {
	display: flex;
	align-items: center;
	gap: var(--wp--preset--spacing--m);
	min-height: 64px;
}

.ap-brand {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	margin-inline-end: auto;
	color: var(--ap-text);
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--large);
	font-weight: 700;
	text-decoration: none;
}

.ap-brand img {
	max-height: 54px;
	width: auto;
}

.ap-nav {
	margin-inline-start: auto;
}

.ap-nav-list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1.1rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ap-nav-list a {
	color: var(--ap-text);
	text-decoration: none;
	padding-block: 0.3em;
}

.ap-nav-list a:hover,
.ap-nav-list .current-menu-item > a,
.ap-nav-list .current_page_item > a {
	color: var(--ap-primary, #2f7fe0);
}

.ap-header-actions {
	display: flex;
	align-items: center;
	gap: 0.4rem;
}

.ap-icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 1px solid var(--ap-border);
	border-radius: 999px;
	background: var(--ap-surface);
	color: var(--ap-text);
	cursor: pointer;
	text-decoration: none;
}

.ap-icon-btn:hover {
	border-color: var(--ap-primary, #2f7fe0);
	color: var(--ap-primary, #2f7fe0);
}

.ap-icon-btn svg {
	width: 20px;
	height: 20px;
}

.ap-menu-toggle {
	display: none;
}

.ap-theme-toggle .ap-icon-sun {
	display: none;
}

html[data-theme="dark"] .ap-theme-toggle .ap-icon-sun {
	display: block;
}

html[data-theme="dark"] .ap-theme-toggle .ap-icon-moon {
	display: none;
}

/* Mobile drawer menu */
.ap-mobile-menu {
	position: fixed;
	inset: 0 0 0 auto;
	z-index: 150;
	width: min(320px, 85vw);
	padding: var(--wp--preset--spacing--l);
	background: var(--ap-bg);
	border-inline-start: 1px solid var(--ap-border);
	box-shadow: var(--ap-shadow);
	transform: translateX(105%);
	transition: transform 0.25s ease;
	overflow-y: auto;
}

.ap-mobile-menu.is-open {
	transform: none;
}

.ap-mobile-menu .ap-nav-list {
	flex-direction: column;
	gap: 0.6rem;
	font-size: var(--wp--preset--font-size--medium);
}

.ap-scrim {
	position: fixed;
	inset: 0;
	z-index: 140;
	background: rgb(10 18 28 / 0.45);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.25s ease;
}

.ap-scrim.is-open {
	opacity: 1;
	pointer-events: auto;
}

/* ----------------------------------------------------------------
   Breadcrumb & meta
---------------------------------------------------------------- */
.ap-breadcrumb {
	display: flex;
	flex-wrap: wrap;
	gap: 0.45rem;
	margin-bottom: var(--wp--preset--spacing--m);
	color: var(--ap-muted);
	font-size: var(--wp--preset--font-size--small);
}

.ap-breadcrumb a {
	color: var(--ap-muted);
	text-decoration: none;
}

.ap-breadcrumb a:hover {
	color: var(--ap-primary, #2f7fe0);
}

.ap-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.45rem;
	color: var(--ap-muted);
	font-size: var(--wp--preset--font-size--small);
}

.ap-meta a {
	color: var(--ap-muted);
}

.ap-section-title {
	font-size: var(--wp--preset--font-size--large);
	margin-block: var(--wp--preset--spacing--xl) var(--wp--preset--spacing--m);
}

/* ----------------------------------------------------------------
   Carousel (scroll-snap)
---------------------------------------------------------------- */
.ap-carousel {
	position: relative;
	margin-bottom: var(--wp--preset--spacing--xl);
}

.ap-carousel-track {
	display: flex;
	gap: var(--wp--preset--spacing--m);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	border-radius: var(--ap-radius);
}

.ap-carousel-track::-webkit-scrollbar {
	display: none;
}

.ap-slide {
	position: relative;
	flex: 0 0 100%;
	scroll-snap-align: start;
	min-height: 300px;
	border-radius: var(--ap-radius);
	overflow: hidden;
	background: var(--ap-surface);
}

.ap-slide img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.ap-slide-body {
	position: absolute;
	inset: auto 0 0 0;
	padding: var(--wp--preset--spacing--l);
	background: linear-gradient(transparent, rgb(8 17 28 / 0.78));
	color: #fff;
}

.ap-slide-body a {
	color: #fff;
	text-decoration: none;
}

.ap-slide-title {
	margin: 0 0 0.25em;
	font-size: var(--wp--preset--font-size--x-large);
	line-height: 1.3;
}

.ap-slide-excerpt {
	margin: 0;
	opacity: 0.9;
	font-size: var(--wp--preset--font-size--small);
}

.ap-slide-placeholder {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	font-size: 5rem;
	font-weight: 700;
	color: #fff;
	background: linear-gradient(135deg, var(--ap-primary, #2f7fe0), var(--ap-accent));
}

.ap-carousel-btn {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
}

.ap-carousel-prev {
	inset-inline-start: 0.75rem;
}

.ap-carousel-next {
	inset-inline-end: 0.75rem;
}

/* ----------------------------------------------------------------
   Post cards
---------------------------------------------------------------- */
.ap-card-list {
	display: grid;
	gap: var(--wp--preset--spacing--l);
}

.ap-card-list.style-card {
	grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
}

.ap-card {
	display: flex;
	gap: var(--wp--preset--spacing--m);
	padding: var(--wp--preset--spacing--m);
	background: var(--ap-surface);
	border: 1px solid var(--ap-border);
	border-radius: var(--ap-radius);
	box-shadow: var(--ap-shadow);
	overflow: hidden;
}

.style-card .ap-card {
	flex-direction: column;
	padding: 0;
	gap: 0;
}

.ap-card-thumb {
	flex: 0 0 240px;
	border-radius: var(--ap-radius-s);
	overflow: hidden;
}

.style-card .ap-card-thumb {
	flex: none;
	border-radius: 0;
	aspect-ratio: 16 / 9;
}

.ap-card-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	aspect-ratio: 8 / 5;
}

.style-card .ap-card-img {
	aspect-ratio: 16 / 9;
}

.ap-card-placeholder {
	display: grid;
	place-items: center;
	min-height: 150px;
	font-size: 3rem;
	font-weight: 700;
	color: #fff;
	background: linear-gradient(135deg, var(--ap-primary, #2f7fe0), var(--ap-accent));
}

.ap-card-body {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	min-width: 0;
	padding-block: 0.2rem;
}

.style-card .ap-card-body {
	padding: var(--wp--preset--spacing--m);
}

.ap-card-title {
	margin: 0;
	font-size: var(--wp--preset--font-size--medium);
	line-height: 1.4;
}

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

.ap-card-title a:hover {
	color: var(--ap-primary, #2f7fe0);
}

.ap-card-excerpt {
	margin: 0;
	color: var(--ap-muted);
	font-size: var(--wp--preset--font-size--small);
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.ap-card-cats {
	font-size: var(--wp--preset--font-size--small);
}

.ap-card-cats a {
	text-decoration: none;
}

.ap-pagination {
	margin-top: var(--wp--preset--spacing--xl);
}

.ap-pagination .nav-links {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	justify-content: center;
}

.ap-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.5rem;
	height: 2.5rem;
	padding-inline: 0.6rem;
	border: 1px solid var(--ap-border);
	border-radius: 999px;
	background: var(--ap-surface);
	color: var(--ap-text);
	text-decoration: none;
}

.ap-pagination .page-numbers.current {
	background: var(--ap-primary, #2f7fe0);
	border-color: var(--ap-primary, #2f7fe0);
	color: #fff;
}

.ap-empty {
	padding: var(--wp--preset--spacing--xl);
	text-align: center;
	background: var(--ap-surface);
	border: 1px dashed var(--ap-border);
	border-radius: var(--ap-radius);
}

/* ----------------------------------------------------------------
   Single article
---------------------------------------------------------------- */
.ap-article-head {
	margin-bottom: var(--wp--preset--spacing--l);
}

.ap-article-title {
	margin: 0 0 0.4em;
	font-size: var(--wp--preset--font-size--xx-large);
	line-height: 1.3;
}

.ap-featured {
	margin: 0 0 var(--wp--preset--spacing--l);
	border-radius: var(--ap-radius);
	overflow: hidden;
}

.ap-featured img {
	display: block;
	width: 100%;
}

.ap-content {
	font-size: 1.05rem;
	line-height: 1.85;
	overflow-wrap: break-word;
}

.ap-content a {
	text-decoration: underline;
	text-underline-offset: 0.18em;
}

.ap-content h2,
.ap-content h3 {
	scroll-margin-top: 90px;
	margin-block: 1.6em 0.6em;
}

.ap-content img {
	border-radius: var(--ap-radius-s);
}

.ap-content pre {
	padding: 1em 1.1em;
	overflow: auto;
	background: var(--ap-code-bg);
	border: 1px solid var(--ap-border);
	border-radius: 12px;
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.6;
}

.ap-content code {
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.92em;
}

.ap-content :not(pre) > code {
	padding: 0.12em 0.35em;
	background: var(--ap-code-bg);
	border-radius: 6px;
}

.ap-content blockquote {
	margin-inline: 0;
	padding-inline-start: 1em;
	border-inline-start: 3px solid var(--ap-primary, #2f7fe0);
	color: var(--ap-muted);
}

.ap-content table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--wp--preset--font-size--small);
}

.ap-content th,
.ap-content td {
	padding: 0.5em 0.8em;
	border: 1px solid var(--ap-border);
	text-align: start;
}

/* Table of contents */
.ap-toc {
	margin-bottom: var(--wp--preset--spacing--l);
	padding: var(--wp--preset--spacing--m) var(--wp--preset--spacing--l);
	background: var(--ap-surface);
	border: 1px solid var(--ap-border);
	border-radius: var(--ap-radius);
}

.ap-toc ul {
	margin: 0.4em 0 0;
	padding-inline-start: 1.1em;
}

.ap-toc li {
	margin-block: 0.2em;
}

.ap-toc .ap-toc-l3 {
	margin-inline-start: 1em;
	font-size: var(--wp--preset--font-size--small);
}

.ap-toc a {
	color: var(--ap-text);
	text-decoration: none;
}

.ap-toc a:hover,
.ap-toc a.is-active {
	color: var(--ap-primary, #2f7fe0);
	font-weight: 600;
}

/* Copyright + tags + post navigation */
.ap-copyright {
	margin-top: var(--wp--preset--spacing--xl);
	padding: var(--wp--preset--spacing--m) var(--wp--preset--spacing--l);
	background: var(--ap-surface);
	border: 1px dashed var(--ap-border);
	border-radius: var(--ap-radius-s);
	color: var(--ap-muted);
	font-size: var(--wp--preset--font-size--small);
}

.ap-tags {
	margin-top: var(--wp--preset--spacing--l);
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.ap-tags a {
	padding: 0.15em 0.8em;
	border: 1px solid var(--ap-border);
	border-radius: 999px;
	background: var(--ap-surface);
	color: var(--ap-muted);
	font-size: var(--wp--preset--font-size--small);
	text-decoration: none;
}

.ap-tags a:hover {
	color: var(--ap-primary, #2f7fe0);
	border-color: var(--ap-primary, #2f7fe0);
}

.ap-post-nav {
	margin-top: var(--wp--preset--spacing--xl);
}

.ap-post-nav .nav-links {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--wp--preset--spacing--m);
}

.ap-post-nav a {
	display: block;
	padding: var(--wp--preset--spacing--m);
	background: var(--ap-surface);
	border: 1px solid var(--ap-border);
	border-radius: var(--ap-radius-s);
	color: var(--ap-text);
	text-decoration: none;
}

.ap-post-nav .nav-next {
	text-align: end;
}

/* Related posts */
.ap-related-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
	gap: var(--wp--preset--spacing--m);
}

.ap-related-card {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	padding-bottom: var(--wp--preset--spacing--s);
	background: var(--ap-surface);
	border: 1px solid var(--ap-border);
	border-radius: var(--ap-radius-s);
	overflow: hidden;
	color: var(--ap-text);
	text-decoration: none;
}

.ap-related-card .ap-card-img {
	aspect-ratio: 16 / 10;
}

.ap-related-card-title {
	padding-inline: var(--wp--preset--spacing--s);
	font-weight: 600;
	line-height: 1.45;
}

.ap-related-card-date {
	padding-inline: var(--wp--preset--spacing--s);
	color: var(--ap-muted);
	font-size: var(--wp--preset--font-size--small);
}

/* ----------------------------------------------------------------
   Widgets & sidebar
---------------------------------------------------------------- */
.ap-widget {
	margin-bottom: var(--wp--preset--spacing--l);
	padding: var(--wp--preset--spacing--m) var(--wp--preset--spacing--l);
	background: var(--ap-surface);
	border: 1px solid var(--ap-border);
	border-radius: var(--ap-radius);
}

.ap-widget-title {
	margin: 0 0 0.7em;
	font-size: var(--wp--preset--font-size--medium);
}

.ap-widget ul {
	margin: 0;
	padding-inline-start: 1.1em;
}

.ap-about {
	text-align: center;
}

.ap-about-name {
	margin-top: 0.5em;
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--large);
	font-weight: 700;
}

.ap-about-text {
	margin: 0.4em 0 0;
	color: var(--ap-muted);
	font-size: var(--wp--preset--font-size--small);
}

.ap-mini-list {
	margin: 0;
	padding: 0;
	list-style: none;
	display: grid;
	gap: 0.8rem;
}

.ap-mini-list a {
	display: flex;
	gap: 0.7rem;
	align-items: flex-start;
	color: var(--ap-text);
	text-decoration: none;
}

.ap-mini-thumb,
.ap-mini-avatar {
	flex: 0 0 auto;
	width: 48px;
	height: 48px;
	object-fit: cover;
	border-radius: var(--ap-radius-s);
}

.ap-mini-avatar {
	border-radius: 999px;
}

.ap-mini-title {
	display: block;
	line-height: 1.45;
}

.ap-mini-date {
	display: block;
	color: var(--ap-muted);
	font-size: var(--wp--preset--font-size--small);
}

/* ----------------------------------------------------------------
   Comments
---------------------------------------------------------------- */
.ap-comments {
	margin-top: var(--wp--preset--spacing--xxl);
}

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

.ap-comment-list .children {
	list-style: none;
	margin-top: var(--wp--preset--spacing--m);
	padding-inline-start: var(--wp--preset--spacing--l);
	border-inline-start: 2px solid var(--ap-border);
}

.ap-comment {
	margin-bottom: var(--wp--preset--spacing--l);
	padding: var(--wp--preset--spacing--m) var(--wp--preset--spacing--l);
	background: var(--ap-surface);
	border: 1px solid var(--ap-border);
	border-radius: var(--ap-radius);
}

.ap-comment-meta {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	color: var(--ap-muted);
	font-size: var(--wp--preset--font-size--small);
}

.ap-comment-meta .avatar {
	border-radius: 999px;
}

.ap-comment-author {
	color: var(--ap-text);
	font-weight: 600;
	font-style: normal;
}

.ap-comment-body p {
	margin-block: 0.6em;
}

.ap-comment-form label {
	display: block;
	margin-bottom: 0.3em;
	font-weight: 600;
}

.ap-comment-form input[type="text"],
.ap-comment-form input[type="email"],
.ap-comment-form input[type="url"],
.ap-comment-form textarea {
	width: 100%;
	padding: 0.65em 0.9em;
	border: 1px solid var(--ap-border);
	border-radius: var(--ap-radius-s);
	background: var(--ap-bg);
	color: var(--ap-text);
	font: inherit;
}

.ap-comment-form textarea {
	min-height: 120px;
}

.ap-comment-form .comment-form-cookies-consent label {
	display: inline;
	font-weight: 400;
}

.ap-btn,
.ap-comment-form .submit,
.ap-search-form .ap-search-submit {
	display: inline-block;
	padding: 0.6em 1.4em;
	border: 0;
	border-radius: 999px;
	background: var(--ap-primary, #2f7fe0);
	color: #fff;
	font: inherit;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
}

.ap-btn:hover,
.ap-comment-form .submit:hover {
	filter: brightness(1.08);
	color: #fff;
}

.ap-btn-ghost {
	background: transparent;
	color: var(--ap-primary, #2f7fe0);
	border: 1px solid var(--ap-primary, #2f7fe0);
}

/* Emoji panel (injected by JS next to the comment textarea) */
.ap-emoji-wrap {
	position: relative;
	margin-bottom: 0.5em;
}

.ap-emoji-toggle {
	padding: 0.3em 0.9em;
	border: 1px solid var(--ap-border);
	border-radius: 999px;
	background: var(--ap-surface);
	color: var(--ap-text);
	cursor: pointer;
	font: inherit;
	font-size: var(--wp--preset--font-size--small);
}

.ap-emoji-panel {
	position: absolute;
	z-index: 20;
	bottom: calc(100% + 6px);
	inset-inline-start: 0;
	display: none;
	grid-template-columns: repeat(8, 2rem);
	gap: 0.15rem;
	padding: 0.5rem;
	background: var(--ap-bg);
	border: 1px solid var(--ap-border);
	border-radius: var(--ap-radius-s);
	box-shadow: var(--ap-shadow);
}

.ap-emoji-panel.is-open {
	display: grid;
}

.ap-emoji-panel button {
	padding: 0.2rem;
	border: 0;
	background: none;
	font-size: 1.15rem;
	cursor: pointer;
	border-radius: 6px;
}

.ap-emoji-panel button:hover {
	background: var(--ap-surface);
}

.ap-comment-notice {
	margin-bottom: var(--wp--preset--spacing--m);
	padding: 0.6em 1em;
	border-radius: var(--ap-radius-s);
	background: var(--ap-surface);
	border: 1px solid var(--ap-border);
	font-size: var(--wp--preset--font-size--small);
}

/* ----------------------------------------------------------------
   Shortcode components
---------------------------------------------------------------- */
.ap-alert {
	margin-block: 1.2em;
	padding: 0.9em 1.1em;
	border-radius: var(--ap-radius-s);
	border-inline-start: 4px solid var(--ap-primary, #2f7fe0);
	background: var(--ap-surface);
}

.ap-alert p:first-child {
	margin-top: 0;
}

.ap-alert p:last-child {
	margin-bottom: 0;
}

.ap-alert-success {
	border-inline-start-color: var(--ap-success);
}

.ap-alert-warning {
	border-inline-start-color: var(--ap-warning);
}

.ap-alert-error {
	border-inline-start-color: var(--ap-error);
}

.ap-collapse {
	margin-block: 1.2em;
	border: 1px solid var(--ap-border);
	border-radius: var(--ap-radius-s);
	background: var(--ap-surface);
}

.ap-collapse summary {
	padding: 0.8em 1.1em;
	font-weight: 600;
	cursor: pointer;
}

.ap-collapse-body {
	padding: 0 1.1em 1em;
}

.ap-download {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.6em 1.3em;
	border-radius: 999px;
	background: var(--ap-primary, #2f7fe0);
	color: #fff;
	font-weight: 600;
	text-decoration: none;
}

.ap-download:hover {
	color: #fff;
	filter: brightness(1.08);
}

.ap-hidden-note {
	margin-block: 1.2em;
	padding: 0.9em 1.1em;
	border: 1px dashed var(--ap-border);
	border-radius: var(--ap-radius-s);
	background: var(--ap-surface);
	color: var(--ap-muted);
	text-align: center;
}

/* ----------------------------------------------------------------
   Search
---------------------------------------------------------------- */
.ap-search-form {
	display: flex;
	gap: 0.5rem;
}

.ap-search-form .ap-search-field {
	flex: 1;
	min-width: 0;
	padding: 0.65em 1em;
	border: 1px solid var(--ap-border);
	border-radius: 999px;
	background: var(--ap-bg);
	color: var(--ap-text);
	font: inherit;
}

.ap-archive-head {
	margin-bottom: var(--wp--preset--spacing--l);
}

.ap-archive-title {
	margin: 0 0 0.3em;
	font-size: var(--wp--preset--font-size--xx-large);
}

.ap-archive-desc {
	color: var(--ap-muted);
}

/* ----------------------------------------------------------------
   Footer
---------------------------------------------------------------- */
.ap-footer {
	margin-top: var(--wp--preset--spacing--xxl);
	border-top: 1px solid var(--ap-border);
	background: var(--ap-surface);
}

.ap-footer-cols {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--wp--preset--spacing--l);
	padding-block: var(--wp--preset--spacing--xl);
}

.ap-footer .ap-widget {
	padding: 0;
	background: none;
	border: 0;
}

.ap-footer-bar {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.3rem;
	padding-block: var(--wp--preset--spacing--l) var(--wp--preset--spacing--xl);
	border-top: 1px solid var(--ap-border);
	text-align: center;
	color: var(--ap-muted);
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.7;
}

.ap-footer-bar a {
	color: var(--ap-muted);
	text-decoration: none;
}

.ap-footer-bar a:hover {
	color: var(--ap-primary, #2f7fe0);
}

.ap-footer-main {
	margin: 0;
}

.ap-footer-main .ap-site-name {
	color: var(--ap-text);
	font-weight: 600;
}

.ap-footer-main .ap-sep {
	margin-inline: 0.45em;
	opacity: 0.6;
}

.ap-footer-credit {
	margin: 0;
	font-size: 0.78rem;
	letter-spacing: 0.02em;
	opacity: 0.75;
}

.ap-footer-nav {
	margin-bottom: 0.5rem;
}

.ap-footer-nav .menu {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.4rem 1rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* ----------------------------------------------------------------
   Lightbox & back-to-top
---------------------------------------------------------------- */
.ap-lightbox {
	max-width: min(92vw, 1100px);
	max-height: 92vh;
	padding: 0;
	border: 0;
	border-radius: var(--ap-radius);
	background: transparent;
}

.ap-lightbox::backdrop {
	background: rgb(8 14 22 / 0.85);
}

.ap-lightbox img {
	display: block;
	max-width: 100%;
	max-height: 88vh;
	border-radius: var(--ap-radius);
}

.ap-lightbox-close {
	position: absolute;
	top: 0.6rem;
	inset-inline-end: 0.6rem;
}

.ap-to-top {
	position: fixed;
	inset-inline-end: 1.2rem;
	bottom: 1.2rem;
	z-index: 120;
	opacity: 0;
	pointer-events: none;
	transform: translateY(8px);
	transition: opacity 0.25s ease, transform 0.25s ease;
	box-shadow: var(--ap-shadow);
}

.ap-to-top.is-visible {
	opacity: 1;
	pointer-events: auto;
	transform: none;
}

/* ----------------------------------------------------------------
   Page templates (links / archives)
---------------------------------------------------------------- */
.ap-link-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
	gap: var(--wp--preset--spacing--m);
	margin: 0;
	padding: 0;
	list-style: none;
}

.ap-link-card a {
	display: block;
	padding: var(--wp--preset--spacing--m) var(--wp--preset--spacing--l);
	background: var(--ap-surface);
	border: 1px solid var(--ap-border);
	border-radius: var(--ap-radius-s);
	color: var(--ap-text);
	text-decoration: none;
}

.ap-link-card a:hover {
	border-color: var(--ap-primary, #2f7fe0);
}

.ap-link-name {
	display: block;
	font-weight: 700;
}

.ap-link-desc {
	display: block;
	margin-top: 0.3em;
	color: var(--ap-muted);
	font-size: var(--wp--preset--font-size--small);
}

.ap-archive-year {
	margin-top: var(--wp--preset--spacing--xl);
	font-size: var(--wp--preset--font-size--large);
}

.ap-archive-list {
	margin: 0;
	padding-inline-start: 1.1em;
}

.ap-archive-list li {
	margin-block: 0.35em;
}

.ap-archive-list time {
	color: var(--ap-muted);
	font-size: var(--wp--preset--font-size--small);
	margin-inline-end: 0.6em;
}

/* ----------------------------------------------------------------
   Responsive
---------------------------------------------------------------- */
@media (max-width: 1024px) {
	.ap-layout.has-sidebar {
		grid-template-columns: minmax(0, 1fr) 280px;
	}
}

@media (max-width: 860px) {
	.ap-layout.has-sidebar {
		grid-template-columns: minmax(0, 1fr);
	}

	.ap-nav {
		display: none;
	}

	.ap-menu-toggle {
		display: inline-flex;
	}

	.ap-card {
		flex-direction: column;
	}

	.ap-card-thumb {
		flex: none;
	}

	.ap-footer-cols {
		grid-template-columns: 1fr;
	}

	.ap-post-nav .nav-links {
		grid-template-columns: 1fr;
	}

	.ap-post-nav .nav-next {
		text-align: start;
	}
}

@media (max-width: 782px) {
	.admin-bar .ap-header {
		top: 46px;
	}
}

/* ----------------------------------------------------------------
   Motion preferences
   (View Transitions: intentionally not enabled here — it is still
   a feature-plugin capability in WordPress; see RESEARCH.md §1.3.)
---------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}

/* ----------------------------------------------------------------
   Engagement (views / likes / sticky badge) — v1.1.0
---------------------------------------------------------------- */
.ap-card-thumb {
	position: relative;
}

.ap-badge-sticky {
	position: absolute;
	top: 0.6rem;
	inset-inline-start: 0.6rem;
	z-index: 2;
	padding: 0.14rem 0.55rem;
	border-radius: 999px;
	background: var(--ap-primary, #2f7fe0);
	color: #fff;
	font-size: 0.72rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	line-height: 1.5;
	box-shadow: var(--ap-shadow);
}

.ap-meta-author {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
}

.ap-meta-avatar {
	border-radius: 50%;
	vertical-align: middle;
}

.ap-actions {
	display: flex;
	justify-content: center;
	padding-block: var(--wp--preset--spacing--l) var(--wp--preset--spacing--s);
}

.ap-like-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	padding: 0.55rem 1.4rem;
	border: 1px solid var(--ap-border);
	border-radius: 999px;
	background: var(--ap-surface);
	color: var(--ap-muted);
	font: inherit;
	font-size: var(--wp--preset--font-size--small);
	cursor: pointer;
	transition: color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.ap-like-btn svg {
	width: 17px;
	height: 17px;
}

.ap-like-btn:hover {
	color: #e0245e;
	border-color: #e0245e;
}

.ap-like-btn:active {
	transform: scale(0.96);
}

.ap-like-btn.is-liked {
	color: #e0245e;
	border-color: #e0245e;
}

/* ================================================================
   v1.1.0 additions, part 2: stats widget, chips, stale notice,
   share, prev/next cards, hero, search panel, reward, code copy,
   comment extras, timeline, card motion.
   ================================================================ */

/* Card motion + unified cover ratio */
.ap-card {
	transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.ap-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 10px 30px rgb(15 40 80 / 0.1);
}

.ap-card-thumb {
	aspect-ratio: 16 / 10;
	background: color-mix(in srgb, var(--ap-primary) 8%, var(--ap-surface));
}

.ap-card-thumb img,
.ap-featured img {
	opacity: 0;
	transition: opacity 0.5s ease, transform 0.4s ease;
}

.ap-card-thumb img.is-loaded,
.ap-featured img.is-loaded {
	opacity: 1;
}

.ap-card:hover .ap-card-thumb img {
	transform: scale(1.04);
}

/* Category chips (front page) */
.ap-cat-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 18px;
}

.ap-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 14px;
	border: 1px solid var(--ap-border);
	border-radius: 999px;
	background: var(--ap-surface);
	color: var(--ap-text);
	font-size: 0.875rem;
	text-decoration: none;
	transition: all 0.2s ease;
}

.ap-chip:hover {
	border-color: var(--ap-primary);
	color: var(--ap-primary);
	transform: translateY(-1px);
}

.ap-chip-count {
	font-size: 0.75rem;
	color: var(--ap-text-2);
	background: color-mix(in srgb, var(--ap-primary) 10%, transparent);
	padding: 0 7px;
	border-radius: 999px;
}

/* Stats widget */
.ap-stats-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 6px;
	text-align: center;
}

.ap-stat-num {
	display: block;
	font-size: 1.05rem;
	font-weight: 700;
	color: var(--ap-primary);
}

.ap-stat-label {
	font-size: 0.75rem;
	color: var(--ap-text-2);
}

/* Stale-content notice */
.ap-stale {
	margin: 0 0 20px;
	padding: 12px 16px;
	border-left: 4px solid #e6a23c;
	border-radius: var(--ap-radius-s);
	background: color-mix(in srgb, #e6a23c 9%, var(--ap-surface));
	font-size: 0.9rem;
	color: var(--ap-text-2);
}

/* Immersive hero title */
.ap-hero {
	position: relative;
	margin: 0 0 24px;
	padding: 64px 28px 26px;
	border-radius: var(--ap-radius);
	background-size: cover;
	background-position: center;
	overflow: hidden;
}

.ap-hero::before {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgb(10 20 40 / 0.25), rgb(10 20 40 / 0.72));
}

.ap-hero .ap-article-title,
.ap-hero .ap-meta {
	position: relative;
	color: #fff;
}

.ap-hero .ap-meta {
	opacity: 0.92;
}

/* Share row */
.ap-share {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin: 18px 0 4px;
}

.ap-share-label {
	font-size: 0.9rem;
	color: var(--ap-text-2);
}

.ap-share-btn {
	display: inline-block;
	padding: 5px 14px;
	border: 1px solid var(--ap-border);
	border-radius: 999px;
	background: var(--ap-surface);
	color: var(--ap-text);
	font-size: 0.85rem;
	cursor: pointer;
	text-decoration: none;
	transition: all 0.2s ease;
}

.ap-share-btn:hover {
	border-color: var(--ap-primary);
	color: var(--ap-primary);
}

.ap-share-wx {
	position: relative;
}

.ap-share-qr {
	position: absolute;
	left: 50%;
	bottom: calc(100% + 10px);
	transform: translateX(-50%);
	z-index: 60;
	width: 180px;
	padding: 12px;
	border: 1px solid var(--ap-border);
	border-radius: var(--ap-radius-s);
	background: var(--ap-surface);
	box-shadow: 0 12px 32px rgb(0 0 0 / 0.16);
	text-align: center;
	font-size: 0.8rem;
	color: var(--ap-text-2);
}

.ap-share-qr img {
	display: block;
	width: 160px;
	height: 160px;
	margin: 0 auto 6px;
}

/* Reward */
.ap-reward-btn {
	padding: 9px 26px;
	border: 1px solid #e6a23c;
	border-radius: 999px;
	background: color-mix(in srgb, #e6a23c 12%, var(--ap-surface));
	color: #b97c1e;
	font-size: 0.95rem;
	cursor: pointer;
	transition: all 0.2s ease;
}

.ap-reward-btn:hover {
	background: #e6a23c;
	color: #fff;
}

.ap-reward {
	border: 1px solid var(--ap-border);
	border-radius: var(--ap-radius);
	background: var(--ap-surface);
	color: var(--ap-text);
	padding: 28px;
	max-width: min(480px, 92vw);
	text-align: center;
}

.ap-reward::backdrop {
	background: rgb(10 15 25 / 0.5);
	backdrop-filter: blur(3px);
}

.ap-reward-codes {
	display: flex;
	gap: 20px;
	justify-content: center;
	margin-top: 14px;
}

.ap-reward-codes figure {
	margin: 0;
}

.ap-reward-codes img {
	width: 160px;
	height: 160px;
	object-fit: contain;
	border: 1px solid var(--ap-border);
	border-radius: var(--ap-radius-s);
}

.ap-reward-codes figcaption {
	margin-top: 6px;
	font-size: 0.85rem;
	color: var(--ap-text-2);
}

.ap-dialog-close {
	position: absolute;
	top: 10px;
	right: 12px;
	border: 0;
	background: transparent;
	color: var(--ap-text-2);
	font-size: 1rem;
	cursor: pointer;
}

.ap-reward {
	position: relative;
}

/* Prev/next cards */
.ap-post-nav {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 14px;
	margin: 26px 0 6px;
}

.ap-nav-card {
	position: relative;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	gap: 4px;
	min-height: 110px;
	padding: 16px;
	border-radius: var(--ap-radius);
	background-color: color-mix(in srgb, var(--ap-primary) 12%, var(--ap-surface));
	background-size: cover;
	background-position: center;
	color: var(--ap-text);
	text-decoration: none;
	overflow: hidden;
	transition: transform 0.25s ease;
}

.ap-nav-card:hover {
	transform: translateY(-2px);
}

.ap-nav-card[style*="background-image"] {
	color: #fff;
}

.ap-nav-card[style*="background-image"]::before {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgb(10 20 40 / 0.05), rgb(10 20 40 / 0.66));
}

.ap-nav-card .ap-nav-label,
.ap-nav-card .ap-nav-title {
	position: relative;
}

.ap-nav-label {
	font-size: 0.8rem;
	opacity: 0.85;
}

.ap-nav-title {
	font-weight: 600;
	line-height: 1.45;
}

.ap-nav-card.next {
	text-align: right;
}

.ap-nav-card.empty {
	background: transparent;
	pointer-events: none;
}

@media (max-width: 640px) {
	.ap-post-nav {
		grid-template-columns: 1fr;
	}

	.ap-nav-card.empty {
		display: none;
	}
}

/* Search bar as floating panel */
.ap-search-bar {
	padding: 14px 16px;
	border: 1px solid var(--ap-border);
	border-radius: var(--ap-radius-s);
	background: var(--ap-surface);
	box-shadow: 0 16px 40px rgb(0 0 0 / 0.14);
	margin-top: 10px;
	animation: ap-drop 0.18s ease;
}

@keyframes ap-drop {
	from {
		opacity: 0;
		transform: translateY(-6px);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

/* Code copy button */
.ap-content pre {
	position: relative;
}

.ap-copy-btn {
	position: absolute;
	top: 8px;
	right: 8px;
	padding: 3px 12px;
	border: 1px solid rgb(255 255 255 / 0.25);
	border-radius: 6px;
	background: rgb(255 255 255 / 0.08);
	color: #dbe7f5;
	font-size: 0.78rem;
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.2s ease;
}

.ap-content pre:hover .ap-copy-btn,
.ap-copy-btn.is-done {
	opacity: 1;
}

.ap-copy-btn.is-done {
	border-color: #67c23a;
	color: #95d475;
}

/* Comment extras */
.ap-badge-author {
	display: inline-block;
	padding: 0 7px;
	border-radius: 4px;
	background: var(--ap-primary);
	color: #fff;
	font-size: 0.7rem;
	font-style: normal;
	vertical-align: 2px;
}

.ap-comment-ua {
	font-size: 0.75rem;
	color: var(--ap-text-2);
}

.ap-comment-foot {
	display: flex;
	align-items: center;
	gap: 14px;
	margin-top: 8px;
}

.ap-clike-btn {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 2px 8px;
	border: 0;
	background: transparent;
	color: var(--ap-text-2);
	font-size: 0.8rem;
	cursor: pointer;
}

.ap-clike-btn.is-liked {
	color: #e0245e;
}

/* Shuoshuo timeline */
.ap-timeline {
	list-style: none;
	margin: 10px 0 0;
	padding: 0 0 0 18px;
	border-left: 2px solid var(--ap-border);
}

.ap-tl-item {
	position: relative;
	padding: 0 0 22px 14px;
}

.ap-tl-item::before {
	content: "";
	position: absolute;
	left: -24px;
	top: 6px;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--ap-primary);
}

.ap-tl-date {
	font-size: 0.8rem;
	color: var(--ap-text-2);
}

.ap-tl-body {
	margin-top: 4px;
}

.ap-tl-link {
	font-size: 0.85rem;
}

/* Footer theme credit link */
.ap-footer-credit a {
	color: inherit;
	text-decoration: none;
	border-bottom: 1px dotted currentColor;
}

.ap-footer-credit a:hover {
	color: var(--ap-primary);
}
