/* Mobile UX Optimization overrides */

/* Base Typography & Inputs Fix for iOS Zoom */
@media (max-width: 768px) {
  input, select, textarea {
    font-size: 16px !important;
  }
}

/* ========================================================= */
/* 1. INDEX.HTML (Landing Page)                              */
/* ========================================================= */

@media (max-width: 1024px) {
  .hero-grid {
    grid-template-columns: 1fr 1fr;
    gap: 40px;
  }
  .discover-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
}

@media (max-width: 768px) {
  /* Hero Section */
  .hero-section {
    padding: 40px 0 60px 0 !important;
  }
  .hero-content h1 {
    font-size: clamp(1.8rem, 8vw, 2.2rem) !important;
  }
  
  
  .btn-primary {
    width: 100% !important;
    min-height: 56px !important;
  }
  /* Grids */
  .discover-grid, .how-grid, .library-grid {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }
  .discover-card {
    padding: 24px !important;
  }
  /* Trust Badges */
  .hero-trust-row {
    justify-content: center !important;
    gap: 12px !important;
  }
}

/* ========================================================= */
/* 2. ASSESSMENT.HTML (Quiz Flow)                            */
/* ========================================================= */

@media (max-width: 768px) {
  header {
    padding: 12px 16px !important;
    height: auto !important;
  }
  header img {
    height: 24px !important; /* Scale down logo */
  }
  .progress-container {
    height: 4px !important;
  }
  .option-btn {
    min-height: 56px !important;
    padding: 16px !important;
    font-size: 16px !important;
    margin-bottom: 12px !important;
  }
  .option-btn:active {
    transform: scale(0.98) !important;
  }
}

/* ========================================================= */
/* 3. REPORT.HTML (Report Page)                              */
/* ========================================================= */

@media (max-width: 1024px) {
  .container {
    max-width: 700px !important;
    padding: 0 32px !important;
  }
  .report-mockup-body {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 24px !important;
  }
  body {
    font-size: 16px !important; /* Improve mobile readability */
  }
  .fails-grid, .age-grid {
    grid-template-columns: 1fr !important;
  }
  .sp-grid {
    flex-direction: column !important;
  }
  /* Horizontal Scroll for Cards if necessary */
  .scroll-x-mobile {
    display: flex !important;
    overflow-x: auto !important;
    scroll-snap-type: x mandatory !important;
    gap: 16px !important;
    padding-bottom: 16px !important;
  }
  .scroll-x-mobile > * {
    scroll-snap-align: start !important;
    min-width: 85vw !important;
  }
}

/* Sticky CTA for Report */
.report-sticky-cta {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(250, 248, 245, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 16px 24px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.05);
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1000;
  display: flex;
  justify-content: center;
  border-top: 1px solid var(--border-light);
}
.report-sticky-cta.visible {
  transform: translateY(0);
}
.report-sticky-cta .btn-primary {
  width: 100%;
  max-width: 400px;
}


/* ========================================================= */
/* 4. PRODUCT-SELECTION.HTML (Pricing Page)                  */
/* ========================================================= */

@media (max-width: 1024px) {
  .snapshot-card {
    gap: 24px !important;
  }
}

@media (max-width: 768px) {
  .snapshot-card {
    grid-template-columns: 1fr !important;
    display: flex !important;
    flex-direction: column !important;
  }
  .snapshot-left {
    border-right: none !important;
    border-bottom: 1px solid var(--border) !important;
    padding-right: 0 !important;
    padding-bottom: 24px !important;
    order: 2 !important; /* Put regular plan below */
  }
  .snapshot-right {
    padding-left: 0 !important;
    padding-top: 24px !important;
    order: 1 !important; /* Put premium plan on top */
    background: rgba(196, 106, 74, 0.03) !important; /* Lovevery-style subtle highlight */
    border-radius: 16px !important;
    border: 1px solid rgba(196, 106, 74, 0.2) !important;
    padding: 24px !important;
  }
  .showcase-carousel-wrapper {
    width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    overflow-x: auto !important;
    scroll-snap-type: x mandatory !important;
    padding: 40px 24px !important;
    display: flex !important;
    gap: 16px !important;
    -webkit-overflow-scrolling: touch !important;
  }
  .showcase-card {
    min-width: 85vw !important;
    width: 85vw !important;
    scroll-snap-align: center !important;
    flex-shrink: 0 !important;
  }
}

