/*
Theme Name: Atelier Store
Theme URI: https://example.com/atelier-store
Author: Your Store
Description: A warm, editorial WooCommerce theme for modern clothing and lifestyle shops. Sand and olive palette, Fraunces display type, magazine-style product grid.
Version: 1.0.0
Requires PHP: 7.4
Text Domain: atelier-store
*/

/* ---------- Tokens ---------- */
:root {
  --sand: #EDE6D9;
  --sand-dark: #E1D8C6;
  --ink: #23281F;
  --leather: #8B5E3C;
  --olive: #4A5D45;
  --white: #FFFFFF;
  --line: rgba(35, 40, 31, 0.16);
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Public Sans', -apple-system, sans-serif;
  --font-fa: 'Vazirmatn', Tahoma, sans-serif;
  --red: #D64545;
  --red-dark: #B93636;
  --maxw: 1180px;
}

/* RTL pages (Persian shop content) switch to Vazirmatn and flip direction */
.rtl body,
body.rtl {
  font-family: var(--font-fa);
  direction: rtl;
}
.rtl .site-header .wrap,
.rtl .header-actions,
.rtl .value-strip li,
.rtl .hero .wrap { direction: rtl; }

/* ---------- Reset ---------- */
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--sand);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; cursor: pointer; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 32px; }

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--sand);
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 22px;
  padding-bottom: 22px;
}
.site-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.primary-nav ul { display: flex; gap: 34px; }
.primary-nav a {
  font-size: 15px;
  padding-bottom: 4px;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.primary-nav a:hover { border-color: var(--leather); }
.header-actions { display: flex; align-items: center; gap: 22px; }
.header-actions a { font-size: 14px; }
.cart-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  margin-left: 6px;
  background: var(--leather);
  color: var(--white);
  border-radius: 999px;
  font-size: 11px;
}

/* ---------- Hero ---------- */
.hero {
  border-bottom: 1px solid var(--line);
}
.hero .wrap {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 56px;
  padding-top: 64px;
  padding-bottom: 64px;
}
.hero-eyebrow {
  color: var(--olive);
  font-size: 14px;
  margin: 0 0 18px;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: 58px;
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 24px;
  max-width: 12ch;
}
.hero p {
  max-width: 46ch;
  color: rgba(35,40,31,0.78);
  margin: 0 0 30px;
}
.btn {
  display: inline-block;
  background: var(--ink);
  color: var(--sand);
  padding: 14px 26px;
  font-size: 15px;
  border: 1px solid var(--ink);
  transition: background 0.2s ease, color 0.2s ease;
}
.btn:hover { background: transparent; color: var(--ink); }
.btn-outline {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
}
.btn-outline:hover { background: var(--ink); color: var(--sand); }
.hero-figure {
  aspect-ratio: 4/5;
  background: var(--sand-dark) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10"><rect width="10" height="10" fill="%23E1D8C6"/></svg>');
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
}
.hero-figure::after {
  content: 'New arrivals, cut for autumn';
  position: absolute;
  left: 20px;
  bottom: 20px;
  right: 20px;
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--ink);
  background: rgba(237,230,217,0.9);
  padding: 12px 16px;
}

/* ---------- Section heading ---------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
  margin-bottom: 36px;
}
.section-head h2 {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 600;
  margin: 0;
}
.section-head a { font-size: 14px; border-bottom: 1px solid var(--ink); }

section.block { padding: 64px 0; }
section.block + section.block { border-top: 1px solid var(--line); }

/* ---------- Product grid ---------- */
ul.products {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 40px 28px !important;
}
@media (max-width: 900px) {
  ul.products { grid-template-columns: repeat(2, 1fr) !important; }
}
ul.products li.product {
  list-style: none;
  margin: 0 !important;
}
ul.products li.product a { display: block; }
ul.products li.product img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  background: var(--sand-dark);
  margin-bottom: 14px;
}
ul.products li.product h2,
ul.products li.product .woocommerce-loop-product__title {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
}
ul.products li.product .price {
  font-size: 14px;
  color: var(--leather);
}
ul.products li.product .price del { color: rgba(35,40,31,0.4); }
ul.products li.product .button {
  margin-top: 10px;
  display: inline-block;
  font-size: 13px;
  border-bottom: 1px solid var(--ink);
  background: none;
  padding: 0;
  color: var(--ink);
}
ul.products li.product .onsale {
  position: static;
  display: inline-block;
  background: var(--olive);
  color: var(--white);
  font-size: 11px;
  padding: 3px 8px;
  margin-bottom: 8px;
  border-radius: 0;
  min-height: 0;
  line-height: 1.4;
}

