/**
 * NORA Website - Responsive Styles
 * Mobile-first breakpoint overrides
 */

/* ========================================
   Breakpoint Reference:
   - Base: 0-479px (mobile portrait)
   - sm: 480px+ (mobile landscape)
   - md: 720px+ (tablet)
   - lg: 1024px+ (desktop)
   - xl: 1280px+ (large desktop)
   ======================================== */

/* ========================================
   Small Mobile Landscape (480px+)
   ======================================== */

@media (min-width: 480px) {
  /* Hero */
  .hero-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  /* Cards scroll */
  .modes-scroll > .mode-card {
    flex: 0 0 75%;
    max-width: 340px;
  }

  /* Karma grid */
  .karma-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ========================================
   Tablet (720px+)
   ======================================== */

@media (min-width: 720px) {
  /* Navigation */
  .nav-links {
    display: flex;
  }

  .nav-toggle {
    display: none;
  }

  .nav-drawer,
  .nav-drawer-overlay {
    display: none;
  }

  /* Hero */
  .hero-content {
    grid-template-columns: 1fr 1fr;
    text-align: left;
  }

  .hero-text {
    text-align: left;
  }

  .hero-description {
    margin-left: 0;
    margin-right: 0;
  }

  .hero-actions {
    justify-content: flex-start;
  }

  .hero-visual {
    order: 1;
  }

  /* Oracle */
  .oracle-content {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3xl);
  }

  .oracle-text {
    text-align: left;
  }

  .oracle-quote::before {
    left: -1em;
  }

  /* Reading modes - grid instead of scroll */
  .modes-scroll {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    overflow-x: visible;
    margin: 0;
    padding: 0;
  }

  .modes-scroll > .mode-card {
    flex: none;
    max-width: none;
  }

  /* How it works */
  .how-steps {
    position: relative;
  }

  .how-steps::before {
    left: 28px;
  }

  /* Daily charms */
  .charms-content {
    grid-template-columns: 1fr 1fr;
  }

  .charms-text {
    order: 1;
  }

  .charms-preview {
    order: 2;
  }

  /* Karma */
  .karma-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
  }

  /* Trust */
  .trust-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Footer */
  .footer-grid {
    grid-template-columns: 1.5fr 2fr;
  }

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

  .footer-bottom {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

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

@media (min-width: 1024px) {
  /* Typography scale up */
  :root {
    --text-hero: clamp(3rem, 6vw, 4.5rem);
    --text-display: clamp(2.25rem, 4vw, 3.5rem);
  }

  /* Container width */
  .container {
    --container-padding: 2rem;
  }

  /* Hero */
  .hero-content {
    grid-template-columns: 1.2fr 1fr;
    gap: var(--space-3xl);
  }

  .hero-orb {
    width: 450px;
  }

  /* Reading modes */
  .modes-scroll,
  .modes-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Karma */
  .karma-grid {
    grid-template-columns: repeat(6, 1fr);
  }

  .karma-card {
    padding: var(--space-xl);
  }

  /* How it works - horizontal layout */
  .how-steps {
    flex-direction: row;
    gap: var(--space-xl);
  }

  .how-steps::before {
    display: none; /* Hide vertical line */
  }

  .how-step {
    flex-direction: column;
    text-align: center;
    flex: 1;
  }

  .how-step-number {
    margin-bottom: var(--space-md);
  }

  /* Oracle */
  .oracle-content {
    gap: var(--space-4xl);
  }

  /* CTA */
  .cta-orb {
    width: 280px;
    height: 280px;
  }
}

/* ========================================
   Large Desktop (1280px+)
   ======================================== */

@media (min-width: 1280px) {
  /* Container max width */
  .container {
    --container-max: 1400px;
  }

  /* Reading modes - 4 column for main modes */
  .modes-grid--featured {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Hero spacing */
  .hero {
    padding-top: calc(100px + var(--space-3xl));
  }

  .hero-content {
    gap: var(--space-4xl);
  }
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
  /* Hide non-essential elements */
  .nav-header,
  .starfield,
  .particles,
  .nebula-glow,
  .aurora,
  .hero-orb,
  .cta-orb,
  .btn,
  .footer-social {
    display: none !important;
  }

  /* Reset backgrounds */
  body {
    background: white !important;
    color: black !important;
  }

  /* Reset text colors */
  h1, h2, h3, h4, h5, h6,
  p, li, span {
    color: black !important;
  }

  /* Reset cards */
  .card,
  .mode-card,
  .karma-card {
    background: white !important;
    border: 1px solid #ccc !important;
    box-shadow: none !important;
  }

  /* Ensure content is visible */
  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }

  /* Page breaks */
  .section {
    page-break-inside: avoid;
  }

  h2, h3 {
    page-break-after: avoid;
  }
}

/* ========================================
   High Contrast Mode
   ======================================== */

@media (prefers-contrast: high) {
  :root {
    --text-luminous: #ffffff;
    --text-soft: #e0e0e0;
    --text-muted: #c0c0c0;
    --border-subtle: rgba(255, 255, 255, 0.4);
    --border-medium: rgba(255, 255, 255, 0.6);
  }

  .btn-primary {
    border: 2px solid var(--gold-bright);
  }

  .btn-ghost {
    border-width: 2px;
  }

  .card,
  .mode-card {
    border-width: 2px;
  }

  a:focus,
  button:focus {
    outline-width: 3px;
  }
}

/* ========================================
   Dark Mode (System Preference)
   Already dark by default, but ensure consistency
   ======================================== */

@media (prefers-color-scheme: dark) {
  /* Site is already dark themed, no changes needed */
}

/* ========================================
   Touch Device Optimizations
   ======================================== */

@media (hover: none) and (pointer: coarse) {
  /* Disable hover effects on touch devices */
  .card:hover,
  .mode-card:hover,
  .karma-card:hover {
    transform: none;
  }

  .btn-primary:hover,
  .btn-ghost:hover {
    transform: none;
  }

  /* Ensure touch targets are large enough */
  .btn,
  .nav-links a,
  .footer-nav-group a {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
  }

  /* Better scrolling */
  .modes-scroll {
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }
}

/* ========================================
   Landscape Mobile Adjustments
   ======================================== */

@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    min-height: auto;
    padding-top: calc(60px + var(--space-lg));
    padding-bottom: var(--space-lg);
  }

  .hero-orb {
    width: 200px;
  }

  .section {
    padding-top: var(--space-2xl);
    padding-bottom: var(--space-2xl);
  }
}

/* ========================================
   Safe Area Insets (Notched Devices)
   ======================================== */

@supports (padding: env(safe-area-inset-bottom)) {
  .nav-header {
    padding-left: max(var(--container-padding), env(safe-area-inset-left));
    padding-right: max(var(--container-padding), env(safe-area-inset-right));
  }

  .nav-drawer {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .site-footer {
    padding-bottom: calc(var(--space-xl) + env(safe-area-inset-bottom));
  }
}

/* ========================================
   Very Large Screens (4K+)
   ======================================== */

@media (min-width: 2560px) {
  html {
    font-size: 18px;
  }

  .container {
    --container-max: 1800px;
  }
}