/* Expendable sections for Product Selection */
details.mobile-expandable {
  margin-bottom: 16px;
  background: #FFF;
  border-radius: 12px;
  border: 1px solid var(--border, #E7E1DA);
  overflow: hidden;
}
details.mobile-expandable summary {
  padding: 16px 20px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
details.mobile-expandable summary::-webkit-details-marker {
  display: none;
}
details.mobile-expandable summary::after {
  content: '+';
  font-size: 1.2rem;
}
details.mobile-expandable[open] summary::after {
  content: '-';
}
details.mobile-expandable .expandable-content {
  padding: 0 20px 20px;
}

@media (min-width: 769px) {
  details.mobile-expandable > summary {
    display: none !important;
  }
}

/* Mobile Comparison Overrides */
.mobile-comparison-cards {
  display: none;
}

@media (max-width: 768px) {
  .checkout-matrix-wrapper {
    display: none !important;
  }
  .mobile-comparison-cards {
    display: flex !important;
    flex-direction: column;
    gap: 24px;
    margin: 32px 0;
  }
  .mobile-compare-card {
    background: #FFF;
    border: 1px solid var(--border, #E7E1DA);
    border-radius: 16px;
    padding: 24px;
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
  }
  .mobile-compare-card.recommended {
    border-color: #C46A4A;
    background: rgba(196, 106, 74, 0.02);
  }
  .mobile-compare-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: #C46A4A;
    color: #FFF;
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
  }
  .mobile-compare-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    gap: 16px;
  }
  .mobile-compare-header h4 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-dark, #2D3748);
    line-height: 1.3;
  }
  .mobile-compare-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--forest, #3A5A40);
  }
  .mobile-compare-best-for {
    font-size: 0.95rem;
    color: var(--text-light, #718096);
    margin-bottom: 24px;
    line-height: 1.5;
  }
  .mobile-compare-features {
    list-style: none;
    padding: 0;
    margin: 0;
  }
  .mobile-compare-features li {
    font-size: 0.95rem;
    padding: 12px 0;
    border-bottom: 1px solid var(--border, #E7E1DA);
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-dark, #2D3748);
  }
  .mobile-compare-features li:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }
  .mobile-compare-features li.missing {
    color: var(--text-light, #A0AEC0);
  }
  .mobile-compare-features .check {
    color: var(--forest, #3A5A40);
    font-weight: 700;
    width: 20px;
    text-align: center;
  }
  .mobile-compare-card.recommended .check {
    color: #e07a5f;
    font-size: 1.1rem;
  }
  .mobile-compare-features .dash {
    color: var(--muted, #CBD5E0);
    width: 20px;
    text-align: center;
  }
}

/* ========================================================= */
/* FINAL UX PASS OVERRIDES                                   */
/* ========================================================= */



/* Task 2: Development Profile Badge */
@media (max-width: 768px) {
  .report-mockup-header {
    justify-content: space-between !important;
  }
  .report-mockup-header > span {
    transform: translateX(4px); /* Shift badge slightly toward the right */
    padding: 6px 12px !important;
    text-align: center;
  }
}

/* Task 3: Mobile Quiz Layout */
@media (max-width: 768px) {
  main {
    display: flex;
    flex-direction: column;
  }
  .quote-container {
    order: 2;
    margin-top: 56px !important; /* Generous spacing above and below for calm transition */
    margin-bottom: 56px !important;
    padding: 0 16px !important;
  }
  .quote-text {
    font-size: 1.12rem !important; /* Increased by ~15-20% for warm, readable, and thoughtful pause */
    line-height: 1.5 !important;
    color: var(--secondary) !important;
    margin-bottom: 12px !important;
  }
  .quote-author {
    font-size: 0.8rem !important; /* Reduced visual emphasis compared to the quote text */
    color: var(--text-muted) !important;
    opacity: 0.8 !important; /* Lighter weight and contrast */
    font-weight: 500 !important;
    letter-spacing: 0.5px !important;
  }
  .quiz-area {
    order: 1;
  }
}

/* Task 4: Continue With Recommended Plan Glow */
.highlight-glow {
  animation: pulse-glow-temp 1.5s ease-in-out;
}
@keyframes pulse-glow-temp {
  0% { box-shadow: 0 0 0 0 rgba(39, 174, 96, 0.4); border-color: rgba(39, 174, 96, 0.6); }
  50% { box-shadow: 0 0 0 20px rgba(39, 174, 96, 0); border-color: #27ae60; }
  100% { box-shadow: 0 0 0 0 rgba(39, 174, 96, 0); }
}

/* Task 5: Product Selection Header */
@media (max-width: 768px) {
  .nav {
    display: grid !important;
    grid-template-columns: 1fr auto 1fr !important;
    align-items: center !important;
    height: 56px !important;
    padding: 0 16px !important;
    background: var(--warm-white) !important;
    border-bottom: 1px solid var(--border) !important;
    gap: 0 !important;
    position: sticky !important;
    top: 0 !important; /* Ensure header sticks to the very top of mobile viewport */
    z-index: 100 !important;
  }
  
  #library-login-section, .checkout-section {
    scroll-margin-top: calc(var(--header-height, 56px) + 24px) !important; /* Dynamic scroll offset with padding */
  }
  
  .nav-logo {
    grid-column: 2 !important;
    grid-row: 1 !important;
    justify-self: center !important;
    font-size: 1.15rem !important;
    font-weight: 700 !important;
    letter-spacing: -0.2px !important;
    margin: 0 !important;
  }
  
  .nav-back {
    grid-column: 1 !important;
    grid-row: 1 !important;
    justify-self: start !important;
    font-size: 0 !important; /* Hide original long text */
    display: inline-flex !important;
    align-items: center !important;
    color: var(--forest) !important;
    text-decoration: none !important;
  }
  
  .nav-back::before {
    content: "← Back" !important;
    font-size: 0.82rem !important; /* Premium compact label */
    font-weight: 600 !important;
  }
  
  .nav-actions {
    grid-column: 3 !important;
    grid-row: 1 !important;
    justify-self: end !important;
    display: flex !important;
    align-items: center !important;
    gap: 0 !important;
  }
  
  .nav-actions .btn-secondary {
    font-size: 0 !important; /* Hide original long text */
    padding: 5px 12px !important;
    border-radius: 100px !important;
    min-height: 28px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1.5px solid var(--primary) !important;
    background: #FAF8F5 !important;
    color: var(--primary) !important;
    box-shadow: none !important;
  }
  
  .nav-actions .btn-secondary::before {
    content: "Library" !important;
    font-size: 0.8rem !important; /* Clean, compact, secondary label */
    font-weight: 700 !important;
  }
}

/* Task 7: Library Login Section */
@media (max-width: 768px) {
  #library-login-section {
    padding: 32px 16px !important;
  }
  #library-login-section p:first-of-type {
    font-size: 1.15rem !important;
    font-weight: 700 !important;
  }
  #library-login-section .btn-outline {
    font-size: 1.05rem !important;
    padding: 16px 24px !important;
    font-weight: 700 !important;
    border-width: 2px !important;
    background: #fdfbf7 !important; /* slight contrast */
    max-width: 100% !important;
  }
}

