/**
 * WonderLead Wonderland - Responsive Design
 * Mobile-first responsive styles
 */

/* ============================================
   MOBILE FIRST (Base styles in wonderland.css)
   ============================================ */

/* ============================================
   SMALL DEVICES (phones, 480px and down)
   ============================================ */
@media (max-width: 480px) {
  html {
    font-size: 14px;
  }
  
  .container,
  .container-narrow {
    padding: 0 1rem;
  }
  
  section {
    padding: var(--spacing-lg) 0;
  }
  
  /* Header */
  .header-container {
    padding: 0 1rem;
  }
  
  .logo {
    font-size: 1.25rem;
  }
  
  .logo-icon {
    font-size: 1.5rem;
  }
  
  /* Typography */
  h1 {
    font-size: 2rem;
  }
  
  h2 {
    font-size: 1.75rem;
  }
  
  h3 {
    font-size: 1.25rem;
  }
  
  p, .lead {
    font-size: 1rem;
  }
  
  /* Hero */
  .hero {
    min-height: 60vh;
    padding: var(--spacing-lg) 0;
  }
  
  .hero-subtitle {
    font-size: 1rem;
  }
  
  /* Buttons */
  .victorian-btn,
  .btn-primary,
  .btn-secondary {
    padding: 12px 24px;
    font-size: 0.95rem;
    width: 100%;
  }
  
  .featured-btn {
    padding: 14px 28px;
    font-size: 1rem;
  }
  
  /* CTA Group */
  .cta-group {
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
  }
  
  /* Cards */
  .wonderland-card {
    padding: 1.25rem;
  }
  
  /* Grids */
  .problem-grid,
  .solution-grid,
  .testimonials-grid,
  .pricing-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  /* Social Proof */
  .social-proof-ticker {
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
  }
  
  .ticker-item {
    flex-direction: column;
    text-align: center;
  }
  
  /* Corner Flourishes */
  .corner-flourish {
    width: 80px;
    height: 80px;
  }
  
  /* Pricing Cards */
  .pricing-card.featured {
    transform: scale(1);
    margin-top: 1rem;
  }
  
  .badge-featured,
  .badge-exclusive {
    font-size: 0.75rem;
    padding: 0.4rem 1rem;
  }
  
  .price .amount {
    font-size: 2.5rem;
  }
  
  /* Book Layout */
  .book-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
  }
  
  /* Ornate Dividers */
  .ornate-divider {
    display: none;
  }
  
  .ornate-divider-full {
    gap: 0.5rem;
  }
  
  .ornate-divider-full .left-flourish,
  .ornate-divider-full .right-flourish {
    font-size: 1rem;
  }
  
  /* Footer */
  .footer-content {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

/* ============================================
   MEDIUM DEVICES (tablets, 768px and down)
   ============================================ */
@media (max-width: 768px) {
  /* Navigation — dropdown from the sticky header bar.
     Using position:absolute (not fixed) avoids every browser quirk
     around position:fixed inside sticky/backdrop-filter ancestors. */
  nav {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-cream);
    padding: 0.5rem 0;
    border-top: 2px solid var(--color-gold);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
    z-index: 1001;
    overflow-y: auto;
    max-height: calc(100dvh - 70px);
    /* hidden state */
    visibility: hidden;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease,
                visibility 0s linear 0.22s;
  }

  nav.active {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    transition: opacity 0.22s ease, transform 0.22s ease,
                visibility 0s;
  }

  nav a {
    display: block;
    padding: 0.9rem 2rem;
    border-bottom: 1px solid var(--color-cream-dark);
    color: var(--color-rich-navy);
  }

  nav a:last-child {
    border-bottom: none;
  }

  nav a::after {
    display: none;
  }

  .mobile-menu-toggle {
    display: block;
    position: relative;
    z-index: 1002;
  }

  /* Full-page dimmer — lives on body (appended by JS), behind the
     sticky header so the toggle remains tappable at all times */
  .mobile-nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(26, 35, 50, 0.4);
    z-index: 999;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
  }

  .mobile-nav-backdrop.active {
    display: block;
  }

  body.mobile-nav-open {
    overflow: hidden;
  }
  
  /* Hero */
  .hero {
    min-height: 70vh;
  }
  
  .floating-rabbit {
    max-width: 150px;
  }
  
  /* Grids */
  .solution-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  
  .problem-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }
  
  .testimonials-grid {
    grid-template-columns: 1fr;
  }
  
  .pricing-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  
  /* Solution Pillars */
  .solution-pillars {
    gap: 1rem;
  }
  
  .pillar {
    padding: 1rem;
  }
  
  /* Testimonials */
  .testimonial-card {
    padding: 1.5rem;
  }
  
  .quote-mark {
    font-size: 3rem;
    top: 0.5rem;
    left: 1rem;
  }
  
  /* Book Layout */
  .book-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 2rem;
  }
  
  .book-layout .left-page::after {
    display: none;
  }
  
  /* Footer */
  .footer-content {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
  }
  
  /* Background Elements */
  .wonderland-bg > * {
    opacity: 0.08;
  }
  
  .playing-card,
  .pocket-watch,
  .teacup {
    transform: scale(0.7);
  }
}

