/*
Theme Name: Appnest
Description: Lightweight, SEO-first theme for app and game download sites with a modern app-store look, dark mode and a fast blogging workflow. No page builder, no jQuery, no external requests.
Version: 0.2.0
Requires at least: 6.6
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: appnest
*/

/* ---------- Tokens. Dark values live in two places: system preference and manual toggle. ---------- */
:root {
	--bg: #f2f6f6;
	--surface: #fff;
	--text: #0f1a1a;
	--muted: #55636b;
	--line: #dde6e8;
	--accent: #0f766e;
	--accent-ink: #fff;
	--accent-soft: #e2f3f1;
	--focus: #1a5fd0;
	--shadow: 0 8px 24px rgba(15, 40, 40, .12);
	--hero-a: #0b4f4a;
	--hero-b: #10796f;
	--radius: 14px;
	--radius-sm: 10px;
	--wrap: 1180px;
	--gap: 1rem;
	--font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	color-scheme: light;
}
:root[data-theme="dark"] {
	--bg: #0b1215;
	--surface: #121b20;
	--text: #e6eef0;
	--muted: #94a7ae;
	--line: #22323a;
	--accent: #2dd4bf;
	--accent-ink: #042f2c;
	--accent-soft: #14312f;
	--focus: #7dd3fc;
	--shadow: 0 8px 24px rgba(0, 0, 0, .45);
	--hero-a: #062f2c;
	--hero-b: #0b5550;
	color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--bg: #0b1215;
		--surface: #121b20;
		--text: #e6eef0;
		--muted: #94a7ae;
		--line: #22323a;
		--accent: #2dd4bf;
		--accent-ink: #042f2c;
		--accent-soft: #14312f;
		--focus: #7dd3fc;
		--shadow: 0 8px 24px rgba(0, 0, 0, .45);
		--hero-a: #062f2c;
		--hero-b: #0b5550;
		color-scheme: dark;
	}
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 1rem/1.6 var(--font); }
img, svg, video { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.25; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.3rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

.screen-reader-text {
	position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
	overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip-link:focus {
	position: fixed; top: .5rem; left: .5rem; z-index: 100; width: auto; height: auto;
	margin: 0; padding: .75rem 1rem; clip-path: none; background: var(--surface);
	color: var(--text); border-radius: var(--radius-sm);
}
.wrap { width: min(100% - 2rem, var(--wrap)); margin-inline: auto; }

/* ---------- Buttons and forms ---------- */
.button, .wp-block-button__link {
	display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 2.75rem;
	padding: .55rem 1.1rem; border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink);
	font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.button:hover, .wp-block-button__link:hover { filter: brightness(1.08); }
input[type="search"], input[type="text"], input[type="email"], input[type="url"] {
	min-height: 2.75rem; padding: .5rem .9rem; border: 1px solid var(--line); border-radius: 999px;
	background: var(--surface); color: var(--text); font: inherit;
}

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 30; border-bottom: 1px solid var(--line); background: var(--surface); }
.admin-bar .site-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .site-header { top: 46px; } }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.25rem; padding-block: .7rem; }
.site-title { color: var(--text); font-size: 1.3rem; font-weight: 800; letter-spacing: -.01em; text-decoration: none; }
.custom-logo { width: auto; max-height: 40px; }

.site-nav { flex: 1; }
.site-nav ul { display: flex; flex-wrap: wrap; gap: .15rem; margin: 0; padding: 0; list-style: none; }
.site-nav li { position: relative; }
.site-nav a { display: block; padding: .5rem .8rem; border-radius: 999px; color: var(--text); font-weight: 500; text-decoration: none; }
.site-nav a:hover, .site-nav .current-menu-item > a, .site-nav .current-menu-ancestor > a { background: var(--accent-soft); color: var(--accent); }
.site-nav .sub-menu {
	position: absolute; top: 100%; left: 0; z-index: 20; display: none; min-width: 12rem; padding: .35rem;
	border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
}
.site-nav .sub-menu a { border-radius: var(--radius-sm); }
.site-nav li:hover > .sub-menu, .site-nav li:focus-within > .sub-menu { display: block; }

