/*
Theme Name: روایت
Theme URI: https://example.com/ravayat
Author: تیم روایت
Author URI: https://example.com
Description: قالبی مدرن، مینیمال و کاملاً راست‌چین برای وبلاگ‌های فارسی.
Version: 1.2.2
Requires at least: 6.0
Tested up to: 7.0.2
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: ravayat
Tags: blog, rtl-language-support, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready
*/

:root {
  --ink: #1c1d1f;
  --muted: #4b5563;
  --line: #e5e7eb;
  --paper: #ffffff;
  --canvas: #f9fafb;
  --header-bg: #ffffff;
  --footer-bg: #ffffff;
  --brand: #0d47a1;
  --brand-dark: #0b387e;
  --accent: #f1b42a;
  --radius: 22px;
  --shadow: 0 16px 45px rgba(26, 50, 38, .08);
  --container: 1180px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  direction: rtl;
  color: var(--ink);
  background: var(--canvas);
  font-family: "Vazirmatn", "IRANSans", Tahoma, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.9;
  -webkit-font-smoothing: antialiased;
}
body.nav-open { overflow: hidden; }
a { color: inherit; text-decoration: none; transition: color .2s ease, background .2s ease, transform .2s ease; }
img { display: block; max-width: 100%; height: auto; }
button, input, textarea, select { font: inherit; }
.container { width: min(calc(100% - 40px), var(--container)); margin-inline: auto; }
.site-main { min-height: 55vh; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.screen-reader-text:focus { top: 8px; right: 8px; z-index: 9999; width: auto; height: auto; padding: 10px 16px; clip: auto; background: #fff; color: #000; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 100; background: var(--header-bg); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.header-inner { min-height: 84px; display: flex; align-items: center; gap: 34px; }
.site-branding { flex: 0 0 auto; }
.custom-logo-link { display: inline-flex; align-items: center; }
.custom-logo { max-height: 52px; width: auto; }
.site-title { display: inline-flex; align-items: center; gap: 10px; font-size: 1.45rem; font-weight: 900; letter-spacing: -.04em; }
.site-title::before { content: "ر"; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; color: white; background: var(--brand); font-size: 1.3rem; }
.default-logo-link, .footer-logo { display: inline-flex; align-items: center; }
.default-logo-link img { display: block; width: 210px; max-height: 54px; object-fit: contain; }
.footer-logo img { display: block; width: 220px; max-height: 58px; object-fit: contain; }
.main-navigation { margin-right: auto; }
.main-navigation ul { display: flex; align-items: center; gap: 30px; margin: 0; padding: 0; list-style: none; }
.main-navigation a { display: block; color: #435048; font-weight: 600; font-size: .95rem; }
.main-navigation a:hover, .main-navigation .current-menu-item > a { color: var(--brand); }
.menu-toggle { display: none; margin-right: auto; width: 44px; height: 44px; padding: 10px; border: 1px solid var(--line); border-radius: 13px; background: #fff; cursor: pointer; }
.menu-toggle span { display: block; width: 100%; height: 2px; margin: 5px 0; background: var(--ink); transition: .25s ease; }
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Hero slider */
.hero { padding: 34px 0 68px; }
.hero-slider { position: relative; min-height: 590px; overflow: hidden; border-radius: 32px; background: #0d47a1; box-shadow: var(--shadow); }
.hero-slide { position: absolute; inset: 0; display: grid; align-items: end; visibility: hidden; opacity: 0; transform: scale(1.025); transition: opacity .7s ease, transform 1.2s ease, visibility .7s; }
.hero-slide.is-active { visibility: visible; opacity: 1; transform: scale(1); }
.hero-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-slide::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(10,22,40,.1), rgba(10,22,40,.18) 35%, rgba(10,33,75,.93) 100%); }
.hero-fallback { position: absolute; inset: 0; background: radial-gradient(circle at 20% 30%, #7b9bcf, transparent 32%), linear-gradient(135deg, #2354a3, #00296b); }
.hero-content { position: relative; z-index: 2; width: min(670px, 88%); padding: 0 64px 76px 20px; color: #fff; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 13px; color: var(--accent); font-size: .88rem; font-weight: 700; }
.eyebrow::before { content: ""; width: 22px; height: 2px; background: currentColor; }
.hero-title { max-width: 650px; margin: 0 0 15px; font-size: clamp(2.15rem, 4.6vw, 4.35rem); line-height: 1.35; letter-spacing: -.055em; font-weight: 900; }
.hero-excerpt { margin: 0 0 26px; color: rgba(255,255,255,.8); font-size: 1.03rem; line-height: 2; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 48px; padding: 0 23px; border-radius: 14px; background: var(--brand); color: #fff; font-weight: 800; }
.button:hover { background: var(--brand-dark); color: #fff; transform: translateY(-2px); }
.button-light { background: #fff; color: var(--brand-dark); }
.button-light:hover { background: #f2f5f3; color: var(--brand-dark); }
.button-arrow::after { content: "←"; font-size: 1.1rem; }
.slider-controls { position: absolute; z-index: 3; left: 28px; bottom: 18px; display: flex; flex-direction: column; align-items: center; gap: 9px; direction: ltr; }
.slider-buttons { display: flex; align-items: center; gap: 10px; }
.slider-button { display: grid; place-items: center; width: 45px; height: 45px; border: 1px solid rgba(255,255,255,.35); border-radius: 50%; color: #fff; background: rgba(10,25,19,.3); cursor: pointer; backdrop-filter: blur(6px); }
.slider-button:hover { background: #fff; color: var(--ink); }
.slider-dots { display: flex; justify-content: center; gap: 8px; }
.slider-dot { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 20px; background: rgba(255,255,255,.45); cursor: pointer; transition: .25s ease; }
.slider-dot.is-active { width: 28px; background: #fff; }

/* Content and cards */
.content-section { padding: 18px 0 90px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 30px; }
.section-kicker { margin: 0 0 3px; color: var(--brand); font-size: .85rem; font-weight: 800; }
.section-title { margin: 0; font-size: clamp(1.7rem, 3vw, 2.45rem); line-height: 1.5; letter-spacing: -.04em; }
.text-link { color: var(--brand); font-weight: 800; white-space: nowrap; }
.posts-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 25px; }
.post-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); transition: transform .25s ease, box-shadow .25s ease; }
.post-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.card-image-wrap { position: relative; display: block; overflow: hidden; aspect-ratio: 16/10; background: #dfe9e2; }
.card-image-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.post-card:hover .card-image-wrap img { transform: scale(1.04); }
.image-placeholder { width: 100%; height: 100%; background: linear-gradient(145deg, #dbe5f5, #7b9bcf); }
.card-category { position: absolute; top: 15px; right: 15px; padding: 5px 12px; border-radius: 9px; background: rgba(255,255,255,.93); color: var(--brand-dark); font-size: .76rem; font-weight: 800; }
.card-body { padding: 23px 23px 25px; }
.post-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; color: var(--muted); font-size: .82rem; }
.post-meta span + span::before { content: "•"; margin-left: 8px; color: #b4bcb7; }
.card-title { margin: 0 0 10px; font-size: 1.24rem; line-height: 1.75; letter-spacing: -.025em; }
.card-title a:hover { color: var(--brand); }
.card-excerpt { margin: 0 0 18px; color: var(--muted); font-size: .91rem; line-height: 1.9; }
.read-more { color: var(--brand); font-size: .9rem; font-weight: 800; }
.read-more::after { content: " ←"; }

/* Archives */
.page-header { padding: 62px 0 40px; text-align: center; }
.page-title { margin: 0; font-size: clamp(2rem, 5vw, 3.6rem); line-height: 1.4; letter-spacing: -.05em; }
.archive-description { max-width: 680px; margin: 12px auto 0; color: var(--muted); }
.pagination { margin-top: 42px; text-align: center; }
.nav-links { display: flex; justify-content: center; gap: 8px; }
.page-numbers { display: grid; place-items: center; min-width: 43px; height: 43px; padding: 0 11px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.page-numbers.current, .page-numbers:hover { border-color: var(--brand); background: var(--brand); color: #fff; }

/* Single post */
.single-hero { padding: 60px 0 38px; text-align: center; }
.single-category { display: inline-block; margin-bottom: 12px; color: var(--brand); font-weight: 800; }
.single-title { max-width: 910px; margin: 0 auto 18px; font-size: clamp(2.15rem, 5.2vw, 4.6rem); line-height: 1.35; letter-spacing: -.055em; }
.single-meta { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 22px; color: var(--muted); font-size: .92rem; }
.single-featured { max-height: 690px; width: 100%; object-fit: cover; border-radius: 30px; box-shadow: var(--shadow); }
.article-layout { display: grid; grid-template-columns: minmax(0,760px); justify-content: center; gap: 38px; padding: 58px 0 78px; }
.entry-content { min-width: 0; color: #252a31; font-size: 1.12rem; line-height: 2.15; }
.entry-content > *:first-child { margin-top: 0; }
.entry-content h2, .entry-content h3, .entry-content h4 { margin: 2.2em 0 .75em; color: var(--ink); line-height: 1.55; letter-spacing: -.03em; }
.entry-content h2 { font-size: 1.8rem; }
.entry-content h3 { font-size: 1.45rem; }
.entry-content p { margin: 0 0 1.5em; }
.entry-content a { color: var(--brand); text-decoration: underline; text-underline-offset: 4px; }
.entry-content blockquote { margin: 2.2em 0; padding: 22px 28px; border-right: 4px solid var(--brand); border-radius: 14px 0 0 14px; background: #edf3fb; color: #0d2137; font-size: 1.15em; }
.entry-content img { border-radius: 18px; }
.entry-content ul, .entry-content ol { padding-right: 1.4em; }
.post-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 38px; padding-top: 24px; border-top: 1px solid var(--line); }
.post-tags a { padding: 4px 12px; border-radius: 8px; background: #edf3fb; color: #4b5563; font-size: .82rem; text-decoration: none; }
.related-posts { padding: 72px 0 90px; background: #f1f5fb; }
.related-posts .posts-grid { grid-template-columns: repeat(3,1fr); }

/* Comments and forms */
.comments-area { max-width: 760px; margin: 0 auto 90px; }
.comments-title, .comment-reply-title { font-size: 1.6rem; }
.comment-list { padding: 0; list-style: none; }
.comment-body { margin: 0 0 20px; padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.comment-author img { float: right; margin-left: 12px; border-radius: 50%; }
input[type="text"], input[type="email"], input[type="url"], input[type="search"], textarea { width: 100%; padding: 13px 15px; border: 1px solid #d9dfdb; border-radius: 12px; background: #fff; color: var(--ink); outline: none; }
input:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31,107,79,.1); }
input[type="submit"], button[type="submit"] { min-height: 46px; padding: 0 21px; border: 0; border-radius: 12px; background: var(--brand); color: #fff; font-weight: 800; cursor: pointer; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--footer-bg); }
.footer-main { display: grid; grid-template-columns: 1.45fr 2fr; gap: 85px; padding: 70px 0 50px; }
.footer-about .site-title { margin-bottom: 18px; }
.footer-about .footer-logo { margin-bottom: 18px; }
.footer-about .custom-logo-link { display: inline-flex; margin-bottom: 18px; }
.footer-description { max-width: 430px; margin: 0 0 18px; color: var(--muted); font-size: .92rem; }
.footer-contact { color: #435047; font-size: .88rem; }
.footer-widgets { display: grid; grid-template-columns: repeat(3,1fr); gap: 30px; }
.footer-column-title, .widget-title { margin: 0 0 16px; font-size: 1rem; }
.footer-links, .widget ul { margin: 0; padding: 0; list-style: none; }
.footer-links li, .widget li { margin: 0 0 8px; }
.footer-links a, .widget a { color: var(--muted); font-size: .89rem; }
.footer-links a:hover, .widget a:hover { color: var(--brand); }
.footer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 22px 0; border-top: 1px solid var(--line); color: #7c857f; font-size: .8rem; }

/* Empty and 404 */
.empty-state { padding: 110px 20px; text-align: center; }
.error-code { margin: 0; color: var(--brand); font-size: clamp(5rem, 18vw, 11rem); line-height: 1; font-weight: 900; opacity: .13; }
.empty-state h1 { margin: -18px 0 10px; font-size: 2.3rem; }
.empty-state p { max-width: 520px; margin: 0 auto 25px; color: var(--muted); }

@media (max-width: 900px) {
  .header-inner { min-height: 72px; }
  .menu-toggle { display: block; }
  .main-navigation { position: fixed; top: 72px; right: 0; left: 0; margin: 0; padding: 12px 20px 24px; visibility: hidden; opacity: 0; transform: translateY(-12px); border-bottom: 1px solid var(--line); background: #fff; box-shadow: 0 16px 30px rgba(20,40,30,.08); transition: .25s ease; }
  .main-navigation.is-open { visibility: visible; opacity: 1; transform: translateY(0); }
  .main-navigation ul { display: block; }
  .main-navigation li { border-bottom: 1px solid #f0f2f0; }
  .main-navigation a { padding: 12px 4px; }
  .hero-slider { min-height: 520px; }
  .posts-grid { grid-template-columns: repeat(2,1fr); }
  .footer-main { grid-template-columns: 1fr; gap: 45px; }
  .article-layout { grid-template-columns: minmax(0,720px); }
}

@media (max-width: 620px) {
  .container { width: min(calc(100% - 28px), var(--container)); }
  .custom-logo { max-height: 42px; max-width: 170px; }
  .site-title { font-size: 1.22rem; }
  .site-title::before { width: 38px; height: 38px; border-radius: 12px; }
  .default-logo-link img { width: 170px; max-height: 44px; }
  .hero { padding: 18px 0 48px; }
  .hero-slider { min-height: 510px; border-radius: 22px; }
  .hero-slide::after { background: linear-gradient(0deg, rgba(10,33,75,.96), rgba(10,33,75,.04) 85%); }
  .hero-content { width: 100%; padding: 0 23px 86px; }
  .hero-title { font-size: 2.1rem; }
  .hero-excerpt { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .slider-controls { left: 18px; bottom: 14px; }
  .slider-button { width: 40px; height: 40px; }
  .section-heading { align-items: center; }
  .posts-grid, .related-posts .posts-grid { grid-template-columns: 1fr; }
  .content-section { padding-bottom: 60px; }
  .single-hero { padding: 42px 0 28px; }
  .single-title { font-size: 2.15rem; }
  .single-featured { min-height: 250px; border-radius: 20px; object-fit: cover; }
  .article-layout { gap: 25px; padding: 38px 0 58px; }
  .entry-content { font-size: 1.03rem; line-height: 2.05; }
  .footer-main { padding: 55px 0 38px; }
  .footer-widgets { grid-template-columns: 1fr 1fr; gap: 30px 22px; }
  .footer-widgets > :first-child { grid-column: 1 / -1; }
  .footer-bottom { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* WordPress alignment helpers */
.alignwide { max-width: 1050px; margin-right: auto; margin-left: auto; }
.alignfull { width: 100vw; max-width: 100vw; margin-right: calc(50% - 50vw); margin-left: calc(50% - 50vw); }
.wp-caption, .gallery-caption { max-width: 100%; color: var(--muted); font-size: .82rem; }
.bypostauthor { display: block; }
.sticky .card-title::before { content: "ویژه · "; color: var(--brand); }
