/* کلاس‌های اختصاصی سایت عمومی (فیگما) کنار Tailwind (D181).
   ترتیب لایه‌ها همان Tailwind است تا این کلاس‌ها روی preflight بنشینند و ابزارهای Tailwind (utilities) رویشان. */
@layer theme, base, components, utilities;

@font-face {
  font-family: Dana;
  src: url("../fonts/Dana-FaNum-Thin.woff") format("woff");
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Dana;
  src: url("../fonts/Dana-FaNum-ExtraLight.woff") format("woff");
  font-weight: 200;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Dana;
  src: url("../fonts/Dana-FaNum-Light.woff") format("woff");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Dana;
  src: url("../fonts/Dana-FaNum-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Dana;
  src: url("../fonts/Dana-FaNum-Medium.woff") format("woff");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Dana;
  src: url("../fonts/Dana-FaNum-DemiBold.woff") format("woff");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Dana;
  src: url("../fonts/Dana-FaNum-Bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Dana;
  src: url("../fonts/Dana-FaNum-ExtraBold.woff") format("woff");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Dana;
  src: url("../fonts/Dana-FaNum-Black.woff") format("woff");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Divan;
  src: url("../fonts/Divan-FaNum-Black.woff") format("woff");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

html,
body,
button,
input,
select,
textarea {
  font-family: Dana, Tahoma, sans-serif;
}

:root {
  --bc-navy: #21438B;
  --bc-navy-dark: #1a3570;
  --bc-yellow: #FFBA2B;
  --bc-red: #DE1D1D;
  --bc-bg: #F6F7FB;
  --bc-text: #1E1E1E;
  --bc-muted: #6B7280;
  --bc-line: #E3E6EF;
  --bc-radius: 15px;
}

@layer components {

  /* ---------- هدر ---------- */
  .site-logo {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    white-space: nowrap;
    color: var(--bc-text);
    text-decoration: none;
  }

  .site-logo>span {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
  }

  .site-logo-fa {
    font-size: 1rem;
  }

  .site-logo-en {
    font-size: .7rem;
    letter-spacing: .08em;
    color: var(--bc-muted);
    font-family: Georgia, serif;
  }

  .header-plus {
    color: var(--bc-text);
    text-decoration: none;
  }

  .header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    color: var(--bc-navy);
    font-size: 1.15rem;
    text-decoration: none;
  }

  .header-icon-box {
    background: #DCE4F5;
    border-radius: 8px;
  }

  .site-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .25rem 1.5rem;
  }

  .site-nav a:not(.btn) {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: var(--bc-text);
    text-decoration: none;
  }

  .site-nav a:not(.btn):hover {
    color: var(--bc-navy);
  }

  .header-pill {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem .9rem;
    background: #fff;
    border: 1px solid var(--bc-line);
    border-radius: 8px;
    color: var(--bc-navy);
    font-size: 13px;
    text-decoration: none;
  }

  .category-accordion-btn[aria-expanded="true"] .chevron-icon {
    transform: rotate(-90deg);
  }

  .category-scroll {
    scrollbar-width: thin;
    scrollbar-color: var(--bc-line) transparent;
  }
  .category-scroll::-webkit-scrollbar {
    width: 5px;
  }
  .category-scroll::-webkit-scrollbar-thumb {
    background: var(--bc-line);
    border-radius: 4px;
  }
  .category-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--bc-muted);
  }

  /* ---------- فوتر ---------- */
  .footer-about {
    max-width: 1100px;
    margin-inline: auto;
    color: var(--bc-muted);
    font-size: 13px;
    line-height: 2;
  }

  .footer-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 1rem;
  }

  .footer-links li {
    margin-bottom: .6rem;
  }

  .footer-links a {
    color: var(--bc-muted);
    font-size: 13px;
    text-decoration: none;
  }

  .footer-links a::before {
    content: "•";
    margin-inline-end: .4rem;
  }

  .footer-links a:hover {
    color: var(--bc-navy);
  }

  .footer-card {
    background: var(--bc-navy);
    color: #fff;
    border-radius: var(--bc-radius);
    padding: 1.25rem;
  }

  .footer-card-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, .15);
    border-radius: 8px;
  }

  .footer-card-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .55rem .75rem;
    background: #fff;
    border-radius: 8px;
    color: var(--bc-text);
    font-size: 13px;
    text-decoration: none;
  }

  .footer-social {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, .15);
    border-radius: 8px;
    color: #fff;
    text-decoration: none;
  }

  .footer-social:hover {
    background: var(--bc-yellow);
    color: var(--bc-navy);
  }

  .footer-contact {
    border-top: 1px solid var(--bc-line);
    border-bottom: 1px solid var(--bc-line);
  }

  .footer-contact-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-inline-end: .35rem;
    background: var(--bc-navy);
    border-radius: 8px;
    color: #fff;
  }

  .footer-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    background: #E5E7EB;
    border-radius: var(--bc-radius);
    color: var(--bc-muted);
  }

  .footer-copy {
    color: var(--bc-muted);
    font-size: 12px;
  }

  .footer-copy a {
    color: inherit;
  }

  /* ---------- مسیر صفحه ---------- */
  .breadcrumb {
    display: flex;
    flex-wrap: wrap;
  }

  .breadcrumb li+li::before {
    content: "/";
    padding-inline: .5rem;
    color: var(--bc-muted);
  }

  .breadcrumb a {
    color: var(--bc-navy);
    text-decoration: none;
  }

  .breadcrumb [aria-current] {
    color: var(--bc-muted);
  }

  /* ---------- کارت محصول ---------- */
  .product-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: var(--bc-radius);
    padding: .75rem;
  }

  .product-card-image {
    position: relative;
    display: block;
    aspect-ratio: 3 / 4;
    border-radius: 10px;
    overflow: hidden;
    background: var(--bc-bg);
  }

  .product-card-image>img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .product-card-noimage {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #C4C9D6;
    font-size: 2.5rem;
  }
  .product-title{
    font-family: Divan;
  }

  .product-card-discount {
    background: var(--bc-red);
    color: #fff;
    border-radius: 6px;
    padding: 0 .4rem;
    font-size: 12px;
  }

  .product-card-badge {
    position: absolute;
    top: 15px;
    left: -20px;
    z-index: 10;
    width: 100px;
    height: 37px;
    transform: rotate(-90deg);
    pointer-events: none;
  }

  .product-card-badge-label {
    position: absolute;
    inset: 0;
    display: block;
    line-height: 37px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-inline: .75rem;
    color: var(--bc-text);
    font-size: .75rem;
    font-weight: 700;
    text-align: center;
  }

  .directory-card-badge {
    position: absolute;
    bottom: .75rem;
    inset-inline-start: 0;
    z-index: 10;
    width: 100px;
    height: 37px;
  }

  .directory-card-badge-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-inline: .75rem;
    color: var(--bc-text);
    font-size: .75rem;
    font-weight: 700;
  }

  .product-card-discount-container {
    position: absolute;
    display: flex;
    justify-content: center;
    top: .5rem;
    inset-inline-start: .5rem;
    background: var(--bc-red);
    color: #fff;
    border-radius: 6px;
    padding: 0 .4rem;
    font-size: 12px;

  }

  .product-card-title {
    font-size: 14px;
    font-weight: 600;
    margin: .6rem 0 .25rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .product-card-title a {
    color: var(--bc-text);
    text-decoration: none;
  }

  .product-card-meta {
    display: flex;
    justify-content: space-between;
    gap: .5rem;
    color: var(--bc-muted);
    font-size: 12px;
    margin-bottom: .5rem;
  }

  .product-card-price {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 13px;
  }

  .product-card-price del {
    color: var(--bc-muted);
    font-size: 12px;
  }

  /* ---------- صفحه محصول ---------- */
  .product-gallery {
    background: #fff;
    border-radius: var(--bc-radius);
    padding: 1rem;
  }

  .product-gallery-main {
    width: 100%;
    height: auto;
    max-height: 520px;
    object-fit: contain;
    aspect-ratio: auto;
  }

  div.product-gallery-main {
    aspect-ratio: 3 / 4;
  }

  .product-gallery-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .75rem;
  }

  .product-gallery-thumbs button {
    border: 1px solid var(--bc-line);
    border-radius: 8px;
    padding: 2px;
    background: #fff;
    cursor: pointer;
  }

  .product-gallery-thumbs img {
    object-fit: cover;
    border-radius: 6px;
  }

  .product-specs {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: .4rem 1rem;
  }

  .product-specs dt {
    color: var(--bc-muted);
    font-weight: 400;
  }

  .product-specs dd {
    margin: 0;
  }

  .product-buy {
    background: #fff;
    border-radius: var(--bc-radius);
    padding: 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
  }

  .variant-option input {
    position: absolute;
    opacity: 0;
  }

  .variant-option span {
    display: inline-block;
    padding: .35rem .9rem;
    border: 1px solid var(--bc-line);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
  }

  .variant-option input:checked+span {
    border-color: var(--bc-navy);
    color: var(--bc-navy);
    font-weight: 600;
  }

  .variant-option input:focus-visible+span {
    outline: 2px solid var(--bc-navy);
    outline-offset: 2px;
  }

  .variant-option input:disabled+span {
    opacity: .45;
    cursor: not-allowed;
    text-decoration: line-through;
  }

  .product-description,
  .category-description {
    background: #fff;
    border-radius: var(--bc-radius);
    padding: 1.25rem;
    line-height: 2;
  }

  /* ---------- صفحه اصلی ---------- */
  .banner-svg {
    display: block;
    width: 100%;
    height: auto;
  }

  .banner-image {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--bc-radius);
  }

  .home-slider {
    position: relative;
  }

  .home-slide {
    border-radius: var(--bc-radius);
    overflow: hidden;
  }

  .home-slider-arrow {
    position: absolute;
    top: 50%;
    translate: 0 -50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 10%;
    background: var(--bc-navy);
    cursor: pointer;
  }

  .home-slider-arrow[data-slide="prev"] {
    inset-inline-start: .75rem;
  }

  .home-slider-arrow[data-slide="next"] {
    inset-inline-end: .75rem;
  }

  .home-slider-dots {
    position: absolute;
    bottom: .75rem;
    inset-inline: 0;
    display: flex;
    justify-content: center;
    gap: .4rem;
  }

  .home-slider-dots button {
    width: 24px;
    height: 4px;
    border: 0;
    border-radius: 2px;
    background: var(--bc-yellow);
    cursor: pointer;
  }

  .home-slider-dots button[aria-current="true"] {
    background: #fff;
  }

  .section-title {
    font-size: 1.15rem;
    font-weight: 800;
    margin-bottom: 1rem;
    padding-inline-start: .6rem;
    border-inline-start: 4px solid var(--bc-yellow);
    font-family: Divan;
  }

  .home-row-highlight {
    background: var(--bc-navy);
    border-radius: var(--bc-radius);
    padding: 1.25rem;
  }

  .home-row-highlight .section-title {
    color: #fff;
  }

  .product-row {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: .5rem;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
  }

  .product-row-item {
    flex: 0 0 200px;
    scroll-snap-align: start;
  }

  @media (max-width: 575px) {
    .product-row-item {
      flex-basis: 150px;
    }
  }

  .home-row-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1rem;
  }

  .home-row-tools {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin-inline-start: auto;
  }

  .home-row-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 6px;
    background: var(--bc-navy);
    color: #fff;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
  }

  .home-row-more {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .25rem .6rem;
    border-radius: 6px;
    background: var(--bc-navy);
    color: #fff;
    font-size: 12px;
    text-decoration: none;
  }

  .home-row-highlight .home-row-arrow,
  .home-row-highlight .home-row-more {
    background: #fff;
    color: var(--bc-navy);
  }

  .home-row-highlight .product-card {
    box-shadow: none;
  }

  .home-banner {
    display: block;
    height: 100%;
  }

  .home-banner .banner-svg {
    height: 100%;
  }

  .home-categories {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
  }

  .directory-card.home-category {
    aspect-ratio: 4 / 3;
    background: var(--bc-navy);
  }

  @media (max-width: 991px) {
    .home-categories {
      grid-template-columns: repeat(3, 1fr);
    }
  }

  @media (max-width: 575px) {
    .home-categories {
      gap: .5rem;
    }

    .directory-card.home-category {
      aspect-ratio: 1;
    }
  }

  .home-start {
    background: #fff;
    border-radius: var(--bc-radius);
    padding: 1.25rem;
  }

  /* نوار «برندهای برتر» لندینگ لوازم تحریر (فیگما 1:2454): کاشی مربعی لوگو */
  .brand-tile {
    flex: 0 0 112px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 112px;
    padding: .75rem;
    border: 1px solid var(--bc-line, #E5E7EB);
    border-radius: var(--bc-radius);
    background: #fff;
    color: var(--bc-navy);
    font-size: .8rem;
    font-weight: 700;
    text-align: center;
    transition: box-shadow .2s;
  }

  .brand-tile:hover {
    box-shadow: 0 4px 14px rgb(0 0 0 / .08);
  }

  .brand-tile img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
  }

  .home-tabs {
    display: flex;
    gap: .5rem;
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .home-tab {
    white-space: nowrap;
    border: 0;
    border-radius: 8px;
    background: #E5E7EB;
    color: var(--bc-text);
    padding: .35rem 1.1rem;
    font-size: 13px;
    cursor: pointer;
  }

  .home-tab[aria-selected="true"] {
    background: var(--bc-navy);
    color: #fff;
  }

  .home-tabs-wide .home-tab {
    background: #fff;
    min-width: 110px;
  }

  .home-tabs-wide .home-tab[aria-selected="true"] {
    background: var(--bc-navy);
  }

  .start-card {
    position: relative;
    flex: 0 0 300px;
    display: flex;
    align-items: flex-end;
    gap: .5rem;
    min-height: 160px;
    padding: 1rem 1rem 0;
    border-radius: var(--bc-radius);
    background: var(--bc-navy);
    color: #fff;
    text-decoration: none;
    overflow: hidden;
    scroll-snap-align: start;
  }

  .start-card img {
    width: 120px;
    height: 150px;
    object-fit: cover;
    object-position: top;
    filter: grayscale(1);
    mix-blend-mode: luminosity;
    flex-shrink: 0;
  }

  .start-card-text {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    align-self: center;
    padding-bottom: 1rem;
    min-width: 0;
  }

  .start-card-text strong {
    font-size: 1.05rem;
  }

  .start-card-bio {
    font-size: 12px;
    line-height: 1.8;
    opacity: .85;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .start-card-tag {
    position: absolute;
    top: 0;
    inset-inline-end: 0;
    padding: .1rem .7rem;
    background: #fff;
    color: var(--bc-navy);
    border-end-start-radius: 8px;
    font-size: 11px;
  }

  .start-card:hover {
    color: #fff;
    background: var(--bc-navy-dark);
  }

  @media (max-width: 575px) {
    .start-card {
      flex-basis: 260px;
    }
  }

  .search-filters {
    background: #fff;
    border-radius: var(--bc-radius);
    padding: 1rem;
    position: sticky;
    top: 1rem;
  }

  /* ---------- حساب کاربری ---------- */
  .account-card {
    background: #fff;
    border-radius: var(--bc-radius);
    padding: 1.25rem;
  }

  .account-nav {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--bc-line);
    border-radius: 8px;
  }

  .account-nav-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    padding: .6rem 1rem;
    color: var(--bc-text);
    text-decoration: none;
    text-align: start;
    background: none;
    border: 0;
    cursor: pointer;
  }

  .account-nav>*+* {
    border-top: 1px solid var(--bc-line);
  }

  .account-nav-item:hover {
    background: var(--bc-bg);
  }

  .account-nav-item[aria-current="page"] {
    background: var(--bc-navy);
    color: #fff;
  }

  /* ---------- سبد و تسویه ---------- */
  .cart-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem 0;
    border-bottom: 1px solid var(--bc-line);
  }

  .cart-item:last-child {
    border-bottom: 0;
  }

  .cart-item-image {
    flex: 0 0 80px;
    height: 106px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bc-bg);
    display: flex;
  }

  .cart-item-image>img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .cart-item-title {
    color: var(--bc-text);
    font-weight: 600;
    text-decoration: none;
  }

  .cart-summary dl,
  dl.cart-summary {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: .5rem 1rem;
  }

  .cart-summary dt {
    font-weight: 400;
  }

  .cart-summary dd {
    margin: 0;
    text-align: end;
  }

  @media (min-width: 992px) {
    .cart-summary {
      position: sticky;
      top: 1rem;
    }
  }

  .checkout-option {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
    padding: .75rem;
    border: 1px solid var(--bc-line);
    border-radius: 10px;
    margin-bottom: .5rem;
    cursor: pointer;
  }

  .checkout-option:has(input:checked) {
    border-color: var(--bc-navy);
    background: #F3F6FC;
  }

  .checkout-option input {
    margin-top: .3rem;
    accent-color: var(--bc-navy);
  }

  /* ---------- اشتراک پلاس ---------- */
  .plus-hero {
    background: var(--bc-navy);
    color: #fff;
    border-radius: var(--bc-radius);
    padding: 1.5rem;
  }

  /* ---------- لیست نویسندگان/مترجمان/ناشران (فیگما 40:1619) ---------- */
  .directory-card {
    position: relative;
    display: block;
    aspect-ratio: 5 / 4;
    border-radius: var(--bc-radius);
    overflow: hidden;
    background: #fff;
    color: var(--bc-navy);
    text-decoration: none;
  }

  .directory-card>img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .directory-card-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: #E5E7EB;
    color: var(--bc-muted);
    font-size: 2.5rem;
  }

  .profile-media {
    background: #fff;
    border-radius: var(--bc-radius);
    padding: .75rem;
    height: 100%;
  }

  .profile-media img,
  .profile-media video,
  .profile-media iframe {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 10px;
  }

  .profile-media img {
    aspect-ratio: 4 / 3;
    object-fit: cover;
  }

  .profile-media iframe {
    aspect-ratio: 16 / 9;
    border: 0;
  }

}