/**
 * Bengal SSG Default Theme
 * Utility Classes
 */

/* ============================================
   LAYOUT UTILITIES
   ============================================ */

/* Container */
.container {
  width: 100%;
  margin-inline: auto; /* Changed from margin-left/right */
  padding-inline: var(--space-3); /* Changed from padding-left/right - 12px for very small screens */
}

/* Increase padding at 400px for better spacing */
@media (min-width: 400px) {
  .container {
    padding-inline: var(--space-4); /* Changed from padding-left/right - 16px */
  }
}

@media (min-width: 640px) {
  .container {
    max-width: var(--container-sm);
    padding-inline: var(--space-4); /* Reduced from --space-6 (24px) to --space-4 (16px) for tighter spacing */
  }
}

@media (min-width: 1024px) {
  .container {
    padding-inline: var(--space-5); /* 20px at desktop - tighter than before */
  }
}

@media (min-width: 768px) {
  .container {
    max-width: var(--container-md);
  }
}

@media (min-width: 1024px) {
  .container {
    max-width: var(--container-lg);
  }
}

@media (min-width: 1280px) {
  .container {
    max-width: var(--container-xl);
  }
}

@media (min-width: 1536px) {
  .container {
    max-width: var(--container-2xl);
  }
}

@media (min-width: 1920px) {
  .container {
    max-width: var(--container-3xl);
  }
}

/* Content Width */
.content-width {
  max-width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
}

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

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

.inline {
  display: inline;
}

.flex {
  display: flex;
}

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

.grid {
  display: grid;
}

/* JS-controlled visibility: add/remove this class to show/hide.
   !important overrides any inline style="display: ..." from legacy code. */
.hidden {
  display: none !important;
}

/* Deprecation warning (e.g. docs-nav-node.html) */
.deprecation-warning {
  background: #ff0;
  color: #000;
  padding: var(--space-4);
  border: 2px solid red;
}

/* Flex Direction */
.flex-row {
  flex-direction: row;
}

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

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

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

/* Flex Wrap */
.flex-wrap {
  flex-wrap: wrap;
}

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

/* Flex & Grid Alignment */
.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;
}

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

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

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

.gap-3 {
  gap: var(--space-3);
}

.gap-4 {
  gap: var(--space-4);
}

.gap-5 {
  gap: var(--space-5);
}

.gap-6 {
  gap: var(--space-6);
}

.gap-8 {
  gap: var(--space-8);
}

.gap-10 {
  gap: var(--space-10);
}

.gap-12 {
  gap: var(--space-12);
}

/* ============================================
   SPACING UTILITIES
   ============================================ */

/* Margin */
.m-0 {
  margin: 0;
}

.m-auto {
  margin: auto;
}

.mx-auto {
  margin-left: auto;
  margin-right: auto;
}

.my-auto {
  margin-top: auto;
  margin-bottom: auto;
}

.mt-0 {
  margin-top: 0;
}

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

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

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

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

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

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

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

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

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

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

.mb-0 {
  margin-bottom: 0;
}

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

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

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

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

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

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

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

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

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

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

/* Padding */
.p-0 {
  padding: 0;
}

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

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

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

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

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

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

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

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

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

.px-2 {
  padding-left: var(--space-2);
  padding-right: var(--space-2);
}

.px-3 {
  padding-left: var(--space-3);
  padding-right: var(--space-3);
}

