/* Asia Core Group — Base / Reset */

/* =========================================================
   Bootstrap 3 → 5 compatibility layer
   The grid classes (col-md-*, row) are unchanged in BS5, but:
   1) BS5 container max-widths (1140/1320) differ from the BS3 ones the
      design was built on (1170) — restore the original dimensions.
   2) .img-responsive was renamed .img-fluid; single-product.php (out of
      scope for edits) still uses the old class, so shim it globally.
   ========================================================= */
@media (min-width: 768px) {
  .container { max-width: 750px; }
}
@media (min-width: 992px) {
  .container { max-width: 970px; }
}
@media (min-width: 1200px) {
  .container { max-width: 1170px; }
}

.img-responsive {
  max-width: 100%;
  height: auto;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  /* Fixed/sticky header (~96px) — anchor jumps must not land under it */
  scroll-padding-top: 110px;
}

body {
  margin: 0;
  padding: 0;
  color: var(--acg-text);
  font: 400 var(--text-base) / var(--leading-relaxed) var(--font-primary);
  background: var(--acg-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  /* Safety net: long URLs/emails and unbroken strings must never
     blow out narrow viewports */
  overflow-wrap: break-word;
  /* Override Bootstrap's --bs-body-font-family */
  --bs-body-font-family: var(--font-primary);
}

/* Wide tables in user content scroll instead of overflowing */
.content-page table,
.entry-content table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

[dir="rtl"] body {
  font-family: var(--font-arabic);
  text-align: right;
}

/* Global font enforcement — override any Bootstrap or wp_editor inline fonts */
body, body *:not(i):not(span[class*="fa"]):not(span[class*="glyph"]) {
  font-family: var(--font-primary) !important;
}
[dir="rtl"] body, [dir="rtl"] body *:not(i):not(span[class*="fa"]):not(span[class*="glyph"]) {
  font-family: var(--font-arabic) !important;
}
/* Preserve FontAwesome icons (rendered via ::before/::after) */
i[class*="fa"], i.fa, i.fas, i.far, i.fab, i.fal, i.fad,
span[class*="fa-"], span.fa, span.fas, span.far, span.fab,
[class*="fa"]::before, [class*="fa"]::after,
[class*="fa-"]::before, [class*="fa-"]::after,
.glyphicon, .glyphicon::before, .glyphicon::after {
  font-family: FontAwesome !important;
}

h1, h2, h3, h4, h5, h6 {
  font-family: inherit;
  color: var(--acg-heading);
  margin: 0 0 var(--space-4);
  line-height: var(--leading-tight);
  font-weight: 700;
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-base); }
h6 { font-size: var(--text-sm); }

p {
  margin: 0 0 var(--space-5);
  line-height: var(--leading-relaxed);
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--acg-red);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover, a:focus {
  color: var(--acg-red-hover);
  text-decoration: none;
}

a:focus-visible {
  outline: 2px solid var(--acg-red);
  outline-offset: 2px;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  margin: 0 0 var(--space-5);
  padding-inline-start: 20px;
}

li {
  line-height: var(--leading-relaxed);
}

button {
  font-family: inherit;
}

.color-red {
  color: var(--acg-red);
}

.ltr-text {
  direction: ltr;
  unicode-bidi: embed;
}

/* Selection */
::selection {
  color: var(--acg-white);
  background: var(--acg-red);
}

.clearfix::after {
  content: ".";
  display: block;
  height: 0;
  clear: both;
  visibility: hidden;
}

/* State helpers — toggled via JS instead of inline styles */
.is-hidden {
  display: none !important;
}

.is-visible {
  display: block;
}

.is-active {
  /* intentionally generic; specific components define display */
}

/* Screen-reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 768px) {
  h1 { font-size: var(--text-4xl); }
  h2 { font-size: var(--text-3xl); }
  h3 { font-size: var(--text-xl); }
}

@media (min-width: 992px) {
  h1 { font-size: var(--text-5xl); }
  h2 { font-size: var(--text-3xl); }
}


@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