/* Task 8: Most Recommended Badge */
@media (max-width: 768px) {
  .recommendation-card {
    position: relative;
    padding-top: 36px !important; /* Space for the badge */
  }
  .rec-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    white-space: nowrap;
    z-index: 2;
  }
}

/* Task 9: Mobile Comparison Table */
@media (max-width: 768px) {
  .checkout-matrix-wrapper {
    overflow-x: hidden !important; /* Prevent horizontal scroll */
  }
  .checkout-matrix {
    width: 100% !important;
    table-layout: fixed;
  }
  .checkout-matrix th, .checkout-matrix td {
    padding: 12px 6px !important;
    font-size: 0.82rem !important;
    word-wrap: break-word;
  }
  .checkout-matrix th {
    font-size: 0.85rem !important;
  }
  .recommended-col {
    background: rgba(39, 174, 96, 0.05) !important; /* subtle highlight so it reads well */
  }
  .matrix-badge {
    font-size: 0.65rem !important;
    padding: 2px 4px !important;
    margin-bottom: 4px !important;
  }
}

/* Task 11: Product Selection Spacing */
@media (max-width: 768px) {
  .supporting-text {
    margin-bottom: 24px !important;
  }
  #hero-heading {
    margin-top: 16px !important;
    margin-bottom: 12px !important;
  }
}

