/*
Theme Name: لیلی‌بوکس
Theme URI: https://lilibooks.ir
Author: LiliBooks
Description: پوسته‌ای فارسی، راست‌چین و شاد برای معرفی و نقد کتاب‌های کودک و نوجوان. همراه با جعبهٔ مشخصات کتاب، گروه‌های سنی، تاریخ شمسی و داده‌های ساختاریافته برای سئو.
Version: 1.0.2
Requires at least: 6.0
Requires PHP: 7.4
License: GPLv2 or later
Text Domain: lilibooks
Tags: rtl-language-support, blog, custom-menu, featured-images, threaded-comments
*/

/* ---------- Font ---------- */
@font-face {
	font-family: "Vazirmatn";
	src: url("assets/fonts/Vazirmatn.woff2") format("woff2-variations"),
	     url("assets/fonts/Vazirmatn.woff2") format("woff2");
	font-weight: 100 900;
	font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
	--cream: #fff8ee;
	--paper: #ffffff;
	--ink: #23324a;
	--ink-soft: #5b6678;
	--coral: #f2734b;
	--coral-dark: #d9572f;
	--sun: #f7b938;
	--mint: #6cc3a0;
	--sky: #74b3e8;
	--lilac: #b49be6;
	--line: #f0e3cf;
	--radius: 22px;
	--radius-sm: 12px;
	--shadow: 0 10px 30px -12px rgba(35, 50, 74, .18);
	--shadow-lg: 0 22px 50px -18px rgba(35, 50, 74, .28);
	--wrap: 1180px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
	margin: 0;
	direction: rtl;
	font-family: "Vazirmatn", Tahoma, sans-serif;
	font-size: 17px;
	line-height: 1.95;
	color: var(--ink);
	background: var(--cream);
	-webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--coral-dark); text-decoration: none; transition: color .2s; }
a:hover { color: var(--ink); }
h1, h2, h3, h4 { line-height: 1.5; font-weight: 800; margin: 1.6em 0 .6em; }
h1 { font-size: clamp(1.7rem, 3.5vw, 2.4rem); }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.75rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1.2em; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: 20px; }
.screen-reader-text {
	position: absolute !important; width: 1px; height: 1px; overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px); white-space: nowrap;
}
.skip-link:focus {
	clip: auto; width: auto; height: auto; z-index: 999; top: 10px; right: 10px;
	background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px;
}
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; border-radius: 6px; }

