/*
Theme Name: BestAI
Theme URI: https://example.com/
Author: BestAI
Description: Lightweight, AdSense-ready blog theme for AI articles. No jQuery, one CSS file, under 2 KB of JavaScript. Creates the essential pages (About, Contact, Privacy Policy, Terms, Disclaimer, Affiliate Disclosure, Editorial Policy), categories and menus on activation. Steps aside automatically for BenSEO, so meta tags and schema are never duplicated.
Version: 1.0.1
Requires at least: 6.3
Tested up to: 6.8
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: bestai
Tags: blog, news, one-column, two-columns, right-sidebar, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready
*/

/* ---------- Tokens ---------- */
:root {
	--accent: #2563eb;
	--ink: #0f172a;
	--ink-2: #1e293b;
	--muted: #475569;
	--line: #e2e8f0;
	--line-2: #cbd5e1;
	--soft: #f8fafc;
	--link: #1d4ed8;
	--radius: 14px;
	--wrap: 1200px;
	--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
	--font-head: "Space Grotesk", var(--font);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; font-family: var(--font); font-size: 17px; line-height: 1.6; color: var(--ink); background: #fff; }
img, svg, video, iframe { max-width: 100%; height: auto; }
img { display: block; }
a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--link); }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 700; line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
button, input, textarea, select { font: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; }
.skip-link:focus { top: 12px; color: #fff; }
[hidden] { display: none !important; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.wrap.narrow { max-width: 820px; }
.site-main { padding-bottom: 72px; }

/* ---------- Buttons & chips ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border-radius: 10px; border: 0; font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: var(--ink-2); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { filter: brightness(.92); color: #fff; }
.btn-outline { border: 1.5px solid var(--ink); background: #fff; }
.icon-btn { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line-2); background: #fff; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; }
.chip { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 14px; font-weight: 500; background: #fff; }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.meta { font-size: 14px; color: var(--muted); }

/* Category tones */
.cat-label { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.tone-blue { --tone: #1d4ed8; --tone-bg: #dbeafe; }
.tone-violet { --tone: #6d28d9; --tone-bg: #ede9fe; }
.tone-amber { --tone: #92400e; --tone-bg: #fef3c7; }
.tone-green { --tone: #15803d; --tone-bg: #dcfce7; }
.cat-label { color: var(--tone, var(--link)); }
.thumb-fallback { display: flex; align-items: flex-end; width: 100%; aspect-ratio: 16 / 9; padding: 18px; background: var(--tone-bg); color: var(--tone); font-family: var(--font-head); font-weight: 700; font-size: 20px; border-radius: inherit; }

/* ---------- Top bar & header ---------- */
.topbar { background: var(--ink); color: #e2e8f0; font-size: 13px; }
.topbar .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding-top: 8px; padding-bottom: 8px; }
.site-header { border-bottom: 1px solid var(--line); background: #fff; position: relative; }
.header-inner { display: flex; align-items: center; gap: 12px; padding-top: 14px; padding-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-mark { width: 40px; height: 40px; border-radius: 10px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--font-head); font-weight: 700; font-size: 16px; flex: none; }
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 22px; letter-spacing: -.02em; }
.brand-name span { color: var(--accent); }
.custom-logo-link { margin-right: auto; }
.custom-logo { max-height: 48px; width: auto; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.header-actions .btn { display: none; }
.site-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: #fff; border-bottom: 1px solid var(--line); z-index: 20; }
.site-nav.is-open { display: block; }
.site-nav .menu { list-style: none; padding: 8px 20px 16px; }
.site-nav a { display: block; padding: 12px 0; font-weight: 600; border-bottom: 1px solid var(--line); }
.site-nav .current-menu-item > a, .site-nav .current-cat > a { color: var(--link); }
.header-search { border-top: 1px solid var(--line); padding: 14px 0; background: var(--soft); }

@media (min-width: 960px) {
	.menu-toggle { display: none; }
	.site-nav { display: block; position: static; border: 0; background: none; }
	.site-nav .menu { display: flex; flex-wrap: wrap; gap: 6px 26px; padding: 0; }
	.site-nav a { padding: 8px 0; border: 0; font-weight: 500; font-size: 15px; }
	.header-actions .btn { display: inline-flex; }
	.brand-name { font-size: 24px; }
}

/* ---------- Search form ---------- */
.search-form { display: flex; gap: 10px; max-width: 640px; }
.search-form input { flex: 1; min-width: 0; height: 46px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; }
.empty-state .search-form { margin: 20px auto; }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs { margin: 24px 0 0; font-size: 14px; color: var(--muted); }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumbs li:not(:last-child)::after { content: "/"; margin-left: 6px; color: var(--line-2); }
.breadcrumbs a { color: var(--link); }

/* ---------- Homepage ---------- */
.hero { display: flex; flex-wrap: wrap; gap: 32px; padding-top: 32px; }
.hero-main { flex: 2 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.hero-media { position: relative; display: block; border-radius: 16px; overflow: hidden; background: var(--ink); }
.hero-media img, .hero-media .thumb-fallback { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 0; }
.badge { position: absolute; left: 18px; top: 18px; background: #f59e0b; color: var(--ink); font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 6px 12px; border-radius: 999px; }
.hero-meta { display: flex; align-items: center; gap: 12px; }
.hero-title { font-size: clamp(28px, 4vw, 38px); line-height: 1.15; letter-spacing: -.02em; }
.hero-excerpt { font-size: 17px; color: var(--muted); }
.byline { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.byline strong, .author-link { color: var(--ink); font-weight: 600; }
.byline-text { display: flex; flex-direction: column; gap: 2px; }

.trending { flex: 1 1 300px; min-width: 0; }
.list-heading { font-family: var(--font); font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding-bottom: 12px; border-bottom: 2px solid var(--ink); }
.trending ol { list-style: none; }
.trending li { display: flex; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.trending li:last-child { border-bottom: 0; }
.trending li > span:last-child { display: flex; flex-direction: column; gap: 6px; }
.num { font-family: var(--font-head); font-weight: 700; font-size: 28px; line-height: 1; color: var(--line-2); }
.trend-title { font-family: var(--font-head); font-weight: 700; font-size: 18px; line-height: 1.3; }

.section-head { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; margin: 56px 0 28px; }
.section-head h2, .section-title { font-size: 26px; letter-spacing: -.02em; }
.section-title { margin-bottom: 22px; }
.more { display: flex; justify-content: center; margin-top: 36px; }

.two-col { display: flex; flex-wrap: wrap; gap: 48px; margin-top: 40px; }
.col-main { flex: 999 1 560px; min-width: 0; }
.home-bottom { margin-top: 64px; padding-top: 48px; border-top: 1px solid var(--line); }
.start-list { list-style: none; display: flex; flex-direction: column; gap: 16px; }
.start-list a { display: flex; gap: 18px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); }
.start-list a:hover { border-color: var(--line-2); color: var(--ink); }
.start-list strong { display: block; font-family: var(--font-head); font-size: 19px; margin-bottom: 4px; }
.start-list a > span:last-child > span { color: var(--muted); font-size: 15px; }
.step { flex: none; width: 52px; height: 52px; border-radius: 12px; background: var(--tone-bg); color: var(--tone); display: flex; align-items: center; justify-content: center; font-family: var(--font-head); font-weight: 700; font-size: 20px; }
.about-teaser p { color: var(--muted); margin-bottom: 12px; }
.about-teaser a { color: var(--link); font-weight: 600; }

/* ---------- Cards grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 36px 28px; }
.grid-full { grid-column: 1 / -1; }
.card { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card-media { display: block; border-radius: var(--radius); overflow: hidden; margin-bottom: 4px; }
.card-media img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; transition: transform .3s; }
.card:hover .card-media img { transform: scale(1.03); }
.card-title { font-size: 20px; line-height: 1.3; }
.card-excerpt { font-size: 15px; color: var(--muted); }
.card .meta { font-size: 13px; }

/* ---------- Archive ---------- */
.archive-head { padding: 24px 0 36px; margin-bottom: 36px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.archive-head h1 { font-size: clamp(32px, 5vw, 46px); letter-spacing: -.02em; }
.archive-intro { max-width: 760px; font-size: 18px; color: var(--muted); }
.archive-intro p + p { margin-top: 10px; }
.author-head { display: flex; align-items: center; gap: 18px; }
.pagination { margin-top: 48px; }
.pagination .nav-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.pagination .page-numbers { min-width: 44px; height: 44px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line-2); border-radius: 10px; font-weight: 600; }
.pagination .current { background: var(--ink); border-color: var(--ink); color: #fff; }
.empty-state { text-align: center; padding: 64px 0; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.empty-state h1, .empty-state h2 { font-size: clamp(28px, 4vw, 38px); }
.empty-state p { color: var(--muted); max-width: 560px; }
.empty-state .chips { justify-content: center; margin: 8px 0 16px; }

/* ---------- Single post ---------- */
.post-head { max-width: 860px; padding: 22px 0 0; display: flex; flex-direction: column; gap: 16px; }
.post-head h1 { font-size: clamp(32px, 5vw, 46px); line-height: 1.1; letter-spacing: -.025em; }
.lede { font-size: 19px; color: var(--muted); }
.post-hero { margin: 0 0 28px; }
.post-hero img { width: 100%; height: auto; border-radius: 16px; aspect-ratio: 1200 / 630; object-fit: cover; }
.post-hero figcaption { font-size: 14px; color: var(--muted); margin-top: 8px; }

.entry { max-width: 760px; }
.entry-content { font-size: 18px; line-height: 1.75; color: var(--ink-2); }
.entry-content > * + * { margin-top: 1.15em; }
.entry-content h2 { font-size: clamp(25px, 3vw, 30px); line-height: 1.25; color: var(--ink); margin-top: 1.8em; scroll-margin-top: 20px; }
.entry-content h3 { font-size: 22px; color: var(--ink); margin-top: 1.6em; }
.entry-content a { color: var(--link); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.entry-content ul, .entry-content ol { padding-left: 1.3em; }
.entry-content li + li { margin-top: .4em; }
.entry-content img { border-radius: 12px; }
.entry-content figcaption, .entry-content .wp-element-caption { font-size: 14px; color: var(--muted); margin-top: 8px; text-align: left; }
.entry-content blockquote { margin-left: 0; margin-right: 0; padding: 18px 24px; background: #eff6ff; border-radius: var(--radius); color: var(--ink); }
.entry-content blockquote p { margin: 0; }
.entry-content code { font-size: .9em; background: #f1f5f9; padding: 2px 6px; border-radius: 6px; }
.entry-content pre { background: var(--ink); color: #e2e8f0; padding: 18px; border-radius: 12px; overflow-x: auto; font-size: 15px; line-height: 1.6; }
.entry-content pre code { background: none; padding: 0; }
.entry-content table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5; }
.entry-content .wp-block-table { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.entry-content th, .entry-content td { padding: 12px 16px; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
.entry-content thead th { background: #f1f5f9; border-top: 0; }
.entry-content .wp-block-table table { border: 0; }
.entry-content .wp-block-table td, .entry-content .wp-block-table th { border-left: 0; border-right: 0; border-bottom: 0; }
.entry-content hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.entry-content .wp-block-button__link { background: var(--accent); color: #fff; text-decoration: none; border-radius: 10px; }

.toc { background: var(--soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; font-size: 16px; line-height: 1.5; }
.toc-title { font-family: var(--font-head); font-weight: 700; font-size: 17px; color: var(--ink); margin-bottom: 8px; }
.entry-content .toc ol { padding-left: 1.2em; }
.entry-content .toc a { text-decoration: none; }

.tags { margin-top: 32px; }
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 32px; padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 15px; }
.share > span { font-weight: 600; margin-right: 6px; }
.author-box { display: flex; flex-wrap: wrap; gap: 20px; background: var(--soft); border-radius: 16px; padding: 24px; margin-top: 32px; }
.author-box > div { flex: 1 1 260px; display: flex; flex-direction: column; gap: 6px; }
.author-name { font-family: var(--font-head); font-weight: 700; font-size: 21px; }
.author-box p:last-child:not(.author-name) { color: var(--muted); font-size: 15px; }
.avatar { position: relative; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: #dbeafe; color: var(--link); font-weight: 700; overflow: hidden; }
.avatar .avatar-img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.related { margin-top: 64px; padding-top: 44px; border-top: 1px solid var(--line); }

/* ---------- Sidebar ---------- */
.sidebar { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 28px; }
.side-list ul { list-style: none; }
.side-list li { border-bottom: 1px solid var(--line); }
.side-list li:last-child { border-bottom: 0; }
.side-list a { display: block; padding: 14px 0; font-family: var(--font-head); font-weight: 700; font-size: 17px; line-height: 1.35; }
.widget-title { font-size: 13px; font-family: var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.widget ul { list-style: none; }
.widget li { padding: 8px 0; border-bottom: 1px solid var(--line); }

.newsletter { background: var(--ink); color: #fff; border-radius: 16px; padding: 26px; display: flex; flex-direction: column; gap: 12px; }
.newsletter h2 { font-size: 22px; color: #fff; }
.newsletter p { color: #cbd5e1; font-size: 15px; }
.newsletter form { display: flex; flex-direction: column; gap: 10px; }
.newsletter label { font-size: 13px; font-weight: 600; color: #e2e8f0; }
.newsletter input { height: 46px; border-radius: 10px; border: 1px solid #475569; background: var(--ink-2); color: #fff; padding: 0 14px; }
.newsletter input::placeholder { color: #94a3b8; }

/* ---------- Ads (space reserved to prevent layout shift) ---------- */
.ad { margin: 36px 0; text-align: center; }
.ad-label { display: block; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.ad-header { min-height: 120px; margin: 24px 0 0; }
.ad-article { min-height: 280px; }
.ad-sidebar { min-height: 270px; margin: 0; }
.ad-archive { min-height: 120px; }
.entry-content .ad { margin: 2em 0; }

/* ---------- Pages & forms ---------- */
.page-entry .post-head { margin-bottom: 24px; }
.page-entry .entry-content h2 { font-size: 24px; }
.contact-form { display: flex; flex-direction: column; gap: 4px; margin-top: 24px; }
.field-row { display: flex; flex-wrap: wrap; gap: 0 16px; }
.field-row .field { flex: 1 1 240px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 15px; font-weight: 600; color: var(--ink); }
.field input, .field textarea { width: 100%; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; font-size: 16px; }
.field input { height: 48px; }
.hp { position: absolute; left: -9999px; }
.form-note { padding: 14px 18px; border-radius: 10px; font-size: 16px; }
.form-note.success { background: #dcfce7; color: #14532d; }
.form-note.error { background: #fee2e2; color: #7f1d1d; }

/* ---------- Comments ---------- */
.comments { margin-top: 48px; }
.comment-list { list-style: none; }
.comment-list .children { list-style: none; padding-left: 24px; }
.comment-body { padding: 18px 0; border-bottom: 1px solid var(--line); font-size: 16px; }
.comment-meta { font-size: 14px; color: var(--muted); }
.comment-author { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.comment-author img { border-radius: 50%; }
.comment-form p { margin-bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.comment-form input:not([type="checkbox"]):not([type="submit"]), .comment-form textarea { width: 100%; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 10px; }
.comment-form .comment-form-cookies-consent { flex-direction: row; align-items: flex-start; gap: 8px; font-size: 14px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: #cbd5e1; font-size: 15px; }
.site-footer a { color: #cbd5e1; }
.site-footer a:hover { color: #fff; }
.footer-grid { display: flex; flex-wrap: wrap; gap: 40px; justify-content: space-between; padding-top: 56px; padding-bottom: 40px; }
.footer-about { flex: 1 1 300px; max-width: 380px; display: flex; flex-direction: column; gap: 12px; }
.footer-brand { font-family: var(--font-head); font-weight: 700; font-size: 22px; color: #fff; }
.footer-col h2 { font-family: var(--font); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: #fff; margin-bottom: 12px; }
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-bottom { border-top: 1px solid var(--ink-2); font-size: 13px; color: #94a3b8; }
.footer-bottom .wrap { padding-top: 18px; padding-bottom: 18px; }

/* WordPress core classes */
.alignleft { float: left; margin: 0 1.5em 1em 0; }
.alignright { float: right; margin: 0 0 1em 1.5em; }
.aligncenter { margin-left: auto; margin-right: auto; }
.sticky, .bypostauthor, .gallery-caption { /* required by theme review */ }