/* ---------- Single product ---------- */
.single-product .summary { max-width: 520px; }
.single-product .product_title {
  font-family: var(--font-display);
  font-size: 36px;
  margin: 0 0 12px;
}
.single-product .price {
  font-size: 20px;
  color: var(--leather);
  margin-bottom: 20px;
}
.single-product .woocommerce-product-details__short-description {
  color: rgba(35,40,31,0.78);
  margin-bottom: 24px;
}
.single-product .cart button.single_add_to_cart_button {
  background: var(--ink);
  color: var(--sand);
  border: 1px solid var(--ink);
  padding: 14px 30px;
  font-size: 15px;
}
.single-product .cart button.single_add_to_cart_button:hover {
  background: transparent;
  color: var(--ink);
}

/* ---------- Value strip ---------- */
.value-strip ul {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}
.value-strip li {
  border-left: 1px solid var(--line);
  padding-left: 20px;
}
.value-strip strong {
  display: block;
  font-family: var(--font-display);
  font-size: 20px;
  margin-bottom: 6px;
}
.value-strip span { color: rgba(35,40,31,0.7); font-size: 14px; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 56px 0 40px;
  margin-top: 40px;
}
.site-footer .wrap {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 40px;
}
.site-footer h3 {
  font-family: var(--font-display);
  font-size: 18px;
  margin: 0 0 14px;
}
.site-footer p { color: rgba(35,40,31,0.7); font-size: 14px; max-width: 32ch; }
.site-footer li { margin-bottom: 8px; font-size: 14px; }
.site-footer .credit {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding-top: 20px;
  font-size: 13px;
  color: rgba(35,40,31,0.55);
}

/* ---------- Cart / checkout tidy-up ---------- */
.woocommerce table.shop_table { border: 1px solid var(--line); border-collapse: collapse; }
.woocommerce table.shop_table th,
.woocommerce table.shop_table td { border-bottom: 1px solid var(--line); padding: 12px; }
.woocommerce-message, .woocommerce-info {
  border-top-color: var(--olive) !important;
  background: var(--white);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero .wrap { grid-template-columns: 1fr; padding-top: 40px; }
  .hero h1 { font-size: 40px; max-width: none; }
  .primary-nav { display: none; }
  .value-strip ul { grid-template-columns: 1fr; }
  .site-footer .wrap { grid-template-columns: 1fr 1fr; }
}

/* Focus visibility */
a:focus-visible, button:focus-visible { outline: 2px solid var(--leather); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ================= Shop page (sidebar + card grid) ================= */

.shop-page { padding-top: 40px; padding-bottom: 72px; }
.shop-page-head { margin-bottom: 28px; }
.shop-page-head h1 {
  font-family: var(--font-display);
  font-size: 30px;
  margin: 0;
}

.shop-layout {
  display: grid;
  grid-template-columns: 1fr 280px; /* content, then sidebar on the right in RTL source order */
  gap: 36px;
  align-items: start;
}
.rtl .shop-layout { direction: rtl; }

.shop-sidebar {
  background: var(--white);
  border: 1px solid var(--line);
  padding: 24px;
  order: 2;
}
.shop-content { order: 1; min-width: 0; }

.shop-widget { margin-bottom: 28px; }
.shop-widget:last-child { margin-bottom: 0; }
.shop-widget-title {
  font-family: var(--font-fa);
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.shop-widget ul li { margin-bottom: 10px; font-size: 14px; }
.shop-widget ul li a { display: flex; justify-content: space-between; color: var(--ink); }
.shop-widget ul li a:hover { color: var(--red); }
.shop-sidebar-hint { font-size: 12px; color: rgba(35,40,31,0.55); line-height: 1.7; }

/* WooCommerce's built-in Filter by Price widget, restyled */
.widget_price_filter .price_slider_amount { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-size: 13px; }
.widget_price_filter .price_slider_amount .button {
  background: var(--ink); color: var(--white); border: none;
  padding: 8px 16px; font-size: 13px; border-radius: 0;
}
.widget_price_filter .ui-slider { background: var(--line); height: 4px; border: none; position: relative; margin: 10px 4px 0; }
.widget_price_filter .ui-slider-range { background: var(--red); height: 4px; position: absolute; }
.widget_price_filter .ui-slider-handle {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--red); border: 2px solid var(--white);
  box-shadow: 0 0 0 1px var(--red);
  position: absolute; top: -5px; margin-inline-start: -7px; cursor: pointer;
}

/* Product tag / category pill widgets */
.widget_product_tag_cloud .tagcloud a {
  display: inline-block; font-size: 12px !important;
  border: 1px solid var(--line); padding: 5px 12px; margin: 0 6px 8px 0;
  color: var(--ink);
}
.widget_product_tag_cloud .tagcloud a:hover { border-color: var(--red); color: var(--red); }

.shop-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  background: var(--white);
  padding: 14px 18px;
  margin-bottom: 28px;
  font-size: 13px;
  color: rgba(35,40,31,0.7);
}
.shop-toolbar .woocommerce-ordering select {
  border: 1px solid var(--line);
  background: var(--white);
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
}