/* ========================================================= */
/* PHASE 1: MOBILE HERO REDESIGN                             */
/* ========================================================= */

/* Mobile Header Optimization */
@media (max-width: 768px) {
  .nav-bar {
    height: 60px !important; 
    padding: 0 !important;
  }
  .logo-area {
    gap: 8px !important;
  }
  .logo-area img {
    height: 24px !important; 
  }
  .logo-text {
    font-size: 1.2rem !important; 
  }
  .nav-actions {
    gap: 8px !important;
  }
  .nav-actions .btn-start-assessment {
    padding: 8px 14px !important; 
    font-size: 0.82rem !important; 
    min-height: 36px !important; 
  }
}

/* Mobile Hero Re-composition (Display: Contents trick) */
@media (max-width: 768px) {
  .hero-section {
    padding: 40px 16px 60px 16px !important;
  }
  
  .hero-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 24px !important;
  }
  
  /* Flatten the DOM structure for flex ordering */
  .hero-content, .hero-image-col {
    display: contents !important;
  }
  
  /* 1. Family Image */
  .hero-img-wrap { 
    order: 1; 
    margin-bottom: 0; 
    width: 100% !important;
    transform: none !important;
    border-radius: var(--radius-lg) !important;
  }
  
  /* 2. Headline */
  .hero-content h1 { 
    order: 2; 
    margin-bottom: 0 !important; 
    text-align: center;
  }
  
  /* 3. Assessment Status Card */
  .floating-report-card { 
    order: 3; 
    position: relative !important; 
    left: auto !important; 
    bottom: auto !important;
    width: 100% !important; 
    max-width: 340px;
    margin: 8px auto 0 auto !important;
    box-shadow: 0 4px 24px rgba(0,0,0,0.06) !important;
    transform: none !important;
    animation: none !important; /* Stop floating on mobile */
    padding: 20px !important;
  }
  
  /* 4. Supporting Text */
  .hero-sub { 
    order: 4; 
    margin-bottom: 16px !important; 
    text-align: center;
  }
  
  /* 5. Actions */
  .hero-actions { 
    order: 5; 
    justify-content: center !important; 
    width: 100%; 
  }
  .hero-actions .btn-primary {
    width: 100% !important;
    max-width: 340px;
  }
  
  /* 6. Trust Badges */
  .hero-trust-badges { 
    order: 6; 
    justify-content: center !important; 
  }
}

/* ========================================================= */
/* RETURNING MEMBER SECTION & HEADER BUTTON                  */
/* ========================================================= */

.returning-member-section {
  background: var(--cream, #FAF8F5);
  padding: 64px 24px 80px; 
  text-align: center;
  border-top: 1px solid var(--border, #E7E1DA);
  transition: background-color 0.5s ease;
}
.returning-member-content {
  max-width: 480px;
  margin: 0 auto;
}
.returning-member-icon {
  color: var(--forest, #3A5A40);
  margin-bottom: 16px;
  display: flex;
  justify-content: center;
}
.returning-member-section h2 {
  font-family: 'Fraunces', serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--forest-dark, #243B2A);
  margin-bottom: 12px;
  line-height: 1.2;
}
.returning-member-section p {
  font-size: 1rem;
  color: var(--text-light, #718096);
  margin-bottom: 32px;
  line-height: 1.5;
}
.btn-returning {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 320px;
  background: #FFF;
  color: var(--forest, #3A5A40);
  border: 2px solid var(--forest, #3A5A40);
  padding: 16px 24px;
  border-radius: 30px;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
}
.btn-returning:hover {
  background: var(--forest, #3A5A40);
  color: #FFF;
}

/* Mobile Header Library Button */
.btn-mobile-library {
  background: rgba(58, 90, 64, 0.1);
  color: var(--forest, #3A5A40);
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s ease;
}
.btn-mobile-library:active {
  background: rgba(58, 90, 64, 0.2);
}

/* Scroll Highlight Animation */
@keyframes highlight-fade {
  0% { background-color: var(--cream, #FAF8F5); }
  20% { background-color: rgba(196, 106, 74, 0.15); }
  80% { background-color: rgba(196, 106, 74, 0.15); }
  100% { background-color: var(--cream, #FAF8F5); }
}
.highlight-animation {
  animation: highlight-fade 2s ease;
}
