/*
 * Theme tokens, sampled from the lmarmagazine.com homepage.
 * Layout uses logical properties (inline-start/end) so it mirrors
 * correctly between RTL (Dari) and LTR (English).
 */
:root {
  --navy: #063c5c;       /* main nav bar, logo */
  --cyan: #01a2cb;       /* active nav item, primary buttons */
  --red: #f05555;        /* "new" ticker tag, badges */
  --red-deep: #d73a38;   /* section headings + underline */
  --ink: #1d1d1d;
  --muted: #6f6f6f;
  --line: #e7e7e7;
  --box: #ffffff;        /* boxed content area */
  --page: #f0f0f0;       /* outer background */

  --font: "Vazirmatn", Tahoma, system-ui, sans-serif;
  --wrap: 1200px;
  --gutter: 16px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  line-height: 1.7;
  /* Soft circle pattern, like the homepage background. */
  background-color: var(--page);
  background-image: repeating-radial-gradient(circle at 0 0, transparent 0 18px, rgba(0, 0, 0, 0.025) 18px 19px);
  background-size: 80px 80px;
}

a { color: inherit; }
img { max-width: 100%; display: block; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* Boxed layout, like the homepage */
.site {
  max-width: var(--wrap);
  margin-inline: auto;
  background: var(--box);
  min-height: 100vh;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
}

/* Header */
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 40px;
}
.logo { display: block; flex-shrink: 0; }
.logo img { height: 84px; width: auto; }

.cart-toggle {
  font: inherit;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--navy);
  color: #fff;
  border: 0;
  border-radius: 4px;
  padding: 10px 16px;
  cursor: pointer;
}
.cart-toggle:hover { background: var(--cyan); }
.cart-count {
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  min-width: 22px;
  padding: 0 6px;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
}

/* Nav bar */
.main-nav {
  display: flex;
  align-items: stretch;
  background: var(--navy);
  padding-inline: 40px;
  min-height: 64px;
  overflow-x: auto;
}
.main-nav a, .lang-toggle {
  display: flex;
  align-items: center;
  padding-inline: 18px;
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
  position: relative;
}
.main-nav a:hover { background: rgba(255, 255, 255, 0.08); }
.main-nav a.is-active { background: var(--cyan); }
.main-nav a.is-active::after {
  content: "";
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 26px;
  height: 2px;
  background: #fff;
}
.lang-toggle {
  margin-inline-start: auto;
  font: inherit;
  font-weight: 500;
  background: none;
  border: 0;
  cursor: pointer;
  opacity: 0.85;
}
.lang-toggle:hover { opacity: 1; }

/* Date + "new" strip */
.ticker {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-inline: 40px;
  min-height: 52px;
  font-size: 0.9rem;
  box-shadow: 0 6px 12px -8px rgba(0, 0, 0, 0.12);
}
.ticker-tag {
  background: var(--red);
  color: #fff;
  align-self: stretch;
  display: flex;
  align-items: center;
  padding-inline: 14px;
}

/* Content */
.content { padding: 40px; }

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 32px;
  padding: 40px;
  margin-bottom: 40px;
  color: #fff;
  background: linear-gradient(to left, var(--navy), #0a5a86);
}
[dir="ltr"] .hero { background: linear-gradient(to right, var(--navy), #0a5a86); }
.eyebrow { margin: 0 0 8px; color: var(--cyan); font-weight: 700; }
.hero h1 { margin: 0 0 12px; font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.3; font-weight: 800; }
.lede { margin: 0 0 20px; opacity: 0.9; max-width: 44ch; }
.hero-cover { width: 180px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35); transform: rotate(-3deg); }
[dir="ltr"] .hero-cover { transform: rotate(3deg); }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 32px;
  align-items: start;
}

/* Section heading: red title with a thick red underline over a thin grey rule */
.section-head { border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.section-head h2 {
  display: inline-block;
  margin: 0 0 -1px;
  padding-bottom: 10px;
  color: var(--red-deep);
  font-size: 1.4rem;
  font-weight: 700;
  border-bottom: 4px solid var(--red-deep);
}

/* Products */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: 24px;
}
.product { display: flex; flex-direction: column; }
.product-cover { position: relative; aspect-ratio: 3 / 4; background: var(--page); overflow: hidden; }
.product-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s ease; }
.product:hover .product-cover img { transform: scale(1.04); }
.badge {
  position: absolute;
  /* Physical "left" on purpose: it sits on the cover art, which doesn't flip. */
  top: 12px;
  left: 12px;
  background: var(--red);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 2px 12px;
  border-radius: 999px;
}
.product-body { display: flex; flex-direction: column; gap: 4px; padding-top: 14px; flex: 1; }
.product-title { margin: 0; font-size: 1.2rem; font-weight: 700; }
.product-blurb { margin: 0 0 12px; color: var(--muted); font-size: 0.92rem; }
.product-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.price { font-weight: 800; font-size: 1.15rem; color: var(--navy); }

