/**
 * MAKTOUB Base Styles
 * Version: 1.0.0
 * Author: WEBDEV
 *
 * Contents:
 * 1. CSS Reset/Normalize
 * 2. RTL Base Styles
 * 3. Typography
 * 4. Utility Classes
 * 5. Focus States (Accessibility)
 * 6. Responsive Utilities
 * 7. Layout Utilities (Flexbox & Grid)
 */

/* ========================================
 * 1. CSS RESET / NORMALIZE
 * Modern CSS Reset based on Josh Comeau's approach
 * ======================================== */

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

/* Remove default margin and padding */
* {
  margin: 0;
  padding: 0;
}

/* Prevent font size inflation */
html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
}

/* Remove list styles on ul, ol elements */
ul,
ol {
  list-style: none;
}

/* Set core body defaults */
body {
  min-height: 100vh;
  line-height: var(--leading-normal);
  font-family: var(--font-family);
  font-size: var(--text-base);
  font-weight: var(--font-regular);
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Set shorter line heights on headings */
h1,
h2,
h3,
h4,
h5,
h6 {
  line-height: var(--leading-tight);
  font-weight: var(--font-bold);
  overflow-wrap: break-word;
}

/* Balance text wrapping on headings */
h1,
h2,
h3,
h4 {
  text-wrap: balance;
}

/* A elements that don't have a class get default styles */
a:not([class]) {
  text-decoration-skip-ink: auto;
  color: var(--brand);
}

/* Make images easier to work with */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Inherit fonts for inputs and buttons */
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

/* Make sure textareas without a rows attribute are not tiny */
textarea:not([rows]) {
  min-height: 10em;
}

/* Anything that has been anchored to should have extra scroll margin */
:target {
  scroll-margin-block: 5ex;
}

/* Remove all animations and transitions for people who prefer not to see them */
@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;
  }
}

/* ========================================
 * 2. RTL BASE STYLES
 * Arabic/RTL-first approach
 * ======================================== */

/* RTL is set on HTML element */
html {
  direction: rtl;
  scroll-behavior: smooth;
}

/* Support LTR sections when needed */
[dir="ltr"],
.ltr {
  direction: ltr;
}

/* RTL-aware text alignment */
.text-start {
  text-align: right; /* RTL start */
}

.text-end {
  text-align: left; /* RTL end */
}

/* For explicit LTR content */
[dir="ltr"] .text-start,
.ltr .text-start {
  text-align: left;
}

[dir="ltr"] .text-end,
.ltr .text-end {
  text-align: right;
}

/* ========================================
 * 3. TYPOGRAPHY
 * Tajawal font with Arabic-optimized styles
 * ======================================== */

