/* ==========================================================================
   THE DHARMAM - Responsive Stylesheet
   Breakpoints: 1024px (Tablets / Small Laptops), 768px (Tablets / Mobile), 480px (Phones)
   ========================================================================== */

/* Prevent horizontal viewport blowout across all screen sizes */
html, body {
  overflow-x: clip;
  max-width: 100vw;
}

@media (max-width: 1024px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 40px;
    text-align: center;
  }

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

  .hero-subtitle {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-ctas {
    justify-content: center;
  }

  .hero-trust-row {
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
  }

  .hero-visual {
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
  }

  .flip-interactive-container {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .card-3d-scene {
    max-width: 320px;
  }

  .anatomy-grid,
  .brand-story-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 36px;
  }
}

@media (max-width: 768px) {
  /* Sticky Top Header on Mobile */
  .site-header {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
  }

  .hero-title {
    font-size: 2.3rem;
  }

  .section {
    padding: 60px 0;
  }

  .section-title {
    font-size: 1.95rem;
  }

  /* Mobile Navigation Backdrop */
  .nav-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 100;
  }

  .nav-backdrop.active {
    opacity: 1;
    pointer-events: auto;
  }

  /* Mobile Navigation Drawer */
  .mobile-nav-toggle {
    display: flex;
    z-index: 110;
  }

  .nav-links {
    position: fixed;
    top: 0;
    right: 0;
    transform: translateX(100%);
    visibility: hidden;
    pointer-events: none;
    display: none; /* Prevent off-screen overflow when closed */
    width: 82%;
    max-width: 340px;
    height: 100vh;
    height: 100dvh;
    background: #ffffff;
    flex-direction: column;
    padding: 90px 28px 40px;
    align-items: flex-start;
    gap: 20px;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.15);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s;
    z-index: 105;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-links.active {
    display: flex;
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }

  body.no-scroll {
    overflow: hidden !important;
    height: 100vh;
  }

  .nav-actions .btn-amazon-nav {
    display: none; /* Mobile header CTA handled in drawer */
  }

  /* Hamburger transform when open */
  .mobile-nav-toggle.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .mobile-nav-toggle.open span:nth-child(2) {
    opacity: 0;
  }

  .mobile-nav-toggle.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .hero-ctas {
    flex-direction: column;
    width: 100%;
  }

  .hero-ctas a,
  .hero-ctas button {
    width: 100%;
    justify-content: center;
  }

  /* 3D Flip Card Showcase Tabs Horizontal Scroll */
  .showcase-tabs {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    padding-bottom: 8px;
    gap: 8px;
    max-width: 100%;
    width: 100%;
    justify-content: flex-start;
  }

  .showcase-tabs::-webkit-scrollbar {
    display: none;
  }

  .card-tab {
    white-space: nowrap;
    flex-shrink: 0;
  }

  .showcase-wrapper {
    padding: 24px 16px;
  }

  .anatomy-box {
    padding: 30px 20px;
  }

  .reviews-grid {
    grid-template-columns: 1fr;
  }

  /* Center align footer on mobile */
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 32px;
    text-align: center;
  }

  .footer-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .footer-brand-logo,
  .footer-logo-img {
    margin: 0 auto 16px auto;
  }

  .footer-bio {
    margin: 0 auto 24px auto;
    text-align: center;
  }

  .footer-title,
  .footer-heading {
    text-align: center;
    width: 100%;
    margin-bottom: 14px;
  }

  .footer-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    gap: 12px;
  }

  .footer-links a {
    text-align: center;
    display: inline-block;
  }

  .footer-links a:hover {
    transform: none; /* Prevent horizontal shift on center alignment */
  }

  .footer-contact-item {
    justify-content: center;
    text-align: center;
    width: 100%;
  }

  .footer-social-links {
    justify-content: center;
    width: 100%;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: center;
    text-align: center;
    justify-content: center;
    gap: 14px;
  }

  .floating-actions {
    bottom: 80px; /* elevated on mobile to avoid overlapping sticky bar */
    right: 16px;
  }

  .hero-floating-badge {
    left: 10px;
    bottom: -15px;
    padding: 10px 14px;
  }

  /* Mobile PDP */
  .pdp-grid {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    max-width: 100%;
    gap: 24px;
    margin-bottom: 40px;
  }

  .pdp-gallery-wrap {
    position: static;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .pdp-main-image-box {
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    margin: 0 auto 12px auto;
  }

  .pdp-main-image-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .pdp-thumbnails-row {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    gap: 8px;
    padding-bottom: 8px;
  }

  .pdp-thumb-item {
    width: 68px;
    height: 68px;
    flex-shrink: 0;
  }

  .pdp-info-column {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .pdp-badge-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
  }

  .pdp-title {
    font-size: 1.6rem;
    line-height: 1.25;
    word-break: break-word;
    overflow-wrap: break-word;
    margin-bottom: 10px;
  }

  .pdp-rating-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    font-size: 0.88rem;
    padding-bottom: 14px;
    margin-bottom: 18px;
  }

  .pdp-cta-container {
    width: 100%;
    max-width: 100%;
    margin-bottom: 24px;
  }

  .pdp-amazon-btn {
    width: 100%;
    max-width: 100%;
    padding: 14px 20px;
    font-size: 1.05rem;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
  }

  .pdp-specs-table {
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
    word-break: break-word;
    font-size: 0.85rem;
    margin-bottom: 24px;
  }

  .pdp-specs-table th {
    width: 42%;
    padding: 10px 6px 10px 0;
    word-break: break-word;
  }

  .pdp-specs-table td {
    width: 58%;
    padding: 10px 0;
    word-break: break-word;
  }

  .pdp-price-box {
    padding: 16px;
    margin-bottom: 20px;
  }

  .pdp-current-price {
    font-size: 1.8rem;
  }

  .related-decks-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .ugc-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .benefits-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .learning-outcomes-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .learning-outcome-card {
    padding: 22px 18px;
  }

  .learning-outcome-title {
    font-size: 1.05rem;
  }

  .learning-outcome-desc {
    font-size: 0.88rem;
  }

  .breadcrumb-nav {
    padding: 10px 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  .breadcrumb-list {
    flex-wrap: nowrap;
    font-size: 0.8rem;
  }

  /* Mobile Sticky Bottom Bar */
  .sticky-amazon-bar {
    padding: 10px 16px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .sticky-bar-thumb,
  .sticky-bar-rating {
    display: none; /* Keep clean on small mobile */
  }

  .sticky-bar-title {
    font-size: 0.85rem;
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sticky-bar-price {
    font-size: 1.05rem;
  }

  .btn-sticky-amazon {
    font-size: 0.9rem;
    padding: 10px 18px;
  }

  body.has-sticky-bar {
    padding-bottom: 74px; /* Space for sticky bar */
  }
}

@media (max-width: 480px) {
  .devotional-top-bar {
    padding: 5px 8px;
    font-size: 0.72rem;
  }

  .devotional-shloka-text {
    font-size: 0.72rem;
  }

  .devotional-tagline {
    display: inline-block;
    font-size: 0.72rem;
  }

  .hero-pill {
    font-size: 0.78rem;
    padding: 6px 12px;
    max-width: 100%;
  }

  .hero-title {
    font-size: 1.95rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .announcement-bar {
    font-size: 0.76rem;
  }

  .trust-bar-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px 8px;
  }

  .trust-bar-item {
    font-size: 0.82rem;
    gap: 8px;
  }

  .trust-bar-item .icon {
    font-size: 1.15rem;
  }

  .card-3d-scene {
    max-width: 280px;
  }

  .card-back-shloka {
    font-size: 0.95rem;
  }

  .card-back-attributes {
    grid-template-columns: 1fr;
  }

  .sticky-bar-left {
    gap: 8px;
  }

  .sticky-bar-title {
    max-width: 110px;
  }

  .btn-sticky-amazon {
    font-size: 0.82rem;
    padding: 9px 14px;
    gap: 6px;
  }

  /* Small Mobile PDP Fine-tuning */
  .pdp-title {
    font-size: 1.4rem;
  }

  .pdp-thumb-item {
    width: 60px;
    height: 60px;
  }

  .pdp-amazon-btn {
    font-size: 1rem;
    padding: 13px 16px;
    gap: 10px;
  }

  .pdp-specs-table th,
  .pdp-specs-table td {
    padding: 8px 4px 8px 0;
    font-size: 0.82rem;
  }

  /* First-Time Promo Popup Mobile Styles */
  .first-time-popup-overlay {
    padding: 12px;
  }

  .first-time-popup-container {
    flex-direction: column;
    max-width: 94vw;
    max-height: 92vh;
    border-radius: 18px;
    overflow-y: auto;
  }

  .first-time-popup-media {
    width: 100%;
    height: 190px;
    flex: none;
  }

  .first-time-popup-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .first-time-popup-body {
    padding: 22px 18px;
    align-items: center;
    text-align: center;
  }

  .first-time-popup-badge {
    align-self: center;
  }

  .first-time-popup-title {
    font-size: 1.3rem;
    text-align: center;
  }

  .first-time-popup-subtitle {
    font-size: 0.88rem;
    text-align: center;
    margin-bottom: 12px;
  }

  .first-time-popup-price-row {
    justify-content: center;
    margin-bottom: 16px;
  }

  .first-time-popup-price {
    font-size: 1.6rem;
  }

  .first-time-popup-btn-amazon {
    padding: 13px 18px;
    font-size: 1rem;
  }
}

@media (max-width: 768px) {
  .first-time-popup-container {
    flex-direction: column;
    max-width: 90vw;
  }

  .first-time-popup-media {
    width: 100%;
    height: 220px;
    flex: none;
  }
}


