/**
 * بِسَاط (Bisaat) — Base & Reset Styles
 * Native RTL Arabic SaaS Platform
 * Kajabi-Aligned High-Contrast Architecture
 */

/* ==========================================================================
   0. Custom Font Faces (Thmanyah Sans — ثمانية سانس)
   ========================================================================== */

@font-face {
  font-family: 'ThmanyahSans';
  src: url('../fonts/thmanyahsans-Light.otf') format('opentype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'ThmanyahSans';
  src: url('../fonts/thmanyahsans-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'ThmanyahSans';
  src: url('../fonts/thmanyahsans-Medium.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'ThmanyahSans';
  src: url('../fonts/thmanyahsans-Bold.otf') format('opentype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'ThmanyahSans';
  src: url('../fonts/thmanyahsans-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'ThmanyahSans';
  src: url('../fonts/thmanyahsans-Black.otf') format('opentype');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'ThmanyahSans';
  src: url('../fonts/thmanyahsans-Black.otf') format('opentype');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

/* Also support 'thmanyahsans' & 'Thmanyah Sans' aliases */
@font-face {
  font-family: 'thmanyahsans';
  src: url('../fonts/thmanyahsans-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'thmanyahsans';
  src: url('../fonts/thmanyahsans-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Thmanyah Sans';
  src: url('../fonts/thmanyahsans-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Thmanyah Sans';
  src: url('../fonts/thmanyahsans-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ==========================================================================
   1. CSS Reset & Base Rules
   ========================================================================== */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -moz-tab-size: 4;
  tab-size: 4;
  background-color: var(--bg-dark-base);
}

section[id],
article[id],
main[id] {
  scroll-margin-top: 80px;
}

#hero,
#top,
#main {
  scroll-margin-top: 0;
}

body {
  font-family: "ThmanyahSans", sans-serif;
  font-feature-settings: "kern", "liga", "ss01";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  font-size: var(--font-body);
  line-height: var(--leading-normal);
  font-weight: var(--font-weight-regular);
  color: var(--text-dark-primary);
  background-color: var(--bg-dark-base);
  direction: rtl;
  text-align: right;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button,
input,
optgroup,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
}

/* ==========================================================================
   2. Selection & Scrollbars
   ========================================================================== */

::selection {
  background-color: rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
}

::-moz-selection {
  background-color: rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
}

/* Custom modern scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark-base);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ==========================================================================
   3. Accessibility & Focus States (§21)
   ========================================================================== */

/* Skip Link */
.skip-link {
  position: absolute;
  top: -100px;
  inset-inline-start: var(--space-4);
  background-color: var(--color-white);
  color: var(--color-black);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-pill);
  font-weight: var(--font-weight-bold);
  text-decoration: none;
  z-index: var(--z-tooltip);
  transition: top var(--duration-fast) var(--ease-out);
  box-shadow: var(--shadow-lg);
}

.skip-link:focus {
  top: var(--space-4);
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

/* Accessible Focus Ring */
:focus-visible {
  outline: 2px solid var(--color-white);
  outline-offset: 3px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--color-white);
  outline-offset: 3px;
}

/* ==========================================================================
   4. Typography Elements
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
  color: inherit;
  font-weight: var(--font-weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: -0.02em;
}

h1 {
  font-size: var(--font-display-1);
}

h2 {
  font-size: var(--font-display-2);
}

h3 {
  font-size: var(--font-h3);
  line-height: var(--leading-snug);
}

h4 {
  font-size: var(--font-h4);
  line-height: var(--leading-snug);
}

h5 {
  font-size: var(--font-h5);
}

p {
  line-height: var(--leading-normal);
  margin-bottom: 0;
}

p.lead {
  font-size: var(--font-body-lg);
  line-height: var(--leading-snug);
}

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

ul, ol {
  list-style: none;
}

img, svg, picture, video {
  max-width: 100%;
  display: block;
  height: auto;
}

/* Code & Numbers */
code, kbd, samp, pre, .font-mono {
  font-family: var(--font-family-mono);
  direction: ltr;
  text-align: left;
}

/* Screen Reader Only Utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ==========================================================================
   5. Section Theme & Layout Utilities
   ========================================================================== */

.container {
  width: 100%;
  max-width: var(--container-max-width);
  margin-inline: auto;
  padding-inline: var(--container-padding);
}

.container-wide {
  width: 100%;
  max-width: var(--container-wide-width);
  margin-inline: auto;
  padding-inline: var(--container-padding);
}

.container-narrow {
  width: 100%;
  max-width: var(--container-narrow-width);
  margin-inline: auto;
  padding-inline: var(--container-padding);
}

/* Section Wrappers */
.section-wrapper {
  padding-block: var(--space-12);
  position: relative;
}

@media (min-width: 768px) {
  .section-wrapper {
    padding-block: var(--space-14);
  }
}

@media (min-width: 1024px) {
  .section-wrapper {
    padding-block: var(--space-16);
  }
}

/* Theme Switching for Sections (Kajabi Pattern) */
.section-dark {
  background-color: var(--bg-dark-base);
  color: var(--text-dark-primary);
}

.section-dark p {
  color: var(--text-dark-secondary);
}

.section-light {
  background-color: var(--bg-light-base);
  color: var(--text-light-primary);
}

.section-light h1,
.section-light h2,
.section-light h3,
.section-light h4 {
  color: var(--text-light-primary);
}

.section-light p {
  color: var(--text-light-secondary);
}

.text-center {
  text-align: center;
}

.text-start {
  text-align: right;
}

/* ==========================================================================
   6. Motion Preferences
   ========================================================================== */

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