/*
 * PATRIOTAS DEL CARIBE - RESPONSIVE DESIGN
 * Mobile-first responsive styles
 * Breakpoints: 640px (sm), 768px (md), 1024px (lg), 1280px (xl)
 */

/* ============================================
   MOBILE FIRST - BASE (< 640px)
   Ya está definido en main.css y components.css
   ============================================ */

/* ============================================
   SMALL TABLETS (≥ 640px)
   ============================================ */

@media (min-width: 640px) {
  /* Containers */
  .container {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  /* Typography */
  h1 {
    font-size: calc(var(--text-3xl) * 1.1);
  }

  /* Grid - 2 columns on small tablets */
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Cards */
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Footer */
  .footer-content {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================
   TABLETS (≥ 768px)
   ============================================ */

@media (min-width: 768px) {
  /* Header */
  .header-container {
    padding: 0 var(--space-5);
  }

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

  .logo-container {
    width: 56px;
    height: 56px;
  }

  /* Hero */
  .hero {
    min-height: 60vh;
  }

  .hero-small {
    min-height: 35vh;
  }

  /* Navigation - show desktop nav */
  .main-nav {
    display: flex;
  }

  .nav-list {
    flex-direction: row;
    gap: var(--space-1);
  }

  .menu-toggle {
    display: none;
  }

  /* Grid - restore proper columns */
  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Cards */
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Content layout with sidebar */
  .content-wrapper {
    grid-template-columns: 250px 1fr;
    gap: var(--space-5);
  }

  .toc-wrapper {
    display: block;
  }

  /* Tables */
  th, td {
    padding: var(--space-3) var(--space-4);
  }

  /* Footer */
  .footer-content {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Sections */
  section {
    padding: var(--space-8) 0;
  }

  /* Buttons */
  .btn {
    min-width: 160px;
  }
}

/* ============================================
   LAPTOPS (≥ 1024px)
   ============================================ */

@media (min-width: 1024px) {
  /* Header */
  .site-header {
    padding: var(--space-3) 0;
  }

  .header-container {
    padding: 0 var(--space-6);
  }

  /* Hero */
  .hero {
    min-height: 65vh;
  }

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

  /* Navigation */
  .nav-link {
    font-size: var(--text-base);
    padding: var(--space-2) var(--space-4);
  }

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

  /* Cards */
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-5);
  }

  /* Content layout */
  .content-wrapper {
    grid-template-columns: 280px 1fr;
    gap: var(--space-6);
  }

  .content-main {
    max-width: 850px;
  }

  /* Related cards */
  .related-cards {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Footer */
  .footer-content {
    gap: var(--space-6);
  }

  /* Sections */
  section {
    padding: var(--space-10) 0;
  }

  /* Spacing */
  .py-lg-8 {
    padding-top: var(--space-8);
    padding-bottom: var(--space-8);
  }
}

/* ============================================
   DESKTOPS (≥ 1280px)
   ============================================ */

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

  /* Hero */
  .hero-content {
    max-width: var(--container-lg);
  }

  /* Content layout */
  .content-wrapper {
    grid-template-columns: 320px 1fr;
  }

  .content-main {
    max-width: 900px;
  }

  /* Cards */
  .card-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Typography - larger on big screens */
  h1 {
    font-size: calc(var(--text-3xl) * 1.2);
  }
}

/* ============================================
   MOBILE SPECIFIC (< 768px)
   ============================================ */

@media (max-width: 767px) {
  /* Mobile menu */
  .menu-toggle {
    display: flex;
    position: relative;
    z-index: 1001;
  }

  .main-nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    background-color: var(--patriotic-blue);
    padding: var(--space-8) var(--space-3);
    box-shadow: var(--shadow-xl);
    transition: right var(--transition-base);
    z-index: 1000;
    overflow-y: auto;
  }

  .main-nav.active {
    right: 0;
  }

  .nav-list {
    flex-direction: column;
    gap: var(--space-1);
    width: 100%;
  }

  .nav-link {
    padding: var(--space-3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  /* Overlay when menu is open */
  body.menu-open::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
  }

  /* Header adjustments */
  .logo-text {
    font-size: var(--text-base);
  }

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

  .logo-container {
    width: 40px;
    height: 40px;
  }

  /* Hero */
  .hero {
    min-height: 50vh;
  }

  .hero-small {
    min-height: 25vh;
  }

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

  /* Typography */
  h2 {
    margin-top: var(--space-5);
  }

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

  /* Content layout - single column */
  .content-wrapper {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  /* TOC - collapse on mobile */
  .toc-wrapper {
    position: static;
    max-height: none;
  }

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

  .toc-title {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .toc-title::after {
    content: '▼';
    font-size: 0.8em;
    transition: transform var(--transition-base);
  }

  .toc.collapsed .toc-title::after {
    transform: rotate(-90deg);
  }

  .toc.collapsed .toc-list {
    display: none;
  }

  /* Cards */
  .card-grid {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

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

  /* Buttons */
  .btn {
    width: 100%;
    padding: var(--space-3) var(--space-4);
  }

  .btn-block {
    display: block;
  }

  /* Tables - horizontal scroll */
  .table-wrapper {
    margin-left: calc(var(--space-3) * -1);
    margin-right: calc(var(--space-3) * -1);
    border-radius: 0;
  }

  /* Footer */
  .footer-content {
    grid-template-columns: 1fr;
    gap: var(--space-4);
    text-align: center;
  }

  /* Social links */
  .social-links {
    justify-content: center;
  }

  /* Breadcrumb */
  .breadcrumb {
    font-size: var(--text-xs);
    padding: var(--space-2) 0;
  }

  /* Related sections */
  .related-cards {
    grid-template-columns: 1fr;
  }

  /* Sections */
  section {
    padding: var(--space-5) 0;
  }

  /* Info boxes */
  .info-box {
    padding: var(--space-2);
  }

  /* Resources */
  .resources-section {
    padding: var(--space-3);
    margin-left: calc(var(--space-3) * -1);
    margin-right: calc(var(--space-3) * -1);
    border-radius: 0;
  }
}

/* ============================================
   TOUCH DEVICES
   ============================================ */

@media (hover: none) and (pointer: coarse) {
  /* Increase touch targets */
  .btn,
  .nav-link,
  .card-link,
  .social-link {
    min-height: 44px;
    min-width: 44px;
  }

  /* Remove hover effects on touch */
  .card:hover {
    transform: none;
  }

  /* Tap highlight */
  a, button {
    -webkit-tap-highlight-color: rgba(0, 61, 130, 0.1);
  }
}

/* ============================================
   LANDSCAPE ORIENTATION (MOBILE)
   ============================================ */

@media (max-width: 767px) and (orientation: landscape) {
  .hero {
    min-height: 80vh;
  }

  .hero-small {
    min-height: 50vh;
  }
}

/* ============================================
   REDUCED MOTION
   ============================================ */

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

  .card:hover {
    transform: none;
  }

  .btn:hover {
    transform: none;
  }
}

/* ============================================
   HIGH CONTRAST MODE
   ============================================ */

@media (prefers-contrast: high) {
  :root {
    --patriotic-blue: #001f3f;
    --patriotic-red: #b30000;
    --charcoal: #000000;
    --gray-medium: #4a4a4a;
  }

  .btn {
    border: 2px solid currentColor;
  }

  a {
    text-decoration: underline;
  }
}

/* ============================================
   DARK MODE (FUTURE ENHANCEMENT)
   ============================================ */

@media (prefers-color-scheme: dark) {
  /* Uncomment to enable automatic dark mode */
  /*
  :root {
    --white: #1a1a1a;
    --off-white: #222222;
    --charcoal: #e0e0e0;
    --gray-medium: #b0b0b0;
    --gray-light: #555555;
    --sand-light: #2a2a2a;
    --sand-medium: #333333;
  }

  body {
    background-color: #1a1a1a;
    color: #e0e0e0;
  }

  .card,
  .info-box,
  .toc {
    background-color: #2a2a2a;
  }

  .hero-overlay {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.9) 100%);
  }
  */
}

/* ============================================
   UTILITY RESPONSIVE CLASSES
   ============================================ */

/* Hide on mobile */
@media (max-width: 767px) {
  .hide-mobile {
    display: none !important;
  }
}

/* Hide on tablet and up */
@media (min-width: 768px) {
  .hide-tablet {
    display: none !important;
  }
}

/* Hide on desktop and up */
@media (min-width: 1024px) {
  .hide-desktop {
    display: none !important;
  }
}

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

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

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

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

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

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

/* Text alignment responsive */
@media (max-width: 767px) {
  .text-mobile-center {
    text-align: center;
  }

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

/* Responsive spacing */
@media (max-width: 767px) {
  .py-mobile-4 {
    padding-top: var(--space-4);
    padding-bottom: var(--space-4);
  }

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

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

/* ============================================
   CONTAINER QUERIES (FUTURE ENHANCEMENT)
   ============================================ */

/* When browser support improves, replace media queries with container queries */
/*
@container (min-width: 768px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@container (min-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
*/