/* ---------- Header ---------- */
.site-header {
	position: sticky; top: 0; z-index: 50;
	background: rgba(255, 248, 238, .9);
	backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--line);
}
.admin-bar .site-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .site-header { top: 46px; } }
@media (max-width: 600px) { .admin-bar .site-header { top: 0; } }
.header-inner { display: flex; align-items: center; gap: 24px; min-height: 76px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-mark {
	width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
	background: var(--coral); color: #fff; font-size: 24px; font-weight: 900;
	box-shadow: 0 6px 0 var(--coral-dark); transform: rotate(-6deg);
}
.brand .custom-logo { max-height: 52px; width: auto; }
.brand-text strong { display: block; font-size: 1.35rem; font-weight: 900; line-height: 1.2; }
.brand-text small { color: var(--ink-soft); font-size: .8rem; }
.main-nav { margin-inline-start: auto; }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.main-nav li { position: relative; }
.main-nav a {
	display: block; padding: 8px 16px; border-radius: 999px; color: var(--ink); font-weight: 600;
}
.main-nav a:hover, .main-nav .current-menu-item > a { background: #fff; color: var(--coral-dark); box-shadow: var(--shadow); }
.main-nav .sub-menu {
	display: none; position: absolute; top: 100%; right: 0; min-width: 200px; padding: 8px;
	background: #fff; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); flex-direction: column;
}
.main-nav li:hover > .sub-menu, .main-nav li:focus-within > .sub-menu { display: flex; }
.header-search {
	display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
	background: #fff; color: var(--ink); box-shadow: var(--shadow);
}
.menu-toggle {
	display: none; margin-inline-start: auto; background: var(--ink); color: #fff; border: 0;
	border-radius: 12px; padding: 8px 14px; cursor: pointer;
}

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: 70px 0 90px; }
.hero::before, .hero::after {
	content: ""; position: absolute; border-radius: 50%; z-index: 0; opacity: .5;
}
.hero::before { width: 380px; height: 380px; background: var(--sun); top: -120px; left: -100px; opacity: .35; }
.hero::after { width: 240px; height: 240px; background: var(--mint); bottom: -90px; right: 8%; opacity: .3; }
.hero .wrap { position: relative; z-index: 1; display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items: center; }
.hero-kicker {
	display: inline-block; background: #fff; color: var(--coral-dark); padding: 6px 16px;
	border-radius: 999px; font-weight: 700; font-size: .9rem; box-shadow: var(--shadow);
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.3rem); margin: .5em 0 .4em; line-height: 1.45; }
.hero h1 span { color: var(--coral); }
.hero p.lead { font-size: 1.15rem; color: var(--ink-soft); max-width: 34em; }
.hero-search { display: flex; gap: 8px; margin-top: 26px; max-width: 520px; }
.hero-search input {
	flex: 1; padding: 14px 20px; border: 2px solid var(--line); border-radius: 999px; background: #fff;
}
.hero-search input:focus { border-color: var(--coral); outline: none; }
.btn {
	display: inline-flex; align-items: center; gap: 8px; padding: 12px 26px; border: 0; cursor: pointer;
	border-radius: 999px; background: var(--coral); color: #fff; font-weight: 700;
	box-shadow: 0 5px 0 var(--coral-dark); transition: transform .15s, box-shadow .15s;
}
.btn:hover { color: #fff; transform: translateY(2px); box-shadow: 0 3px 0 var(--coral-dark); }
.btn-ghost { background: #fff; color: var(--ink); box-shadow: 0 5px 0 var(--line); }
.btn-ghost:hover { color: var(--ink); box-shadow: 0 3px 0 var(--line); }

.hero-books { position: relative; height: 340px; }
.hero-books .bk {
	position: absolute; width: 150px; height: 210px; border-radius: 8px 16px 16px 8px;
	box-shadow: var(--shadow-lg); display: flex; align-items: flex-end; padding: 16px;
	color: #fff; font-weight: 800; font-size: 1rem; line-height: 1.5;
	border-right: 10px solid rgba(0,0,0,.12);
	animation: float 6s ease-in-out infinite;
}
.hero-books .bk:nth-child(1) { background: var(--coral); right: 10%; top: 40px; transform: rotate(-8deg); }
.hero-books .bk:nth-child(2) { background: var(--sky); right: 38%; top: 0; animation-delay: -2s; }
.hero-books .bk:nth-child(3) { background: var(--mint); right: 64%; top: 70px; transform: rotate(7deg); animation-delay: -4s; }
.hero-books .star { position: absolute; font-size: 34px; color: var(--sun); animation: twinkle 3s infinite; }
@keyframes float { 0%,100% { translate: 0 0; } 50% { translate: 0 -14px; } }
@keyframes twinkle { 0%,100% { opacity: 1; scale: 1; } 50% { opacity: .4; scale: .8; } }
@media (prefers-reduced-motion: reduce) { .hero-books .bk, .hero-books .star { animation: none; } }

/* ---------- Sections ---------- */
.section { padding: 56px 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.section-head h2 { margin: 0; position: relative; padding-bottom: 6px; }
.section-head h2::after {
	content: ""; position: absolute; bottom: 0; right: 0; width: 60px; height: 6px;
	border-radius: 6px; background: var(--sun);
}

/* Age cards */
.ages { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; }
.age-card {
	--c: var(--coral);
	display: block; padding: 26px 22px; border-radius: var(--radius); background: #fff; color: var(--ink);
	box-shadow: var(--shadow); border-top: 8px solid var(--c); transition: transform .2s, box-shadow .2s;
}
.age-card:hover { transform: translateY(-6px) rotate(-1deg); box-shadow: var(--shadow-lg); color: var(--ink); }
.age-card .age-emoji { font-size: 2.2rem; line-height: 1; }
.age-card h3 { margin: 12px 0 4px; }
.age-card p { margin: 0; color: var(--ink-soft); font-size: .92rem; }
.age-card .count { display: inline-block; margin-top: 10px; font-size: .8rem; font-weight: 700; color: var(--c); }
.age-card:nth-child(4n+2) { --c: var(--sky); }
.age-card:nth-child(4n+3) { --c: var(--mint); }
.age-card:nth-child(4n+4) { --c: var(--lilac); }

/* Post cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 26px; }
.card {
	display: flex; flex-direction: column; background: #fff; border-radius: var(--radius);
	overflow: hidden; box-shadow: var(--shadow); transition: transform .25s, box-shadow .25s;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.card-thumb { position: relative; aspect-ratio: 4 / 3; background: linear-gradient(135deg, var(--sun), var(--coral)); overflow: hidden; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.card:hover .card-thumb img { transform: scale(1.06); }
.card-thumb .placeholder { position: absolute; inset: 0; display: grid; place-items: center; font-size: 3.4rem; }
.card-badge {
	position: absolute; top: 14px; right: 14px; background: #fff; color: var(--ink);
	padding: 3px 12px; border-radius: 999px; font-size: .78rem; font-weight: 700; box-shadow: var(--shadow);
}
.card-body { padding: 20px 22px 22px; display: flex; flex-direction: column; flex: 1; }
.card-title { font-size: 1.12rem; margin: 0 0 8px; line-height: 1.7; }
.card-title a { color: var(--ink); }
.card-title a:hover { color: var(--coral-dark); }
.card-excerpt { color: var(--ink-soft); font-size: .93rem; margin: 0 0 14px; }
.card-meta { margin-top: auto; display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--ink-soft); }
.stars { color: var(--sun); letter-spacing: 2px; }
.stars .off { color: #e6dccb; }

/* Featured post */
.featured {
	display: grid; grid-template-columns: 1fr 1fr; background: #fff; border-radius: 28px;
	overflow: hidden; box-shadow: var(--shadow-lg); margin-bottom: 36px;
}
.featured .card-thumb { aspect-ratio: auto; min-height: 320px; }
.featured .card-body { padding: 38px; justify-content: center; }
.featured .card-title { font-size: 1.7rem; }

/* ---------- Layout: single ---------- */
.page-head { padding: 44px 0 10px; }
.breadcrumbs { font-size: .85rem; color: var(--ink-soft); }
.breadcrumbs a { color: var(--ink-soft); }
.breadcrumbs a:hover { color: var(--coral-dark); }
.breadcrumbs .sep { margin: 0 6px; opacity: .5; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 40px; align-items: start; padding-bottom: 60px; }
.layout.no-side { grid-template-columns: minmax(0, 820px); justify-content: center; }
.entry {
	background: #fff; border-radius: 28px; padding: clamp(22px, 4vw, 48px); box-shadow: var(--shadow);
}
.entry-header h1 { margin-top: 0; }
.entry-meta { display: flex; gap: 16px; flex-wrap: wrap; color: var(--ink-soft); font-size: .88rem; margin-bottom: 22px; }
.entry-meta span { display: inline-flex; align-items: center; gap: 6px; }
.entry-thumb { border-radius: var(--radius); overflow: hidden; margin: 0 0 28px; }
.entry-content > * { max-width: 100%; }
.entry-content img { border-radius: var(--radius-sm); }
.entry-content blockquote {
	margin: 1.6em 0; padding: 18px 24px; background: var(--cream); border-right: 6px solid var(--coral);
	border-radius: var(--radius-sm); font-size: 1.05rem;
}
.entry-content ul, .entry-content ol { padding-right: 1.4em; }
.entry-content li::marker { color: var(--coral); }
.entry-content h2 { border-bottom: 2px dashed var(--line); padding-bottom: 6px; }
.entry-content table { width: 100%; border-collapse: collapse; }
.entry-content th, .entry-content td { border: 1px solid var(--line); padding: 8px 12px; }
.entry-footer { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
	display: inline-block; padding: 4px 14px; border-radius: 999px; background: var(--cream);
	color: var(--ink); font-size: .85rem; border: 1px solid var(--line);
}
.tag:hover { background: var(--coral); color: #fff; border-color: var(--coral); }

/* Book card (review box) */
.book-box {
	position: relative; background: #fff; border-radius: 28px; padding: 26px; box-shadow: var(--shadow);
	border: 3px dashed var(--line);
}
.book-box h2 { margin: 0 0 16px; font-size: 1.15rem; display: flex; gap: 8px; align-items: center; }
.book-box dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; font-size: .93rem; }
.book-box dt { color: var(--ink-soft); }
.book-box dd { margin: 0; font-weight: 700; }
.book-box .rating-big { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); text-align: center; }
.book-box .rating-big .stars { font-size: 1.7rem; }
.book-box .verdict { margin-top: 10px; background: var(--cream); border-radius: var(--radius-sm); padding: 12px 14px; font-size: .92rem; }
.sidebar { position: sticky; top: 100px; display: grid; gap: 24px; }
.widget { background: #fff; border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.widget-title { margin: 0 0 12px; font-size: 1.05rem; }
.widget ul { list-style: none; margin: 0; padding: 0; }
.widget li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.widget li:last-child { border: 0; }

/* Author box & related */
.author-box {
	display: flex; gap: 18px; align-items: center; margin-top: 32px; padding: 22px;
	border-radius: var(--radius); background: var(--cream);
}
.author-box img { border-radius: 50%; }
.author-box h3 { margin: 0 0 4px; }
.author-box p { margin: 0; font-size: .92rem; color: var(--ink-soft); }
.related { margin-top: 40px; }
.related h2 { font-size: 1.3rem; }

/* TOC */
.toc { background: var(--cream); border-radius: var(--radius-sm); padding: 16px 22px; margin: 0 0 26px; }
.toc strong { display: block; margin-bottom: 6px; }
.toc ol { margin: 0; padding-right: 1.2em; font-size: .93rem; }

/* ---------- Archive / pagination ---------- */
.archive-head {
	background: #fff; border-radius: 28px; padding: 34px; box-shadow: var(--shadow); margin: 30px 0 34px;
	border-right: 10px solid var(--coral);
}
.archive-head h1 { margin: 0 0 6px; }
.archive-head p { margin: 0; color: var(--ink-soft); }
.pagination { margin: 40px 0 10px; display: flex; justify-content: center; }
.pagination .nav-links { display: flex; gap: 8px; flex-wrap: wrap; }
.pagination .page-numbers {
	min-width: 44px; height: 44px; display: grid; place-items: center; padding: 0 12px; border-radius: 14px;
	background: #fff; color: var(--ink); box-shadow: var(--shadow); font-weight: 700;
}
.pagination .current { background: var(--coral); color: #fff; }

/* ---------- Comments ---------- */
.comments { margin-top: 40px; }
.comment-list { list-style: none; padding: 0; }
.comment-list .children { list-style: none; padding-right: 30px; }
.comment-body { background: var(--cream); border-radius: var(--radius-sm); padding: 16px 20px; margin-bottom: 14px; }
.comment-author img { border-radius: 50%; float: right; margin-left: 10px; }
.comment-meta { font-size: .82rem; color: var(--ink-soft); }
.comment-form input[type=text], .comment-form input[type=email], .comment-form input[type=url], .comment-form textarea, .search-form input[type=search] {
	width: 100%; padding: 12px 16px; border: 2px solid var(--line); border-radius: var(--radius-sm); background: #fff;
}
.comment-form input:focus, .comment-form textarea:focus { border-color: var(--coral); outline: none; }
.comment-form input[type=submit], .search-form button {
	padding: 12px 26px; border: 0; border-radius: 999px; background: var(--coral); color: #fff; font-weight: 700; cursor: pointer;
}
.search-form { display: flex; gap: 8px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: #d7deea; margin-top: 40px; position: relative; }
.site-footer::before {
	content: ""; position: absolute; top: -28px; left: 0; right: 0; height: 30px;
	background: radial-gradient(circle at 15px -6px, transparent 22px, var(--ink) 23px) repeat-x;
	background-size: 30px 30px;
}
.site-footer a { color: #fff; }
.site-footer a:hover { color: var(--sun); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 36px; padding: 56px 0 30px; }
.footer-grid h3 { color: #fff; margin-top: 0; font-size: 1.05rem; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { padding: 4px 0; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); padding: 18px 0; font-size: .85rem; text-align: center; }

/* ---------- Gutenberg alignments ---------- */
.alignwide { margin-inline: -40px; max-width: calc(100% + 80px); }
.alignfull { margin-inline: calc(50% - 50vw); max-width: 100vw; }
.aligncenter { margin-inline: auto; }
.alignright { float: right; margin: 0 0 1em 1.5em; }
.alignleft { float: left; margin: 0 1.5em 1em 0; }
.wp-caption-text, figcaption { font-size: .85rem; color: var(--ink-soft); text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
	.hero .wrap, .featured, .layout, .footer-grid { grid-template-columns: 1fr; }
	.hero-books { height: 260px; }
	.sidebar { position: static; }
	.alignwide { margin-inline: 0; max-width: 100%; }
}
@media (max-width: 760px) {
	body { font-size: 16px; }
	.menu-toggle { display: block; }
	.header-search { order: 2; }
	.main-nav { display: none; position: absolute; top: 76px; right: 0; left: 0; background: var(--cream); padding: 12px 20px 20px; border-bottom: 1px solid var(--line); }
	.main-nav.open { display: block; }
	.main-nav ul { flex-direction: column; }
	.main-nav .sub-menu { position: static; display: flex; box-shadow: none; }
	.hero { padding: 40px 0 60px; }
	.hero-books .bk { width: 115px; height: 160px; font-size: .85rem; }
	.featured .card-body { padding: 24px; }
	.author-box { flex-direction: column; text-align: center; }
}

/* ---------- Persian list numbers ---------- */
.toc ol, .entry-content ol { list-style-type: persian; }

/* ---------- Block widgets (default sidebar widgets) ---------- */
.widget h2, .widget .wp-block-heading { font-size: 1.05rem; margin: 0 0 12px; }
.widget .wp-block-search__label { display: block; font-weight: 800; margin-bottom: 10px; }
.wp-block-search__inside-wrapper { display: flex; gap: 8px; }
.wp-block-search__input {
	flex: 1; min-width: 0; padding: 10px 16px; border: 2px solid var(--line); border-radius: 999px; background: var(--cream);
}
.wp-block-search__input:focus { border-color: var(--coral); outline: none; }
.wp-block-search__button {
	margin: 0; padding: 10px 20px; border: 0; border-radius: 999px; background: var(--coral); color: #fff; font-weight: 700; cursor: pointer;
}
.widget .wp-block-latest-posts, .widget .wp-block-latest-comments, .widget .wp-block-archives, .widget .wp-block-categories { padding: 0; margin: 0; }
.widget .wp-block-latest-comments__comment { padding: 6px 0; margin: 0; }
.widget .wp-block-latest-comments__comment-excerpt p { margin: 0; font-size: .88rem; }
.widget .wp-block-group__inner-container > * + * { margin-top: 0; }
