/*
Theme Name: Fars Encyclopedia
Theme URI: https://fars-encyclopedia.com
Author: WebClub
Description: قالب اختصاصی دانشنامهٔ فارس — دانشنامهٔ آثار تاریخی و مشاهیر استان فارس و شیراز. راست‌چین، فارسی، آرشیومحور.
Version: 1.0.1
Requires PHP: 8.1
Text Domain: fars
*/

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

/* ---------- Tokens ---------- */
:root {
  --blue-950: #062434;
  --blue-900: #083247;
  --blue-800: #0a415c;
  --blue-700: #0b4f6c;
  --blue-600: #0e6288;
  --gold: #c8a45c;
  --gold-dark: #a9843d;
  --gold-soft: #e9d9b8;
  --cream: #f6f1e7;
  --paper: #fffdf8;
  --ink: #22303c;
  --muted: #5f6d7a;
  --border: #e8dfcd;
  --shadow: 0 1px 2px rgba(8, 50, 71, .06), 0 8px 24px -12px rgba(8, 50, 71, .18);
  --shadow-lg: 0 2px 4px rgba(8, 50, 71, .08), 0 18px 44px -16px rgba(8, 50, 71, .28);
  --radius: 14px;
  --wrap: 1200px;
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='%23c8a45c' stroke-opacity='.16'%3E%3Cpath d='M36 8 L43 29 L64 36 L43 43 L36 64 L29 43 L8 36 L29 29 Z'/%3E%3Ccircle cx='36' cy='36' r='3.5'/%3E%3C/g%3E%3C/svg%3E");
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 90px; }
body {
  margin: 0;
  font-family: 'Vazirmatn', Tahoma, 'Segoe UI', sans-serif;
  font-size: 16.5px;
  line-height: 1.9;
  color: var(--ink);
  background: var(--cream);
  direction: rtl;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; }
a { color: var(--blue-700); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--blue-600); }
h1, h2, h3, h4, h5, h6 { line-height: 1.5; color: var(--blue-900); font-weight: 800; margin: 0 0 .5em; }
.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: 22px; }

.skip-link {
  position: absolute; inset-inline-start: -9999px; top: 0;
  background: var(--blue-900); color: #fff; padding: 10px 18px; z-index: 200; border-radius: 0 0 8px 8px;
}
.skip-link:focus { inset-inline-start: 12px; color: #fff; }

::selection { background: var(--gold-soft); color: var(--blue-950); }

/* دسترس‌پذیری: حالت فوکوس صفحه‌کلید */
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.hero-search input:focus-visible, .header-search input:focus-visible { outline-offset: 0; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 253, 248, .94);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow .2s ease;
}
.site-header.is-scrolled { box-shadow: 0 6px 24px -10px rgba(8, 50, 71, .28); }
.header-inner { display: flex; align-items: center; gap: 26px; min-height: 74px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--blue-900); }
.brand-mark {
  display: grid; place-items: center; width: 58px; height: 58px; flex: none;
  background: #fff;
  border-radius: 12px; border: 1px solid var(--border);
  box-shadow: inset 0 0 0 1.5px rgba(200, 164, 92, .45), var(--shadow);
}
.brand-mark img { display: block; }
.brand-text { display: flex; flex-direction: column; }
.brand-title { font-size: 20px; font-weight: 800; letter-spacing: -.2px; }
.brand-tag { font-size: 11.5px; color: var(--muted); }

.main-nav { margin-inline-start: auto; }
.main-nav ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.main-nav a {
  display: block; padding: 8px 14px; border-radius: 999px;
  font-size: 15px; font-weight: 600; color: var(--blue-900);
}
.main-nav a:hover { background: var(--cream); color: var(--blue-700); }
.main-nav .current-menu-item > a, .main-nav .current_page_item > a {
  background: var(--blue-900); color: #fff;
}

