/* =========================================================
   ErfanChap Unified Typography System (.rich-content)
   ========================================================= */

.rich-content {
  --rc-accent: #ED3237;
  --rc-accent-soft: #fdecec;
  --rc-gold: #C9A227;
  --rc-text: #1f2937;
  --rc-muted: #6b7280;
  --rc-border: #e5e7eb;
  --rc-zebra: #f9fafb;
  --rc-radius: 12px;
  --rc-space: 1em;

  direction: rtl;
  text-align: right;
  font-family: Dana, Tahoma, sans-serif;
  font-synthesis: weight;
  font-size: clamp(15px, 14px + .25vw, 16.5px);
  line-height: 1.95;
  color: var(--rc-text);
  max-width: 780px;
  margin-inline: auto;
  overflow-wrap: anywhere;
}

.rich-content--intro {
  max-width: none;
}

.category-content,
.category-intro {
  text-align: right;
}

/* Paragraphs */
.rich-content p {
  margin: 0 0 1.1em;
  text-align: right;
}

.rich-content p,
.rich-content li,
.rich-content td {
  line-height: inherit;
}

.rich-content.rich-content--justify,
.rich-content .rich-content--justify {
  text-align: justify;
  text-justify: inter-word;
}

/* Headings */
.rich-content h2,
.rich-content h3,
.rich-content h4 {
  font-weight: 800;
  line-height: 1.5;
  color: #111827;
  scroll-margin-top: 96px;
  margin: 1.8em 0 .6em;
}

.rich-content > *:first-child {
  margin-top: 0;
}

.rich-content h2 {
  font-size: clamp(1.25rem, 1.05rem + .9vw, 1.6rem);
  padding-inline-start: .65em;
  border-inline-start: 4px solid var(--rc-accent);
  border-radius: 2px;
}

.rich-content h3 {
  font-size: clamp(1.08rem, 1rem + .45vw, 1.28rem);
}

.rich-content h3::after {
  content: "";
  display: block;
  width: 42px;
  height: 3px;
  margin-top: .35em;
  background: var(--rc-accent);
  opacity: .85;
  border-radius: 3px;
}

.rich-content h4 {
  font-size: 1.05rem;
  color: var(--rc-accent);
}

/* Links */
.rich-content a {
  color: #c81e24;
  text-decoration: underline;
  text-decoration-color: rgba(237, 50, 55, .35);
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}

.rich-content a:hover {
  text-decoration-color: currentColor;
}