/* Headings */
.h1,
h1 {
  font-size: var(--text-4xl);
  font-weight: var(--font-extrabold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

.h2,
h2 {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
}

.h3,
h3 {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  line-height: var(--leading-snug);
}

.h4,
h4 {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  line-height: var(--leading-snug);
}

.h5,
h5 {
  font-size: var(--text-lg);
  font-weight: var(--font-medium);
  line-height: var(--leading-normal);
}

.h6,
h6 {
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  line-height: var(--leading-normal);
}

/* Body text sizes */
.text-xs {
  font-size: var(--text-xs);
}

.text-sm {
  font-size: var(--text-sm);
}

.text-base {
  font-size: var(--text-base);
}

.text-lg {
  font-size: var(--text-lg);
}

.text-xl {
  font-size: var(--text-xl);
}

.text-2xl {
  font-size: var(--text-2xl);
}

.text-3xl {
  font-size: var(--text-3xl);
}

.text-4xl {
  font-size: var(--text-4xl);
}

/* Font weights */
.font-regular {
  font-weight: var(--font-regular);
}

.font-medium {
  font-weight: var(--font-medium);
}

.font-bold {
  font-weight: var(--font-bold);
}

.font-extrabold {
  font-weight: var(--font-extrabold);
}

/* Text colors */
.text-primary {
  color: var(--text);
}

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

.text-muted {
  color: var(--text-muted);
}

.text-brand {
  color: var(--brand);
}

.text-white {
  color: var(--white);
}

.text-success {
  color: var(--success);
}

.text-error {
  color: var(--error);
}

.text-warning {
  color: var(--warning);
}

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

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

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

/* Line heights */
.leading-tight {
  line-height: var(--leading-tight);
}

.leading-snug {
  line-height: var(--leading-snug);
}

.leading-normal {
  line-height: var(--leading-normal);
}

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

.leading-loose {
  line-height: var(--leading-loose);
}

/* Text transforms */
.uppercase {
  text-transform: uppercase;
}

.lowercase {
  text-transform: lowercase;
}

.capitalize {
  text-transform: capitalize;
}

.normal-case {
  text-transform: none;
}

/* Text decoration */
.underline {
  text-decoration: underline;
}

.line-through {
  text-decoration: line-through;
}

.no-underline {
  text-decoration: none;
}

/* Text overflow */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-wrap {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* ========================================
 * 4. UTILITY CLASSES
 * ======================================== */

/* Display */
.block {
  display: block;
}

.inline-block {
  display: inline-block;
}

.inline {
  display: inline;
}

.hidden {
  display: none;
}

/* Visibility */
.visible {
  visibility: visible;
}

.invisible {
  visibility: hidden;
}

/* Position */
.relative {
  position: relative;
}

.absolute {
  position: absolute;
}

.fixed {
  position: fixed;
}

.sticky {
  position: sticky;
}

.static {
  position: static;
}

/* Z-index */
.z-0 {
  z-index: var(--z-base);
}

.z-10 {
  z-index: var(--z-dropdown);
}

.z-20 {
  z-index: var(--z-sticky);
}

.z-30 {
  z-index: var(--z-fixed);
}

.z-40 {
  z-index: var(--z-modal-backdrop);
}

.z-50 {
  z-index: var(--z-modal);
}

/* Overflow */
.overflow-auto {
  overflow: auto;
}

.overflow-hidden {
  overflow: hidden;
}

.overflow-visible {
  overflow: visible;
}

.overflow-scroll {
  overflow: scroll;
}

.overflow-x-auto {
  overflow-x: auto;
}

.overflow-y-auto {
  overflow-y: auto;
}

/* Cursor */
.cursor-pointer {
  cursor: pointer;
}

.cursor-default {
  cursor: default;
}

.cursor-not-allowed {
  cursor: not-allowed;
}

/* User select */
.select-none {
  user-select: none;
}

.select-text {
  user-select: text;
}

.select-all {
  user-select: all;
}

/* Pointer events */
.pointer-events-none {
  pointer-events: none;
}

.pointer-events-auto {
  pointer-events: auto;
}

/* Width & Height */
.w-full {
  width: 100%;
}

.w-auto {
  width: auto;
}

.w-screen {
  width: 100vw;
}

.h-full {
  height: 100%;
}

.h-auto {
  height: auto;
}

.h-screen {
  height: 100vh;
}

.min-h-screen {
  min-height: 100vh;
}

.max-w-full {
  max-width: 100%;
}

/* Spacing - Margin */
.m-0 {
  margin: var(--space-0);
}

.m-auto {
  margin: auto;
}

.mx-auto {
  margin-inline: auto;
}

.my-auto {
  margin-block: auto;
}

.m-xs {
  margin: var(--space-xs);
}

.m-sm {
  margin: var(--space-sm);
}

.m-md {
  margin: var(--space-md);
}

.m-lg {
  margin: var(--space-lg);
}

.m-xl {
  margin: var(--space-xl);
}

.m-2xl {
  margin: var(--space-2xl);
}

/* Margin Top */
.mt-0 {
  margin-top: var(--space-0);
}

.mt-xs {
  margin-top: var(--space-xs);
}

.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);
}

.mt-2xl {
  margin-top: var(--space-2xl);
}

.mt-3xl {
  margin-top: var(--space-3xl);
}

/* Margin Bottom */
.mb-0 {
  margin-bottom: var(--space-0);
}

.mb-xs {
  margin-bottom: var(--space-xs);
}

.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);
}

.mb-2xl {
  margin-bottom: var(--space-2xl);
}

.mb-3xl {
  margin-bottom: var(--space-3xl);
}

