/*
 * base.css
 * Base / Reset / Global Styles — Bnood Industrial V1
 *
 * Source of truth: docs/02_UX_UI/DESIGN_SYSTEM.md, docs/02_UX_UI/UI_TOKENS.md
 * Task: B02-T02 — Create Base CSS And Layout CSS
 * Batch: B02 — UI Foundation & Shared Layouts
 *
 * Rules:
 * - All values must reference tokens from tokens.css.
 * - No Tailwind, Bootstrap, Sass, or CSS framework.
 * - No page-specific or admin-specific styles here.
 * - No fake content.
 */

/* =========================
   Box Model Reset
========================= */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* =========================
   Root / HTML
========================= */

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

/* RTL — Arabic */
html[lang="ar"],
[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

/* LTR — English */
html[lang="en"],
[dir="ltr"] {
  direction: ltr;
  text-align: left;
}

/* =========================
   Body
========================= */

body {
  font-family: var(--font-family-base);
  font-size: var(--font-body);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-body);
  color: var(--color-text-main);
  background-color: var(--color-bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* =========================
   Headings
========================= */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-family-base);
  font-weight: var(--font-weight-extrabold);
  line-height: var(--line-heading);
  color: var(--color-text-heading);
  margin-bottom: 0;
}

h1 { font-size: var(--font-page-title);      letter-spacing: var(--tracking-title);   }
h2 { font-size: var(--font-section-title);   letter-spacing: var(--tracking-section); }
h3 { font-size: var(--font-subsection-title); }
h4 { font-size: var(--font-card-title);      }
h5 { font-size: var(--font-body-lg);         font-weight: var(--font-weight-bold);  }
h6 { font-size: var(--font-body);            font-weight: var(--font-weight-bold);  }

@media (max-width: 767px) {
  h1 { font-size: var(--font-page-title-mobile);    }
  h2 { font-size: var(--font-section-title-mobile); }
  h4 { font-size: var(--font-card-title-mobile);    }
}

/* =========================
   Paragraphs
========================= */

p {
  font-size: var(--font-body);
  line-height: var(--line-body);
  color: var(--color-text-secondary);
  margin-bottom: 0;
}

/* =========================
   Links
========================= */

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-standard);
}

a:hover {
  color: var(--color-primary-900);
}

a:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-6);
}

/* =========================
   Lists
========================= */

ul,
ol {
  list-style: none;
}

/* =========================
   Images & Media
========================= */

img,
video,
picture {
  display: block;
  max-width: 100%;
  height: auto;
}

img {
  object-fit: cover;
}

/* =========================
   Form Element Resets
========================= */

button,
input,
optgroup,
select,
textarea {
  font-family: var(--font-family-base);
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  background: transparent;
  border: none;
}

button {
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

input,
textarea,
select {
  outline: none;
}

textarea {
  resize: vertical;
}

/* =========================
   Tables
========================= */

table {
  border-collapse: collapse;
  width: 100%;
}

th,
td {
  text-align: start;
  padding: 0;
}

/* =========================
   Horizontal Rule
========================= */

hr {
  border: none;
  border-top: var(--border-soft);
  margin: 0;
}

/* =========================
   Code / Pre
========================= */

code,
kbd,
pre,
samp {
  font-family: var(--font-family-mono);
  font-size: var(--font-body-sm);
  letter-spacing: var(--tracking-code);
}

/* =========================
   Focus Visible (global fallback)
========================= */

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* =========================
   Selection
========================= */

::selection {
  background-color: var(--color-accent-200);
  color: var(--color-primary-900);
}

/* =========================
   Scrollbar (Webkit)
========================= */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-muted);
}

::-webkit-scrollbar-thumb {
  background: var(--color-neutral-300);
  border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-neutral-400);
}

/* =========================
   Product Code (direction-invariant)
========================= */

.product-code {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-flex;
  font-size: 13px;
  line-height: 1.4;
  font-weight: var(--font-weight-extrabold);
  letter-spacing: var(--tracking-code);
  color: var(--color-primary-900);
}
