/* ==========================================================================
   Quantum Weave — Dedicated Mobile Stylesheet
   Loaded last so all phone rules take precedence.
   Tested across: 375px, 390px, 412px, 430px, 440px
   ========================================================================== */

@media (max-width: 640px) {
  html {
    scroll-padding-top: 68px;
  }

  body.cinematic-theme {
    width: 100%;
    max-width: 100%;
    padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
  }

  /* ------------------------------------------------------------------------
     Header: 64px sticky, Brand left + 3-line hamburger right
     ------------------------------------------------------------------------ */
  .nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    padding: 0 18px;
    background: rgba(4, 14, 28, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
  }

  .nav-links,
  .nav .btn-nav {
    display: none !important;
  }

  .brand {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .brand-text {
    font-size: 1.05rem;
  }

  .brand-logo-img {
    width: 32px;
    height: 32px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  /* ------------------------------------------------------------------------
     Hamburger Button: 44x44px minimum tap area, 3 lines, subtle X animation
     ------------------------------------------------------------------------ */
  .mobile-hamburger-btn {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-hamburger-btn:hover,
  .mobile-hamburger-btn:active {
    background: rgba(0, 170, 202, 0.14);
    border-color: rgba(112, 232, 238, 0.4);
  }

  .hamburger-line {
    display: block;
    width: 20px;
    height: 2px;
    background: #ffffff;
    border-radius: 2px;
    transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease, background-color 0.2s ease;
    transform-origin: center;
  }

  /* Animate 3 lines into an X when open */
  .mobile-hamburger-btn.is-active .hamburger-line.line-1 {
    transform: translateY(7px) rotate(45deg);
    background: var(--cyan-glow);
  }

  .mobile-hamburger-btn.is-active .hamburger-line.line-2 {
    opacity: 0;
    transform: scaleX(0);
  }

  .mobile-hamburger-btn.is-active .hamburger-line.line-3 {
    transform: translateY(-7px) rotate(-45deg);
    background: var(--cyan-glow);
  }

  /* ------------------------------------------------------------------------
     Mobile Menu Panel: Premium slide-down panel below header
     ------------------------------------------------------------------------ */
  .mobile-nav-panel {
    display: block !important;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(4, 14, 28, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.6);
    padding: 22px 20px 26px;
    z-index: 99;
    transform: translateY(-115%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.24s ease;
  }

  .mobile-nav-panel.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-panel-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
  }

  .mobile-nav-link {
    display: block;
    font-family: 'Manrope', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #ffffff;
    padding: 12px 14px;
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
  }

  .mobile-nav-link:hover,
  .mobile-nav-link:active {
    background: rgba(0, 170, 202, 0.12);
    color: var(--cyan-glow);
    transform: translateX(4px);
  }

  .mobile-panel-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .mobile-panel-wa {
    width: 100%;
    min-height: 48px;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--green);
    color: var(--white);
    border-radius: 10px;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(8, 127, 97, 0.35);
    transition: background 0.2s ease;
  }

  .mobile-panel-wa:hover,
  .mobile-panel-wa:active {
    background: var(--green-hover);
  }

  .mobile-panel-assessment {
    width: 100%;
    min-height: 48px;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
  }

  .mobile-panel-assessment:hover,
  .mobile-panel-assessment:active {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.3);
  }

  /* ------------------------------------------------------------------------
     1. HERO: Single screen on mobile (calc(100svh - 64px))
     ------------------------------------------------------------------------ */
  .ambient-video {
    animation: ambientVideoMobile 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  @keyframes ambientVideoMobile {
    0% { transform: scale(1.015); opacity: 0.2; }
    100% { transform: scale(1); opacity: 0.32; }
  }

  .nav {
    animation-duration: 0.35s;
  }

  .cinematic-hero {
    min-height: calc(100svh - 64px);
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
  }

  .hero-content {
    width: 100%;
    max-width: 100%;
  }

  .eyebrow-tag {
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    margin-bottom: 14px;
  }

  .hero-content .eyebrow-tag {
    --hero-y: 12px;
    animation: heroEntranceFadeUp 0.70s cubic-bezier(0.22, 1, 0.36, 1) 0.12s both;
  }

  .hero-title {
    font-size: clamp(2.2rem, 9.5vw, 2.9rem);
    line-height: 1.05;
    margin-bottom: 14px;
    letter-spacing: -0.04em;
  }

  .hero-title-line.line-1 {
    --hero-y: 16px;
    animation: heroEntranceFadeUp 0.75s cubic-bezier(0.22, 1, 0.36, 1) 0.24s both;
  }

  .hero-title-line.line-2 {
    --hero-y: 16px;
    animation: heroEntranceFadeUp 0.75s cubic-bezier(0.22, 1, 0.36, 1) 0.36s both;
  }

  .hero-subtext {
    font-size: 15.5px;
    line-height: 1.45;
    margin: 0 auto 24px;
    max-width: 340px;
    color: #cadbe8;
    --hero-y: 14px;
    animation: heroEntranceFadeUp 0.75s cubic-bezier(0.22, 1, 0.36, 1) 0.48s both;
  }

  .hero-cta-group {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 10px;
    margin-bottom: 24px;
  }

  .hero-cta-group .btn {
    width: 100%;
    min-height: 48px;
    font-size: 15px;
  }

  .hero-cta-group .btn-primary {
    --hero-y: 12px;
    animation: heroEntranceFadeUp 0.70s cubic-bezier(0.22, 1, 0.36, 1) 0.62s both;
  }

  .hero-cta-group .btn-secondary {
    --hero-y: 12px;
    animation: heroEntranceFadeUp 0.70s cubic-bezier(0.22, 1, 0.36, 1) 0.72s both;
  }

  .hero-journey-indicator {
    padding: 7px 16px;
    gap: 10px;
    --hero-y: 10px;
    animation: heroEntranceFadeUp 0.70s cubic-bezier(0.22, 1, 0.36, 1) 0.84s both;
  }

  .indicator-step {
    font-size: 0.72rem;
  }

  .indicator-line {
    width: 16px;
  }

  /* ------------------------------------------------------------------------
     Global Mobile Section Spacing
     ------------------------------------------------------------------------ */
  .section {
    padding: 64px 18px;
  }

  .section-title {
    font-size: clamp(1.95rem, 8.2vw, 2.45rem);
    line-height: 1.1;
    margin-bottom: 12px;
  }

  .section-tagline {
    font-size: 15.5px;
    line-height: 1.5;
  }

  /* ------------------------------------------------------------------------
     2. VIDEO STORY SECTION (Standalone on Mobile)
     ------------------------------------------------------------------------ */
  .video-story-section {
    padding: 56px 18px 44px;
    background: linear-gradient(180deg, var(--navy-dark) 0%, #07172d 75%, var(--soft-bg) 100%);
  }

  .video-heading-block {
    text-align: left;
    margin-bottom: 24px;
  }

  .video-heading-block .eyebrow-tag {
    justify-content: flex-start;
  }

  .cinematic-video-frame {
    margin-bottom: 0;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  }

  .showcase-video {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 14px;
  }

  /* ------------------------------------------------------------------------
     3. THE GAP (Standalone Problem Discovery on Mobile)
     ------------------------------------------------------------------------ */
  .gap-section {
    padding: 60px 18px;
  }

  .gap-heading-block {
    text-align: left;
    margin-bottom: 30px;
  }

  .gap-heading-block .eyebrow-tag {
    justify-content: flex-start;
  }

  /* Shorter travel distances & refined mobile timing (700–900ms text, 850–1100ms video) */
  .reveal-item,
  .reveal-chapter,
  .reveal-pill,
  .reveal-faq,
  .reveal-footer,
  .journey-node {
    transform: translateY(16px);
    transition-duration: 0.80s;
    transition-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  }

  .reveal-video {
    transform: scale(0.975) translateY(14px);
    transition-duration: 0.95s;
    transition-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  }

  /* Journey nodes on mobile reveal individually as scrolled into view */
  .journey-node {
    opacity: 0;
  }

  .journey-node.is-revealed {
    opacity: 1;
    transform: translateY(0);
  }

  .reveal-chapter {
    transition-duration: 0.80s;
    transition-delay: 0s;
  }

  .reveal-faq {
    transition-duration: 0.75s;
    transition-delay: 0s;
  }

  .journey-experience {
    gap: 24px;
    margin-bottom: 36px;
  }

  .journey-nodes {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .journey-connector {
    display: none;
  }

  .journey-node {
    padding: 18px;
    border-radius: 14px;
  }

  .journey-node.leak-node {
    transform: none;
  }

  .leak-pulse-badge {
    top: -10px;
    right: 12px;
    font-size: 0.68rem;
  }

  .node-title {
    font-size: 1.18rem;
  }

  .node-desc {
    font-size: 0.86rem;
  }

  .gap-cinematic-visual {
    border-radius: 16px;
  }

  .leak-artwork {
    max-height: 240px;
  }

  .gap-revelation-card {
    padding: 20px 16px;
    border-radius: 14px;
  }

  .gap-revelation-card p {
    font-size: 1.15rem;
  }

  .gap-revelation-card strong {
    font-size: 1.3rem;
  }

  .leak-labels-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .leak-label-pill {
    padding: 16px 18px;
    border-radius: 12px;
  }

  .leak-pill-text strong {
    font-size: 0.98rem;
  }

  .leak-pill-text span {
    font-size: 0.84rem;
  }

  /* ------------------------------------------------------------------------
     3. OUR APPROACH (Mobile: One stage at a time)
     ------------------------------------------------------------------------ */
  .approach-heading-block {
    text-align: left;
    margin-bottom: 32px;
  }

  .approach-heading-block .eyebrow-tag {
    justify-content: flex-start;
  }

  .approach-chapters {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 36px;
  }

  .chapter-card {
    padding: 24px 20px;
    border-radius: 16px;
    gap: 16px;
  }

  .chapter-badge {
    font-size: 1.9rem;
  }

  .chapter-name {
    font-size: 1.35rem;
  }

  .chapter-tagline {
    font-size: 0.95rem;
    margin-bottom: 8px;
  }

  .chapter-desc {
    font-size: 0.9rem;
    line-height: 1.5;
  }

  .approach-action-row {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }

  .approach-action-row .btn {
    width: 100%;
    min-height: 48px;
    font-size: 15px;
  }

  /* ------------------------------------------------------------------------
     4. FAQs (Mobile)
     ------------------------------------------------------------------------ */
  .faq-heading-block {
    text-align: left;
    margin-bottom: 28px;
  }

  .faq-heading-block .eyebrow-tag {
    justify-content: flex-start;
  }

  details {
    padding: 0 16px;
    border-radius: 12px;
  }

  summary {
    padding: 18px 0;
    font-size: 1.02rem;
    gap: 14px;
  }

  .faq-toggle {
    font-size: 1.3rem;
  }

  .faq-answer {
    padding: 0 0 18px;
  }

  .faq-answer p {
    font-size: 0.92rem;
  }

  /* ------------------------------------------------------------------------
     Modal Dialog (Mobile)
     ------------------------------------------------------------------------ */
  .modal {
    padding: 12px;
  }

  .modal-card {
    padding: 28px 18px;
    border-radius: 16px;
    max-height: 92vh;
  }

  .modal-close {
    top: 12px;
    right: 14px;
    font-size: 1.6rem;
  }

  .assessment-header h2 {
    font-size: 1.45rem;
  }

  .form-step label {
    font-size: 0.88rem;
    margin: 14px 0;
  }

  .form-step input,
  .form-step select,
  .form-step textarea {
    font-size: 16px; /* Prevents auto-zoom in iOS Safari */
    padding: 13px 12px;
    border-radius: 10px;
  }

  .form-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 18px;
  }

  .form-nav .btn {
    flex: 1;
    min-height: 46px;
  }

  /* ------------------------------------------------------------------------
     Footer & Mobile Sticky Action Bar
     ------------------------------------------------------------------------ */
  .site-footer {
    padding: 36px 18px calc(88px + env(safe-area-inset-bottom, 0px));
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
  }

  .footer-brand-col {
    gap: 4px;
  }

  .footer-tagline {
    font-size: 0.88rem;
  }

  .footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    padding: 2px 0;
  }

  .footer-nav a {
    font-size: 0.9rem;
  }

  .footer-actions {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 10px;
    margin: 8px 0;
  }

  .footer-actions .btn,
  .footer-actions .btn-secondary-footer {
    width: 100%;
    min-height: 48px;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 13px 18px;
  }

  .footer-meta-col {
    width: 100%;
    display: flex;
    justify-content: flex-start;
  }

  .back-to-top {
    font-size: 0.88rem;
  }

  .mobile-cta {
    display: block;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 9px 16px calc(9px + env(safe-area-inset-bottom, 0px));
    background: rgba(4, 14, 28, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25);
    z-index: 150;
  }

  .mobile-cta a {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--green);
    color: var(--white);
    border-radius: 10px;
    min-height: 48px;
    font-weight: 800;
    font-size: 15px;
    gap: 8px;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(8, 127, 97, 0.35);
  }
}

/* Very compact screens (375px or short landscape) */
@media (max-width: 380px), (max-height: 700px) and (max-width: 640px) {
  .cinematic-hero {
    justify-content: flex-start;
    padding-top: 20px;
    padding-bottom: 20px;
  }

  .hero-title {
    font-size: 2rem;
    margin-bottom: 10px;
  }

  .hero-subtext {
    font-size: 14.5px;
    margin-bottom: 18px;
  }

  .hero-cta-group .btn {
    min-height: 44px;
    font-size: 14px;
    padding: 10px;
  }

  .hero-journey-indicator {
    display: none;
  }
}