/* Margin Inline (Start/End for RTL support) */
.ms-0 {
  margin-inline-start: var(--space-0);
}

.ms-xs {
  margin-inline-start: var(--space-xs);
}

.ms-sm {
  margin-inline-start: var(--space-sm);
}

.ms-md {
  margin-inline-start: var(--space-md);
}

.ms-lg {
  margin-inline-start: var(--space-lg);
}

.ms-xl {
  margin-inline-start: var(--space-xl);
}

.ms-auto {
  margin-inline-start: auto;
}

.me-0 {
  margin-inline-end: var(--space-0);
}

.me-xs {
  margin-inline-end: var(--space-xs);
}

.me-sm {
  margin-inline-end: var(--space-sm);
}

.me-md {
  margin-inline-end: var(--space-md);
}

.me-lg {
  margin-inline-end: var(--space-lg);
}

.me-xl {
  margin-inline-end: var(--space-xl);
}

.me-auto {
  margin-inline-end: auto;
}

/* Spacing - Padding */
.p-0 {
  padding: var(--space-0);
}

.p-xs {
  padding: var(--space-xs);
}

.p-sm {
  padding: var(--space-sm);
}

.p-md {
  padding: var(--space-md);
}

.p-lg {
  padding: var(--space-lg);
}

.p-xl {
  padding: var(--space-xl);
}

.p-2xl {
  padding: var(--space-2xl);
}

/* Padding Top */
.pt-0 {
  padding-top: var(--space-0);
}

.pt-xs {
  padding-top: var(--space-xs);
}

.pt-sm {
  padding-top: var(--space-sm);
}

.pt-md {
  padding-top: var(--space-md);
}

.pt-lg {
  padding-top: var(--space-lg);
}

.pt-xl {
  padding-top: var(--space-xl);
}

.pt-2xl {
  padding-top: var(--space-2xl);
}

/* Padding Bottom */
.pb-0 {
  padding-bottom: var(--space-0);
}

.pb-xs {
  padding-bottom: var(--space-xs);
}

.pb-sm {
  padding-bottom: var(--space-sm);
}

.pb-md {
  padding-bottom: var(--space-md);
}

.pb-lg {
  padding-bottom: var(--space-lg);
}

.pb-xl {
  padding-bottom: var(--space-xl);
}

.pb-2xl {
  padding-bottom: var(--space-2xl);
}

/* Padding Inline (Start/End for RTL support) */
.ps-0 {
  padding-inline-start: var(--space-0);
}

.ps-xs {
  padding-inline-start: var(--space-xs);
}

.ps-sm {
  padding-inline-start: var(--space-sm);
}

.ps-md {
  padding-inline-start: var(--space-md);
}

.ps-lg {
  padding-inline-start: var(--space-lg);
}

.ps-xl {
  padding-inline-start: var(--space-xl);
}

.pe-0 {
  padding-inline-end: var(--space-0);
}

.pe-xs {
  padding-inline-end: var(--space-xs);
}

.pe-sm {
  padding-inline-end: var(--space-sm);
}

.pe-md {
  padding-inline-end: var(--space-md);
}

.pe-lg {
  padding-inline-end: var(--space-lg);
}

.pe-xl {
  padding-inline-end: var(--space-xl);
}

/* Padding X/Y */
.px-0 {
  padding-inline: var(--space-0);
}

.px-xs {
  padding-inline: var(--space-xs);
}

.px-sm {
  padding-inline: var(--space-sm);
}

.px-md {
  padding-inline: var(--space-md);
}

.px-lg {
  padding-inline: var(--space-lg);
}

.px-xl {
  padding-inline: var(--space-xl);
}

.px-2xl {
  padding-inline: var(--space-2xl);
}

.py-0 {
  padding-block: var(--space-0);
}

.py-xs {
  padding-block: var(--space-xs);
}

.py-sm {
  padding-block: var(--space-sm);
}

.py-md {
  padding-block: var(--space-md);
}

.py-lg {
  padding-block: var(--space-lg);
}

.py-xl {
  padding-block: var(--space-xl);
}

.py-2xl {
  padding-block: var(--space-2xl);
}

