/**
 * Responsive Styles
 * Mobile-first breakpoints and responsive utilities
 * 
 * @package Rank_Hacker_Blocks
 */

/* ========================================
   CONTAINER SYSTEM - Mobile First
   ======================================== */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 20px;
  padding-right: 20px;
}

@media (min-width: 768px) {
  .container {
    padding-left: 40px;
    padding-right: 40px;
  }
}

@media (min-width: 1024px) {
  .container {
    padding-left: 48px;
    padding-right: 48px;
  }
}

.container-narrow {
  max-width: 768px;
}

.container-wide {
  max-width: 1600px;
}

.container-full {
  max-width: 100%;
  padding: 0;
}

/* ========================================
   SECTION PADDING - Mobile First
   ======================================== */

.section {
  padding: 60px 20px;
}

@media (min-width: 768px) {
  .section {
    padding: 100px 40px;
  }
}

@media (min-width: 1024px) {
  .section {
    padding: 140px 48px;
  }
}

@media (min-width: 1440px) {
  .section {
    padding: 200px 80px;
  }
}

.section-compact {
  padding: 40px 20px;
}

@media (min-width: 768px) {
  .section-compact {
    padding: 60px 40px;
  }
}

@media (min-width: 1024px) {
  .section-compact {
    padding: 80px 48px;
  }
}

/* ========================================
   GRID SYSTEM - Responsive
   ======================================== */

.grid {
  display: grid;
  gap: 24px;
}

@media (min-width: 768px) {
  .grid {
    gap: 32px;
  }
}

@media (min-width: 1024px) {
  .grid {
    gap: 48px;
  }
}

/* Column classes - mobile first */
.grid-cols-1 { grid-template-columns: 1fr; }

@media (min-width: 640px) {
  .grid-cols-2-sm { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 768px) {
  .grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-3-md { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1024px) {
  .grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
  .grid-cols-6 { grid-template-columns: repeat(6, 1fr); }
}

/* Responsive grid - auto-adjusts */
.grid-responsive {
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .grid-responsive {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .grid-responsive {
    grid-template-columns: repeat(3, 1fr);
  }
}

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

.flex {
  display: flex;
}

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

@media (min-width: 768px) {
  .flex-row-md {
    flex-direction: row;
  }
}

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

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

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

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

.gap-sm { gap: 16px; }
.gap-md { gap: 24px; }
.gap-lg { gap: 48px; }

/* ========================================
   VISIBILITY UTILITIES
   ======================================== */

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

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

/* Hide on tablet */
@media (min-width: 768px) and (max-width: 1023px) {
  .hidden-tablet {
    display: none;
  }
}

/* Hide on desktop */
@media (min-width: 1024px) {
  .hidden-desktop {
    display: none;
  }
}

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

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

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

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

/* ========================================
   TEXT ALIGNMENT - Responsive
   ======================================== */

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

@media (min-width: 768px) {
  .text-left-md {
    text-align: left;
  }
  
  .text-center-md {
    text-align: center;
  }
  
  .text-right-md {
    text-align: right;
  }
}

/* ========================================
   SPACING UTILITIES - Responsive
   ======================================== */

/* Mobile */
.mt-mobile { margin-top: 20px; }
.mb-mobile { margin-bottom: 20px; }
.pt-mobile { padding-top: 20px; }
.pb-mobile { padding-bottom: 20px; }

/* Tablet */
@media (min-width: 768px) {
  .mt-tablet { margin-top: 40px; }
  .mb-tablet { margin-bottom: 40px; }
  .pt-tablet { padding-top: 40px; }
  .pb-tablet { padding-bottom: 40px; }
}

/* Desktop */
@media (min-width: 1024px) {
  .mt-desktop { margin-top: 80px; }
  .mb-desktop { margin-bottom: 80px; }
  .pt-desktop { padding-top: 80px; }
  .pb-desktop { padding-bottom: 80px; }
}

/* ========================================
   BUTTON RESPONSIVENESS
   ======================================== */

.btn {
  min-height: 44px; /* Touch-friendly */
  padding: 16px 32px;
}

@media (max-width: 767px) {
  .btn-full-mobile {
    width: 100%;
    display: block;
  }
}

.btn-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (min-width: 768px) {
  .btn-group {
    flex-direction: row;
  }
  
  .btn-group .btn {
    width: auto;
  }
}

/* ========================================
   TOUCH-FRIENDLY ELEMENTS
   ======================================== */

@media (max-width: 1023px) {
  /* Increase tap targets on mobile/tablet */
  .clickable,
  button,
  a.btn,
  input[type="submit"],
  .carousel-dot,
  .faq-toggle,
  .tab-trigger {
    min-width: 44px;
    min-height: 44px;
  }
}

/* ========================================
   IMAGE RESPONSIVENESS
   ======================================== */

img {
  max-width: 100%;
  height: auto;
}

.img-full {
  width: 100%;
}

/* ========================================
   ASPECT RATIOS
   ======================================== */

.aspect-16-9 {
  aspect-ratio: 16 / 9;
}

.aspect-4-3 {
  aspect-ratio: 4 / 3;
}

.aspect-1-1 {
  aspect-ratio: 1 / 1;
}

@supports not (aspect-ratio: 16 / 9) {
  /* Fallback for older browsers */
  .aspect-16-9 {
    position: relative;
    padding-bottom: 56.25%;
  }
  
  .aspect-16-9 > * {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }
}

/* ========================================
   OVERFLOW HANDLING
   ======================================== */

@media (max-width: 767px) {
  .overflow-x-auto-mobile {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ========================================
   STACK ON MOBILE
   ======================================== */

.stack-mobile > * + * {
  margin-top: 20px;
}

@media (min-width: 768px) {
  .stack-mobile > * + * {
    margin-top: 0;
  }
}
