/*
Theme Name: SwapNet Blog
Theme URI: https://swapnet.co
Author: SwapNet
Author URI: https://swapnet.co
Description: Brand theme for the SwapNet magazine — violet accent, RTL Persian, IRANYekanX + Modam. Headless-quality design rendered natively by WordPress.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 8.0
License: GNU General Public License v2 or later
Text Domain: swapnet
*/

/* ================= Fonts (local, self-contained) ================= */
@font-face { font-family: "IRANYekanX"; src: url("assets/fonts/IRANYekanX/IRANYekanX-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IRANYekanX"; src: url("assets/fonts/IRANYekanX/IRANYekanX-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "IRANYekanX"; src: url("assets/fonts/IRANYekanX/IRANYekanX-DemiBold.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "IRANYekanX"; src: url("assets/fonts/IRANYekanX/IRANYekanX-Bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "IRANYekanX"; src: url("assets/fonts/IRANYekanX/IRANYekanX-Black.woff2") format("woff2"); font-weight: 900; font-style: normal; font-display: swap; }
@font-face { font-family: "ModamVF"; src: url("assets/fonts/ModamVF.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }

/* ================= Tokens ================= */
:root {
  --color-primary: #8670ff;
  --color-primary-light: #a899ff;
  --color-primary-dark: #543bdf;
  --color-primary-muted: rgb(134 112 255 / 0.12);
  --color-text: #17181d;
  --color-text-muted: rgb(23 24 29 / 0.8);
  --color-text-subtle: rgb(23 24 29 / 0.62);
  --color-bg: #ffffff;
  --color-bg-muted: #f5f5f5;
  --color-bg-subtle: #f7f7f7;
  --color-bg-chip: #f1f1f1;
  --color-border: rgb(0 0 0 / 0.08);
  --color-border-strong: rgb(0 0 0 / 0.12);
  --color-lavender: #f9f8ff;
  --color-success: #13bf58;
  --radius-button: 12px;
  --radius-card: 16px;
  --radius-feature: 20px;
  --radius-full: 9999px;
  --gradient-hero: radial-gradient(90.34% 121.7% at 50% -4.4%, #9a88ff 0%, #543bdf 100%);
  --gradient-primary: radial-gradient(94.44% 535.91% at 1.59% 2.5%, #a899ff 0%, #8670ff 100%);
  --maxw: 1200px;
}

/* ================= Reset / base ================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "IRANYekanX", "Vazirmatn", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.85;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--color-primary-dark); }
h1, h2, h3, h4 { font-family: "ModamVF", "IRANYekanX", "Vazirmatn", sans-serif; line-height: 1.4; color: var(--color-text); }
.container { max-width: var(--maxw); margin-inline: auto; padding-inline: 1.5rem; }

/* ================= Header ================= */
.site-header {
  position: sticky; top: 0; z-index: 40; background: var(--color-bg-muted);
}
.site-header .bar { display: flex; align-items: center; justify-content: space-between; height: 70px; }
.brand { display: flex; align-items: center; gap: 8px; font-family: "ModamVF", "IRANYekanX"; font-weight: 700; font-size: 20px; color: var(--color-text); }
.brand img { width: 34px; height: 34px; border-radius: 9px; flex: none; }
.nav { display: flex; align-items: center; gap: 28px; }
.nav a { font-weight: 400; color: var(--color-text-muted); font-size: 15px; }
.nav a:hover { color: var(--color-primary); }
.nav a.active { color: var(--color-primary); font-weight: 500; }
.header-actions { display: flex; align-items: center; gap: 16px; }
.header-download { display: inline-flex; align-items: center; font-weight: 500; font-size: 14px; color: var(--color-text); }
.header-download:hover { color: var(--color-primary); }
.header-login { display: inline-flex; align-items: center; height: 44px; padding: 0 22px; border-radius: var(--radius-button); font-weight: 600; font-size: 14px; background: var(--color-text); color: #fff; }
.header-login:hover { color: #fff; opacity: .9; }
.menu-toggle { display: none; background: none; border: 0; cursor: pointer; padding: 6px; }
.menu-toggle span { display: block; width: 22px; height: 2px; background: var(--color-text); margin: 5px 0; border-radius: 2px; }
@media (max-width: 900px) { .nav, .header-download.desktop, .header-login.desktop { display: none; } .menu-toggle { display: block; } }

/* Mobile drawer */
.mobile-drawer { display: none; padding: 12px 0 20px; border-top: 1px solid var(--color-border); }
.mobile-drawer.open { display: block; }
.mobile-drawer a { display: block; padding: 12px 4px; font-weight: 500; color: var(--color-text-muted); border-bottom: 1px solid var(--color-border); }
.mobile-drawer a.drawer-login { margin-top: 14px; text-align: center; background: var(--color-text); color: #fff; border: 0; border-radius: var(--radius-button); padding: 14px; }

/* ================= Hero ================= */
.hero { position: relative; background: var(--gradient-hero); color: #fff; padding: 64px 0 96px; text-align: center; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgb(255 255 255 / 0.12) 1px, transparent 1px); background-size: 26px 26px; opacity: 0.5; }
.hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 60px; background: var(--color-bg); border-radius: 50% 50% 0 0 / 100% 100% 0 0; }
.hero .inner { position: relative; z-index: 2; }
.hero .eyebrow { display: inline-flex; align-items: center; gap: 8px; background: rgb(255 255 255 / 0.15); border: 1px solid rgb(255 255 255 / 0.25); padding: 6px 16px; border-radius: var(--radius-full); font-size: 13px; font-weight: 500; margin-bottom: 18px; }
.hero .eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: #fff; }
.hero h1 { font-size: clamp(30px, 5vw, 46px); font-weight: 800; margin: 0 0 14px; color: #fff; }
.hero p { max-width: 640px; margin: 0 auto; color: rgb(255 255 255 / 0.9); font-size: 16px; line-height: 1.9; }

/* Search + chips */
.searchrow { display: flex; gap: 10px; max-width: 560px; margin: 26px auto 0; }
.searchrow input { flex: 1; border: 1px solid rgb(255 255 255 / 0.35); background: rgb(255 255 255 / 0.15); color: #fff; border-radius: var(--radius-button); padding: 12px 16px; font-family: inherit; font-size: 15px; }
.searchrow input::placeholder { color: rgb(255 255 255 / 0.75); }
.searchrow button { background: #fff; color: var(--color-primary-dark); border: 0; border-radius: var(--radius-button); padding: 0 22px; font-family: inherit; font-weight: 700; cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 20px; }
.chips a { background: rgb(255 255 255 / 0.16); border: 1px solid rgb(255 255 255 / 0.22); color: #fff; padding: 7px 16px; border-radius: var(--radius-full); font-size: 13px; font-weight: 500; }
.chips a:hover { background: #fff; color: var(--color-primary-dark); }

/* Page header (archives) */
.page-hero { background: var(--gradient-hero); color: #fff; padding: 56px 0 84px; text-align: center; position: relative; overflow: hidden; }
.page-hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 50px; background: var(--color-bg); border-radius: 50% 50% 0 0 / 100% 100% 0 0; }
.page-hero h1 { position: relative; z-index: 2; font-size: clamp(26px, 4vw, 38px); color: #fff; margin: 0 0 8px; }
.page-hero p { position: relative; z-index: 2; color: rgb(255 255 255 / 0.85); margin: 0; }

/* ================= Layout: content + sidebar ================= */
.layout { display: grid; grid-template-columns: 1fr 320px; gap: 40px; padding: 44px 0 64px; align-items: start; }
@media (max-width: 960px) { .layout { grid-template-columns: 1fr; } }

/* ================= Cards ================= */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; } }
.card { background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius-card); overflow: hidden; transition: transform .2s, box-shadow .2s; display: flex; flex-direction: column; }
.card:hover { transform: translateY(-3px); box-shadow: 0 16px 40px rgb(84 59 223 / 0.12); }
.card .thumb { aspect-ratio: 16 / 9; background: var(--color-lavender); overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.card:hover .thumb img { transform: scale(1.04); }
.card .body { padding: 18px 20px 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card .meta-top { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--color-text-subtle); }
.chip { display: inline-block; background: var(--color-primary-muted); color: var(--color-primary-dark); padding: 4px 12px; border-radius: var(--radius-full); font-size: 12px; font-weight: 600; }
.card h3 { font-size: 18px; font-weight: 700; margin: 0; line-height: 1.55; }
.card h3 a:hover { color: var(--color-primary-dark); }
.card .excerpt { font-size: 14px; color: var(--color-text-subtle); margin: 0; line-height: 1.8; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta-bottom { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--color-text-subtle); margin-top: auto; padding-top: 6px; }

/* Featured (first) card spans full width */
.featured-card { grid-column: 1 / -1; }
.featured-card .thumb { aspect-ratio: 21 / 8; }
.featured-card h3 { font-size: 24px; }

/* ================= Sidebar ================= */
.sidebar > * + * { margin-top: 28px; }
.widget { background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius-card); padding: 22px; }
.widget h4 { margin: 0 0 16px; font-size: 16px; font-weight: 700; }
.popular-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--color-border); }
.popular-item:last-child { border-bottom: 0; }
.popular-item .rank { flex: none; width: 26px; height: 26px; border-radius: 8px; background: var(--color-primary-muted); color: var(--color-primary-dark); font-weight: 800; font-size: 13px; display: grid; place-items: center; }
.popular-item a { font-size: 14px; font-weight: 600; line-height: 1.6; }
.popular-item a:hover { color: var(--color-primary-dark); }
.newsletter { background: var(--gradient-hero); color: #fff; border: 0; }
.newsletter h4 { color: #fff; }
.newsletter p { font-size: 13px; color: rgb(255 255 255 / 0.9); margin: 0 0 14px; line-height: 1.8; }
.newsletter .btn-white { display: block; text-align: center; background: #fff; color: var(--color-primary-dark); padding: 11px; border-radius: var(--radius-button); font-weight: 700; }

/* ================= Single post ================= */
.breadcrumb { font-size: 13px; color: var(--color-text-subtle); padding: 22px 0 4px; display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumb a:hover { color: var(--color-primary); }
.article-head { padding: 8px 0 22px; }
.article-head .meta-top { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--color-text-subtle); margin-bottom: 14px; }
.article-head h1 { font-size: clamp(26px, 4vw, 38px); font-weight: 800; margin: 0 0 16px; line-height: 1.5; }
.article-head .byline { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--color-text-subtle); }
.article-head .byline img { width: 38px; height: 38px; border-radius: 50%; }
.article-hero-img { border-radius: var(--radius-feature); overflow: hidden; margin: 8px 0 30px; aspect-ratio: 16 / 9; background: var(--color-lavender); }
.article-hero-img img { width: 100%; height: 100%; object-fit: cover; }

.prose { font-size: 17px; line-height: 2.05; color: var(--color-text); }
.prose > * + * { margin-top: 1.15em; }
.prose h2 { font-size: 24px; font-weight: 700; margin-top: 1.8em; margin-bottom: .2em; }
.prose h3 { font-size: 20px; font-weight: 700; margin-top: 1.5em; }
.prose p { margin: 0; }
.prose a { color: var(--color-primary-dark); font-weight: 600; border-bottom: 1px solid var(--color-primary-muted); }
.prose a:hover { border-color: var(--color-primary); }
.prose strong { font-weight: 700; }
.prose ul, .prose ol { padding-inline-start: 1.4em; }
.prose li { margin: .4em 0; }
.prose img { border-radius: var(--radius-card); margin: 1.4em 0; }
.prose blockquote { border-inline-start: 4px solid var(--color-primary); background: var(--color-lavender); padding: 12px 18px; border-radius: 0 var(--radius-card) var(--radius-card) 0; color: var(--color-text-muted); }
.prose audio { width: 100%; margin: 1.2em 0; }
.prose iframe { width: 100%; aspect-ratio: 16/9; border: 0; border-radius: var(--radius-card); margin: 1.2em 0; }

/* Share + tags */
.share { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 34px 0; padding-top: 22px; border-top: 1px solid var(--color-border); }
.share .label { font-weight: 600; font-size: 14px; }
.share a { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--color-border-strong); padding: 7px 15px; border-radius: var(--radius-full); font-size: 13px; font-weight: 600; }
.share a:hover { border-color: var(--color-primary); color: var(--color-primary-dark); }
.post-tags { display: flex; gap: 8px; flex-wrap: wrap; margin: 20px 0; }
.post-tags a { background: var(--color-bg-chip); padding: 5px 14px; border-radius: var(--radius-full); font-size: 13px; color: var(--color-text-muted); }
.post-tags a:hover { background: var(--color-primary-muted); color: var(--color-primary-dark); }

/* Related */
.related { margin: 44px 0; }
.related h3 { font-size: 22px; margin: 0 0 20px; }

/* ================= Pagination ================= */
.pagination { display: flex; justify-content: center; gap: 8px; margin: 40px 0; }
.pagination a, .pagination span { min-width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--radius-button); border: 1px solid var(--color-border); font-weight: 600; font-size: 14px; padding: 0 12px; }
.pagination a:hover { border-color: var(--color-primary); color: var(--color-primary-dark); }
.pagination .current { background: var(--gradient-primary); color: #fff; border-color: transparent; }

/* ================= Footer ================= */
.site-footer { background: var(--color-bg-muted); margin-top: 40px; }

/* Gradient "about" band with curved top + circular logo (mirrors swapnet.app) */
.footer-band {
  position: relative; overflow: hidden; background: var(--gradient-hero); color: #fff;
  text-align: center; padding: 70px 24px 84px; margin-bottom: 56px;
}
.footer-band::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgb(255 255 255 / 0.12) 1px, transparent 1px);
  background-size: 26px 26px; opacity: 0.5; pointer-events: none;
}
/* concave white cap at the top edge */
.footer-band-cap {
  position: absolute; top: -1px; left: 0; right: 0; height: 56px; z-index: 2;
  background: var(--color-bg-muted); border-radius: 0 0 50% 50% / 0 0 100% 100%;
}
.footer-logo-badge {
  position: relative; z-index: 3; width: 80px; height: 80px; margin: 8px auto 22px;
  border-radius: var(--radius-full); background: #fff; display: grid; place-items: center;
  box-shadow: 0 16px 48px -8px #644FD6;
}
.footer-logo-badge img { width: 48px; height: 48px; border-radius: 12px; }
.footer-about { position: relative; z-index: 3; max-width: 640px; margin-inline: auto; display: flex; flex-direction: column; gap: 16px; }
.footer-about p { margin: 0; font-size: 15px; line-height: 2; opacity: 0.72; }

/* Column grid */
.footer-grid { display: grid; grid-template-columns: minmax(auto,186px) minmax(auto,220px) minmax(auto,240px) minmax(auto,280px); gap: 28px; justify-content: space-between; padding-bottom: 40px; }
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; row-gap: 40px; } }
@media (max-width: 560px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-col h2 { font-family: "ModamVF", "IRANYekanX"; font-size: 18px; font-weight: 600; margin: 0 0 22px; color: var(--color-text); }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.footer-col li { font-size: 14px; color: var(--color-text); }
.footer-col a:hover { color: var(--color-primary); }
.footer-col.contact li { opacity: 0.7; }
.footer-col.downloads a { display: inline-flex; align-items: center; gap: 10px; }
.footer-col.downloads img { width: 24px; height: 24px; border-radius: 6px; }
.footer-col.namad .badges { display: flex; gap: 12px; flex-wrap: wrap; }
.footer-col.namad .badges img { height: 64px; width: auto; }
.site-footer .bottom { border-top: 1px solid var(--color-border); padding: 22px 0; text-align: center; font-size: 13px; color: var(--color-text-subtle); }

/* Single article column */
.article-wrap { max-width: 780px; margin-inline: auto; }
.article-wrap .related .grid { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 700px) { .article-wrap .related .grid { grid-template-columns: 1fr; } }

/* Inline CTA rendered from data-embed shortcodes */
.swapnet-embed-cta { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; background: var(--gradient-hero); color: #fff; border-radius: var(--radius-feature); padding: 22px 24px; margin: 1.6em 0; }
.swapnet-embed-cta .t { font-family: "ModamVF", "IRANYekanX"; font-weight: 700; font-size: 18px; }
.swapnet-embed-cta a { background: #fff; color: var(--color-primary-dark); padding: 11px 22px; border-radius: var(--radius-button); font-weight: 700; white-space: nowrap; }

/* Utility */
.section-title { font-size: 22px; font-weight: 800; margin: 0 0 20px; }
.reading-time::before { content: "⏱ "; }
.post-tags a[rel="tag"] { background: var(--color-bg-chip); padding: 5px 14px; border-radius: var(--radius-full); font-size: 13px; color: var(--color-text-muted); }