.header-search { position: relative; flex: none; }
.header-search input[type=search] {
  width: 210px; padding: 9px 14px 9px 40px;
  border: 1px solid var(--border); border-radius: 999px;
  background: #fff; font: inherit; font-size: 14px; color: var(--ink);
}
.header-search input[type=search]:focus { outline: 2px solid var(--gold); outline-offset: 1px; border-color: var(--gold); }
.header-search button {
  position: absolute; left: 6px; right: auto; top: 50%; transform: translateY(-50%);
  background: none; border: 0; cursor: pointer; color: var(--blue-700); padding: 4px; line-height: 0;
}
.nav-toggle {
  display: none; margin-inline-start: auto;
  background: none; border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 10px; cursor: pointer; color: var(--blue-900); line-height: 0;
}

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden; color: #fff;
  background: radial-gradient(1100px 500px at 85% -10%, rgba(200, 164, 92, .28), transparent 60%),
              linear-gradient(160deg, var(--blue-950) 0%, var(--blue-800) 55%, var(--blue-700) 100%);
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background-image: var(--pattern); background-size: 72px 72px; opacity: .5; pointer-events: none;
}
.hero-inner { position: relative; padding: 60px 0 66px; text-align: center; }
.hero-logo {
  width: 124px; height: 124px; margin: 0 auto 18px;
  background: #fff; border-radius: 50%;
  display: grid; place-items: center;
  box-shadow: 0 0 0 5px rgba(200, 164, 92, .38), 0 14px 34px -12px rgba(0, 0, 0, .55);
}
.hero-logo img { display: block; }
.hero-kicker {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--gold-soft); font-size: 14px; font-weight: 600; letter-spacing: .3px; margin-bottom: 14px;
}
.hero-kicker::before, .hero-kicker::after { content: ''; width: 34px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.hero-kicker::after { background: linear-gradient(270deg, transparent, var(--gold)); }
.hero h1 { color: #fff; font-size: clamp(34px, 5.4vw, 56px); margin: 0 0 10px; }
.hero h1 em { font-style: normal; color: var(--gold-soft); }
.hero-sub { max-width: 640px; margin: 0 auto 30px; color: rgba(255, 255, 255, .82); font-size: 17px; }

.hero-search { max-width: 620px; margin: 0 auto; position: relative; }
.hero-search input[type=search] {
  width: 100%; padding: 17px 24px 17px 128px;
  border: 1px solid rgba(200, 164, 92, .5); border-radius: 999px;
  font: inherit; font-size: 16px; color: var(--ink);
  background: var(--paper); box-shadow: var(--shadow-lg);
}
.hero-search input[type=search]:focus { outline: 3px solid rgba(200, 164, 92, .55); outline-offset: 0; }
.hero-search button {
  position: absolute; left: 7px; right: auto; top: 7px; bottom: 7px;
  padding: 0 26px; border: 0; border-radius: 999px; cursor: pointer;
  background: linear-gradient(145deg, var(--gold), var(--gold-dark));
  color: var(--blue-950); font: inherit; font-size: 15px; font-weight: 700;
}
.hero-search button:hover { filter: brightness(1.06); }

/* حباب اعتبارسنجی اختصاصی (راست‌چین، آیکن سمت راست) */
.fars-validate-tip {
  position: absolute; top: calc(100% + 10px); right: 16px; z-index: 60;
  display: flex; align-items: center; gap: 9px; direction: rtl; white-space: nowrap;
  background: #fff; color: var(--ink); font-size: 13.5px; font-weight: 600;
  padding: 9px 15px; border-radius: 10px; box-shadow: var(--shadow-lg);
}
.fars-validate-tip::before {
  content: ''; position: absolute; top: -6px; right: 28px;
  border: 6px solid transparent; border-bottom-color: #fff; border-top: 0;
}
.fars-validate-tip .tip-icon {
  display: grid; place-items: center; width: 20px; height: 20px; flex: none;
  background: #e2571b; color: #fff; border-radius: 5px; font-weight: 800; font-size: 13px;
}

.hero-stats { display: flex; justify-content: center; gap: clamp(24px, 6vw, 70px); margin-top: 40px; }
.hero-stat { text-align: center; }
.hero-stat b { display: block; font-size: clamp(24px, 3vw, 32px); font-weight: 800; color: var(--gold-soft); line-height: 1.3; }
.hero-stat span { font-size: 13.5px; color: rgba(255, 255, 255, .72); }

/* ---------- Sections ---------- */
.section { padding: 58px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.section-title { font-size: clamp(22px, 3vw, 28px); margin: 0; position: relative; padding-inline-start: 16px; }
.section-title::before {
  content: ''; position: absolute; inset-inline-start: 0; top: 8px; bottom: 8px; width: 5px;
  border-radius: 4px; background: linear-gradient(var(--gold), var(--gold-dark));
}
.section-more { font-size: 14px; font-weight: 700; color: var(--blue-700); white-space: nowrap; }
.section-more:hover { color: var(--gold-dark); }

/* Topic cards */
.topics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.topic-card {
  position: relative; display: flex; flex-direction: column; gap: 8px;
  background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 30px 26px 26px; box-shadow: var(--shadow); overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
}
.topic-card::after {
  content: ''; position: absolute; inset-inline: 0; top: 0; height: 4px;
  background: linear-gradient(90deg, var(--gold), transparent 70%);
  opacity: 0; transition: opacity .18s ease;
}
.topic-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.topic-card:hover::after { opacity: 1; }
.topic-icon {
  width: 52px; height: 52px; display: grid; place-items: center; margin-bottom: 6px;
  background: linear-gradient(145deg, var(--cream), #efe6d3);
  border: 1px solid var(--border); border-radius: 14px; color: var(--blue-700);
}
.topic-card h3 { font-size: 20px; margin: 0; }
.topic-card h3 a { color: inherit; }
.topic-card h3 a::after { content: ''; position: absolute; inset: 0; }
.topic-card p { margin: 0; color: var(--muted); font-size: 14.5px; }
.topic-count {
  margin-top: auto; padding-top: 12px; font-size: 13.5px; font-weight: 700; color: var(--gold-dark);
}

/* ---------- Entry cards ---------- */
.card-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card-media { aspect-ratio: 16/10; overflow: hidden; background: var(--blue-900); }
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.card:hover .card-media img { transform: scale(1.04); }
.card-media.is-placeholder {
  display: grid; place-items: center;
  background: linear-gradient(150deg, var(--blue-800), var(--blue-950));
  background-image: var(--pattern), linear-gradient(150deg, var(--blue-800), var(--blue-950));
  background-size: 72px 72px, cover;
}
.card-media.is-placeholder span {
  font-size: 44px; font-weight: 800; color: var(--gold-soft); opacity: .9; line-height: 1;
}
.card-body { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px 18px; flex: 1; }
.card-cat {
  align-self: flex-start; font-size: 11.5px; font-weight: 700; color: var(--blue-700);
  background: var(--cream); border: 1px solid var(--border); border-radius: 999px; padding: 2px 11px;
  position: relative; z-index: 2;
}
.card h3 { font-size: 16.5px; line-height: 1.65; margin: 0; }
.card h3 a { color: var(--blue-900); }
.card h3 a::after { content: ''; position: absolute; inset: 0; z-index: 1; }
.card:hover h3 a { color: var(--blue-600); }
.card p { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.8; }
.card-date { margin-top: auto; padding-top: 8px; font-size: 12px; color: var(--gold-dark); font-weight: 600; }

/* ---------- About band ---------- */
.about-band {
  background: linear-gradient(160deg, var(--blue-900), var(--blue-700));
  background-image: var(--pattern), linear-gradient(160deg, var(--blue-900), var(--blue-700));
  background-size: 72px 72px, cover;
  color: rgba(255, 255, 255, .88); border-radius: var(--radius);
  padding: clamp(28px, 5vw, 52px); text-align: center; box-shadow: var(--shadow-lg);
}
.about-band h2 { color: #fff; font-size: clamp(22px, 3vw, 30px); }
.about-band p { max-width: 760px; margin: 0 auto; font-size: 15.5px; }
.about-band .btn { margin-top: 22px; }

.btn {
  display: inline-block; padding: 11px 30px; border-radius: 999px;
  background: linear-gradient(145deg, var(--gold), var(--gold-dark));
  color: var(--blue-950); font-weight: 700; font-size: 15px; border: 0; cursor: pointer;
}
.btn:hover { filter: brightness(1.06); color: var(--blue-950); }

/* ---------- Archive / content ---------- */
.page-head {
  background: linear-gradient(160deg, var(--blue-950), var(--blue-700));
  background-image: var(--pattern), linear-gradient(160deg, var(--blue-950), var(--blue-700));
  background-size: 72px 72px, cover;
  color: #fff; padding: 44px 0 38px;
}
.page-head h1 { color: #fff; font-size: clamp(26px, 4vw, 38px); margin: 6px 0 0; }
.page-head .archive-desc { color: rgba(255, 255, 255, .78); max-width: 720px; margin-top: 8px; font-size: 15px; }
.breadcrumb { font-size: 13px; color: rgba(255, 255, 255, .66); }
.breadcrumb a { color: var(--gold-soft); }
.breadcrumb .sep { margin-inline: 7px; opacity: .55; }
.entry-wrap .breadcrumb { color: var(--muted); }
.entry-wrap .breadcrumb a { color: var(--blue-700); }

.alphabet-bar { display: flex; flex-wrap: wrap; gap: 7px; margin: 26px 0 6px; }
.alphabet-bar a {
  min-width: 38px; text-align: center; padding: 5px 10px;
  background: var(--paper); border: 1px solid var(--border); border-radius: 10px;
  font-size: 14.5px; font-weight: 700; color: var(--blue-800);
}
.alphabet-bar a:hover { border-color: var(--gold); color: var(--gold-dark); }
.alphabet-bar a.is-active { background: var(--blue-900); border-color: var(--blue-900); color: #fff; }

.results-count { color: var(--muted); font-size: 14px; margin: 4px 0 0; }

/* Pagination */
.pagination { margin-top: 36px; }
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.pagination .page-numbers {
  min-width: 42px; text-align: center; padding: 8px 13px;
  background: var(--paper); border: 1px solid var(--border); border-radius: 10px;
  font-size: 14.5px; font-weight: 700; color: var(--blue-800);
}
.pagination .page-numbers.current { background: var(--blue-900); border-color: var(--blue-900); color: #fff; }
.pagination a.page-numbers:hover { border-color: var(--gold); color: var(--gold-dark); }

/* ---------- Single / page ---------- */
.entry-wrap { padding: 40px 0 64px; }
.entry-layout { max-width: 820px; margin-inline: auto; }
.entry-header { margin-bottom: 26px; }
.entry-header .card-cat { margin-bottom: 12px; }
.entry-title { font-size: clamp(26px, 4vw, 40px); line-height: 1.55; margin: 10px 0 8px; }
.entry-subtitle { color: var(--muted); font-size: 16px; margin: 4px 0 8px; }
.entry-meta { display: flex; flex-wrap: wrap; gap: 16px; color: var(--muted); font-size: 13.5px; }
.entry-meta b { color: var(--gold-dark); font-weight: 700; }
.entry-rule { height: 3px; border: 0; margin: 22px 0 0; border-radius: 3px;
  background: linear-gradient(90deg, var(--gold), transparent 60%); }

.entry-content {
  background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: clamp(22px, 4vw, 44px);
  font-size: 17px; line-height: 2.1; overflow-wrap: break-word;
  display: flow-root; /* contain legacy floats so they never spill under the card */
  text-align: justify;
}
.entry-content * { font-family: inherit !important; }
/* Legacy float layouts (align attrs / inline float) break the modern layout — flow images naturally */
.entry-content img, .entry-content table,
.entry-content img[align], .entry-content table[align],
.entry-content [style*="float"] { float: none !important; }
.entry-content table { display: block; max-width: 100%; overflow-x: auto; margin-inline: auto; }
/* Legacy Word/VML markup: kill absolute positioning + negative margins that break layout */
.entry-content [style*="POSITION: absolute"],
.entry-content [style*="position: absolute"],
.entry-content [style*="position:absolute"] {
  position: static !important; margin: 0 !important; width: auto !important; height: auto !important;
}
.entry-content { overflow-x: clip; }
.entry-content p { margin: 0 0 1.1em; }
.entry-content img {
  border-radius: 10px; box-shadow: var(--shadow); margin: 20px auto; display: block;
  max-width: 100% !important; height: auto !important;
}
.entry-content h2, .entry-content h3 { margin-top: 1.6em; }
.entry-content a { border-bottom: 1px dashed var(--gold); }
.entry-content blockquote {
  margin: 1.2em 0; padding: 14px 22px; background: var(--cream);
  border-inline-start: 4px solid var(--gold); border-radius: 8px;
}
.entry-content table { border-collapse: collapse; width: 100%; }
.entry-content td, .entry-content th { border: 1px solid var(--border); padding: 8px 12px; }

/* کتاب‌ها */
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 20px; }
.book-grid-5 { grid-template-columns: repeat(5, 1fr); }
.book-card {
  display: flex; flex-direction: column;
  background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.book-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.book-cover {
  display: block; aspect-ratio: 3 / 4; overflow: hidden;
  background: linear-gradient(150deg, var(--blue-800), var(--blue-950));
}
.book-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.book-card:hover .book-cover img { transform: scale(1.045); }
.book-cover.is-placeholder { display: grid; place-items: center; color: var(--gold-soft);
  background-image: var(--pattern), linear-gradient(150deg, var(--blue-800), var(--blue-950));
  background-size: 72px 72px, cover; }
.book-card-body { display: flex; flex-direction: column; gap: 4px; padding: 13px 15px 15px; }
.book-card h3 { font-size: 14.5px; line-height: 1.7; margin: 0; }
.book-card h3 a { color: var(--blue-900); }
.book-card h3 a:hover { color: var(--blue-600); }
.book-author { font-size: 12px; color: var(--muted); }
.book-year { font-size: 12px; font-weight: 700; color: var(--gold-dark); }

.book-single { display: grid; grid-template-columns: 270px 1fr; gap: 32px; align-items: start; }
.book-single-cover {
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-lg);
  aspect-ratio: 3 / 4; background: linear-gradient(150deg, var(--blue-800), var(--blue-950));
}
.book-single-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.book-single-cover.is-placeholder { display: grid; place-items: center; color: var(--gold-soft); }
.book-details {
  width: 100%; border-collapse: collapse;
  background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
}
.book-details th, .book-details td { padding: 12px 18px; border-bottom: 1px solid var(--border); font-size: 15px; text-align: right; }
.book-details tr:last-child th, .book-details tr:last-child td { border-bottom: 0; }
.book-details th { color: var(--gold-dark); font-weight: 700; white-space: nowrap; width: 1%; }
@media (max-width: 780px) {
  .book-single { grid-template-columns: 1fr; }
  .book-single-cover { max-width: 300px; margin-inline: auto; }
  .book-grid-5 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 540px) {
  .book-grid { grid-template-columns: repeat(2, 1fr); }
  .book-grid-5 { grid-template-columns: repeat(2, 1fr); }
}

/* سعدی‌شناسی: شبکهٔ دفترها */
.volume-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.volume-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--paper); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 18px; box-shadow: var(--shadow); color: var(--blue-900);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.volume-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--gold); color: var(--blue-700); }
.volume-icon {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none;
  background: linear-gradient(145deg, var(--cream), #efe6d3);
  border: 1px solid var(--border); border-radius: 10px; color: var(--blue-700);
}
.volume-name { font-weight: 700; font-size: 15.5px; }
.volume-count { margin-inline-start: auto; font-size: 12.5px; font-weight: 700; color: var(--gold-dark); white-space: nowrap; }

/* فهرست دفترها (نوشتارهای هم‌مجموعه) */
.daftar-box { margin-top: 38px; }
.daftar-list {
  background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); margin: 0; padding: 26px 46px;
  columns: 2; column-gap: 44px; list-style-position: outside;
}
.daftar-list li { break-inside: avoid; padding: 7px 0; border-bottom: 1px dashed var(--border); }
.daftar-list li::marker { color: var(--gold-dark); font-weight: 700; }
.daftar-list a { font-size: 15.5px; font-weight: 600; color: var(--blue-800); }
.daftar-list a:hover { color: var(--gold-dark); }
@media (max-width: 700px) { .daftar-list { columns: 1; padding: 20px 34px; } }

/* Related */
.related { margin-top: 46px; }
.related .card-grid { grid-template-columns: repeat(4, 1fr); }

/* ---------- Search / 404 ---------- */
.search-hero { max-width: 620px; margin: 0 auto 34px; }
.error-404 { text-align: center; padding: 90px 0; }
.error-404 .code { font-size: 90px; font-weight: 800; color: var(--gold); line-height: 1; }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 30px; color: rgba(255, 255, 255, .8);
  background: linear-gradient(180deg, var(--blue-950), #04101a);
}
.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; padding: 54px 0 40px;
}
.site-footer h3 { color: var(--gold-soft); font-size: 16.5px; margin-bottom: 14px; }
.site-footer p { font-size: 14px; margin: 0; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.site-footer li a { color: rgba(255, 255, 255, .78); font-size: 14px; }
.site-footer li a:hover { color: var(--gold-soft); }
.footer-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.footer-brand .brand-mark { border-color: transparent; box-shadow: inset 0 0 0 1.5px rgba(200, 164, 92, .55); }
.footer-brand b { color: #fff; font-size: 19px; }
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, .1);
  padding: 18px 0; font-size: 13px; color: rgba(255, 255, 255, .55);
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.footer-bottom a { color: var(--gold-soft); }
.footer-bottom a:hover { color: var(--gold); }

/* ---------- دکمهٔ بازگشت به بالا ---------- */
.go-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 90;
  width: 46px; height: 46px; border: 0; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: linear-gradient(145deg, var(--blue-700), var(--blue-900));
  color: var(--gold-soft);
  box-shadow: inset 0 0 0 1.5px rgba(200, 164, 92, .45), 0 8px 24px -8px rgba(8, 50, 71, .45);
  opacity: 0; visibility: hidden; transform: translateY(14px);
  transition: opacity .25s ease, transform .25s ease, filter .15s ease;
}
.go-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.go-top:hover { filter: brightness(1.18); }
@media (max-width: 540px) { .go-top { right: 14px; bottom: 14px; width: 42px; height: 42px; } }

/* ---------- Responsive ---------- */
@media (max-width: 1020px) {
  .card-grid { grid-template-columns: repeat(3, 1fr); }
  .related .card-grid { grid-template-columns: repeat(2, 1fr); }
  .header-search { display: none; }
}
@media (max-width: 820px) {
  .topics { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .nav-toggle { display: block; }
  .main-nav {
    display: none; position: absolute; inset-inline: 0; top: 100%;
    background: var(--paper); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lg);
    padding: 12px 22px 18px;
  }
  body.nav-open .main-nav { display: block; }
  .main-nav ul { flex-direction: column; gap: 2px; }
  .main-nav a { border-radius: 10px; }
}
@media (max-width: 540px) {
  body { font-size: 15.5px; }
  .card-grid { grid-template-columns: 1fr; }
  .related .card-grid { grid-template-columns: 1fr; }
  .hero-inner { padding: 54px 0 48px; }
  .hero-search input[type=search] { padding: 15px 20px 15px 110px; font-size: 15px; }
  .hero-stats { gap: 22px; }
  .brand-tag { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* پشتیبانی مرورگرهای قدیمی‌تر (Safari < 15): جایگزین aspect-ratio */
@supports not (aspect-ratio: 1) {
  .card-media { position: relative; height: 0; padding-top: 62.5%; overflow: hidden; }
  .book-cover, .book-single-cover { position: relative; height: 0; padding-top: 133%; overflow: hidden; }
  .card-media img, .book-cover img, .book-single-cover img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
  .card-media.is-placeholder span, .book-cover.is-placeholder svg, .book-single-cover.is-placeholder svg {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  }
}

/* چاپ: فقط متن مقاله */
@media print {
  .site-header, .site-footer, .related, .daftar-box, .nav-toggle, .header-search,
  .hero-search, .alphabet-bar, .pagination, .fars-validate-tip { display: none !important; }
  body { background: #fff; font-size: 12pt; }
  .entry-content { box-shadow: none; border: 0; padding: 0; background: #fff; }
  .page-head { background: none; color: #000; }
  .page-head h1, .entry-title { color: #000; }
}