/* Sidebar widget, styled like the homepage's "most viewed" box */
.widget { border: 1px solid var(--line); padding: 24px; }
.widget-title {
  margin: 0 0 16px;
  padding-bottom: 10px;
  font-size: 1.15rem;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.widget-title::after {
  content: "";
  position: absolute;
  bottom: -1px;
  inset-inline-end: 0;
  width: 100px;
  height: 3px;
  background: var(--ink);
}
.widget-item + .widget-item { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; }
.widget-item h3 { margin: 0 0 4px; font-size: 1rem; }
.widget-item p { margin: 0; color: var(--muted); font-size: 0.9rem; }

/* Buttons */
.btn {
  font: inherit;
  font-weight: 700;
  border: 0;
  border-radius: 4px;
  padding: 9px 18px;
  cursor: pointer;
  background: var(--navy);
  color: #fff;
  text-decoration: none;
  display: inline-block;
  transition: background 0.15s ease;
}
.btn:hover:not(:disabled) { background: var(--cyan); }
.btn-primary { background: var(--cyan); }
.btn-primary:hover:not(:disabled) { background: var(--red); }
.btn:disabled { background: #bdbdbd; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn:focus-visible, .cart-toggle:focus-visible, .main-nav a:focus-visible,
.lang-toggle:focus-visible, .icon-btn:focus-visible, .qty button:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 2px;
}

/* Cart drawer: slides in from the inline-start side (right in RTL). */
.cart { position: fixed; inset: 0; z-index: 50; }
.cart[hidden] { display: none; }
.cart-backdrop { position: absolute; inset: 0; background: rgba(6, 60, 92, 0.55); }
.cart-panel {
  position: absolute;
  top: 0;
  bottom: 0;
  inset-inline-start: 0;
  width: min(400px, 100%);
  background: #fff;
  display: flex;
  flex-direction: column;
  padding: 24px var(--gutter);
}
.cart-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 4px solid var(--navy); padding-bottom: 10px; }
.cart-head h2 { margin: 0; font-size: 1.3rem; color: var(--navy); }
.icon-btn { font-size: 1.8rem; line-height: 1; background: none; border: 0; cursor: pointer; color: var(--ink); }
.cart-items { list-style: none; margin: 12px 0; padding: 0; overflow-y: auto; flex: 1; }
.cart-item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  align-items: center;
  padding-block: 14px;
  border-bottom: 1px solid var(--line);
}
.cart-item img { width: 56px; aspect-ratio: 3 / 4; object-fit: cover; }
.cart-item-title { font-weight: 700; margin: 0; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); margin-top: 4px; }
.qty button { background: none; border: 0; width: 30px; height: 30px; cursor: pointer; font-size: 1rem; }
.qty span { min-width: 24px; text-align: center; }
.cart-empty { margin: 20px 0; }
.cart-foot { border-top: 1px solid var(--line); padding-top: 16px; }
.cart-total { display: flex; justify-content: space-between; font-size: 1.1rem; }
.cart-error { color: var(--red-deep); min-height: 1.2em; margin: 8px 0; font-size: 0.9rem; }

/* Footer */
.site-footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--navy);
  color: #fff;
  padding: 20px 40px;
  font-size: 0.9rem;
}
.site-footer .muted { color: rgba(255, 255, 255, 0.65); }

/* Success page */
.status-page { text-align: center; padding-block: 80px; }
.status-page h1 { color: var(--navy); font-size: clamp(1.7rem, 4vw, 2.4rem); margin: 0 0 12px; }
.status-page .eyebrow { color: var(--red-deep); }
.status-page p { max-width: 46ch; margin: 0 auto 24px; color: var(--muted); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .header-row, .main-nav, .ticker, .site-footer { padding-inline: var(--gutter); }
  .content { padding: 24px var(--gutter); }
  .ticker-date { display: none; }
  .ticker { min-height: 44px; }
  .hero { grid-template-columns: 1fr; padding: 28px 20px; }
  .hero-cover { display: none; }
  .main-nav a, .lang-toggle { padding-inline: 12px; }
  .cart-toggle [data-i18n] { display: none; }
  .logo img { height: 56px; }
}

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