/* Gap */
.gap-0 {
  gap: var(--space-0);
}

.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);
}

.gap-2xl {
  gap: var(--space-2xl);
}

/* Background colors */
.bg-primary {
  background-color: var(--bg);
}

.bg-white {
  background-color: var(--white);
}

.bg-brand {
  background-color: var(--brand);
}

.bg-brand-light {
  background-color: var(--brand-light);
}

.bg-success {
  background-color: var(--success-bg);
}

.bg-error {
  background-color: var(--error-bg);
}

.bg-warning {
  background-color: var(--warning-bg);
}

.bg-transparent {
  background-color: transparent;
}

/* Border radius */
.rounded-none {
  border-radius: var(--radius-none);
}

.rounded-sm {
  border-radius: var(--radius-sm);
}

.rounded-md {
  border-radius: var(--radius-md);
}

.rounded-lg {
  border-radius: var(--radius-lg);
}

.rounded-xl {
  border-radius: var(--radius-xl);
}

.rounded-2xl {
  border-radius: var(--radius-2xl);
}

.rounded-full {
  border-radius: var(--radius-full);
}

/* Borders */
.border {
  border: 1px solid var(--border);
}

.border-0 {
  border: none;
}

.border-brand {
  border-color: var(--brand);
}

.border-error {
  border-color: var(--error);
}

.border-success {
  border-color: var(--success);
}

/* Shadows */
.shadow-sm {
  box-shadow: var(--shadow-sm);
}

.shadow-card {
  box-shadow: var(--shadow-card);
}

.shadow-button {
  box-shadow: var(--shadow-button);
}

.shadow-modal {
  box-shadow: var(--shadow-modal);
}

.shadow-none {
  box-shadow: none;
}

/* Opacity */
.opacity-0 {
  opacity: 0;
}

.opacity-25 {
  opacity: 0.25;
}

.opacity-50 {
  opacity: 0.5;
}

.opacity-75 {
  opacity: 0.75;
}

.opacity-100 {
  opacity: 1;
}

/* Transitions */
.transition {
  transition: all var(--transition-normal);
}

.transition-fast {
  transition: all var(--transition-fast);
}

.transition-slow {
  transition: all var(--transition-slow);
}

.transition-colors {
  transition: var(--transition-colors);
}

.transition-transform {
  transition: var(--transition-transform);
}

.transition-opacity {
  transition: var(--transition-opacity);
}

.transition-none {
  transition: none;
}

/* ========================================
 * 5. FOCUS STATES (Accessibility)
 * ======================================== */

/* Default focus ring for interactive elements */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* Custom focus ring using box-shadow */
.focus-ring:focus,
.focus-ring:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

/* Remove focus ring for mouse users, keep for keyboard */
.focus-visible-only:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}

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

/* Skip link for keyboard navigation */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  z-index: var(--z-toast);
  padding: var(--space-md);
  background: var(--brand);
  color: var(--white);
  text-decoration: none;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 0;
}

/* ========================================
 * 6. RESPONSIVE UTILITIES
 * Mobile-first approach
 * ======================================== */

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

.container-narrow {
  max-width: var(--max-width-narrow);
}

.container-wide {
  max-width: var(--max-width-wide);
}

.container-fluid {
  max-width: 100%;
}

/* Hide/Show at breakpoints */
/* Mobile: visible by default */
/* Hide on tablet and up */
.hide-tablet-up {
  display: block;
}

/* Hide on mobile only */
.hide-mobile {
  display: none;
}

/* Show only on mobile */
.show-mobile-only {
  display: block;
}

/* Show only on tablet */
.show-tablet-only {
  display: none;
}

/* Show only on desktop */
.show-desktop-only {
  display: none;
}

