/**
 * Persian-first right-to-left presentation.
 *
 * The main stylesheet mostly uses logical properties. This file owns the
 * remaining bidi rules and third-party/WooCommerce corrections in one place.
 * It is intentionally loaded after assets/css/main.css.
 *
 * @package Hair_Xzed
 */

html {
  direction: rtl;
}

body {
  direction: rtl;
  text-align: right;
}

/* Keep mixed Persian/Latin content readable without changing the page flow. */
input,
select,
textarea,
button {
  text-align: right;
}

input[type="email"],
input[type="url"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="time"],
code,
pre,
kbd,
samp,
.ltr {
  direction: ltr;
  unicode-bidi: plaintext;
}

input[type="email"],
input[type="url"],
input[type="tel"] {
  text-align: right;
}

input[type="number"],
input[type="date"],
input[type="time"],
code,
pre,
kbd,
samp {
  text-align: left;
}

/* Accessibility: the keyboard skip link opens from the RTL start edge. */
.screen-reader-text:focus,
.skip-link:focus {
  right: 8px;
  left: auto;
}

/* Header and menus. */
.primary-menu,
.primary-menu .sub-menu,
.hx-header-search__panel,
.hx-header-search__panel form {
  text-align: right;
}

.primary-menu .sub-menu {
  right: 0;
  left: auto;
}

/* The action group is visually stable while every action keeps RTL text. */
.site-header__actions {
  direction: ltr;
}

.site-header__actions > * {
  direction: rtl;
}

/* Hero media stays on the left and Persian copy stays on the right. */
.hx-home-hero {
  direction: ltr;
}

.hx-home-hero__content,
.hx-home-hero__copy {
  direction: rtl;
}

/* Search forms: input is first in the DOM but visually begins on the right. */
.empty-state input[type="search"] {
  border-radius: 0 10px 10px 0;
}

.empty-state input[type="submit"] {
  border-radius: 10px 0 0 10px;
}

/* Catalog hero: Persian copy on the right, artwork on the left. */
.hx-catalog-hero__inner {
  direction: ltr;
  grid-template-columns: minmax(390px, 0.9fr) minmax(0, 1fr);
  grid-template-areas: "media copy";
}

.hx-catalog-hero__copy,
.hx-catalog-hero__media {
  direction: rtl;
}

.hx-catalog-hero__media {
  clip-path: ellipse(72% 90% at 60% 50%);
}

/* Catalog sidebar is fixed on the right, results stay on the left. */
.hx-catalog-layout {
  direction: ltr;
  grid-template-columns: 300px minmax(0, 1fr);
  grid-template-areas: "filters results";
}

.hx-shop-filters,
.hx-catalog-results {
  direction: rtl;
}

/* Product media remains on the left and its Persian description on the right. */
.hx-catalog-card__inner {
  direction: ltr;
}

.hx-catalog-card__media,
.hx-catalog-card__body {
  direction: rtl;
  text-align: right;
}

.hx-catalog-toolbar,
.hx-catalog-card__meta,
.hx-catalog-card__price,
.hx-offer-card__footer,
.service-card__meta,
.hxz-entity-card__meta {
  direction: rtl;
}

/* Mobile filter drawer opens from the RTL edge. */
@media (max-width: 980px) {
  .hx-catalog-layout {
    grid-template-columns: 1fr;
    grid-template-areas: "results";
  }

  .hx-shop-filters {
    right: 0;
    left: auto;
    box-shadow: -15px 0 40px rgba(37, 20, 24, 0.2);
    transform: translateX(110%);
  }

  .hx-shop-filters.is-open {
    transform: translateX(0);
  }
}

@media (max-width: 720px) {
  .hx-catalog-hero__inner {
    grid-template-columns: 1fr;
    grid-template-areas: "media" "copy";
  }

  .hx-category-strip {
    justify-content: flex-start;
  }
}

/* WordPress content and navigation. */
.entry-content,
.comment-content,
.widget,
.footer-widget,
.navigation,
.post-navigation,
.pagination {
  text-align: right;
}

.entry-content ul,
.entry-content ol,
.comment-content ul,
.comment-content ol {
  padding-right: 1.2rem;
  padding-left: 0;
}

/* WooCommerce fallbacks for installations whose locale is not set to Persian. */
.woocommerce,
.woocommerce-page,
.woocommerce form,
.woocommerce table.shop_table,
.woocommerce-checkout #payment ul.payment_methods li {
  text-align: right;
}

.woocommerce table.shop_table th,
.woocommerce table.shop_table td {
  text-align: right;
}

.woocommerce .woocommerce-result-count {
  float: right;
}

.woocommerce .woocommerce-ordering {
  float: left;
}

.woocommerce div.product form.cart div.quantity,
.woocommerce div.product form.cart .button {
  float: right;
}

.woocommerce div.product form.cart div.quantity {
  margin: 0 0 0 0.5rem;
}

.woocommerce .quantity .qty {
  direction: ltr;
  text-align: center;
}

.woocommerce .woocommerce-error .button,
.woocommerce .woocommerce-info .button,
.woocommerce .woocommerce-message .button {
  float: left;
}

.woocommerce-account .woocommerce-MyAccount-navigation {
  float: right;
}

.woocommerce-account .woocommerce-MyAccount-content {
  float: left;
}

.woocommerce-checkout #payment div.payment_box::before {
  right: 0;
  left: auto;
  margin: -1em 2em 0 0;
}

@media (max-width: 768px) {
  .woocommerce-account .woocommerce-MyAccount-navigation,
  .woocommerce-account .woocommerce-MyAccount-content {
    float: none;
    width: 100%;
  }
}
