/* ==========================================================================
   MOBILE OPTIMIZATIONS & RESPONSIVE DESIGN FOR PAISAN.AI / AGNI
   Strictly scoped to mobile viewports (max-width: 1023px / max-width: 767px)
   Guarantees ZERO changes to PC/desktop layout, typography, or interactions.
   ========================================================================== */

/* 1. Global Viewport & Hygiene */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

/* 2. Mobile Safe Area & Bottom Padding */
@media (max-width: 767px) {
  body {
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Fixed bottom bar mobile polish */
  .fixed.inset-x-0.bottom-0 {
    padding-bottom: max(12px, env(safe-area-inset-bottom, 12px)) !important;
    background: rgba(255, 255, 255, 0.96) !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
    border-top: 1px solid rgba(16, 24, 40, 0.08) !important;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.07) !important;
  }
}

/* 3. Mobile Navigation Drawer (Drawer & Backdrop) */
.mobile-nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 240;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.mobile-nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  max-height: 88vh;
  background: #ffffff;
  border-bottom: 1px solid rgba(16, 24, 40, 0.1);
  box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.18);
  z-index: 250;
  transform: translateY(-100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 20px 24px;
}

.mobile-nav-drawer.open {
  transform: translateY(0);
}

.mobile-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(16, 24, 40, 0.08);
}

.mobile-nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.mobile-nav-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid rgba(16, 24, 40, 0.1);
  background: #f7f8fb;
  color: #101828;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.15s;
}

.mobile-nav-close-btn:active {
  transform: scale(0.95);
  background: #eceff3;
}

.mobile-nav-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 0;
}

.mobile-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  color: #101828;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s, transform 0.1s;
}

.mobile-nav-item:hover,
.mobile-nav-item:active {
  background-color: #f7f8fb;
  color: #e8572a;
}

.mobile-nav-arrow {
  color: #98a2b3;
  transition: transform 0.15s, color 0.15s;
}

.mobile-nav-item:hover .mobile-nav-arrow,
.mobile-nav-item:active .mobile-nav-arrow {
  color: #e8572a;
  transform: translateX(3px);
}

.mobile-nav-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid rgba(16, 24, 40, 0.08);
}

.mobile-nav-call {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 9px;
  font-family: monospace, sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  color: #344054;
  background: #f7f8fb;
  border: 1px solid rgba(16, 24, 40, 0.1);
  text-decoration: none;
  transition: background-color 0.2s, border-color 0.2s;
}

.mobile-nav-call:active {
  background-color: #eaecf0;
}

.mobile-nav-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mobile-nav-signin {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 11px 16px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  color: #101828;
  background: #ffffff;
  border: 1px solid rgba(16, 24, 40, 0.16);
  text-decoration: none;
  transition: background-color 0.2s;
}

.mobile-nav-signin:active {
  background-color: #f7f8fb;
}

.mobile-nav-demo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 11px 16px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  background: #e8572a;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(232, 87, 42, 0.25);
  transition: background-color 0.2s;
}

.mobile-nav-demo:active {
  background-color: #cc451b;
}

/* Ensure mobile nav is strictly invisible on desktop/PC */
@media (min-width: 1024px) {
  .mobile-nav-backdrop,
  .mobile-nav-drawer {
    display: none !important;
  }
}

/* 4. Fix Transcript Overlapping Bug (Audio Tape Scrubber) */
.tape-dialogue-box {
  min-height: 110px;
  position: relative;
}

@media (max-width: 767px) {
  .tape-dialogue-box {
    min-height: 125px;
  }
}

/* Dialogue active/inactive visibility */
.tape-dialogue-turn[data-active="0"] {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.tape-dialogue-turn[data-active="1"] {
  opacity: 1 !important;
  pointer-events: auto !important;
  visibility: visible !important;
}

/* 5. Mobile Tape Scrubber Milestones Formatting */
@media (max-width: 767px) {
  .tape-milestones-row {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 8px !important;
    padding: 10px 2px !important;
    position: static !important;
    height: auto !important;
    scrollbar-width: none;
  }

  .tape-milestones-row::-webkit-scrollbar {
    display: none;
  }

  .tape-milestone-btn {
    position: static !important;
    transform: none !important;
    top: auto !important;
    left: auto !important;
    flex-shrink: 0 !important;
    background: #ffffff !important;
    border: 1px solid rgba(16, 24, 40, 0.12) !important;
    border-radius: 999px !important;
    padding: 6px 12px !important;
    font-size: 10px !important;
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 6px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
  }

  .tape-milestone-btn[data-active="1"] {
    background: #fff4ed !important;
    border-color: #e8572a !important;
  }

  .tape-milestone-btn[data-active="1"] span:first-child {
    background-color: #e8572a !important;
    border-color: #e8572a !important;
  }

  .tape-milestone-btn[data-active="1"] span:last-child {
    color: #e8572a !important;
    font-weight: 600 !important;
  }
}

/* 6. Footer Clean Reset on Mobile */
footer ul,
div.border-t ul {
  list-style: none !important;
  padding-left: 0 !important;
  margin-left: 0 !important;
}

footer li {
  list-style: none !important;
}

/* 7. Code Blocks & Containers Touch Scrolling */
pre {
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

/* 8. Announcement Bar on Small Screens */
.announce-bar {
  padding-left: 12px !important;
  padding-right: 12px !important;
}

.announce-bar span {
  max-width: 92vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 9. Live Demo Card Mobile Ergonomics */
@media (max-width: 640px) {
  .widget-card {
    width: 100% !important;
    max-width: calc(100vw - 32px) !important;
    margin: 0 auto !important;
  }

  .orb-container {
    width: 11.5rem !important;
    height: 11.5rem !important;
  }
  
  .tap-text {
    margin-top: 1.25rem !important;
    font-size: 0.95rem !important;
  }

  .tagline {
    font-size: 0.75rem !important;
  }
}

/* 10. Smooth Header Transition */
header {
  transition: top 0.2s ease, box-shadow 0.2s ease;
}
