/* ─────────────────────────────────────────────────────────
   Charsu magazine — editorial "warm paper & ink" system.
   Static, self-contained, RTL-first. No frameworks.
   ───────────────────────────────────────────────────────── */

@font-face { font-family: 'Vazirmatn'; src: url('fonts/Vazirmatn-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Vazirmatn'; src: url('fonts/Vazirmatn-Medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Vazirmatn'; src: url('fonts/Vazirmatn-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Vazirmatn'; src: url('fonts/Vazirmatn-Black.woff2') format('woff2'); font-weight: 900; font-display: swap; }

:root {
  --paper: #F6F1E7;
  --paper-deep: #EDE5D3;
  --paper-line: #DDD2BC;
  --ink: #221E1A;
  --ink-soft: #6F6656;
  --accent: #C63D1F;
  --accent-deep: #A93217;
  --teal: #1F6F6B;
  --gold: #B98A2F;
  --shadow: 0 1px 2px rgba(34, 30, 26, .06), 0 8px 24px -18px rgba(34, 30, 26, .4);
  --radius: 14px;
  --font: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.9;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  /* faint paper grain */
  background-image: radial-gradient(rgba(34,30,26,.028) 1px, transparent 1px);
  background-size: 22px 22px;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, h5 { margin: 0; line-height: 1.6; }
p { margin: 0; }
.container { max-width: 1080px; margin-inline: auto; padding-inline: 20px; }
.muted { color: var(--ink-soft); }
.hide-sm { display: initial; }

/* ── top bar ── */
.topbar { background: var(--ink); color: var(--paper); font-size: 12px; }
.topbar-in { display: flex; align-items: center; gap: 18px; min-height: 34px; }
.topbar-item { display: flex; align-items: center; gap: 7px; }
.topbar .muted { color: rgba(246, 241, 231, .62); }
.topbar b { color: var(--paper); font-weight: 700; }
.topbar .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(198, 61, 31, .25); }
.topbar-item:last-child { margin-inline-start: auto; }

/* ── masthead ── */
.masthead { background: var(--paper); }
.masthead-in { display: flex; align-items: center; justify-content: space-between; padding-block: 22px 16px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark { width: 52px; height: 52px; }
.brand-mark--sm { width: 40px; height: 40px; flex: none; }
.mark-bg { fill: var(--accent); }
.mark-star { fill: var(--paper); }
.mark-core { fill: var(--ink); }
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-size: 34px; font-weight: 900; letter-spacing: -.5px; line-height: 1.2; }
.brand-tag { font-size: 12.5px; color: var(--ink-soft); }
.masthead-side { display: flex; gap: 10px; align-items: center; }
.btn-solid, .btn-ghost {
  font-size: 13px; font-weight: 700; padding: 9px 18px; border-radius: 10px;
  border: 1.5px solid var(--ink); transition: transform .15s ease, box-shadow .15s ease;
}
.btn-solid { background: var(--ink); color: var(--paper); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-solid:hover, .btn-ghost:hover { transform: translateY(-1px); box-shadow: 0 3px 0 0 var(--accent); }

/* ── nav: double editorial rules ── */
.mainnav { border-block: 2px solid var(--ink); position: relative; }
.mainnav::after { content: ''; position: absolute; inset-inline: 0; bottom: -5px; border-bottom: 1px solid var(--ink); }
.mainnav-in { display: flex; align-items: center; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.mainnav-in::-webkit-scrollbar { display: none; }
.nav-flex { flex: 1; }
.nav-link {
  padding: 10px 13px; font-size: 14px; font-weight: 700; white-space: nowrap; position: relative;
}
.nav-link::after {
  content: ''; position: absolute; inset-inline: 13px; bottom: 6px; height: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: right; transition: transform .2s ease;
}
.nav-link:hover::after, .nav-link.is-active::after { transform: scaleX(1); }
.nav-link.is-active { color: var(--accent); }
.nav-link--quiet { font-weight: 500; color: var(--ink-soft); }

/* ── ticker ── */
.ticker { border-bottom: 1px solid var(--paper-line); background: var(--paper-deep); }
.ticker-in { display: flex; align-items: center; gap: 0; min-height: 38px; }
.ticker-label {
  flex: none; background: var(--accent); color: var(--paper); font-size: 11.5px; font-weight: 900;
  padding: 3px 12px; border-radius: 7px; margin-inline-end: 14px;
}
.ticker-window { overflow: hidden; flex: 1; mask-image: linear-gradient(to left, transparent, #000 6%, #000 94%, transparent); -webkit-mask-image: linear-gradient(to left, transparent, #000 6%, #000 94%, transparent); }
.ticker-track { display: inline-flex; align-items: center; gap: 26px; white-space: nowrap; font-size: 13px; color: var(--ink-soft); animation: tick 46s linear infinite; }
.ticker-track i { color: var(--accent); font-size: 8px; font-style: normal; }
.ticker-window:hover .ticker-track { animation-play-state: paused; }
@keyframes tick { from { transform: translateX(0); } to { transform: translateX(50%); } }

/* ── hero ── */
.hero { display: grid; grid-template-columns: 1.85fr 1fr; gap: 22px; margin-block: 26px 8px; }
.feature {
  display: flex; flex-direction: column; background: #fff; border: 1.5px solid var(--ink);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.feature:hover { transform: translateY(-3px); box-shadow: 7px 7px 0 0 var(--accent); }
.feature-art { position: relative; aspect-ratio: 16 / 8.6; overflow: hidden; }
.feature-art svg, .mini-art svg, .card-art svg { display: block; width: 100%; height: 100%; }
.feature-body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 10px; }
.feature-body h1 { font-size: clamp(21px, 2.6vw, 29px); font-weight: 900; line-height: 1.75; }
.feature-body p { color: var(--ink-soft); font-size: 14.5px; }
.meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-soft); }
.meta-author { color: var(--accent); font-weight: 700; }
.meta-dot { opacity: .5; }

.hero-side { display: flex; flex-direction: column; gap: 22px; }
.mini {
  flex: 1; display: flex; flex-direction: column; background: #fff; border: 1.5px solid var(--ink);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.mini:hover { transform: translateY(-3px); box-shadow: 5px 5px 0 0 var(--teal); }
.mini-art { aspect-ratio: 16 / 7; }
.mini-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.mini-body h3 { font-size: 15.5px; font-weight: 700; line-height: 1.8; }

/* ── chips ── */
.chip {
  align-self: flex-start; font-size: 11px; font-weight: 900; padding: 2.5px 10px; border-radius: 7px;
  background: var(--ink); color: var(--paper); letter-spacing: .2px;
}
.feature-art .chip { position: absolute; top: 12px; right: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.chip--city { background: var(--accent); }
.chip--tech { background: var(--teal); }
.chip--econ { background: var(--gold); }
.chip--culture { background: #8E4A5B; }
.chip--life { background: #8A5A44; }
.chip--travel { background: #5C8A64; }

/* ── layout: content + sidebar ── */
.layout { display: grid; grid-template-columns: 1fr 300px; gap: 26px; align-items: start; margin-top: 30px; }
.section-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.section-head h2 { font-size: 20px; font-weight: 900; }
.section-head .rule { flex: 1; border-top: 2px solid var(--ink); position: relative; top: 1px; }
.section-head .more { font-size: 13px; font-weight: 700; color: var(--accent); }
.section-head .more:hover { text-decoration: underline; }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.card {
  display: flex; flex-direction: column; background: #fff; border: 1.5px solid var(--ink);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 5px 5px 0 0 var(--ink); }
.card-art { aspect-ratio: 16 / 9; }
.card-body { padding: 13px 15px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-body h3 { font-size: 14.5px; font-weight: 700; line-height: 1.8; }
.card-body p { font-size: 12.5px; color: var(--ink-soft); }
.card-body .meta { margin-top: auto; }

/* ── sidebar ── */
.sidebar { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 16px; }
.side-box { background: #fff; border: 1.5px solid var(--ink); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.side-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.side-head::after { content: ''; flex: 1; border-top: 1px dashed var(--paper-line); }
.side-head h4 { font-size: 14.5px; font-weight: 900; }
.toplist { margin: 0; padding: 0; list-style: none; counter-reset: top; }
.toplist li { counter-increment: top; display: flex; gap: 12px; align-items: baseline; padding-block: 9px; border-bottom: 1px dashed var(--paper-line); }
.toplist li:last-child { border-bottom: 0; }
.toplist li::before {
  content: counter(top, persian); font-size: 19px; font-weight: 900; color: var(--accent); min-width: 20px; text-align: center;
}
.toplist a { font-size: 13px; font-weight: 500; line-height: 1.8; }
.toplist a:hover { color: var(--accent); }
.side-box--news { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.side-box--news .side-head h4 { color: var(--paper); }
.side-box--news p { font-size: 12.5px; color: rgba(246,241,231,.72); margin-bottom: 12px; }
.news-form { display: flex; gap: 8px; }
.news-form input {
  flex: 1; min-width: 0; background: rgba(246,241,231,.12); border: 1px solid rgba(246,241,231,.35);
  border-radius: 9px; padding: 8px 12px; color: var(--paper); font-family: var(--font); font-size: 13px;
}
.news-form input::placeholder { color: rgba(246,241,231,.45); }
.news-form input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.news-form button {
  background: var(--accent); border: 0; color: #fff; font-family: var(--font); font-weight: 700;
  font-size: 13px; padding: 8px 16px; border-radius: 9px; cursor: pointer;
}
.news-form button:hover { background: var(--accent-deep); }
.news-note { display: block; margin-top: 10px; font-size: 12.5px; color: #E4B33C; }

/* ── dossier band ── */
.dossier {
  margin-block: 40px 26px; background: var(--ink); color: var(--paper);
  border-radius: 18px; overflow: hidden; position: relative;
}
.dossier::before {
  content: ''; position: absolute; inset: 0; opacity: .12; pointer-events: none;
  background-image: repeating-linear-gradient(-45deg, transparent 0 26px, var(--paper) 26px 27px);
}
.dossier-in { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 30px; padding: 34px 36px; align-items: center; }
.dossier-kicker { display: inline-block; background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 900; padding: 3px 12px; border-radius: 7px; margin-bottom: 12px; }
.dossier-text h2 { font-size: 30px; font-weight: 900; margin-bottom: 10px; }
.dossier-text p { font-size: 13.5px; color: rgba(246,241,231,.75); margin-bottom: 14px; }
.dossier-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.dossier-list a { font-size: 13.5px; font-weight: 700; color: var(--paper); }
.dossier-list a::before { content: '← '; color: var(--accent); }
.dossier-list a:hover { color: #E4B33C; }
.sponsor-frame {
  border: 1.5px dashed rgba(246,241,231,.5); border-radius: 14px; padding: 22px 18px 12px; position: relative;
}
.sponsor-label {
  position: absolute; top: -11px; right: 18px; background: var(--ink); padding-inline: 10px;
  font-size: 12px; font-weight: 700; color: rgba(246,241,231,.85);
}
.sponsor-note { display: block; margin-top: 8px; font-size: 10.5px; color: rgba(246,241,231,.45); text-align: center; }

/* ── ad units ── */
.ad-unit { position: relative; }
/* thin editorial caption above standalone units */
.ad-billboard, .ad-strip, .ad-side, .ad-article {
  margin-block: 18px;
}
.ad-billboard::before, .ad-strip::before, .ad-side::before, .ad-article::before {
  content: 'آگــهــی'; display: flex; align-items: center; gap: 10px; justify-content: center;
  font-size: 10px; letter-spacing: 2px; color: var(--ink-soft); opacity: .75; margin-bottom: 5px;
}
.ad-billboard { height: 120px; max-width: 940px; margin-inline: auto; }
.ad-strip { height: 90px; max-width: 940px; margin-inline: auto; margin-block: 34px 30px; }
.ad-side { width: 100%; height: 250px; margin-block: 0; }
.ad-article { height: 110px; max-width: 680px; margin-inline: auto; }
.ad-promo { height: 120px; }
.ad-sticky { height: 72px; }
/* the caption sits above the box; the fill area is the unit itself */
.ad-billboard, .ad-strip, .ad-side, .ad-article { box-sizing: content-box; padding-top: 0; }

/* native card slot mimics an article card exactly */
.card--ad { min-height: 356px; border-style: solid; }

/* ── house-ad placeholder (injected by site.js when a slot stays empty) ── */
.ad-house {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; text-align: center; border: 1.5px solid var(--ink); border-radius: 12px; overflow: hidden;
  background:
    linear-gradient(rgba(246,241,231,.94), rgba(246,241,231,.94)),
    repeating-linear-gradient(-45deg, var(--paper-deep) 0 14px, var(--paper) 14px 28px);
}
.card--ad .ad-house { position: absolute; inset: 0; border: 0; border-radius: var(--radius); }
.ad-house svg { width: 30px; height: 30px; }
.ad-house b { font-size: 13.5px; font-weight: 900; }
.ad-house span { font-size: 11px; color: var(--ink-soft); }
.ad-house a { font-size: 11px; font-weight: 700; color: var(--accent); border-bottom: 1px dashed var(--accent); }
.ad-house--sm b { font-size: 12px; }
.ad-house--sm svg { width: 22px; height: 22px; }

/* ── footer ── */
.footer { margin-top: 44px; background: var(--paper-deep); border-top: 2px solid var(--ink); }
.footer-in { display: grid; grid-template-columns: 1.2fr 2fr; gap: 30px; padding-block: 30px 18px; }
.footer-brand { display: flex; gap: 14px; align-items: flex-start; }
.footer-brand b { font-size: 18px; font-weight: 900; }
.footer-brand p { font-size: 12.5px; color: var(--ink-soft); margin-top: 6px; max-width: 300px; }
.footer-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.footer-cols h5 { font-size: 13.5px; font-weight: 900; margin-bottom: 10px; }
.footer-cols a { display: block; font-size: 12.5px; color: var(--ink-soft); padding-block: 3.5px; }
.footer-cols a:hover { color: var(--accent); }
.footer-base {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border-top: 1px dashed var(--paper-line); padding-block: 14px; font-size: 12px; color: var(--ink-soft);
}

/* ── mobile sticky ad ── */
.sticky-ad {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 60; background: var(--paper);
  border-top: 1.5px solid var(--ink); padding: 6px 44px 6px 8px; box-shadow: 0 -8px 24px rgba(34,30,26,.14);
}
.sticky-close {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--ink);
  background: var(--paper); color: var(--ink); font-size: 12px; cursor: pointer;
}
@media (min-width: 769px) { .sticky-ad { display: none !important; } }

/* ── article page ── */
.progress { position: fixed; top: 0; inset-inline: 0; height: 3px; z-index: 80; background: transparent; }
.progress b { display: block; height: 100%; width: 0; background: var(--accent); transition: width .1s linear; }
.article-head { max-width: 760px; margin: 30px auto 0; text-align: center; padding-inline: 20px; }
.article-head .chip { align-self: center; }
.article-head h1 { font-size: clamp(24px, 3.4vw, 36px); font-weight: 900; line-height: 1.75; margin-block: 14px 10px; }
.article-head .lede { font-size: 15.5px; color: var(--ink-soft); max-width: 620px; margin-inline: auto; }
.article-head .meta { justify-content: center; margin-top: 16px; }
.article-cover { max-width: 860px; margin: 26px auto 0; padding-inline: 20px; }
.article-cover figure { margin: 0; border: 1.5px solid var(--ink); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
.article-cover svg { display: block; width: 100%; height: auto; }
.article-cover figcaption { font-size: 11.5px; color: var(--ink-soft); text-align: center; padding: 8px; background: #fff; border-top: 1px dashed var(--paper-line); }

.article-layout { display: grid; grid-template-columns: 1fr 300px; gap: 34px; max-width: 1080px; margin: 30px auto 0; padding-inline: 20px; align-items: start; }
.prose { max-width: 680px; font-size: 15.5px; line-height: 2.15; }
.prose p { margin-block: 0 18px; }
.prose h2 { font-size: 20px; font-weight: 900; margin-block: 30px 12px; display: flex; align-items: center; gap: 12px; }
.prose h2::after { content: ''; flex: 1; border-top: 1.5px solid var(--paper-line); }
.pull {
  margin: 26px 0; padding: 18px 22px; border-inline-start: 4px solid var(--accent);
  background: #fff; border-radius: 0 12px 12px 0; font-size: 17px; font-weight: 700; line-height: 2;
}
.pull small { display: block; margin-top: 6px; font-size: 12px; color: var(--ink-soft); font-weight: 500; }
.factbox { background: #fff; border: 1.5px solid var(--ink); border-radius: 14px; padding: 16px 20px; margin: 24px 0; }
.factbox h4 { font-size: 14px; font-weight: 900; margin-bottom: 8px; color: var(--accent); }
.factbox ul { margin: 0; padding-inline-start: 18px; font-size: 13.5px; }
.factbox li { margin-block: 4px; }
.author-box { display: flex; gap: 14px; align-items: center; background: var(--paper-deep); border-radius: 14px; padding: 14px 18px; margin-top: 30px; }
.author-avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--teal); color: var(--paper); display: grid; place-items: center; font-weight: 900; font-size: 19px; flex: none; }
.author-box b { font-size: 14px; }
.author-box p { font-size: 12.5px; color: var(--ink-soft); }
.tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 22px; }
.tags a { font-size: 12px; font-weight: 700; border: 1px solid var(--paper-line); background: #fff; border-radius: 8px; padding: 4px 12px; color: var(--ink-soft); }
.tags a:hover { border-color: var(--accent); color: var(--accent); }
.ad-tall { width: 300px; height: 600px; }
.related { max-width: 1080px; margin: 40px auto 0; padding-inline: 20px; }

/* ── slot inspector (debug) ── */
.snbk-chip {
  position: fixed; bottom: 14px; left: 14px; z-index: 90; display: flex; align-items: center; gap: 8px;
  background: var(--ink); color: var(--paper); border: 0; border-radius: 999px; padding: 8px 14px;
  font-family: var(--font); font-size: 12px; font-weight: 700; cursor: pointer; box-shadow: 0 6px 20px rgba(34,30,26,.3);
}
.snbk-chip .led { width: 8px; height: 8px; border-radius: 50%; background: #E4B33C; }
.snbk-chip.is-on .led { background: #4CAF7D; }
.snbk-panel {
  position: fixed; bottom: 58px; left: 14px; z-index: 90; width: 300px; max-height: 60vh; overflow: auto;
  background: var(--ink); color: var(--paper); border-radius: 14px; padding: 14px 16px;
  font-size: 12px; box-shadow: 0 14px 40px rgba(34,30,26,.4);
}
.snbk-panel h5 { font-size: 13px; font-weight: 900; margin-bottom: 4px; }
.snbk-panel .snbk-sub { color: rgba(246,241,231,.55); font-size: 11px; margin-bottom: 10px; }
.snbk-row {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: start;
  background: rgba(246,241,231,.07); border: 0; border-radius: 9px; padding: 7px 10px; margin-block: 4px;
  color: var(--paper); font-family: var(--font); font-size: 11.5px; cursor: pointer;
}
.snbk-row:hover { background: rgba(246,241,231,.14); }
.snbk-row .st { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.st--filled { background: #4CAF7D; }
.st--empty { background: #E4B33C; }
.st--nocode { background: #E05252; }
.snbk-row code { font-family: ui-monospace, monospace; font-size: 10.5px; color: rgba(246,241,231,.6); margin-inline-start: auto; direction: ltr; }
.snbk-debug-outline { outline: 2px dashed var(--accent) !important; outline-offset: 3px; }
.snbk-debug-tag {
  position: absolute; top: -10px; right: 10px; z-index: 5; background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 6px; direction: ltr;
}
.snbk-flash { animation: snbkflash 1.2s ease 2; }
@keyframes snbkflash { 50% { outline-color: #E4B33C; } }

/* ── responsive ── */
@media (max-width: 1024px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .dossier-in { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .article-layout { grid-template-columns: 1fr; }
  .article-side { display: none; }
}
@media (max-width: 768px) {
  .hero { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .brand-name { font-size: 27px; }
  .brand-mark { width: 44px; height: 44px; }
  .footer-in { grid-template-columns: 1fr; }
  .ad-billboard { height: 100px; }
  body { padding-bottom: 92px; } /* room for the sticky unit */
  /* keep the inspector clear of the sticky ad */
  .snbk-chip { bottom: 104px; }
  .snbk-panel { bottom: 148px; }
}
@media (max-width: 560px) {
  .cards { grid-template-columns: 1fr; }
  .mini-art { aspect-ratio: 16 / 6; }
  .dossier-in { padding: 24px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
