/*
Theme Name: Persian Editorial
Description: A responsive, right-to-left magazine theme for WordPress posts, guides and topic archives.
Version: 1.0.1
Requires at least: 6.5
Requires PHP: 7.4
Text Domain: persian-editorial
*/

@font-face {
  font-family: "Editorial Vazirmatn";
  src: url("assets/vazirmatn-arabic.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0600-06FF,U+0750-077F,U+0870-089F,U+08A0-08FF,U+200C-200F,U+FB50-FDFF,U+FE70-FEFF;
}
@font-face {
  font-family: "Editorial Vazirmatn";
  src: url("assets/vazirmatn-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

:root {
  --ink: #23282a;
  --muted: #555d60;
  --paper: #fbf8f2;
  --surface: #fffdfa;
  --line: #ded8cf;
  --brand: #785044;
  --accent: #f0dfd6;
  --night: #252725;
  --shell: 76rem;
  --gutter: clamp(1rem, 3.8vw, 3.75rem);
  --font: "Editorial Vazirmatn", Tahoma, Arial, sans-serif;
  --radius: 1rem;
}
.ed-ziba { --brand: #873e4f; --accent: #f4e0e0; --night: #35252a; }
.ed-ghanoon { --brand: #665027; --accent: #efe7d2; --night: #292b24; }
.ed-vakil { --brand: #3b5068; --accent: #e2e8ee; --night: #263345; }
.ed-ravan { --brand: #3a624e; --accent: #e1ece0; --night: #283932; }
.ed-hamsar { --brand: #843f52; --accent: #f2e3e5; --night: #392932; }
.ed-khodro { --brand: #38536a; --accent: #dde8ed; --night: #222f38; }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-block-start: 1.4rem; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.85 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p, figure { margin: 0; }
h1, h2, h3, h4 { font-family: var(--font); line-height: 1.45; }
p + p { margin-block-start: .9em; }
ul, ol { margin-block: 0; padding-inline-start: 1.4em; }
a { color: inherit; text-decoration-thickness: .075em; text-underline-offset: .22em; }
img { display: block; max-width: 100%; height: auto; }
input, button, select, textarea { font: inherit; }
button, summary { cursor: pointer; }
svg { inline-size: 1.15em; block-size: 1.15em; flex: none; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; }
[id] { scroll-margin-block-start: 1rem; }
.ed-wrap { width: min(var(--shell), calc(100% - var(--gutter) * 2)); margin-inline: auto; }
.screen-reader-text {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.screen-reader-text:focus {
  position: fixed;
  inset-block-start: 1rem;
  inset-inline-start: 1rem;
  z-index: 99999;
  inline-size: auto;
  block-size: auto;
  clip-path: none;
  padding: .6rem 1rem;
  color: var(--ink);
  background: var(--surface);
}
.ed-button, .ed-search button, .ed-comments .submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  padding: .62rem 1rem;
  min-height: 2.85rem;
  border: 1px solid var(--brand);
  border-radius: .55rem;
  background: var(--brand);
  color: white;
  font-weight: 750;
  text-decoration: none;
}
.ed-button:hover, .ed-search button:hover, .ed-comments .submit:hover { filter: brightness(.9); }
.ed-button--quiet { background: transparent; color: var(--brand); border-color: var(--brand); }
.ed-link { color: var(--brand); font-weight: 750; }

.ed-header { background: var(--surface); border-block-start: .32rem solid var(--brand); }
.ed-masthead { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; min-height: 6.25rem; }
.ed-brand { display: inline-flex; gap: .8rem; align-items: center; text-decoration: none; }
.ed-brand-mark {
  display: grid;
  place-items: center;
  inline-size: 3.25rem;
  block-size: 3.25rem;
  flex: none;
  border: 1px solid var(--line);
  border-radius: .8rem;
  background: var(--accent);
  color: var(--brand);
  font-size: 1.4rem;
  font-weight: 900;
}
.ed-brand-mark img { width: 100%; }
.ed-brand-mark svg { width: 1.55rem; height: 1.55rem; }
.ed-brand-name { display: block; font-size: clamp(1.25rem, 3vw, 1.65rem); font-weight: 900; line-height: 1.35; }
.ed-brand-description { display: block; font-size: .79rem; color: var(--muted); line-height: 1.6; margin-block-start: .22rem; }
.ed-mast-search { width: min(100%, 19rem); }
.ed-search { display: flex; align-items: stretch; gap: .45rem; }
.ed-search label { flex: 1; min-inline-size: 0; }
.ed-search input {
  inline-size: 100%;
  block-size: 100%;
  min-block-size: 2.85rem;
  padding: .47rem .75rem;
  outline-offset: 1px;
  border: 1px solid var(--line);
  border-radius: .55rem;
  background: var(--paper);
  color: var(--ink);
}
.ed-search input::placeholder {
  color: #666;
  opacity: 1;
}
.ed-search button { padding-inline: .75rem; }
.ed-nav { border-block: 1px solid var(--line); }
.ed-nav ul { display: flex; flex-wrap: wrap; gap: 0 1.4rem; list-style: none; padding: 0; }
.ed-nav li { position: relative; }
.ed-nav a {
  display: flex;
  align-items: center;
  min-block-size: 2.8rem;
  color: var(--muted);
  font-size: .91rem;
  font-weight: 750;
  text-decoration: none;
}
.ed-nav a:hover, .ed-nav [aria-current="page"] { color: var(--brand); }
.ed-nav [aria-current="page"] { box-shadow: inset 0 -2px var(--brand); }
.ed-nav .sub-menu { padding-inline-start: 1rem; gap: 0 1rem; }
.ed-nav .sub-menu a { font-size: .83rem; }

.ed-hero { padding-block: clamp(1.3rem, 4vw, 3.55rem) 0; }
.ed-hero-layout {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
  min-height: 28rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) * 1.35);
  background: var(--accent);
}
.ed-hero-copy { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; padding: clamp(1.35rem, 4vw, 3.6rem); }
.ed-kicker {
  color: var(--brand);
  font-size: .83rem;
  font-weight: 850;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
}
.ed-hero h1 {
  margin-block: .6rem .9rem;
  font-size: clamp(2.05rem, 4.25vw, 3.8rem);
  font-weight: 900;
  line-height: 1.25;
  text-wrap: balance;
}
.ed-hero p { color: var(--muted); max-inline-size: 38ch; }
.ed-hero-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-block-start: 1.4rem; }
.ed-hero-media { position: relative; min-inline-size: 0; margin: 0; background: var(--night); color: var(--accent); }
.ed-hero-media img { position: absolute; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.ed-hero-empty { display: grid; place-items: center; }
.ed-hero-empty svg { width: 6rem; height: 6rem; }

.ed-section { margin-block: clamp(2.6rem, 6vw, 5rem); }
.ed-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: .45rem 1rem;
  border-block-end: 1px solid var(--line);
  padding-block-end: .75rem;
  margin-block-end: 1.15rem;
}
.ed-section-head h2, .ed-section-head h3 { font-weight: 850; font-size: clamp(1.4rem, 3vw, 2rem); }
.ed-section-head p { color: var(--muted); max-inline-size: 58ch; }
.ed-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 1rem; }
.ed-grid--posts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ed-grid--topics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ed-topic {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .6rem;
  min-height: 11rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
}
.ed-topic:hover, .ed-card:hover { border-color: var(--brand); }
.ed-topic-title { display: flex; gap: .4rem; width: 100%; justify-content: space-between; align-items: center; font-weight: 850; line-height: 1.45; font-size: 1.02rem; }
.ed-topic-title svg { color: var(--brand); }
.ed-topic p { color: var(--muted); font-size: .87rem; line-height: 1.75; }
.ed-topic-icon { display: grid; place-items: center; background: var(--accent); color: var(--brand); inline-size: 2.45rem; block-size: 2.45rem; border-radius: .55rem; }
.ed-topic-icon img { inline-size: 1.9rem; }
.ed-card {
  min-inline-size: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.ed-card-media { display: block; aspect-ratio: 1.65; background: var(--accent); overflow: hidden; }
.ed-card-media img { width: 100%; height: 100%; object-fit: cover; }
.ed-card-copy { display: grid; align-content: start; gap: .52rem; padding: 1.15rem; }
.ed-card-title { margin: 0; font-size: 1.11rem; font-weight: 850; }
.ed-card-title a { text-decoration: none; }
.ed-card-title a:hover { color: var(--brand); text-decoration: underline; }
.ed-card p, .ed-card .ed-date, .ed-muted { color: var(--muted); }
.ed-card p { font-size: .92rem; }
.ed-date { font-size: .78rem; }
.ed-empty {
  padding: 1.35rem;
  max-width: 46rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.ed-empty .ed-search { max-width: 25rem; margin-block-start: .85rem; }
.ed-feature {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .75fr);
  gap: clamp(1rem, 4vw, 3rem);
  align-items: center;
  background: var(--accent);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 4vw, 3rem);
}
.ed-feature h2 { margin-block-end: .5rem; font-size: clamp(1.35rem, 3vw, 2rem); }
.ed-feature p { color: var(--muted); }
.ed-feature .ed-button { margin-block-start: 1rem; }
.ed-feature img { width: 100%; border-radius: .6rem; }
.ed-editorial-principles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.ed-editorial-principles div { border-inline-start: .2rem solid var(--brand); padding-inline-start: .85rem; }
.ed-editorial-principles p { color: var(--muted); font-size: .92rem; }

.ed-breadcrumbs { margin-block: 1.4rem; color: var(--muted); font-size: .85rem; }
.ed-breadcrumbs ol { display: flex; flex-wrap: wrap; gap: .3rem .6rem; list-style: none; padding: 0; }
.ed-breadcrumbs li + li::before { content: "/"; margin-inline-end: .6rem; color: var(--muted); }
.ed-archive-head { padding: clamp(1.2rem, 4.5vw, 3.1rem); border-radius: var(--radius); background: var(--accent); }
.ed-archive-head h1, .ed-entry-title { color: var(--ink); font-size: clamp(1.85rem, 4.3vw, 3.28rem); font-weight: 900; line-height: 1.34; }
.ed-archive-head p { color: var(--muted); max-inline-size: 62ch; margin-block-start: .6rem; }
.ed-pagination { margin-block-start: 1.6rem; }
.ed-pagination .nav-links { display: flex; flex-wrap: wrap; gap: .4rem; }
.ed-pagination .page-numbers, .ed-page-links .post-page-numbers {
  min-inline-size: 2.65rem;
  text-align: center;
  text-decoration: none;
  padding: .3rem .62rem;
  border: 1px solid var(--line);
  border-radius: .4rem;
  background: var(--surface);
}
.ed-pagination .current, .ed-page-links .current { background: var(--brand); color: white; border-color: var(--brand); }

.ed-entry { margin-block: 0 clamp(2.8rem, 7vw, 6rem); }
.ed-entry-header { max-inline-size: 61rem; padding-block: .3rem 1.35rem; }
.ed-entry-title { margin-block: .4rem .9rem; overflow-wrap: anywhere; }
.ed-entry-meta { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem 1rem; color: var(--muted); font-size: .86rem; }
.ed-entry-cover { margin-block-end: clamp(1.4rem, 4vw, 2.8rem); max-width: 66rem; }
.ed-entry-cover img { width: 100%; max-height: 34rem; object-fit: cover; border-radius: var(--radius); }
.ed-entry-layout { display: grid; grid-template-columns: minmax(0, 48rem) minmax(12rem, 18rem); align-items: start; gap: clamp(1.15rem, 4.2vw, 3.6rem); }
.ed-entry-layout--wide { grid-template-columns: minmax(0, 48rem); }
.ed-prose { min-width: 0; font-size: clamp(1rem, 2vw, 1.1rem); line-height: 2.05; overflow-wrap: anywhere; }
.ed-prose > :where(p, ul, ol, blockquote, figure, pre, address, details, .wp-block-buttons) { margin-block: 0 1.1rem; }
.ed-prose > :first-child { margin-block-start: 0; }
.ed-prose :where(h2, h3, h4) { margin-block: 1.75em .55em; font-weight: 850; }
.ed-prose h2 { font-size: clamp(1.32rem, 3vw, 1.82rem); border-block-start: 1px solid var(--line); padding-block-start: .8em; }
.ed-prose h3 { font-size: clamp(1.13rem, 2.6vw, 1.4rem); }
.ed-prose h4 { font-size: 1.08rem; }
.ed-prose a { color: var(--brand); font-weight: 700; }
.ed-prose li + li { margin-block-start: .36rem; }
.ed-prose ol { list-style-type: persian; }
.ed-prose li::marker { color: var(--brand); font-weight: 850; }
.ed-prose blockquote, .ed-prose .ed-guide {
  padding: .95rem 1.15rem;
  background: var(--accent);
  border-inline-start: .22rem solid var(--brand);
  border-radius: .55rem;
}
.ed-prose .ed-guide { margin-block: 1.2rem; }
.ed-prose .ed-guide > :last-child, .ed-prose blockquote > :last-child { margin-block-end: 0; }
.ed-prose figure img { border-radius: .55rem; }
.ed-prose figcaption, .ed-entry-cover figcaption { color: var(--muted); font-size: .85rem; margin-block-start: .45rem; }
.ed-prose iframe { max-inline-size: 100%; }
.ed-prose pre { white-space: pre; overflow: auto; padding: 1rem; background: var(--accent); direction: ltr; text-align: left; }
.ed-prose table { width: 100%; border-collapse: collapse; }
.ed-prose :where(th, td) { padding: .55rem; border: 1px solid var(--line); }
.ed-prose th { background: var(--accent); }
.ed-table-scroll, .ed-prose .wp-block-table { overflow-x: auto; }
.ed-prose .wp-block-gallery img { border-radius: .5rem; }
.ed-prose .aligncenter { margin-inline: auto; }
.ed-prose .aligncenter img { margin-inline: auto; }
.ed-prose .alignleft { float: left; margin: 0 1rem .7rem 0; }
.ed-prose .alignright { float: right; margin: 0 0 .7rem 1rem; }
.ed-prose::after { content: ""; display: block; clear: both; }
.ed-toc {
  grid-column: 2;
  grid-row: 1;
  position: sticky;
  inset-block-start: 1.5rem;
  max-block-size: calc(100vh - 3rem);
  overflow: auto;
  padding: .8rem .95rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.ed-toc summary { color: var(--brand); font-weight: 850; }
.ed-toc ol { list-style: none; padding: .4rem 0 0; }
.ed-toc li { border-block-end: 1px solid var(--line); }
.ed-toc li:last-child { border-block-end: 0; }
.ed-toc a { display: block; padding-block: .36rem; color: var(--ink); font-size: .86rem; text-decoration: none; }
.ed-toc a:hover { color: var(--brand); text-decoration: underline; }
.ed-toc .ed-toc-sub { padding-inline-start: .8rem; }
.ed-toc .ed-toc-sub a { color: var(--muted); }
.ed-prose :target { background: var(--accent); }
.ed-related { padding-block-start: 1.25rem; border-block-start: 1px solid var(--line); }
.ed-related .ed-section-head { border: 0; }
.ed-comments { margin-block: 2rem; max-width: 48rem; }
.ed-comments h2, .ed-comments h3 { margin-block-end: .6rem; }
.ed-comments :where(input:not([type="checkbox"]):not([type="submit"]), textarea) { width: 100%; padding: .5rem .7rem; border: 1px solid var(--line); border-radius: .4rem; background: var(--surface); }
.ed-comments .comment-form { display: grid; gap: .65rem; }
.ed-comments .comment-list { margin-block-end: 1rem; }
.ed-comments .comment-body { margin-block: 1rem; padding: 1rem; background: var(--surface); }

.ed-footer { background: var(--night); color: white; padding-block: 2.5rem 1.2rem; }
.ed-footer :focus-visible { outline-color: white; }
.ed-footer-grid { display: grid; grid-template-columns: 1.25fr 1fr .85fr; gap: 1.4rem; }
.ed-footer-title { font-weight: 850; font-size: 1.08rem; margin-block-end: .5rem; }
.ed-footer p { max-inline-size: 38ch; color: #e5dfd9; font-size: .9rem; }
.ed-footer ul { list-style: none; padding: 0; }
.ed-footer a { display: inline-block; padding-block: .16rem; color: #f5efea; text-decoration: none; font-size: .91rem; }
.ed-footer a:hover { text-decoration: underline; }
.ed-footer-bottom { border-block-start: 1px solid #ffffff3d; margin-block-start: 1.5rem; padding-block-start: .8rem; }

@media (max-width: 62rem) {
  .ed-grid--topics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ed-grid--posts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ed-hero-layout { min-height: 23rem; }
}
@media (max-width: 48rem) {
  .ed-entry-layout { display: flex; flex-direction: column; gap: 1.2rem; }
  .ed-entry-layout > * { width: 100%; }
  .ed-toc { position: static; max-block-size: none; }
  .ed-grid--topics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ed-footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ed-footer-grid > :first-child { grid-column: 1 / -1; }
  .ed-hero-layout { min-height: 0; }
  .ed-hero-copy { padding: 1.25rem; }
  .ed-nav ul { gap: 0 .95rem; }
}
@media (max-width: 36rem) {
  .ed-masthead { flex-direction: column; align-items: stretch; justify-content: center; gap: .85rem; padding-block: .85rem; }
  .ed-mast-search { width: 100%; }
  .ed-nav ul { gap: 0 .85rem; }
  .ed-nav a { font-size: .82rem; min-block-size: 2.35rem; }
  .ed-hero-layout, .ed-feature { grid-template-columns: minmax(0, 1fr); }
  .ed-hero-media { aspect-ratio: 1.65; }
  .ed-hero h1 { font-size: clamp(1.8rem, 8vw, 2.6rem); }
  .ed-hero-copy { padding: 1.1rem; }
  .ed-button { font-size: .87rem; padding-inline: .75rem; }
  .ed-grid--posts { grid-template-columns: minmax(0, 1fr); }
  .ed-grid--topics { gap: .6rem; }
  .ed-topic { padding: .75rem; min-height: auto; }
  .ed-topic-title { font-size: .92rem; }
  .ed-topic p { font-size: .82rem; }
  .ed-editorial-principles { grid-template-columns: minmax(0, 1fr); }
  .ed-prose .alignleft, .ed-prose .alignright { float: none; margin-inline: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}

.ed-prose > ol:not(.wp-block-gallery) {
  padding: .8rem 2.45rem .8rem 1rem;
  border-inline-start: .2rem solid var(--brand);
  border-radius: .55rem;
  background: var(--accent);
}
.ed-prose > table {
  display: block;
  overflow-x: auto;
}
.ed-custom-logo img { max-width: 3.25rem; max-height: 3.25rem; object-fit: contain; }
.ed-brand-group { display: flex; align-items: center; gap: .75rem; }
