﻿/* ===================================================================
   MegaCurcumin / MegaCurcumin - Universal Responsive Engine
   Ensures 100% pixel-perfect scaling, fluid layouts, and flawless
   rendering on ALL screen types (320px mobile up to 4K displays).
   =================================================================== */

/* Safe area padding for notch & dynamic island devices */
:root {
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Global overflow and box-sizing safeguards */
html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden !important;
  position: relative;
}

*, *::before, *::after {
  max-width: 100%;
}

img, svg, video, canvas, iframe {
  max-width: 100%;
  height: auto;
}

/* Fluid Container Sizing */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(1rem, 3vw, 2rem);
  padding-right: clamp(1rem, 3vw, 2rem);
}

.container-wide {
  width: 100%;
  max-width: var(--container-wide);
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(1rem, 3vw, 2.5rem);
  padding-right: clamp(1rem, 3vw, 2.5rem);
}

/* Fluid Typography */
h1 {
  font-size: clamp(2rem, 3.8vw + 0.8rem, 3.75rem);
  line-height: 1.18;
  word-break: break-word;
}

h2 {
  font-size: clamp(1.65rem, 2.4vw + 0.6rem, 2.65rem);
  line-height: 1.25;
  word-break: break-word;
}

h3 {
  font-size: clamp(1.25rem, 1.4vw + 0.5rem, 1.75rem);
  line-height: 1.3;
}

p, li, span, input, select, textarea {
  word-break: normal;
  overflow-wrap: break-word;
}

/* Prevent auto-zoom on iOS mobile browsers */
input, select, textarea, button {
  font-size: 16px;
}

/* ===================================================================
   BREAKPOINT: Large Screens & 4K (Min-width: 1440px)
   =================================================================== */
@media (min-width: 1440px) {
  .hero-content {
    max-width: 720px;
  }

  .section {
    padding: 5.5rem 0;
  }
}

/* ===================================================================
   BREAKPOINT: Standard Laptops & Tablets Landscape (Max-width: 1199px)
   =================================================================== */
@media (max-width: 1199px) {
  .hero-grid {
    gap: 2.5rem;
  }

  .process-steps-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 1.25rem;
  }

  .footer-grid {
    grid-template-columns: 1.2fr 1fr 1fr 1.1fr;
    gap: 2.5rem;
  }
}

/* ===================================================================
   BREAKPOINT: Tablets & Small Laptops (Max-width: 1080px)
   =================================================================== */
@media (max-width: 1080px) {
  /* Navbar */
  .site-header {
    height: 76px;
  }

  .navbar {
    height: 76px;
  }

  .top-bar-right {
    display: none;
  }

  .top-bar-inner {
    justify-content: center;
    text-align: center;
    font-size: 0.75rem;
  }

  .mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    color: var(--primary-900);
    z-index: 1001;
  }

  .mobile-toggle:hover {
    background: var(--neutral-100);
  }

  .nav-menu {
    position: fixed;
    top: 76px;
    left: 0;
    right: 0;
    bottom: auto;
    background: var(--white);
    flex-direction: column;
    align-items: stretch;
    padding: 1.5rem 2rem 2rem;
    gap: 0.75rem;
    border-bottom: 2px solid var(--neutral-200);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    transform: translateY(-120%);
    opacity: 0;
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: calc(100vh - 76px);
    overflow-y: auto;
  }

  .nav-menu.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-link {
    font-size: 1.05rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--neutral-100);
    display: block;
    width: 100%;
  }

  .nav-actions .btn,
  .nav-actions button {
    display: none;
  }

  /* Hero Section */
  .hero {
    padding: 4.5rem 0 5rem;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  .hero-content {
    max-width: 100%;
    text-align: left;
  }

  /* Split Layouts */
  .split-layout {
    grid-template-columns: 1fr !important;
    gap: 2.5rem;
  }

  .split-image-wrapper img {
    height: clamp(280px, 45vw, 400px);
    width: 100%;
  }

  /* Grids */
  .grid-3 {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .grid-4 {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Bio Simulator */
  .bio-grid {
    grid-template-columns: 1fr !important;
    gap: 2.5rem;
  }

  /* Footer */
  .footer-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 2.5rem;
  }
}

/* ===================================================================
   BREAKPOINT: Small Tablets & Large Phones (Max-width: 767px)
   =================================================================== */
@media (max-width: 767px) {
  .section {
    padding: clamp(2.75rem, 6vw, 4rem) 0;
  }

  .section-header {
    margin-bottom: 2rem;
  }

  /* Grids to single column */
  .grid-4,
  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr !important;
    gap: 1.25rem;
  }

  /* Process Steps */
  .process-steps-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1rem;
  }

  /* Product Tabs */
  .product-tabs-wrapper {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.75rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    gap: 0.5rem;
  }

  .tab-btn {
    flex-shrink: 0;
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
  }

  /* Form Row */
  .form-row {
    grid-template-columns: 1fr !important;
    gap: 0;
  }

  /* Partner Banner */
  .partner-banner {
    padding: 3rem 1.5rem;
  }

  .partner-banner-actions {
    flex-direction: column;
    width: 100%;
  }

  .partner-banner-actions .btn {
    width: 100%;
  }

  /* Floating pill in split images */
  .split-floating-pill {
    position: static;
    margin-top: 1rem;
    border-radius: var(--radius-md);
    width: 100%;
  }
}

