/*
Theme Name: CouponKit
Theme URI: https://example.com/couponkit
Author: CouponKit
Description: Lightweight parent theme for coupon, promo code and deal websites. No plugins required: built-in Store and Coupon post types, SEO meta, Schema.org JSON-LD, and GEO (llms.txt, AI-crawler rules, answer-first store pages). Designed to be extended with child themes.
Version: 1.0.1
Requires at least: 6.3
Tested up to: 6.8
Requires PHP: 7.4
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: couponkit
Tags: custom-logo, custom-menu, featured-images, translation-ready, blog, e-commerce
*/

/* ---------- Tokens (colors are overridden from the Customizer) ---------- */
:root {
	--ck-primary: #0e7490;
	--ck-accent: #c2410c;
	--ck-ink: #111827;
	--ck-muted: #4b5563;
	--ck-line: #e5e7eb;
	--ck-bg: #ffffff;
	--ck-soft: #f3f4f6;
	--ck-ok: #15803d;
	--ck-radius: 12px;
	--ck-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 2px 8px rgba(0, 0, 0, .05);
	--ck-width: 1200px;
	--ck-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--ck-font); font-size: 1rem; line-height: 1.65; color: var(--ck-ink); background: var(--ck-bg); }
img, svg, video { max-width: 100%; height: auto; }
a { color: var(--ck-primary); text-underline-offset: 2px; }
a:hover { text-decoration: none; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.35rem, 3vw, 1.75rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--ck-accent); outline-offset: 2px; }
.container { width: 100%; max-width: var(--ck-width); margin-inline: auto; padding-inline: 16px; }
.screen-reader-text, .skip-link:not(:focus) { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link:focus { position: fixed; top: 8px; left: 8px; z-index: 100; background: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--ck-shadow); }
.section { padding-block: 40px; }
.section--soft { background: var(--ck-soft); }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section__head h2 { margin: 0; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: #fff; border-bottom: 1px solid var(--ck-line); }
.header-inner { display: flex; align-items: center; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 1.3rem; color: var(--ck-ink); text-decoration: none; display: inline-flex; align-items: center; }
.brand img { max-height: 44px; width: auto; }
.nav-toggle { margin-left: auto; background: none; border: 1px solid var(--ck-line); border-radius: 8px; padding: 8px 12px; font: inherit; cursor: pointer; }
.primary-nav { display: none; width: 100%; order: 5; }
.primary-nav.is-open { display: block; }
.primary-nav ul { list-style: none; margin: 0; padding: 0; }
.primary-nav a { display: block; padding: 10px 4px; color: var(--ck-ink); text-decoration: none; font-weight: 600; }
.primary-nav a:hover, .primary-nav .current-menu-item > a { color: var(--ck-primary); }
.header-search { width: 100%; order: 4; }

/* ---------- Search form ---------- */
.search-form { display: flex; gap: 8px; }
.search-form input[type="search"] { flex: 1; min-width: 0; border: 1px solid var(--ck-line); border-radius: 999px; padding: 11px 18px; font: inherit; background: #fff; }
.search-form button { border: 0; border-radius: 999px; padding: 0 20px; font: inherit; font-weight: 700; color: #fff; background: var(--ck-primary); cursor: pointer; }

/* ---------- Buttons & tags ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 10px; padding: 12px 20px; font: inherit; font-weight: 700; text-decoration: none; color: #fff; background: var(--ck-accent); cursor: pointer; white-space: nowrap; }
.btn:hover { filter: brightness(1.08); }
.btn--primary { background: var(--ck-primary); }
.btn--code { position: relative; background: #fff; color: var(--ck-accent); border: 2px dashed var(--ck-accent); padding: 0; overflow: hidden; min-width: 190px; }
.btn--code .btn__label { background: var(--ck-accent); color: #fff; padding: 12px 22px 12px 18px; clip-path: polygon(0 0, 100% 0, 88% 100%, 0 100%); position: relative; z-index: 1; }
.btn--code .btn__code { padding: 12px 14px; font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .06em; flex: 1; text-align: center; }
.btn--code.is-revealed .btn__label { clip-path: none; }
.tag { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--ck-soft); color: var(--ck-muted); }
.tag--ok { background: #dcfce7; color: var(--ck-ok); }
.tag--hot { background: #ffedd5; color: var(--ck-accent); }

/* ---------- Hero ---------- */
.hero { background: linear-gradient(135deg, var(--ck-primary), #164e63); color: #fff; padding-block: clamp(36px, 8vw, 80px); text-align: center; }
.hero h1 { margin-bottom: .3em; }
.hero p { opacity: .92; max-width: 640px; margin-inline: auto; }
.hero .search-form { max-width: 560px; margin: 22px auto 0; }
.hero .search-form button { background: var(--ck-accent); }

/* ---------- Grids & cards ---------- */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(2, 1fr); }
.cat-tile { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; min-height: 130px; padding: 16px; text-align: center; text-decoration: none; color: var(--ck-ink); font-weight: 700; background: #fff; border: 1px solid var(--ck-line); border-radius: var(--ck-radius); box-shadow: var(--ck-shadow); }
.cat-tile img { width: 64px; height: 64px; object-fit: cover; border-radius: 50%; }
.cat-tile small { font-weight: 500; color: var(--ck-muted); }
.store-card { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 16px; background: #fff; border: 1px solid var(--ck-line); border-radius: var(--ck-radius); box-shadow: var(--ck-shadow); text-decoration: none; color: var(--ck-ink); transition: transform .15s; }
.store-card:hover { transform: translateY(-2px); }
.store-card__logo { height: 64px; display: flex; align-items: center; }
.store-card__logo img { max-height: 56px; width: auto; object-fit: contain; }
.store-card__name { font-weight: 800; margin: 0; font-size: 1.05rem; }
.store-card__line { color: var(--ck-muted); font-size: .9rem; margin: 0; flex: 1; }
.store-card__badge { align-self: flex-start; background: var(--ck-accent); color: #fff; font-weight: 800; font-size: .8rem; padding: 3px 10px; border-radius: 8px; }
.logo-ph { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: 12px; background: var(--ck-soft); color: var(--ck-primary); font-weight: 800; font-size: 1.5rem; }
.post-card { background: #fff; border: 1px solid var(--ck-line); border-radius: var(--ck-radius); overflow: hidden; box-shadow: var(--ck-shadow); }
.post-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.post-card__body { padding: 14px 16px 18px; }
.post-card__body h3 { margin: 4px 0 0; }
.post-card a { color: inherit; text-decoration: none; }
.post-card time { color: var(--ck-muted); font-size: .85rem; }

/* ---------- Store page ---------- */
.breadcrumbs { font-size: .875rem; color: var(--ck-muted); padding-block: 14px; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 8px; margin: 0; padding: 0; }
.breadcrumbs li + li::before { content: "›"; margin-right: 8px; }
.breadcrumbs a { color: inherit; }
.store-head { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-bottom: 18px; }
.store-head__logo { width: 88px; height: 88px; border: 1px solid var(--ck-line); border-radius: var(--ck-radius); display: flex; align-items: center; justify-content: center; padding: 8px; background: #fff; }
.store-head__logo img { max-height: 72px; width: auto; }
.store-head h1 { margin: 0; flex: 1; min-width: 220px; }
.updated { color: var(--ck-muted); font-size: .9rem; }
.disclosure { font-size: .85rem; color: var(--ck-muted); background: var(--ck-soft); border-radius: 8px; padding: 8px 12px; margin-bottom: 18px; }
.answer { border-left: 4px solid var(--ck-primary); background: #f0f9ff; padding: 14px 18px; border-radius: 0 var(--ck-radius) var(--ck-radius) 0; margin-bottom: 18px; }
.answer p:last-child { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 0 0 24px; padding: 0; list-style: none; }
.stats li { background: var(--ck-soft); border-radius: 10px; padding: 10px 14px; }
.stats strong { display: block; font-size: 1.25rem; color: var(--ck-primary); }
.stats span { font-size: .85rem; color: var(--ck-muted); }
.layout { display: grid; gap: 28px; }
.coupon-list { display: grid; gap: 14px; }
.coupon { display: grid; gap: 12px; padding: 16px; background: #fff; border: 1px solid var(--ck-line); border-radius: var(--ck-radius); box-shadow: var(--ck-shadow); scroll-margin-top: 90px; }
.coupon:target { outline: 3px solid var(--ck-accent); }
.coupon__badge { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 64px; padding: 8px 12px; border-radius: 10px; background: #fff7ed; color: var(--ck-accent); font-weight: 900; font-size: 1.25rem; line-height: 1.15; }
.coupon__meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.coupon__title { margin: 0 0 4px; font-size: 1.1rem; }
.coupon__desc { color: var(--ck-muted); font-size: .95rem; }
.coupon__desc p:last-child { margin: 0; }
.coupon__store { font-size: .85rem; font-weight: 700; color: var(--ck-muted); }
.sidebar .box { background: #fff; border: 1px solid var(--ck-line); border-radius: var(--ck-radius); padding: 16px; margin-bottom: 16px; }
.sidebar h2 { font-size: 1.05rem; }
.sidebar ul { margin: 0; padding-left: 18px; }
.prose { max-width: 75ch; }
.prose h2 { margin-top: 1.6em; }
.faq h3 { margin-top: 1.1em; }

/* ---------- Posts & pages ---------- */
.entry { padding-block: 24px 48px; }
.entry__title { margin-bottom: .3em; }
.entry__meta { color: var(--ck-muted); font-size: .9rem; margin-bottom: 20px; }
.entry__thumb { border-radius: var(--ck-radius); margin-bottom: 24px; width: 100%; }
.alignwide { max-width: 100%; }
.nav-links { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 28px; }
.nav-links .page-numbers { padding: 8px 14px; border: 1px solid var(--ck-line); border-radius: 8px; text-decoration: none; color: var(--ck-ink); }
.nav-links .current { background: var(--ck-primary); color: #fff; border-color: var(--ck-primary); }

/* ---------- Footer ---------- */
.site-footer { background: #0f172a; color: #cbd5e1; padding-block: 40px 24px; margin-top: 40px; font-size: .92rem; }
.site-footer a { color: #fff; }
.footer-nav ul, .social-links { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0 0 16px; padding: 0; }
.social-links a { text-decoration: none; border: 1px solid #334155; border-radius: 999px; padding: 4px 12px; }
.footer-disclosure { border-top: 1px solid #1e293b; padding-top: 16px; margin-top: 8px; }

/* ---------- Breakpoints ---------- */
@media (min-width: 640px) {
	.grid--cats { grid-template-columns: repeat(3, 1fr); }
	.grid--stores, .grid--posts { grid-template-columns: repeat(3, 1fr); }
	.stats { grid-template-columns: repeat(4, 1fr); }
	.coupon { grid-template-columns: 120px 1fr auto; align-items: center; gap: 18px; }
}
@media (min-width: 960px) {
	.nav-toggle { display: none; }
	.primary-nav { display: block; width: auto; order: 0; }
	.primary-nav ul { display: flex; gap: 20px; }
	.header-search { width: 360px; order: 0; margin-left: auto; }
	.header-search .search-form button { padding: 0 16px; }
	.grid--cats { grid-template-columns: repeat(6, 1fr); }
	.grid--stores { grid-template-columns: repeat(4, 1fr); }
	.grid--posts { grid-template-columns: repeat(3, 1fr); }
	.layout { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
	.sidebar { position: sticky; top: 84px; }
}
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	.store-card { transition: none; }
}
