/* ==========================================================================
   PyTalavera - Responsive Styles
   Mobile-first responsive design
   ========================================================================== */

/* Base styles are mobile-first (320px+) defined in main.css
   ========================================================================== */

/* Tablet: 768px and up
   ========================================================================== */
@media (min-width: 768px) {
  /* Typography adjustments */
  .hero-title {
    font-size: var(--font-size-4xl);
  }

  /* Header & Navigation */
  .mobile-menu-toggle {
    display: none;
  }

  .main-nav {
    display: block;
  }

  .mobile-menu {
    display: none !important;
  }

  /* Grid System */
  .grid-md-2 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-md-3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .grid-md-4 {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Hero Section */
  .hero {
    padding: calc(var(--spacing-4xl) * 1.5) 0;
  }

  .hero-logo {
    width: 200px;
  }

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

  /* Cards */
  .card {
    padding: var(--spacing-2xl);
  }

  /* Team Member Cards */
  .team-member-card .member-photo {
    width: 220px;
    height: 220px;
  }

  /* Instagram Grid */
  .instagram-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Blog Grid */
  .blog-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Sponsor Tiers */
  .sponsors-grid-gold {
    grid-template-columns: repeat(2, 1fr);
  }

  .sponsors-grid-silver {
    grid-template-columns: repeat(3, 1fr);
  }

  .sponsors-grid-bronze {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Section spacing */
  section {
    padding: calc(var(--spacing-4xl) * 1.25) 0;
  }

  /* Container padding */
  .container {
    padding-left: var(--spacing-xl);
    padding-right: var(--spacing-xl);
  }

  /* Hero CTA buttons */
  .hero-cta {
    flex-wrap: nowrap;
  }

  /* Code of Conduct Layout */
  .coc-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: var(--spacing-2xl);
    align-items: start;
  }

  .toc-sidebar {
    display: block;
  }

  .toc-mobile {
    display: none;
  }
}

/* Desktop: 1024px and up
   ========================================================================== */
@media (min-width: 1024px) {
  /* Typography */
  html {
    font-size: 18px;
  }

  /* Grid System */
  .grid-lg-2 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-lg-3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .grid-lg-4 {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Hero */
  .hero {
    padding: calc(var(--spacing-4xl) * 1.75) 0;
  }

  .hero-logo {
    width: 250px;
  }

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

  /* Section spacing */
  section {
    padding: calc(var(--spacing-4xl) * 1.5) 0;
  }

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

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

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

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

  .team-member-card .member-photo {
    width: 240px;
    height: 240px;
  }

  /* Container max-width */
  .container {
    padding-left: var(--spacing-2xl);
    padding-right: var(--spacing-2xl);
  }

  /* Code of Conduct Layout */
  .coc-layout {
    grid-template-columns: 300px 1fr;
    gap: var(--spacing-3xl);
  }

  /* Larger cards on desktop */
  .card {
    padding: var(--spacing-3xl);
  }

  /* Social links larger on desktop */
  .social-link {
    width: 48px;
    height: 48px;
  }

  .social-link svg {
    width: 24px;
    height: 24px;
  }
}

/* Large Desktop: 1440px and up
   ========================================================================== */
@media (min-width: 1440px) {
  /* Typography */
  html {
    font-size: 18px;
  }

  /* Container max-width with centered content */
  .container {
    max-width: var(--max-width-2xl);
  }

  /* Hero even larger */
  .hero {
    padding: calc(var(--spacing-4xl) * 2) 0;
  }

  .hero-logo {
    width: 300px;
  }

  /* Section spacing */
  section {
    padding: calc(var(--spacing-4xl) * 2) 0;
  }

  /* Larger grid gaps */
  .grid {
    gap: var(--spacing-2xl);
  }

  /* Team photos larger */
  .team-member-card .member-photo {
    width: 260px;
    height: 260px;
  }
}

/* Specific Component Responsive Overrides
   ========================================================================== */

/* Mobile-only styles (up to 767px) */
@media (max-width: 767px) {
  /* Show mobile menu */
  .mobile-menu,
  .mobile-menu-overlay {
    display: block;
  }

  /* Stack hero buttons */
  .hero-cta {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-cta .btn {
    width: 100%;
  }

  /* Single column grids */
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: 1fr;
  }

  /* Reduce section padding on mobile */
  section {
    padding: var(--spacing-3xl) 0;
  }

  /* Smaller hero */
  .hero {
    padding: var(--spacing-3xl) 0;
  }

  /* Talavera borders smaller on mobile */
  .talavera-border-top {
    padding-top: 35px;
  }

  .talavera-border-top::before {
    height: 30px;
    background-size: 150px 30px;
  }

  .talavera-border-bottom {
    padding-bottom: 35px;
  }

  .talavera-border-bottom::after {
    height: 30px;
    background-size: 150px 30px;
  }

  /* Smaller corner ornaments */
  .talavera-corners::before,
  .talavera-corners::after {
    width: 20px;
    height: 20px;
  }

  /* Hide desktop table of contents */
  .toc-sidebar {
    display: none;
  }

  /* Show mobile dropdown TOC */
  .toc-mobile {
    display: block;
  }

  /* Footer single column */
  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
  }

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

  /* Cards less padding on mobile */
  .card {
    padding: var(--spacing-lg);
  }

  /* Team member photos smaller */
  .team-member-card .member-photo {
    width: 160px;
    height: 160px;
  }

  /* Buttons full width on mobile */
  .btn-block-mobile {
    display: block;
    width: 100%;
  }

  /* Smaller headings on mobile */
  h1 {
    font-size: var(--font-size-3xl);
  }

  h2 {
    font-size: var(--font-size-2xl);
  }

  h3 {
    font-size: var(--font-size-xl);
  }
}

/* Touch Device Optimizations
   ========================================================================== */
@media (hover: none) and (pointer: coarse) {
  /* Larger touch targets */
  .btn {
    min-height: 48px;
  }

  .social-link {
    width: 48px;
    height: 48px;
  }

  .main-nav a {
    padding: var(--spacing-md) var(--spacing-lg);
  }

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

  .instagram-item:hover img {
    transform: none;
  }

  .instagram-item:hover::before {
    opacity: 0;
  }

  /* Tap highlights */
  a,
  button {
    -webkit-tap-highlight-color: rgba(30, 58, 138, 0.2);
  }
}

/* Landscape Mobile (e.g., phones in landscape)
   ========================================================================== */
@media (max-width: 767px) and (orientation: landscape) {
  /* Reduce vertical spacing */
  section {
    padding: var(--spacing-2xl) 0;
  }

  .hero {
    padding: var(--spacing-2xl) 0;
  }

  .hero-logo {
    width: 120px;
  }
}

/* Print Styles
   ========================================================================== */
@media print {
  /* Reset background colors */
  * {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  /* Remove unnecessary elements */
  .site-header,
  .site-footer,
  .mobile-menu-toggle,
  .language-toggle,
  .btn,
  .hero-cta,
  .social-links,
  .talavera-border-top::before,
  .talavera-border-bottom::after {
    display: none !important;
  }

  /* Page breaks */
  h1, h2, h3 {
    page-break-after: avoid;
  }

  img {
    page-break-inside: avoid;
  }

  /* Links */
  a[href]::after {
    content: " (" attr(href) ")";
  }

  /* Ensure content fits */
  .container {
    max-width: 100%;
    padding: 0;
  }

  /* Single column */
  .grid {
    grid-template-columns: 1fr !important;
  }
}

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

/* High Contrast Mode
   ========================================================================== */
@media (prefers-contrast: high) {
  :root {
    --color-primary: #000080;
    --color-secondary: #FF6600;
    --color-text: #000000;
    --color-background: #FFFFFF;
    --color-border: #000000;
  }

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

  .btn {
    border-width: 3px;
  }
}

/* Dark Mode (Future Enhancement)
   ========================================================================== */
@media (prefers-color-scheme: dark) {
  /* Optional: Uncomment to enable automatic dark mode
  :root {
    --color-primary: #60A5FA;
    --color-secondary: #FBBF24;
    --color-text: #F3F4F6;
    --color-text-light: #D1D5DB;
    --color-background: #1F2937;
    --color-border: #374151;
    --rich-black: #F3F4F6;
    --white: #111827;
    --gray-50: #1F2937;
    --gray-100: #374151;
    --gray-200: #4B5563;
  }

  .site-header {
    background-color: var(--color-background);
  }

  .card {
    background-color: #374151;
  }

  img {
    opacity: 0.9;
  }
  */
}

/* Utility Responsive Classes
   ========================================================================== */

/* Show/Hide based on breakpoint */
.mobile-only {
  display: block;
}

.tablet-up {
  display: none;
}

.desktop-up {
  display: none;
}

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

  .tablet-up {
    display: block;
  }
}

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

  .tablet-only {
    display: none;
  }
}

/* Flexbox responsive utilities */
.flex-column-mobile {
  flex-direction: column;
}

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