.nav-toggle, .theme-toggle {
	min-height: 2.75rem; border: 1px solid var(--line); border-radius: 999px;
	background: var(--surface); color: var(--text); font: inherit; cursor: pointer;
}
.nav-toggle { display: none; padding: .4rem 1rem; }
.theme-toggle { display: none; width: 2.75rem; padding: 0; place-items: center; }
.js .theme-toggle { display: inline-grid; }
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
	:root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}

.search-form { display: flex; gap: .4rem; }
.search-form input[type="search"] { width: min(100%, 15rem); }
.search-submit { padding-inline: 1rem; }
.site-header .search-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.site-header .search-submit { width: 2.75rem; padding: 0; }
.has-hero .site-header .search-form { display: none; }

@media (max-width: 47.99rem) {
	.nav-toggle { order: 3; }
	.js .nav-toggle { display: inline-flex; align-items: center; }
	.theme-toggle { order: 2; margin-inline-start: auto; }
	.site-nav { order: 4; flex-basis: 100%; }
	.js .site-nav { display: none; }
	.js.nav-open .site-nav { display: block; }
	.site-nav ul { flex-direction: column; }
	.site-nav .sub-menu { position: static; display: block; min-width: 0; border: 0; box-shadow: none; padding: 0 0 0 1rem; }
	.search-form { order: 5; flex-basis: 100%; }
	.search-form input[type="search"] { flex: 1; width: auto; }
	.has-hero .site-header .search-form { display: none; }
}

/* ---------- Main and headings ---------- */
.site-main { padding-block: 1.25rem 2.5rem; }
.page-header { margin-bottom: 1.25rem; }
.page-description { max-width: 70ch; color: var(--muted); }

