/* ==========================================================================
   LAYOUT.CSS — Layout System & Structural Components
   Containers, grids, section scaffolding, and utility classes.
   Mobile-first with RTL as the default direction.
   ========================================================================== */

/* -----------------------------------------------------------------------
   SECTION SHELL — Main Content Container
   Centers content with consistent max-width and padding.
   ----------------------------------------------------------------------- */

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

/* Narrow variant for text-heavy sections */
.section-shell--narrow {
  max-width: var(--container-md);
}

/* Wide variant for full-bleed adjacent content */
.section-shell--wide {
  max-width: var(--container-2xl);
}

/* -----------------------------------------------------------------------
   SECTION — Base Section Styles
   Consistent vertical rhythm and positioning context.
   ----------------------------------------------------------------------- */

.section {
  position: relative;
  padding-block: var(--section-padding-block);
  overflow: hidden;
  background-color: var(--bg-primary); /* Ensures sections hide sticky ones beneath them */
  z-index: 0; /* Creates an isolated stacking context for every section */
}

/* Alternate section backgrounds for visual rhythm */
.section--alt {
  background-color: var(--bg-secondary);
}

/* Section with no bottom padding (when stacking tightly) */
.section--flush-bottom {
  padding-block-end: 0;
}

/* Section with reduced padding */
.section--compact {
  padding-block: clamp(2rem, 6vw, 4rem);
}

/* -----------------------------------------------------------------------
   SPLIT LAYOUT — Two-Column Grid
   Used for hero-like and about-like sections with text + visual.
   ----------------------------------------------------------------------- */

.split-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
  align-items: center;
}

/* -----------------------------------------------------------------------
   SECTION HEADING — Centered Heading Group
   Used at the top of most sections for title + subtitle.
   ----------------------------------------------------------------------- */

.section-heading {
  text-align: center;
  margin-block-end: var(--space-2xl);
  max-width: 700px;
  margin-inline: auto;
}

.section-heading h2 {
  font-size: var(--fs-h2);
  font-weight: var(--fw-bold);
  line-height: var(--lh-heading);
  margin-block-end: var(--space-sm);
}

.section-heading p {
  font-size: var(--fs-body);
  color: var(--text-secondary);
  max-width: 55ch;
  margin-inline: auto;
  line-height: var(--lh-body);
}

/* -----------------------------------------------------------------------
   SECTION KICKER — Numbered Label with Decorative Line
   Appears above section headings: "01 — الخدمات"
   ----------------------------------------------------------------------- */

.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--ff-accent);
  font-size: var(--fs-eyebrow);
  font-weight: var(--fw-medium);
  color: var(--green-secondary);
  text-transform: uppercase;
  letter-spacing: var(--ls-eyebrow);
  margin-block-end: var(--space-md);
}

/* The numbered portion */
.section-kicker span {
  font-family: var(--ff-accent);
  font-weight: var(--fw-semibold);
  color: var(--green-secondary);
}

/* Decorative line after the kicker */
.section-kicker::after {
  content: '';
  display: block;
  width: 40px;
  height: 1px;
  background: var(--green-gradient);
  flex-shrink: 0;
}

/* -----------------------------------------------------------------------
   RESPONSIVE BREAKPOINTS
   Mobile-first: min-width queries scale up.
   ----------------------------------------------------------------------- */

/* Small phones → Larger phones (480px) */
@media (min-width: 480px) {
  .section-shell {
    padding-inline: clamp(1.5rem, 5vw, 2.5rem);
  }
}

/* Tablets (768px) */
@media (min-width: 768px) {
  .split-layout {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2xl);
  }

  .section-heading {
    margin-block-end: var(--space-3xl);
  }

  .section-kicker::after {
    width: 60px;
  }
}

/* Laptops / Small desktops (1024px) */
@media (min-width: 1024px) {
  .split-layout {
    gap: var(--space-3xl);
  }

  .split-layout--wide {
    grid-template-columns: 1.2fr 0.8fr;
  }

  .split-layout--reverse {
    grid-template-columns: 0.8fr 1.2fr;
  }

  .split-layout--reverse > :first-child {
    order: 2;
  }

  .split-layout--reverse > :last-child {
    order: 1;
  }
}

/* Large desktops (1400px) */
@media (min-width: 1400px) {
  .section-shell {
    padding-inline: var(--space-lg);
  }
}

/* -----------------------------------------------------------------------
   UTILITY CLASSES
   ----------------------------------------------------------------------- */

/* Visually Hidden — Accessible content hidden from view */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Text Alignment */
.text-center {
  text-align: center;
}

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

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

/* Text Gradient — Green branded gradient text */
.text-gradient {
  background: var(--green-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Gold text gradient */
.text-gradient--gold {
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Flex utilities */
.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-column {
  display: flex;
  flex-direction: column;
}

/* Gap utilities */
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

/* Spacing utilities */
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

/* Overflow control */
.overflow-hidden {
  overflow: hidden;
}

/* Full-bleed element (breaks out of container) */
.full-bleed {
  width: 100vw;
  margin-inline: calc(-50vw + 50%);
}

/* Decorative green line — thin horizontal accent */
.accent-line {
  width: 60px;
  height: 2px;
  background: var(--green-gradient);
  border: none;
  border-radius: 1px;
}

.accent-line--center {
  margin-inline: auto;
}

/* Responsive show/hide */
.hide-mobile {
  display: none;
}

.show-mobile {
  display: block;
}

@media (min-width: 768px) {
  .hide-mobile {
    display: block;
  }

  .show-mobile {
    display: none;
  }
}

.hide-desktop {
  display: block;
}

@media (min-width: 1024px) {
  .hide-desktop {
    display: none;
  }
}
