/**
 * Responsive Styles
 * Myśl Konserwatywna - Portal Publicystyczny
 * 
 * Media queries i responsive overrides
 * Mobile-first approach
 */

/* ===========================================
   BASE (Mobile: 320px - 767px)
   Styles defined in base.css, variables.css, layout.css
   =========================================== */

/* ===========================================
   TABLET (768px+)
   =========================================== */

@media (min-width: 768px) {
  /* Typography scaling */
  h1 {
    font-size: var(--text-4xl);
  }
  
  h2 {
    font-size: var(--text-3xl);
  }
  
  h3 {
    font-size: var(--text-2xl);
  }
  
  /* Spacing adjustments */
  .section {
    padding-top: var(--space-16);
    padding-bottom: var(--space-16);
  }
  
  /* Grid adjustments */
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .category-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Flex direction changes */
  .flex-tablet-row {
    flex-direction: row;
  }
  
  .flex-tablet-col {
    flex-direction: column;
  }
  
  /* Text alignment */
  .text-tablet-left {
    text-align: left;
  }
  
  .text-tablet-center {
    text-align: center;
  }
  
  .text-tablet-right {
    text-align: right;
  }
}

/* ===========================================
   DESKTOP (1024px+)
   =========================================== */

@media (min-width: 1024px) {
  /* Typography scaling */
  h1 {
    font-size: var(--text-5xl);
  }
  
  h2 {
    font-size: var(--text-4xl);
  }
  
  h3 {
    font-size: var(--text-3xl);
  }
  
  /* Spacing adjustments */
  .section {
    padding-top: var(--space-20);
    padding-bottom: var(--space-20);
  }
  
  .section-lg {
    padding-top: var(--space-24);
    padding-bottom: var(--space-24);
  }
  
  /* Grid adjustments */
  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .category-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  /* Sidebar layout */
  .layout-with-sidebar {
    grid-template-columns: 1fr 320px;
  }
  
  .layout-with-sidebar.sidebar-left {
    grid-template-columns: 320px 1fr;
  }
  
  /* Flex direction changes */
  .flex-desktop-row {
    flex-direction: row;
  }
  
  .flex-desktop-col {
    flex-direction: column;
  }
  
  /* Text alignment */
  .text-desktop-left {
    text-align: left;
  }
  
  .text-desktop-center {
    text-align: center;
  }
  
  .text-desktop-right {
    text-align: right;
  }
  
  /* Hover effects (only on devices with hover capability) */
  @media (hover: hover) {
    a:hover,
    button:hover {
      transition: var(--transition-colors);
    }
  }
}

/* ===========================================
   LARGE DESKTOP (1440px+)
   =========================================== */

@media (min-width: 1440px) {
  /* Container max-width increase */
  .container {
    max-width: var(--container-max);
  }
  
  /* Typography fine-tuning */
  h1 {
    font-size: 4.5rem; /* 72px */
  }
}

/* ===========================================
   PRINT STYLES
   =========================================== */

@media print {
  /* Hide non-essential elements */
  header,
  nav,
  .nav-menu,
  .sidebar,
  .partners-carousel,
  footer,
  .share-buttons,
  button,
  .skip-link {
    display: none !important;
  }
  
  /* Optimize for print */
  body {
    font-size: 12pt;
    line-height: 1.5;
    color: #000;
    background: #fff;
  }
  
  .container {
    max-width: 100%;
    padding: 0;
  }
  
  /* Ensure links are visible */
  a {
    color: #000;
    text-decoration: underline;
  }
  
  /* Show link URLs after text */
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }
  
  /* Don't show URLs for internal links */
  a[href^="#"]::after,
  a[href^="javascript:"]::after {
    content: "";
  }
  
  /* Page breaks */
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
  }
  
  img, figure {
    page-break-inside: avoid;
  }
  
  /* Optimize images */
  img {
    max-width: 100% !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-text: #000000;
    --color-bg: #ffffff;
    --color-primary: #0000ff;
    --color-secondary: #ff0000;
    --color-border: #000000;
  }
  
  a {
    text-decoration: underline;
  }
  
  button,
  .btn {
    border: 2px solid currentColor;
  }
}

/* ===========================================
   DARK MODE (future enhancement)
   =========================================== */

@media (prefers-color-scheme: dark) {
  /* Placeholder for future dark mode implementation */
  /* 
  :root {
    --color-bg: #1a202c;
    --color-surface: #2d3748;
    --color-text: #f7fafc;
    --color-text-light: #e2e8f0;
    --color-border: #4a5568;
  }
  */
}

/* ===========================================
   LANDSCAPE ORIENTATION (Mobile)
   =========================================== */

@media (max-width: 767px) and (orientation: landscape) {
  /* Reduce vertical spacing in landscape */
  .section {
    padding-top: var(--space-8);
    padding-bottom: var(--space-8);
  }
  
  /* Adjust header height if needed */
  .site-header {
    padding-top: var(--space-2);
    padding-bottom: var(--space-2);
  }
}

/* ===========================================
   TOUCH DEVICE OPTIMIZATIONS
   =========================================== */

@media (pointer: coarse) {
  /* Larger touch targets */
  button,
  a,
  input,
  select,
  textarea {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Increase spacing for easier tapping */
  .nav-menu a {
    padding: var(--space-3) var(--space-4);
  }
}

/* ===========================================
   RESPONSIVE FONT SIZING (Fluid Typography)
   =========================================== */

/* Fluid typography between breakpoints */
@media (min-width: 768px) and (max-width: 1440px) {
  h1 {
    font-size: clamp(2.25rem, 4vw, 4rem);
  }
  
  h2 {
    font-size: clamp(1.875rem, 3vw, 3rem);
  }
  
  h3 {
    font-size: clamp(1.5rem, 2.5vw, 2.25rem);
  }
}

/* ===========================================
   CONTAINER QUERIES (Future Enhancement)
   =========================================== */

/* Placeholder for container queries when widely supported */
/*
@container (min-width: 600px) {
  .article-card {
    display: flex;
    flex-direction: row;
  }
}
*/
