/* ====================================================
   UTILITY CLASSES - AICEBERG MIND
   Reusable utility classes for layout, spacing, and components
   Uses design tokens for consistency
   ==================================================== */

/* ================================
   ACCESSIBILITY UTILITIES
   ================================ */

/* Skip to content link for keyboard/screen reader navigation */
.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  transform: translateY(-120%);
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  padding: 0.5rem 1rem;
  z-index: var(--z-overlay);
  transition: transform var(--timing-fast);
}
.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
  outline: 2px solid var(--brand-cyan);
}

/* Screen reader only text but focusable when needed */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.sr-only-focusable:active,
.sr-only-focusable:focus {
  position: static !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  overflow: visible !important;
  clip: auto !important;
  white-space: normal !important;
}

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

/* Container scales */
.container {
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: clamp(1rem, 3vw, 2rem);
}

.container-wide {
  margin-inline: auto;
  padding-inline: clamp(1rem, 3vw, 2rem);
  max-width: min(1440px, 96vw);
}

.container-narrow {
  max-width: min(800px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Mobile container adjustments */
@media (max-width: 768px) {
  .container-narrow {
    max-width: calc(100vw - 2rem);
    padding: 0 1.25rem;
  }
}

@media (max-width: 480px) {
  .container-narrow {
    max-width: calc(100vw - 1.5rem);
    padding: 0 1rem;
  }
}

/* Section rhythm */
.section {
  padding-block: clamp(3rem, 8vw, 6rem);
}
.section--tight {
  padding-block: clamp(2rem, 6vw, 4rem);
}
.section--loose {
  padding-block: clamp(4rem, 10vw, 8rem);
}

/* Editorial layouts */
.editorial-section {
  padding-block: var(--space-xl);
}
.editorial-container {
  display: grid;
  grid-template-columns: 1fr min(70ch, 100%) 1fr;
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: start;
}
.editorial-content {
  grid-column: 2;
}
.editorial-sidebar {
  grid-column: 3;
}

/* ================================
   GRID UTILITIES
   ================================ */

.grid {
  display: grid;
  gap: var(--space-md);
}
.grid-xs-2 {
  grid-template-columns: repeat(2, 1fr);
}
.grid-xs-3 {
  grid-template-columns: repeat(3, 1fr);
}
.grid-xs-4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1024px) {
  .grid-md-1 {
    grid-template-columns: 1fr !important;
  }
  .grid-md-2 {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}
@media (max-width: 768px) {
  .grid-sm-1 {
    grid-template-columns: 1fr !important;
  }
}

/* ================================
   FLEXBOX UTILITIES
   ================================ */

.flex {
  display: flex;
}
.flex-col {
  flex-direction: column;
}
.items-center {
  align-items: center;
}
.justify-center {
  justify-content: center;
}
.justify-between {
  justify-content: space-between;
}
.flex-wrap {
  flex-wrap: wrap;
}

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

/* 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);
}

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

/* Padding utilities */
.pt-sm {
  padding-top: var(--space-sm);
}
.pt-md {
  padding-top: var(--space-md);
}
.pt-lg {
  padding-top: var(--space-lg);
}
.pb-sm {
  padding-bottom: var(--space-sm);
}
.pb-md {
  padding-bottom: var(--space-md);
}
.pb-lg {
  padding-bottom: var(--space-lg);
}

/* ================================
   COMPONENT UTILITIES
   ================================ */

/* Card surface with glassmorphism effect */
.surface {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  border-radius: 0.75rem;
  backdrop-filter: blur(10px);
}
.surface--hover:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
}

/* Shadow utilities */
.shadow-sm {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}
.shadow-md {
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
}

/* ================================
   TEXT & MISC UTILITIES
   ================================ */

/* Width utilities */
.w-full {
  width: 100%;
}
.max-w-prose {
  max-width: 70ch;
}

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

/* Z-index utilities */
.z-base {
  z-index: var(--z-base);
  position: relative;
}
.z-content {
  z-index: var(--z-content);
  position: relative;
}
.z-overlay {
  z-index: var(--z-overlay);
  position: relative;
}

/* Visibility utilities */
.hidden {
  display: none !important;
}

/* Blog-specific utilities */
.blog-articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--blog-card-spacing, 2rem);
}