/* =============================================================================
   responsive.css — Mobile-first breakpoints for Android and desktop
   Oakopal Observatory

   Breakpoints:
     xs:  ≤ 480px  (Android portrait, small phones)
     sm:  ≤ 600px  (Android landscape, large phones)
     md:  ≤ 768px  (small tablets)
     lg:  ≤ 1024px (tablets, small laptops)
     xl:  > 1024px (desktop — base styles in main.css / components.css)
   ============================================================================= */

/* ─── Large (tablet / small laptop) ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  :root {
    --max-width: 960px;
  }

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

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

  .footer-inner {
    grid-template-columns: 1fr;
  }

  .footer-links {
    flex-wrap: wrap;
    gap: var(--space-4);
  }
}

/* ─── Medium (tablet portrait / large phone landscape) ───────────────────────── */
@media (max-width: 768px) {
  /* Nav: hide link bar, show hamburger */
  .nav-links {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  /* Hero */
  .hero {
    padding-block: var(--space-16);
  }

  .hero-actions {
    flex-direction: column;
    align-items: center;
  }

  .hero-actions .btn {
    width: 100%;
    max-width: 280px;
    justify-content: center;
  }

  /* Layout grids collapse to single column */
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  /* Star trails / keogram side-by-side */
  .trails-grid {
    grid-template-columns: 1fr;
  }

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

  /* Gallery preview */
  .gallery-preview-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Section spacing */
  .section {
    padding-block: var(--space-12);
  }

  .section-header {
    margin-bottom: var(--space-8);
  }

  /* Footer */
  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }

  .footer-links {
    justify-content: center;
  }
}

/* ─── Small (Android portrait / standard phone) ──────────────────────────────── */
@media (max-width: 600px) {
  html {
    font-size: 15px;
  }

  .container {
    padding-inline: var(--space-4);
  }

  /* Nav */
  .nav-logo span {
    /* Hide the full site name on very small screens, keep icon */
    display: none;
  }

  /* Hero */
  .hero {
    padding-block: var(--space-12);
  }

  .hero-eyebrow::before,
  .hero-eyebrow::after {
    width: 20px;
  }

  /* Cards */
  .widget-header {
    padding: var(--space-3) var(--space-4);
  }

  .widget-body {
    padding: var(--space-4);
  }

  /* Gallery */
  .gallery-preview-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
  }

  /* Status strip */
  .status-strip {
    gap: var(--space-3);
  }

  /* Counter values slightly smaller */
  .counter-value {
    font-size: 2rem;
  }
}

/* ─── Extra small (≤ 480px) ──────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .container {
    padding-inline: var(--space-3);
  }

  /* Hero */
  .hero {
    padding-block: var(--space-10);
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .hero-tagline {
    font-size: 0.95rem;
  }

  /* Gallery: single column on very small screens */
  .gallery-preview-grid {
    grid-template-columns: 1fr;
  }

  /* Counter: full width each */
  .counter-grid {
    grid-template-columns: 1fr;
  }

  /* Widget meta can wrap */
  .widget-header {
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  /* Live image timestamps */
  .live-image-timestamp {
    font-size: 0.65rem;
  }
}

/* ─── Touch device optimisations ────────────────────────────────────────────── */
@media (hover: none) and (pointer: coarse) {
  /* Larger tap targets */
  .nav-links a,
  .nav-menu a {
    padding: var(--space-3) var(--space-4);
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .btn {
    min-height: 44px;
    padding: var(--space-3) var(--space-6);
  }

  /* Hover effects cause visual flicker on touch — disable */
  .gallery-thumb:hover img {
    transform: none;
  }

  .widget-card:hover {
    border-color: var(--color-border);
    box-shadow: var(--shadow-card);
  }
}

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

  .live-dot {
    animation: none;
    opacity: 1;
  }

  .spinner {
    animation: none;
    border-top-color: var(--color-accent);
    opacity: 0.6;
  }
}

/* ─── Print ──────────────────────────────────────────────────────────────────── */
@media print {
  .site-nav,
  .stars-bg,
  .hero-actions,
  .refresh-bar,
  .nav-toggle {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }
}