/* ---------- Hero ---------- */
.hero {
	margin-bottom: 2rem; padding: clamp(2rem, 6vw, 3.75rem) 1.25rem clamp(2.25rem, 6vw, 4rem); border-radius: 24px; color: #fff; text-align: center;
	background: radial-gradient(900px 320px at 90% -20%, rgba(255, 255, 255, .16), transparent 60%),
		radial-gradient(600px 240px at 0% 110%, rgba(255, 255, 255, .1), transparent 60%),
		linear-gradient(135deg, var(--hero-a), var(--hero-b));
}
.hero-title { margin-bottom: .5rem; font-size: clamp(1.9rem, 1.3rem + 3vw, 3rem); letter-spacing: -.02em; }
.hero-text { max-width: 55ch; margin: 0 auto; color: rgba(255, 255, 255, .92); font-size: 1.1rem; }
.hero .search-form { max-width: 580px; margin: 1.5rem auto 0; }
.hero .search-form input[type="search"] { flex: 1; width: auto; min-height: 3.25rem; padding-inline: 1.3rem; border: 0; font-size: 1.05rem; background: #fff; color: #0f1a1a; }
.hero .search-submit { min-height: 3.25rem; padding-inline: 1.5rem; background: #062f2c; color: #fff; }
.hero .search-submit:hover { filter: brightness(1.25); }
.hero .search-form :focus-visible { outline-color: #fff; }

/* ---------- Sections ---------- */
.home-intro { margin-bottom: 1.5rem; }
.home-content { margin-bottom: 1.5rem; }
.home-section { margin-bottom: 2.25rem; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25rem 1rem; margin-bottom: .9rem; }
.section-head h2 { margin: 0; }
.section-head a { font-weight: 600; text-decoration: none; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.chips a {
	display: inline-flex; align-items: center; gap: .5rem; min-height: 2.5rem; padding: .35rem .95rem;
	border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); font-weight: 500; text-decoration: none;
}
.chips a:hover { border-color: var(--accent); background: var(--accent-soft); }
.chips span { color: var(--muted); font-size: .85rem; }

.empty-state { padding: 1.5rem; border: 2px dashed var(--line); border-radius: var(--radius); background: var(--surface); }
.empty-state ol { margin: 0 0 1rem; padding-inline-start: 1.25rem; }

/* ---------- Cards ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--gap); }
.card {
	position: relative; display: flex; flex-direction: column; overflow: hidden;
	border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
	.card { transition: transform .15s ease, box-shadow .15s ease; }
	.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
}
.card:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.card-title { margin: 0; font-size: 1rem; }
.card-title a { color: var(--text); text-decoration: none; }
.card-title a:focus-visible { outline: 0; }
.card-title a::after { content: ""; position: absolute; inset: 0; }

.card--game { align-items: center; padding: 1.1rem .75rem 1rem; text-align: center; }
.card-icon { width: 88px; height: 88px; margin-bottom: .65rem; overflow: hidden; border-radius: 22px; background: var(--accent-soft); }
.card-icon img { width: 100%; height: 100%; object-fit: cover; }
.card-icon--empty { display: grid; place-items: center; color: var(--accent); font-size: 2rem; font-weight: 800; }
.card--game .card-title { display: -webkit-box; overflow: hidden; font-size: .95rem; line-height: 1.3; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 .6rem; margin: .3rem 0 0; color: var(--muted); font-size: .8rem; }
.badge {
	position: absolute; top: .55rem; inset-inline-start: .55rem; padding: .1rem .55rem; border-radius: 999px;
	background: var(--accent); color: var(--accent-ink); font-size: .68rem; font-weight: 800; letter-spacing: .03em; text-transform: uppercase;
}
.badge--updated { background: #b45309; color: #fff; }

.card--post { grid-column: span 2; }
.card--post .card-media img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.card--post .card-body { padding: .9rem 1rem 1.1rem; }
.card-date { display: block; margin-bottom: .2rem; color: var(--muted); font-size: .8rem; }
.card-excerpt { margin: .4rem 0 0; color: var(--muted); font-size: .92rem; }
@media (max-width: 20rem) { .card--post { grid-column: auto; } }

.scroll-row { display: flex; gap: var(--gap); padding-bottom: .5rem; overflow-x: auto; scroll-snap-type: x proximity; }
.scroll-row > .card { flex: 0 0 160px; scroll-snap-align: start; }

/* ---------- Pagination ---------- */
.pagination { margin-top: 1.75rem; }
.pagination .nav-links { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; }
.page-numbers {
	min-width: 2.75rem; padding: .5rem .85rem; border: 1px solid var(--line); border-radius: 999px;
	background: var(--surface); color: var(--text); text-align: center; text-decoration: none;
}
.page-numbers.current { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.page-numbers.dots { border: 0; background: none; }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs { margin-bottom: 1rem; font-size: .875rem; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: .25rem .5rem; margin: 0; padding: 0; list-style: none; color: var(--muted); }
.breadcrumbs li + li::before { content: "/"; margin-inline-end: .5rem; }
.breadcrumbs a { color: var(--muted); }

/* ---------- Single game ---------- */
.game { max-width: 860px; }
.game-header {
	display: flex; align-items: flex-start; gap: 1.25rem; margin-bottom: 1.75rem; padding: 1.25rem;
	border: 1px solid var(--line); border-radius: 20px; background: var(--surface);
}
.game-icon { flex: none; width: 104px; height: 104px; border-radius: 24px; object-fit: cover; }
.game-title { margin-bottom: .25rem; }
.game-developer { margin-bottom: .5rem; color: var(--muted); }
.game-summary { max-width: 60ch; }
.game-section { margin-bottom: 2rem; scroll-margin-top: 5rem; }
.game-section ul, .game-section ol { padding-inline-start: 1.25rem; }
.game-section li { margin-bottom: .35rem; }
.table-wrap { overflow-x: auto; }
.info-table { width: 100%; overflow: hidden; border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.info-table th, .info-table td { padding: .65rem 1rem; border-bottom: 1px solid var(--line); text-align: start; }
.info-table tr:last-child > * { border-bottom: 0; }
.info-table tbody th { width: 34%; color: var(--muted); font-weight: 600; }
.info-table thead th { background: var(--accent-soft); }
.shots { display: flex; gap: .75rem; margin: 0; padding: 0 !important; overflow-x: auto; list-style: none; scroll-snap-type: x proximity; }
.shots li { flex: none; margin: 0; scroll-snap-align: start; }
.shots img { width: auto; height: 320px; border: 1px solid var(--line); border-radius: var(--radius); }
.download-box { padding: 1.4rem; border: 1px solid var(--accent); border-radius: 20px; background: var(--accent-soft); }
.download-meta { display: flex; flex-wrap: wrap; gap: 0 1rem; color: var(--muted); }
.button--large { min-height: 3.25rem; padding-inline: 1.75rem; font-size: 1.05rem; }
@media (max-width: 30rem) {
	.game-header { flex-direction: column; }
	.shots img { height: 260px; }
}

/* ---------- Articles ---------- */
.entry { max-width: 780px; }
.entry-title { font-size: clamp(1.7rem, 1.3rem + 2vw, 2.5rem); letter-spacing: -.02em; }
.entry-meta { display: flex; flex-wrap: wrap; gap: 0 1rem; margin-bottom: 1rem; color: var(--muted); font-size: .9rem; }
.entry-thumb { margin-bottom: 1.5rem; }
.entry-thumb img { width: 100%; border-radius: 20px; }
.entry-content { max-width: 70ch; font-size: 1.0625rem; line-height: 1.75; }
.entry-content :is(h2, h3) { margin-top: 1.9em; scroll-margin-top: 5rem; }
.entry-content img { border-radius: var(--radius-sm); }
.entry-content blockquote { margin: 1.5rem 0; padding: .25rem 1.25rem; border-inline-start: 4px solid var(--accent); color: var(--muted); }
.entry-content pre { padding: 1rem; overflow-x: auto; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); }
.entry-content table { width: 100%; border-collapse: collapse; }
.entry-content :is(th, td) { padding: .55rem .8rem; border: 1px solid var(--line); text-align: start; }
.entry-content details { margin-bottom: .6rem; padding: .7rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.entry-content summary { font-weight: 600; cursor: pointer; }
.entry-content .alignleft { float: left; margin: 0 1rem 1rem 0; }
.entry-content .alignright { float: right; margin: 0 0 1rem 1rem; }
.entry-content .aligncenter { margin-inline: auto; }
.callout { margin: 1.5rem 0; padding: 1rem 1.25rem; border-inline-start: 4px solid var(--accent); border-radius: var(--radius-sm); background: var(--accent-soft); }
.callout > :last-child { margin-bottom: 0; }
.wp-caption-text, figcaption { color: var(--muted); font-size: .875rem; }
.entry-footer { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin-top: 1.5rem; color: var(--muted); font-size: .9rem; }
.post-navigation { max-width: 780px; margin-top: 2rem; }
.post-navigation .nav-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }
.related-articles { margin-top: 2.25rem; }
.toc { margin: 0 0 1.75rem; padding: 1rem 1.25rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: .95rem; line-height: 1.5; }
.toc-title { margin: 0 0 .5rem; font-weight: 700; }
.toc ul { margin: 0; padding: 0; list-style: none; }
.toc li { margin-bottom: .3rem; }
.toc .toc-l3 { margin-inline-start: 1.1rem; }

/* ---------- Comments ---------- */
.comments { max-width: 780px; margin-top: 2.5rem; }
.comment-list { padding-inline-start: 0; list-style: none; }
.comment-list .children { padding-inline-start: 1.25rem; list-style: none; }
.comment-body { margin-bottom: 1rem; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.comment-meta { color: var(--muted); font-size: .85rem; }
.comment-form label { display: block; margin-bottom: .25rem; }
.comment-form textarea, .comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"] {
	width: 100%; padding: .6rem .9rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit;
}
.comment-form .submit { min-height: 2.75rem; padding: .55rem 1.25rem; border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600; cursor: pointer; }
.search-browse { margin-top: 1.5rem; font-size: 1.1rem; }

/* ---------- Footer ---------- */
.site-footer { padding-block: 1.75rem; border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: .9rem; }
.footer-widgets { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem; margin-bottom: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--line); }
.widget-title { color: var(--text); font-size: 1rem; }
.widget ul { margin: 0; padding-inline-start: 1.1rem; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1.5rem; }
.footer-nav ul { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin: 0; padding: 0; list-style: none; }
.footer-nav a { color: var(--muted); }
.copyright { margin: 0; }