.rich-content a:focus-visible {
  outline: 2px solid var(--rc-accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* External Link Indicator */
.rich-content a[href^="http"]:not([href*="erfanchap.com"])::after {
  content: "";
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-inline-start: 0.35em;
  vertical-align: middle;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M14 3h7v7h-2V6.41l-9.29 9.3-1.42-1.42 9.3-9.29H14V3zM5 5h6V3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-6h-2v6H5V5z'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M14 3h7v7h-2V6.41l-9.29 9.3-1.42-1.42 9.3-9.29H14V3zM5 5h6V3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-6h-2v6H5V5z'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* Direction for Phone and WhatsApp */
.rich-content a[href^="tel:"] {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
}

.rich-content a[href*="wa.me"] {
  direction: ltr;
  unicode-bidi: isolate;
}

/* Buttons inside rich content */
.rich-content a.btn {
  text-decoration: none !important;
  color: #fff !important;
}

.rich-content a.btn:hover {
  text-decoration: none !important;
  color: #fff !important;
}

/* Unordered Lists */
.rich-content ul {
  list-style: none;
  padding-inline-start: 0;
  margin: 0 0 1.2em;
}

.rich-content ul li {
  position: relative;
  padding-inline-start: 1.5em;
  margin-bottom: .45em;
}

.rich-content ul li::before {
  content: "";
  position: absolute;
  inset-inline-start: .2em;
  top: .8em;
  width: .5em;
  height: .5em;
  border-radius: 50%;
  background: var(--rc-accent);
}

.rich-content ul ul {
  margin-top: .45em;
  margin-bottom: .45em;
  padding-inline-start: 1.2em;
}

.rich-content ul ul li::before {
  background: transparent;
  border: 2px solid var(--rc-accent);
}

/* Ordered Lists */
.rich-content ol {
  list-style: none;
  counter-reset: rc-ol;
  padding-inline-start: 0;
  margin: 0 0 1.2em;
}

.rich-content ol > li {
  counter-increment: rc-ol;
  position: relative;
  padding-inline-start: 2.6em;
  min-height: 1.9em;
  margin-bottom: .7em;
}

.rich-content ol > li::before {
  content: counter(rc-ol, persian);
  position: absolute;
  inset-inline-start: 0;
  top: .1em;
  width: 1.85em;
  height: 1.85em;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--rc-accent);
  color: #fff;
  font-weight: 800;
  font-size: .85em;
}

.rich-content ol ol {
  margin-top: .45em;
  margin-bottom: .45em;
  padding-inline-start: 1.2em;
}

/* Tables */
.rich-content table:not(.rc-wrapped) {
  display: block;
  overflow-x: auto;
  max-width: 100%;
}

.rc-table {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.2em 0;
  border: 1px solid var(--rc-border);
  border-radius: var(--rc-radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
  background: #fff;
}

.rc-table:focus-visible {
  outline: 2px solid var(--rc-accent);
}

.rich-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: .95em;
  min-width: 520px;
}

.rich-content table[style] {
  width: 100% !important;
}

.rich-content table[border] {
  border: 0 !important;
}

.rich-content th {
  background: #fff1f1;
  color: #7f1d1d;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
  padding: .7em .9em;
  border-bottom: 1px solid var(--rc-border);
}

.rich-content td {
  padding: .7em .9em;
  border-bottom: 1px solid var(--rc-border);
  text-align: right;
  vertical-align: top;
}

.rich-content tbody tr:nth-child(even) {
  background: var(--rc-zebra);
}

.rich-content tr:first-child > th {
  background: #fff1f1;
  color: #7f1d1d;
  font-weight: 800;
}

/* Blockquotes */
.rich-content blockquote {
  margin: 1.4em 0;
  padding: 1em 1.2em 1em 1em;
  padding-inline-start: 3.2em;
  border-inline-start: 4px solid var(--rc-accent);
  background: var(--rc-accent-soft);
  border-radius: var(--rc-radius);
  position: relative;
  color: #374151;
}

.rich-content blockquote::before {
  content: "”";
  font-family: Georgia, serif;
  font-size: 3em;
  line-height: 1;
  color: var(--rc-accent);
  opacity: .5;
  position: absolute;
  inset-inline-start: .3em;
  top: .1em;
  pointer-events: none;
}

.rich-content blockquote footer,
.rich-content blockquote cite {
  display: block;
  margin-top: .6em;
  font-size: .9em;
  color: var(--rc-muted);
  font-style: normal;
}

/* Figure and Images */
.rich-content figure {
  margin: 1.4em 0;
  text-align: center;
}

.rich-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--rc-radius);
  display: block;
  margin-inline: auto;
}

.rich-content figcaption {
  margin-top: .5em;
  font-size: .88em;
  color: var(--rc-muted);
  text-align: center;
}

.rich-content img[style] {
  height: auto !important;
}

/* Inline Styles & Code */
.rich-content strong {
  font-weight: 800;
  color: #111827;
}

.rich-content mark {
  background: #fff3c4;
  padding: 0 .2em;
  border-radius: 3px;
}

.rich-content hr {
  border: 0;
  height: 1px;
  background: linear-gradient(to left, transparent, var(--rc-border), transparent);
  margin: 2em 0;
}

.rich-content code {
  direction: ltr;
  unicode-bidi: isolate;
  background: #f3f4f6;
  padding: .1em .4em;
  border-radius: 4px;
  font-size: .9em;
}

.rich-content pre {
  direction: ltr;
  overflow-x: auto;
  background: #1f2937;
  color: #f9fafb;
  padding: 1em 1.2em;
  border-radius: var(--rc-radius);
  margin: 1.4em 0;
  text-align: left;
}

.rich-content pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: .95em;
}

/* =========================================================
   FAQ Section (.rc-faq)
   ========================================================= */

.rc-faq {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rc-border);
  text-align: right;
}

.rc-faq h2 {
  margin-bottom: 1.2em;
}

.rc-faq__item {
  border: 1px solid var(--rc-border);
  border-radius: var(--rc-radius);
  margin-bottom: .7em;
  background: #fff;
  overflow: hidden;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.rc-faq__item[open] {
  border-color: #f3b4b6;
  box-shadow: 0 4px 14px rgba(237, 50, 55, .08);
}

.rc-faq__q {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1em;
  padding: .9em 1.1em;
  min-height: 48px;
  user-select: none;
  background: #fafafa;
  transition: background-color .2s;
}

.rc-faq__item[open] > .rc-faq__q {
  background: #fff;
}

.rc-faq__q::-webkit-details-marker {
  display: none;
}

.rc-faq__q h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
  border: 0;
  padding: 0;
}