ul.atelier-product-grid.products {
  grid-template-columns: repeat(3, 1fr) !important;
}
@media (max-width: 1000px) {
  ul.atelier-product-grid.products { grid-template-columns: repeat(2, 1fr) !important; }
  .shop-layout { grid-template-columns: 1fr; }
  .shop-sidebar { order: 1; }
  .shop-content { order: 2; }
}

.atelier-card {
  background: var(--white);
  border: 1px solid var(--line);
  height: 100%;
  display: flex;
  flex-direction: column;
}
.atelier-card-media { position: relative; display: block; }
.atelier-card-media img { aspect-ratio: 1/1; object-fit: cover; width: 100%; margin: 0; }
.atelier-badge {
  position: absolute; top: 12px; inset-inline-end: 12px;
  background: var(--red); color: var(--white);
  font-size: 11px; padding: 4px 10px; z-index: 2;
}
.atelier-card-body { padding: 16px 18px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.atelier-card-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.atelier-card-price { font-size: 15px; color: var(--red-dark); font-weight: 600; }
.atelier-card-price del { color: rgba(35,40,31,0.4); font-weight: 400; margin-inline-end: 6px; }
.atelier-card-actions { margin-top: auto; display: flex; gap: 8px; padding-top: 6px; }
.atelier-card-actions .btn-ghost,
.atelier-card-actions a.button,
.atelier-card-actions a.add_to_cart_button {
  flex: 1;
  text-align: center;
  font-size: 13px;
  padding: 10px 8px;
  border: 1px solid var(--red);
}
.atelier-card-actions .btn-ghost { color: var(--red); background: transparent; }
.atelier-card-actions .btn-ghost:hover { background: var(--red); color: var(--white); }
.atelier-card-actions a.button,
.atelier-card-actions a.add_to_cart_button {
  background: var(--red);
  color: var(--white);
}
.atelier-card-actions a.button:hover,
.atelier-card-actions a.add_to_cart_button:hover {
  background: var(--red-dark);
  border-color: var(--red-dark);
}

.shop-pagination { margin-top: 40px; text-align: center; }
.shop-pagination .page-numbers {
  display: inline-block; padding: 8px 14px; margin: 0 3px;
  border: 1px solid var(--line); font-size: 13px;
}
.shop-pagination .page-numbers.current { background: var(--ink); color: var(--white); border-color: var(--ink); }

/* ================= Easy Digital Downloads compatibility ================= */
.atelier-card-actions form.edd_download_purchase_form { flex: 1; margin: 0; }
.atelier-card-actions .edd-add-to-cart,
.atelier-card-actions a.edd-add-to-cart {
  width: 100%;
  background: var(--red);
  color: var(--white);
  border: 1px solid var(--red);
  font-size: 13px;
  padding: 10px 8px;
  border-radius: 0;
}
.atelier-card-actions .edd-add-to-cart:hover { background: var(--red-dark); border-color: var(--red-dark); }
.atelier-card-price .edd_price { color: var(--red-dark); font-weight: 600; }
.single-download-layout .cart form.edd_download_purchase_form .edd-add-to-cart {
  background: var(--ink); color: var(--sand); border: 1px solid var(--ink);
  padding: 14px 30px; font-size: 15px; border-radius: 0;
}
.single-download-layout .cart form.edd_download_purchase_form .edd-add-to-cart:hover { background: transparent; color: var(--ink); }
