/* Mobile-First Responsive Styles for mHC Course */

/* Base mobile styles */
@media (max-width: 768px) {
  :root {
    --grid-columns: 4;
    --grid-gap: 1rem;
  }
  
  html {
    font-size: 15px;
  }
  
  body {
    padding-top: 60px;
  }
  
  /* Navigation */
  .swiss-nav-inner {
    padding: var(--space-3) var(--space-4);
  }
  
  .swiss-logo {
    font-size: var(--text-lg);
  }
  
  .level-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--swiss-white);
    border-bottom: 1px solid var(--swiss-gray-200);
    flex-direction: column;
    padding: var(--space-4);
  }
  
  .level-nav.active {
    display: flex;
  }
  
  .level-nav a {
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--swiss-gray-100);
  }
  
  .nav-toggle {
    display: block;
    width: 30px;
    height: 24px;
    position: relative;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
  }
  
  .nav-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--swiss-black);
    position: absolute;
    left: 0;
    transition: all var(--transition-fast);
  }
  
  .nav-toggle span:nth-child(1) { top: 0; }
  .nav-toggle span:nth-child(2) { top: 50%; transform: translateY(-50%); }
  .nav-toggle span:nth-child(3) { bottom: 0; }
  
  .nav-toggle.active span:nth-child(1) {
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
  }
  
  .nav-toggle.active span:nth-child(2) {
    opacity: 0;
  }
  
  .nav-toggle.active span:nth-child(3) {
    bottom: 50%;
    transform: translateY(50%) rotate(-45deg);
  }
  
  /* Hero Section */
  .hero {
    min-height: auto;
    padding: var(--space-16) var(--space-4);
    padding-top: 100px;
  }
  
  .hero h1 {
    font-size: var(--text-4xl);
    line-height: 1;
  }
  
  .hero-subtitle {
    font-size: var(--text-lg);
  }
  
  /* Grid Layouts */
  .swiss-grid {
    grid-template-columns: 1fr;
    padding: 0 var(--space-4);
  }
  
  .swiss-asymmetric,
  .swiss-asymmetric-reverse {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }
  
  /* Sections */
  .swiss-section {
    padding: var(--space-12) 0;
  }
  
  /* Level Cards */
  .levels-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
    margin-top: var(--space-8);
  }
  
  .level-card {
    padding: var(--space-6);
  }
  
  .level-number {
    font-size: var(--text-4xl);
  }
  
  /* Mode Switchers */
  .mode-switcher {
    bottom: var(--space-4);
    right: var(--space-4);
    left: var(--space-4);
    flex-direction: row;
    justify-content: center;
    gap: var(--space-2);
  }
  
  .mode-pill {
    flex: 1;
    max-width: 200px;
  }
  
  .mode-option {
    flex: 1;
    text-align: center;
    padding: var(--space-2) var(--space-2);
  }
  
  /* Progress Tracker */
  .progress-tracker {
    display: none;
  }
  
  /* Code Blocks */
  .code-block {
    padding: var(--space-4);
    font-size: var(--text-xs);
  }
  
  .code-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Visualizations */
  .viz-container {
    padding: var(--space-4);
    margin: var(--space-6) 0;
  }
  
  .viz-toggle {
    position: relative;
    top: auto;
    right: auto;
    margin-bottom: var(--space-4);
    justify-content: flex-end;
  }
  
  /* Typography */
  h2 {
    font-size: var(--text-3xl);
  }
  
  h3 {
    font-size: var(--text-xl);
  }
  
  /* Cards */
  .swiss-card {
    padding: var(--space-6);
  }
  
  /* Buttons */
  .swiss-btn {
    width: 100%;
    padding: var(--space-4) var(--space-6);
  }
  
  /* Content spacing */
  .content-wrapper {
    padding: 0 var(--space-4);
  }
  
  /* Math blocks */
  .math-block {
    padding: var(--space-4);
    overflow-x: scroll;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Figure captions */
  .figure-container {
    margin: var(--space-6) 0;
  }
  
  /* Footer */
  footer {
    padding: var(--space-8) var(--space-4);
  }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
  :root {
    --grid-columns: 8;
  }
  
  .swiss-grid {
    padding: 0 var(--space-6);
  }
  
  .levels-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .swiss-asymmetric {
    grid-template-columns: 1fr 1.3fr;
  }
}

/* Large screens */
@media (min-width: 1440px) {
  :root {
    --grid-gap: 2rem;
  }
  
  html {
    font-size: 18px;
  }
  
  .swiss-grid {
    padding: 0 var(--space-12);
  }
  
  .levels-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Touch device optimizations */
@media (hover: none) {
  .level-card:hover {
    transform: none;
  }
  
  .level-card:active {
    transform: scale(0.98);
  }
  
  .swiss-btn:hover {
    background-color: var(--swiss-white);
    color: var(--swiss-black);
  }
  
  .swiss-btn:active {
    background-color: var(--swiss-black);
    color: var(--swiss-white);
  }
}

/* Reduced motion preference */
@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;
  }
  
  .fade-in,
  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  :root {
    --swiss-accent: #ff0000;
    --swiss-gray-400: #666666;
    --swiss-gray-500: #555555;
  }
  
  .swiss-card {
    border-width: 2px;
  }
  
  .level-card::before {
    width: 6px;
  }
}

/* Dark mode support (optional enhancement) */
@media (prefers-color-scheme: dark) {
  :root {
    --swiss-black: #ffffff;
    --swiss-white: #0a0a0a;
    --swiss-offwhite: #111111;
    --swiss-gray-100: #1a1a1a;
    --swiss-gray-200: #262626;
    --swiss-gray-300: #404040;
    --swiss-gray-400: #525252;
    --swiss-gray-500: #737373;
    --swiss-gray-600: #a3a3a3;
    --swiss-gray-700: #d4d4d4;
    --swiss-gray-800: #e5e5e5;
    --swiss-gray-900: #f5f5f5;
  }
  
  .swiss-nav {
    background-color: rgba(10, 10, 10, 0.95);
    border-bottom-color: var(--swiss-gray-800);
  }
  
  .hero {
    background-color: var(--swiss-offwhite);
  }
  
  .code-block {
    background-color: #000000;
  }
}