/* ============================================
   LARGE DEVICES (desktops, 992px and up)
   ============================================ */
@media (min-width: 992px) {
  /* Grids */
  .problem-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .testimonials-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .pricing-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
  
  /* Hero */
  .hero-content {
    max-width: 900px;
    margin: 0 auto;
  }
  
  /* Solution Grid */
  .solution-grid {
    gap: 5rem;
  }
}

/* ============================================
   EXTRA LARGE DEVICES (large desktops, 1200px and up)
   ============================================ */
@media (min-width: 1200px) {
  .container {
    padding: 0 3rem;
  }
  
  /* Pricing Grid - Show all 5 cards in a row if space allows */
  .pricing-section .pricing-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 1.5rem;
  }
  
  /* Adjust featured card scaling */
  .pricing-card.featured {
    transform: scale(1.08);
  }
  
  /* Testimonials */
  .testimonials-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  /* Wonderland Cards */
  .wonderland-card {
    padding: 3rem;
  }
  
  /* Corner Flourishes */
  .corner-flourish {
    width: 200px;
    height: 200px;
  }
}

/* ============================================
   LANDSCAPE ORIENTATION
   ============================================ */
@media (max-height: 600px) and (orientation: landscape) {
  .hero {
    min-height: auto;
    padding: var(--spacing-lg) 0;
  }
  
  section {
    padding: var(--spacing-lg) 0;
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  * {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  
  header,
  footer,
  nav,
  .cta-group,
  .wonderland-bg {
    display: none;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.5;
  }
  
  h1 {
    font-size: 24pt;
  }
  
  h2 {
    font-size: 20pt;
  }
  
  h3 {
    font-size: 16pt;
  }
  
  .wonderland-card {
    border: 1px solid #000;
    page-break-inside: avoid;
  }
  
  a {
    text-decoration: underline;
  }
  
  a[href]:after {
    content: " (" attr(href) ")";
  }
}

/* ============================================
   HIGH CONTRAST MODE
   ============================================ */
@media (prefers-contrast: high) {
  :root {
    --color-gold: #8b6424;
    --color-deep-teal: #0a4855;
  }
  
  .wonderland-card {
    border: 2px solid var(--color-gold);
  }
  
  .btn-primary,
  .victorian-btn {
    border: 2px solid rgba(0, 0, 0, 0.2);
  }
}

/* ============================================
   DARK MODE (if needed in future)
   ============================================ */
@media (prefers-color-scheme: dark) {
  /* Dark mode would be implemented here if needed */
  /* For now, keeping light theme only as per Victorian aesthetic */
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */
@media (hover: none) and (pointer: coarse) {
  /* Increase touch targets */
  .victorian-btn,
  .btn-primary,
  .btn-secondary,
  button,
  a {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Remove hover effects on touch devices */
  .wonderland-card:hover {
    transform: none;
    box-shadow: var(--shadow-md),
      inset 0 1px 0 rgba(255, 255, 255, 0.9);
  }
  
  .hover-lift:hover,
  .hover-grow:hover,
  .hover-rotate:hover {
    transform: none;
  }
  
  /* Add tap effects instead */
  .victorian-btn:active,
  .btn-primary:active {
    transform: scale(0.98);
  }
  
  .wonderland-card:active {
    transform: scale(0.99);
  }
}

/* ============================================
   SPECIFIC COMPONENT RESPONSIVE OVERRIDES
   ============================================ */

/* Pricing cards on mobile */
@media (max-width: 768px) {
  .pricing-card {
    margin-bottom: 1rem;
  }
  
  .pricing-card.featured {
    order: -1; /* Show featured card first on mobile */
  }
  
  .features li {
    font-size: 0.9rem;
  }
}

/* Solution image on tablets */
@media (min-width: 769px) and (max-width: 991px) {
  .solution-grid {
    grid-template-columns: 1fr;
  }
  
  .solution-image {
    max-width: 500px;
    margin: 0 auto;
  }
}

/* Testimonial grid adjustments */
@media (min-width: 769px) and (max-width: 1199px) {
  .testimonials-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Header adjustments for medium screens */
@media (min-width: 769px) and (max-width: 991px) {
  nav {
    gap: 1rem;
  }
  
  nav a {
    font-size: 0.9rem;
  }
}