.px-4 {
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

.px-5 {
  padding-left: var(--space-5);
  padding-right: var(--space-5);
}

.px-6 {
  padding-left: var(--space-6);
  padding-right: var(--space-6);
}

.px-8 {
  padding-left: var(--space-8);
  padding-right: var(--space-8);
}

.py-2 {
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
}

.py-3 {
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
}

.py-4 {
  padding-top: var(--space-4);
  padding-bottom: var(--space-4);
}

.py-5 {
  padding-top: var(--space-5);
  padding-bottom: var(--space-5);
}

.py-6 {
  padding-top: var(--space-6);
  padding-bottom: var(--space-6);
}

.py-8 {
  padding-top: var(--space-8);
  padding-bottom: var(--space-8);
}

/* ============================================
   SIZING UTILITIES
   ============================================ */

/* Width */
.w-auto {
  width: auto;
}

.w-full {
  width: 100%;
}

.w-screen {
  width: 100vw;
}

.w-fit {
  width: fit-content;
}

/* Height */
.h-auto {
  height: auto;
}

.h-full {
  height: 100%;
}

.h-screen {
  height: 100vh;
}

.h-fit {
  height: fit-content;
}

/* Max Width */
.max-w-sm {
  max-width: var(--container-sm);
}

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

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

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

.max-w-2xl {
  max-width: var(--container-2xl);
}

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

.max-w-prose {
  max-width: var(--prose-width);
}

/* ============================================
   BORDER UTILITIES
   ============================================ */

.border {
  border: 1px solid var(--color-border);
}

.border-t {
  border-top: 1px solid var(--color-border);
}

.border-b {
  border-bottom: 1px solid var(--color-border);
}

.border-l {
  border-left: 1px solid var(--color-border);
}

.border-r {
  border-right: 1px solid var(--color-border);
}

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

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

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

/* ============================================
   BACKGROUND UTILITIES
   ============================================ */

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

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

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

/* ============================================
   SHADOW UTILITIES
   ============================================ */

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

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

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

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

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

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

/* Elevation utilities (preferred over shadow-*) */
.elevation-none {
  box-shadow: var(--elevation-none);
}

.elevation-subtle {
  box-shadow: var(--elevation-subtle);
}

.elevation-low {
  box-shadow: var(--elevation-low);
}

.elevation-medium {
  box-shadow: var(--elevation-medium);
}

.elevation-high {
  box-shadow: var(--elevation-high);
}

.elevation-highest {
  box-shadow: var(--elevation-highest);
}

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

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

.elevation-popover {
  box-shadow: var(--elevation-popover);
}

/* ============================================
   OPACITY UTILITIES
   ============================================ */

.opacity-0 {
  opacity: 0;
}

.opacity-25 {
  opacity: 0.25;
}

.opacity-50 {
  opacity: 0.5;
}

.opacity-75 {
  opacity: 0.75;
}

.opacity-100 {
  opacity: 1;
}

/* ============================================
   POSITION UTILITIES
   ============================================ */

.static {
  position: static;
}

.fixed {
  position: fixed;
}

.absolute {
  position: absolute;
}

.relative {
  position: relative;
}

.sticky {
  position: sticky;
}

.top-0 {
  top: 0;
}

.right-0 {
  right: 0;
}

.bottom-0 {
  bottom: 0;
}

.left-0 {
  left: 0;
}

/* ============================================
   Z-INDEX UTILITIES
   ============================================ */

.z-0 {
  z-index: var(--z-0);
}

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

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

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

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

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

/* (removed glass utilities) */

/* ============================================
   OVERFLOW UTILITIES
   ============================================ */

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

/* ============================================
   TRANSITION UTILITIES
   ============================================ */

.transition {
  transition-property: all;
  transition-duration: var(--transition-base);
  transition-timing-function: var(--ease-in-out);
}

.transition-colors {
  transition-property: color, background-color, border-color;
  transition-duration: var(--transition-base);
  transition-timing-function: var(--ease-in-out);
}

.transition-opacity {
  transition-property: opacity;
  transition-duration: var(--transition-base);
  transition-timing-function: var(--ease-in-out);
}

/* ============================================
   RESPONSIVE UTILITIES
   ============================================ */

/* Show/Hide on mobile (tablet and below: <= 768px) */
@media (max-width: 768px) {
  .hidden-mobile {
    display: none !important;
  }
}

@media (min-width: 769px) {
  .visible-mobile {
    display: none !important;
  }
}

/* Show/Hide on desktop (desktop and up: >= 769px) */
@media (min-width: 769px) {
  .hidden-desktop {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .visible-desktop {
    display: none !important;
  }
}

/* ============================================
   VERY SMALL VIEWPORT HANDLING (< 320px)
   ============================================ */

/* Handle extremely small windows (desktop users who didn't maximize) */
@media (max-width: 319px) {
  .container {
    padding-inline: var(--space-2);  /* 8px for tiny windows */
  }

  /* Ensure critical interactive elements remain usable */
  .mobile-nav-toggle {
    min-width: 36px;  /* Smaller but still tappable */
    min-height: 36px;
  }

  button,
  .btn,
  a.button {
    min-height: 44px;  /* Maintain touch target */
    min-width: 44px;
  }
}