/* ===================================================================
   BREAKPOINT: Standard & Compact Mobile Devices (Max-width: 575px)
   =================================================================== */
@media (max-width: 575px) {
  /* Top Bar */
  .top-bar {
    display: none; /* Streamline mobile experience */
  }

  /* Header */
  .site-header {
    height: 64px;
  }

  .navbar {
    height: 64px;
  }

  .brand-logo {
    font-size: 1.2rem;
    gap: 0.6rem;
  }

  .brand-logo svg {
    width: 32px;
    height: 32px;
  }

  .nav-menu {
    top: 64px;
    padding: 1.25rem 1.5rem;
  }

  /* Hero */
  .hero {
    padding: 3rem 0 4rem;
  }

  .hero h1 {
    font-size: 2.15rem;
  }

  .hero p.lead {
    font-size: 1.05rem;
    margin-bottom: 1.75rem;
  }

  .hero-actions {
    flex-direction: column;
    gap: 0.85rem;
    width: 100%;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .hero-card-glass {
    padding: 1.5rem;
  }

  .hero-stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .hero-stat-box {
    padding: 0.9rem;
  }

  .hero-stat-num {
    font-size: 1.65rem;
  }

  .hero-stat-label {
    font-size: 0.72rem;
  }

  /* Bio Simulator */
  .interactive-bio-box {
    padding: 1.75rem 1.25rem;
    margin: 2rem 0;
  }

  .bio-metrics-row {
    flex-direction: column;
    gap: 1rem;
  }

  .bio-metric-item h4 {
    font-size: 1.85rem;
  }

  .chart-legend {
    flex-direction: column;
    gap: 0.5rem;
  }

  /* Process Steps to 1 col on compact mobile */
  .process-steps-grid {
    grid-template-columns: 1fr !important;
  }

  /* Product Card Footer */
  .product-card {
    padding: 1.5rem;
  }

  .product-card-footer {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .product-card-footer .view-product-detail-btn,
  .product-card-footer .request-sample-btn {
    width: 100%;
  }

  /* Modals */
  .modal-overlay {
    padding: 0.75rem;
  }

  .modal-container {
    max-height: 94vh;
    border-radius: var(--radius-lg);
  }

  .modal-header {
    padding: 1.25rem 1.25rem 1rem;
  }

  .modal-header h3 {
    font-size: 1.15rem;
  }

  .modal-body {
    padding: 1.25rem;
  }

  /* Footer */
  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 2rem;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 1.25rem;
  }

  .footer-bottom-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
  }
}

/* ===================================================================
   BREAKPOINT: Ultra-Compact Phones (Max-width: 374px, iPhone SE, etc.)
   =================================================================== */
@media (max-width: 374px) {
  .hero h1 {
    font-size: 1.85rem;
  }

  .hero-stats-grid {
    grid-template-columns: 1fr;
  }

  .brand-logo .logo-text span {
    font-size: 1.05rem;
  }

  .btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
  }

  /* Ultra-Compact Screen Adaptations for Biotech Formulation Section */
  .carrier-stat-pill {
    padding: 0.4rem 0.6rem;
  }

  .carrier-stat-pill .stat-label {
    font-size: 0.62rem;
  }

  .carrier-stat-pill .stat-number {
    font-size: 0.8rem;
  }

  .carrier-render-badge {
    padding: 0.25rem 0.5rem;
    font-size: 0.62rem;
  }

  .benchmark-table th:first-child,
  .benchmark-table td.cell-metric-name {
    width: 140px;
    min-width: 130px;
    font-size: 0.76rem;
  }
}

/* ===================================================================
   RESPONSIVE ENHANCEMENTS: Next-Gen Biotech Molecular Engine Section
   =================================================================== */
@media (max-width: 980px) {
  .biotech-stage-layout {
    grid-template-columns: 1fr;
  }

  .stage-visual-col {
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
  }

  .carrier-render-card {
    max-height: 280px;
  }
}

@media (max-width: 640px) {
  /* Horizontal swipeable platform deck on mobile */
  .biotech-nav-deck {
    display: flex !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    gap: 0.65rem !important;
    padding: 0.75rem !important;
    background: #f1f5f9;
  }

  .biotech-nav-item {
    flex: 0 0 80% !important;
    min-width: 240px !important;
    scroll-snap-align: start;
    border: 1px solid #e2e8f0 !important;
    border-radius: 16px !important;
    background: #ffffff !important;
    padding: 0.85rem 1rem !important;
  }

  .biotech-nav-item.active {
    border-color: #f59e0b !important;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.18) !important;
  }

  .biotech-nav-item.active::after {
    border-radius: 0 0 16px 16px;
    height: 3px;
  }

  /* Full-width stage buttons */
  .stage-action-row {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .stage-btn-group {
    width: 100%;
    flex-direction: column;
  }

  .stage-sample-btn,
  .stage-dossier-btn {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  /* Sticky first column on table */
  .benchmark-table th:first-child,
  .benchmark-table td.cell-metric-name {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #fafbfc;
    box-shadow: 3px 0 6px -2px rgba(0, 0, 0, 0.08);
  }

  .benchmark-table th:first-child {
    background: #f1f5f9;
    z-index: 3;
  }
}

