/* 
 * Theme Name: LaComics Pro
 * File: responsive.css
 * Description: Media queries for responsive design.
 */

/* ==========================================================================
   Extra Large Devices (>1400px)
   ========================================================================== */
@media (min-width: 1401px) {
  .lc-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* ==========================================================================
   Large Devices (1200px - 1400px)
   ========================================================================== */
@media (max-width: 1400px) and (min-width: 1200px) {
  .lc-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .lc-related__grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ==========================================================================
   Medium Devices (992px - 1199px)
   ========================================================================== */
@media (max-width: 1199px) {
  .lc-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .lc-related__grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .lc-single {
    grid-template-columns: 250px 1fr;
    gap: 24px;
  }
  
  .lc-search-form__input:focus {
    width: 260px;
  }
}

/* ==========================================================================
   Tablets (768px - 991px)
   ========================================================================== */
@media (max-width: 991px) {
  .lc-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .lc-related__grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Header adjustments */
  .lc-header__nav {
    display: none;
  }
  
  .lc-hamburger {
    display: block;
  }
  
  .lc-header__search,
  .lc-header__btn,
  .lc-header__sponsor-btn {
    display: none !important;
  }

  .lc-header__icon-btn {
    display: inline-flex !important;
  }

  /* Single Post - keep 2 columns on tablet and split screen */
  .lc-single {
    grid-template-columns: 230px 1fr;
    gap: 20px;
  }

  .lc-single__sidebar {
    max-width: none;
    margin: 0;
    width: 100%;
  }

  /* Footer */
  .lc-footer__popular-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
}

/* ==========================================================================
   Mobile Landscape (480px - 767px)
   ========================================================================== */
@media (max-width: 767px) {
  :root {
    --header-height: 50px;
  }

  body {
    padding-bottom: 24px;
  }

  .lc-header {
    height: var(--header-height);
  }

  .lc-cat-bar {
    margin-top: 12px !important;
    margin-bottom: 20px !important;
  }

  .lc-archive-header + .lc-cat-bar {
    margin-top: 14px !important;
  }

  .lc-cat-bar__track {
    padding: 0 4px 4px !important;
  }

  .lc-cat-bar__nav-btn {
    display: none !important;
  }

  .lc-breadcrumbs {
    margin-top: 12px !important;
    margin-bottom: 16px !important;
  }

  .lc-logo-brand__badge {
    padding: 3px 9px;
    font-size: 1.15rem;
  }

  .lc-header__icon-btn {
    display: inline-flex !important;
    width: 32px;
    height: 32px;
  }

  .lc-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .lc-related__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  /* Header Search hidden or simplified */
  .lc-header__actions .lc-search-form,
  .lc-header__actions .lc-header__btn,
  .lc-header__actions .lc-header__sponsor-btn {
    display: none;
  }

  .lc-mobile-nav {
    display: none !important;
  }

  .lc-back-top {
    display: flex !important;
    bottom: 20px;
    right: 16px;
  }

  /* Footer */
  .lc-footer__popular {
    grid-template-columns: 1fr;
  }

  /* Typography & Cards */
  .lc-card__title {
    font-size: 0.85rem;
  }
  
  .lc-card__meta {
    font-size: 0.7rem;
  }

  /* Search Live Full width */
  .lc-search-live {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    width: 100%;
    border-radius: 0;
    border-left: none;
    border-right: none;
    max-height: calc(100vh - var(--header-height));
  }
  
  .lc-archive-header {
    padding: 12px 0 0 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }

  .lc-archive-header__title {
    font-size: 1.15rem;
    margin: 0;
    line-height: 1.2;
  }

  .lc-archive-header__desc {
    font-size: 0.82rem;
    margin-top: 3px;
    margin-bottom: 0;
  }

  /* Single Post - keep 2-column side-by-side layout on split screen */
  .lc-single {
    grid-template-columns: 200px 1fr;
    gap: 16px;
  }

  .lc-single__sidebar {
    max-width: none;
    margin: 0;
    width: 100%;
  }

  .lc-single__preview-grid,
  .preview {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)) !important;
    gap: 8px !important;
  }
}

/* ==========================================================================
   iPhone / Small Phone (≤430px) — 1 column grid
   ========================================================================== */
@media (max-width: 430px) {
  .lc-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* ==========================================================================
   Narrow Mobile (<640px) - Collapse to 1 column only here
   ========================================================================== */
@media (max-width: 640px) {
  .lc-single {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .lc-single__sidebar {
    max-width: 320px;
    margin: 0 auto;
    width: 100%;
  }
}

/* ==========================================================================
   Mobile Portrait (<480px)
   ========================================================================== */
@media (max-width: 479px) {
  .lc-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .lc-related__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .lc-card__body {
    padding: 8px;
  }

  .lc-card__title {
    font-size: 0.8rem;
  }

  .lc-card__meta {
    font-size: 0.65rem;
    gap: 4px;
  }

  .lc-card__meta .lc-meta-item {
    padding: 2.5px 5.5px;
    gap: 3.5px;
  }

  .lc-card__meta .lc-meta-item svg {
    width: 11px;
    height: 11px;
  }

  .lc-single__downloads {
    flex-direction: column;
    align-items: stretch;
  }

  .lc-download-btn {
    justify-content: center;
  }
  
  .lc-single__preview {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==========================================================================
   System Preferences
   ========================================================================== */
@media (prefers-color-scheme: dark) {
  /* Default to dark, if data-theme is not explicitly set */
  :root:not([data-theme="light"]) {
    --bg-primary: #0f1117;
    --bg-secondary: #181a20;
    --bg-card: #1e2028;
    --bg-card-hover: #252830;
    --bg-elevated: #2a2d36;
    --text-primary: #e4e4e7;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent: #43acc4;
    --accent-hover: #5bc0d8;
    --accent-soft: rgba(67, 172, 196, 0.15);
    --download: #f59e0b;
    --download-hover: #fbbf24;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.15);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
  body {
    background: #fff;
    color: #000;
    padding: 0;
  }
  
  .lc-header,
  .lc-footer,
  .lc-mobile-nav,
  .lc-back-top,
  .lc-theme-toggle,
  .lc-comments,
  .lc-search-form,
  .lc-related {
    display: none !important;
  }

  .lc-container {
    width: 100%;
    max-width: none;
    padding: 0;
    margin: 0;
  }

  .lc-single {
    display: block;
  }
  
  .lc-single__sidebar {
    page-break-inside: avoid;
    margin-bottom: 20px;
  }
  
  a {
    color: #000;
    text-decoration: underline;
  }
}