/* Tablet: 768px and up */
@media (min-width: 768px) {
  .container {
    padding-inline: var(--container-padding-md);
  }

  .hide-tablet-up {
    display: none;
  }

  .hide-mobile {
    display: block;
  }

  /* Preserve flex display for navigation elements */
  .nav.hide-mobile,
  .flex.hide-mobile {
    display: flex;
  }

  .show-mobile-only {
    display: none;
  }

  .show-tablet-only {
    display: block;
  }

  /* Tablet-specific text sizes */
  .md\:text-lg {
    font-size: var(--text-lg);
  }

  .md\:text-xl {
    font-size: var(--text-xl);
  }

  .md\:text-2xl {
    font-size: var(--text-2xl);
  }

  .md\:text-3xl {
    font-size: var(--text-3xl);
  }

  /* Tablet-specific spacing */
  .md\:p-lg {
    padding: var(--space-lg);
  }

  .md\:p-xl {
    padding: var(--space-xl);
  }

  .md\:px-lg {
    padding-inline: var(--space-lg);
  }

  .md\:py-lg {
    padding-block: var(--space-lg);
  }

  .md\:mt-xl {
    margin-top: var(--space-xl);
  }

  .md\:mb-xl {
    margin-bottom: var(--space-xl);
  }

  .md\:gap-lg {
    gap: var(--space-lg);
  }

  .md\:gap-xl {
    gap: var(--space-xl);
  }

  /* Tablet-specific display */
  .md\:block {
    display: block;
  }

  .md\:hidden {
    display: none;
  }

  .md\:flex {
    display: flex;
  }

  .md\:grid {
    display: grid;
  }

  /* Tablet-specific flex */
  .md\:flex-row {
    flex-direction: row;
  }

  .md\:flex-col {
    flex-direction: column;
  }

  /* Tablet-specific grid */
  .md\:grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
  }

  .md\:grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Tablet-specific text align */
  .md\:text-start {
    text-align: right;
  }

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

/* Desktop: 1024px and up */
@media (min-width: 1024px) {
  .container {
    padding-inline: var(--container-padding-lg);
  }

  .show-tablet-only {
    display: none;
  }

  .show-desktop-only {
    display: block;
  }

  /* Desktop-specific text sizes */
  .lg\:text-xl {
    font-size: var(--text-xl);
  }

  .lg\:text-2xl {
    font-size: var(--text-2xl);
  }

  .lg\:text-3xl {
    font-size: var(--text-3xl);
  }

  .lg\:text-4xl {
    font-size: var(--text-4xl);
  }

  /* Desktop-specific spacing */
  .lg\:p-xl {
    padding: var(--space-xl);
  }

  .lg\:p-2xl {
    padding: var(--space-2xl);
  }

  .lg\:px-xl {
    padding-inline: var(--space-xl);
  }

  .lg\:px-2xl {
    padding-inline: var(--space-2xl);
  }

  .lg\:py-xl {
    padding-block: var(--space-xl);
  }

  .lg\:py-2xl {
    padding-block: var(--space-2xl);
  }

  .lg\:mt-2xl {
    margin-top: var(--space-2xl);
  }

  .lg\:mb-2xl {
    margin-bottom: var(--space-2xl);
  }

  .lg\:gap-xl {
    gap: var(--space-xl);
  }

  .lg\:gap-2xl {
    gap: var(--space-2xl);
  }

  /* Desktop-specific display */
  .lg\:block {
    display: block;
  }

  .lg\:hidden {
    display: none;
  }

  .lg\:flex {
    display: flex;
  }

  .lg\:grid {
    display: grid;
  }

  /* Desktop-specific flex */
  .lg\:flex-row {
    flex-direction: row;
  }

  .lg\:flex-col {
    flex-direction: column;
  }

  /* Desktop-specific grid */
  .lg\:grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
  }

  .lg\:grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .lg\:grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Wide: 1440px and up */