.rc-faq__q h3::after {
  display: none !important;
}

.rc-faq__q::after {
  content: "";
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  background-color: var(--rc-accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z'/%3E%3C/svg%3E") no-repeat center / contain;
  transition: transform .2s ease;
}

.rc-faq__item[open] > .rc-faq__q::after {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 13H5v-2h14v2z'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 13H5v-2h14v2z'/%3E%3C/svg%3E") no-repeat center / contain;
}

.rc-faq__q:focus-visible {
  outline: 2px solid var(--rc-accent);
  outline-offset: -2px;
}

.rc-faq__a {
  padding: .8em 1.1em 1.1em;
  border-top: 1px solid var(--rc-border);
  color: #374151;
  font-size: .95em;
  line-height: 1.85;
}

.rc-faq__a p {
  margin: 0;
}

/* =========================================================
   Mobile Typography Adjustments
   ========================================================= */

@media (max-width: 575.98px) {
  .rich-content {
    font-size: 15px;
    line-height: 1.9;
  }

  .rich-content h2 {
    margin: 1.4em 0 .5em;
  }

  .rich-content h3 {
    margin: 1.3em 0 .4em;
  }
}

/* =========================================================
   Catalog Filter Sort Bar & Mobile Bottom Sheet Drawer
   ========================================================= */

.sort-bar-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.sort-bar-wrap .sort-bar {
  margin-bottom: 0;
}

.filter-toggle {
  display: none;
}

html:not(.js-filter) .filter-toggle,
html:not(.js-filter) .filter-drawer__head {
  display: none !important;
}

.filter-drawer__reset {
  display: block;
  text-align: center;
  color: #6b7280;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.filter-drawer__reset:hover {
  color: #ED3237;
}

@media (min-width: 768px) {
  .filter-drawer__head {
    display: none;
  }

  .filter-backdrop {
    display: none !important;
  }

  .filter-drawer__foot {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .filter-drawer__foot .view_more {
    margin-bottom: 0;
  }
}

@media (max-width: 767.98px) {
  .filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 0 16px;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    color: #1f2937;
    cursor: pointer;
    transition: all .2s ease;
    flex-shrink: 0;
  }

  .filter-toggle:active {
    background: #f3f4f6;
  }

  .filter-toggle__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #ED3237;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
  }

  html.js-filter .filter-drawer {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 5000;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 18px 18px 0 0;
    transform: translateY(105%);
    transition: transform .3s ease;
    padding: 0 !important;
    margin: 0;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, .18);
    visibility: hidden;
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
  }

  html.js-filter .filter-drawer.is-open {
    transform: none;
    visibility: visible;
  }

  @media (prefers-reduced-motion: reduce) {
    html.js-filter .filter-drawer {
      transition: none !important;
    }
  }

  html.js-filter .filter-drawer form {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 85vh;
    overflow: hidden;
  }

  .filter-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
  }

  .filter-drawer__head h2 {
    font-size: 16px;
    font-weight: 800;
    margin: 0;
    color: #111827;
  }

  .filter-drawer__close {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    background: transparent;
    font-size: 26px;
    line-height: 1;
    color: #4b5563;
    cursor: pointer;
    border-radius: 8px;
  }

  .filter-drawer__body {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px 20px;
  }

  .filter-drawer__foot {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
  }

  .filter-drawer__foot .view_more {
    flex: 1;
    min-height: 44px;
    margin: 0 !important;
  }

  .filter-drawer__reset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 14px;
    color: #6b7280;
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    white-space: nowrap;
  }

  .filter-drawer__reset:hover {
    color: #ED3237;
  }

  .filter-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 4999;
  }

  .filter-backdrop[hidden] {
    display: none !important;
  }

  body.filter-open {
    overflow: hidden !important;
  }

  body.filter-open .contact-dock {
    display: none !important;
  }

  /* Range input touch thumb sizes */
  input[type=range]::-webkit-slider-thumb {
    height: 28px !important;
    width: 28px !important;
  }

  input[type=range]::-moz-range-thumb {
    height: 28px !important;
    width: 28px !important;
  }
}

/* =========================================================
   Mobile Floating Contact Dock Polish
   ========================================================= */

@media (max-width: 767.98px) {
  footer.main-footer .copyright {
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }

  body .contact-dock {
    bottom: calc(14px + env(safe-area-inset-bottom)) !important;
    right: 14px !important;
    z-index: 4600 !important;
  }

  .footer-widgets .card-header {
    padding-inline-end: 64px !important;
  }
}