@media (min-width: 1440px) {
  /* Wide-specific spacing */
  .xl\:p-2xl {
    padding: var(--space-2xl);
  }

  .xl\:p-3xl {
    padding: var(--space-3xl);
  }

  .xl\:gap-2xl {
    gap: var(--space-2xl);
  }

  /* Wide-specific grid */
  .xl\:grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
  }

  .xl\:grid-cols-5 {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* ========================================
 * 7. LAYOUT UTILITIES (Flexbox & Grid)
 * ======================================== */

/* Flexbox */
.flex {
  display: flex;
}

.inline-flex {
  display: inline-flex;
}

.flex-row {
  flex-direction: row;
}

.flex-row-reverse {
  flex-direction: row-reverse;
}

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

.flex-col-reverse {
  flex-direction: column-reverse;
}

.flex-wrap {
  flex-wrap: wrap;
}

.flex-nowrap {
  flex-wrap: nowrap;
}

.flex-wrap-reverse {
  flex-wrap: wrap-reverse;
}

/* Justify Content */
.justify-start {
  justify-content: flex-start;
}

.justify-end {
  justify-content: flex-end;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-around {
  justify-content: space-around;
}

.justify-evenly {
  justify-content: space-evenly;
}

/* Align Items */
.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

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

.items-baseline {
  align-items: baseline;
}

.items-stretch {
  align-items: stretch;
}

/* Align Self */
.self-auto {
  align-self: auto;
}

.self-start {
  align-self: flex-start;
}

.self-end {
  align-self: flex-end;
}

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

.self-stretch {
  align-self: stretch;
}

/* Flex grow/shrink */
.flex-1 {
  flex: 1 1 0%;
}

.flex-auto {
  flex: 1 1 auto;
}

.flex-initial {
  flex: 0 1 auto;
}

.flex-none {
  flex: none;
}

.grow {
  flex-grow: 1;
}

.grow-0 {
  flex-grow: 0;
}

.shrink {
  flex-shrink: 1;
}

.shrink-0 {
  flex-shrink: 0;
}

/* Grid */
.grid {
  display: grid;
}

.inline-grid {
  display: inline-grid;
}

.grid-cols-1 {
  grid-template-columns: repeat(1, 1fr);
}

.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.grid-cols-5 {
  grid-template-columns: repeat(5, 1fr);
}

.grid-cols-6 {
  grid-template-columns: repeat(6, 1fr);
}

.grid-cols-12 {
  grid-template-columns: repeat(12, 1fr);
}

/* Grid rows */
.grid-rows-1 {
  grid-template-rows: repeat(1, 1fr);
}

.grid-rows-2 {
  grid-template-rows: repeat(2, 1fr);
}

.grid-rows-3 {
  grid-template-rows: repeat(3, 1fr);
}

/* Grid span */
.col-span-1 {
  grid-column: span 1 / span 1;
}

.col-span-2 {
  grid-column: span 2 / span 2;
}

.col-span-3 {
  grid-column: span 3 / span 3;
}

.col-span-4 {
  grid-column: span 4 / span 4;
}

.col-span-6 {
  grid-column: span 6 / span 6;
}

.col-span-full {
  grid-column: 1 / -1;
}

.row-span-1 {
  grid-row: span 1 / span 1;
}

.row-span-2 {
  grid-row: span 2 / span 2;
}

.row-span-3 {
  grid-row: span 3 / span 3;
}

.row-span-full {
  grid-row: 1 / -1;
}

/* Grid alignment */
.place-items-center {
  place-items: center;
}

.place-items-start {
  place-items: start;
}

.place-items-end {
  place-items: end;
}

.place-content-center {
  place-content: center;
}

.place-content-between {
  place-content: space-between;
}

/* Auto grid (responsive without media queries) */
.grid-auto-fit {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-auto-fill {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* Centering shortcut */
.center {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Stack (vertical flexbox with gap) */
.stack {
  display: flex;
  flex-direction: column;
}

.stack > * + * {
  margin-top: var(--space-md);
}

.stack-sm > * + * {
  margin-top: var(--space-sm);
}

.stack-lg > * + * {
  margin-top: var(--space-lg);
}

.stack-xl > * + * {
  margin-top: var(--space-xl);
}

/* Cluster (horizontal flexbox with gap and wrap) */
.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.cluster-sm {
  gap: var(--space-sm);
}

.cluster-lg {
  gap: var(--space-lg);
}

/* Sidebar layout */
.with-sidebar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xl);
}

.with-sidebar > :first-child {
  flex-basis: var(--sidebar-width);
  flex-grow: 1;
}

.with-sidebar > :last-child {
  flex-basis: 0;
  flex-grow: 999;
  min-inline-size: 50%;
}

/* Split layout (equal halves) */
.split {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-lg);
}

.split > * {
  flex: 1;
  min-inline-size: min(100%, 300px);
}
