/* ────────────────────────────────────────────────────────────────
   mobile.css — site-wide responsive overrides
   Loaded after each page's stylesheet so these rules win.
   Standard tiers: ≤ 640px (phone) and ≤ 900px (tablet).
   Nav burger uses ≤ 1070px because the desktop nav layout
   breaks between 901–1070 (center menu overlaps right buttons).
   ──────────────────────────────────────────────────────────────── */

/* ─── 1. NAV — hide center menu, show hamburger ─────────────── */
/* Note: nav uses its own breakpoint (1070px) because the desktop nav's
   absolutely-positioned center menu overlaps the right-side buttons
   between 901–1070px. Other rules below stay at the standard 900px tablet tier. */
@media (max-width: 1070px) {
  nav {
    padding: 16px 18px !important;
  }
  nav .logo img {
    height: 28px !important;
  }
  nav .logo .logo-icon {
    height: 38px !important;
    width: 38px !important;
  }

  /* Center mega-menu — hide on mobile, expose via burger */
  .nav-center {
    display: none !important;
  }

  /* Right side — show only Book button, drop "Log in" + "EN/DA" labels */
  nav .nav-right {
    gap: 10px !important;
  }
  nav .nav-right .log-in {
    display: none;
  }
  .lang-switcher {
    display: none !important;
  }

  nav .btn-book {
    padding: 10px 16px !important;
    font-size: 13px !important;
  }

  /* Hamburger trigger (auto-injected by mobile-nav.js) */
  .mobile-burger {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(20, 17, 31, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: #fff;
    cursor: pointer;
    font-size: 18px;
    pointer-events: auto;
  }
  .mobile-burger svg {
    width: 20px;
    height: 20px;
  }
}
@media (min-width: 1071px) {
  .mobile-burger,
  .mobile-drawer {
    display: none !important;
  }
}

/* Mobile drawer — full-screen takeover on mobile.
   Sized by left/right insets (not width: 100vw) — Brave/older Android
   browsers interpret 100vw inconsistently when there's any horizontal
   page extension or scrollbar gutter. Insets are universally reliable
   for position: fixed. */
.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: auto;
  max-width: none;
  background: #0d0a14;
  z-index: 250;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 88px 28px 36px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-sizing: border-box;
}
.mobile-drawer.open {
  transform: translateX(0);
}
.mobile-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 2, 8, 0.7);
  backdrop-filter: blur(8px);
  z-index: 249;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.mobile-drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.mobile-drawer a {
  font-family: "Outfit", sans-serif;
  font-size: 17px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  padding: 14px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mobile-drawer a:hover {
  color: #fff;
}
.mobile-drawer a.section-label {
  font-size: 11px;
  font-weight: 800;
  color: rgba(196, 181, 253, 0.7);
  letter-spacing: 1.4px;
  text-transform: uppercase;
  margin-top: 18px;
  padding-bottom: 6px;
  border: none;
}
.mobile-drawer a.section-label:first-child {
  margin-top: 0;
}
.mobile-drawer .drawer-cta {
  margin-top: 28px;
  width: 100%;
  padding: 18px 24px;
  background: #7c3aed;
  border-radius: 14px;
  text-align: center;
  justify-content: center;
  border: none;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.2px;
  box-shadow: 0 10px 28px rgba(124, 58, 237, 0.5);
}
.mobile-drawer-close {
  position: absolute;
  top: 22px;
  right: 22px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
}
.mobile-drawer-lang {
  display: flex;
  gap: 8px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.mobile-drawer-lang a {
  flex: 1;
  text-align: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.5px;
}
.mobile-drawer-lang a.active {
  background: rgba(124, 58, 237, 0.18);
  border-color: rgba(124, 58, 237, 0.4);
  color: #fff;
}
body.drawer-open {
  overflow: hidden;
}

/* Default state for the burger on desktop = hidden */
.mobile-burger {
  display: none;
}
.mobile-drawer,
.mobile-drawer-backdrop {
  display: block;
}
@media (min-width: 1071px) {
  .mobile-drawer,
  .mobile-drawer-backdrop {
    display: none;
  }
}

/* ─── 2. HERO — stack vertically + scale type ──────────────── */
@media (max-width: 900px) {
  .hero {
    padding: 132px 20px 32px !important; /* extra top padding so Vee 3.0 badge breathes from the nav */
    min-height: auto !important;
    flex-direction: column !important; /* parent is flex-row on desktop; force vertical on phone */
    align-items: stretch !important;
  }
  .hero h1 {
    font-size: clamp(36px, 9vw, 56px) !important;
    line-height: 1.05 !important;
  }
  .hero .lede {
    font-size: 17px !important;
  }
  .hero .sub {
    font-size: 14px !important;
    max-width: 100% !important;
  }
  /* CTAs side-by-side, content-sized, centered — matching the final-CTA
     and engine-page CTA pattern. */
  .hero-ctas {
    flex-direction: row !important;
    width: 100% !important;
    gap: 12px !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .hero-ctas .btn-lg-primary {
    flex: 0 0 auto !important;
    width: auto !important;
    justify-content: center;
    padding: 16px 22px !important;
    font-size: 15px !important;
    white-space: nowrap;
  }
  .hero-ctas .btn-lg-secondary {
    flex: 0 0 auto !important;
    width: auto !important;
    justify-content: center;
    padding: 16px 18px !important;
    font-size: 15px !important;
    white-space: nowrap;
  }

  /* Logo strip + stats — flow in document order on mobile (no absolute) */
  .hero-logos {
    position: relative !important;
    margin-top: 28px;
    padding: 16px 0 !important;
    background: none !important; /* drop the bottom-edge fade */
  }
  .hero-logos-label {
    font-size: 14px !important;
    text-align: center;
    flex-direction: row !important; /* keep stats inline; wrap only if needed */
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 6px 10px !important;
    padding: 0 16px;
    margin-bottom: 18px !important;
  }
  .hero-logos-label strong {
    font-size: 16px !important;
  }
  .hero-logos-label .after {
    margin-left: 0 !important;
  }
  .hero-logos-track {
    gap: 48px !important;
  }
  .hero-logos-track .logo-text {
    font-size: 22px !important;
  }

  /* Engine.html / role pages — 2-photo collage shrinks */
  .en-hero-grid {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }
  .en-hero-photos {
    display: none !important;
  }
}

/* ─── 3. SECTION TITLES — tame the 6-7vw clamps ─────────────── */
@media (max-width: 640px) {
  .section-title,
  .proof-title,
  h1,
  h2 {
    font-size: clamp(26px, 8vw, 40px) !important;
    letter-spacing: -0.8px !important;
    line-height: 1.05 !important;
  }
  .section-desc,
  .section-sub {
    font-size: 15px !important;
  }
}

/* ─── 3b. SECTION SPACING — tighten gaps between sections on mobile ─ */
@media (max-width: 900px) {
  /* Hero → Problem */
  .hero {
    padding-bottom: 24px !important;
  }
  .problem {
    padding-top: 24px !important;
    padding-bottom: 40px !important;
  }
  .problem-outro {
    margin-top: 56px !important;
  }

  /* Solution / Engine handoff */
  .solution {
    padding-top: 40px !important;
    padding-bottom: 40px !important;
  }
  .engine-handoff {
    margin-top: 56px !important;
  }

  /* Proof → Case-story → Concept */
  .proof,
  .case-story {
    padding-top: 56px !important;
    padding-bottom: 56px !important;
  }

  /* Concept (platform) → Compare (alternativerne) — user flagged this gap */
  .concept {
    padding-top: 40px !important;
    padding-bottom: 56px !important;
  }
  .compare-section {
    padding-top: 40px !important;
    padding-bottom: 40px !important;
  }

  /* Modes + final */
  .modes {
    padding-top: 56px !important;
    padding-bottom: 56px !important;
  }
}

/* ─── 4. GRID LAYOUTS — collapse to single column ───────────── */
@media (max-width: 900px) {
  /* Footer: 5 cols → stacked */
  footer {
    padding-left: 24px !important;
    padding-right: 24px !important;
  }
  footer .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
    padding: 40px 0 !important;
  }
  footer .footer-brand {
    order: -1;
  }
  footer .footer-bottom {
    flex-direction: column;
    gap: 12px;
    padding: 20px 0 !important;
    text-align: center;
  }

  /* Tier cards / pricing cards */
  .tier-bridge-grid {
    grid-template-columns: 1fr !important;
  }
  .id-grid {
    grid-template-columns: 1fr !important;
  }

  /* Logo wall — 3 cols on phone */
  .logo-wall {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  .logo-tile {
    font-size: 12px !important;
    padding: 12px 8px !important;
  }

  /* Metric grid */
  .metric-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .case-stats {
    grid-template-columns: repeat(3, 1fr) !important;
  }

  /* Cases grid (customers page) — 2 cols on phone */
  .cases-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 14px !important;
  }
  .cu-card {
    aspect-ratio: 9 / 14 !important;
  }

  /* Concept accordion — vertical */
  .concept-accordion {
    grid-template-columns: 1fr !important;
    height: auto !important;
  }
  .concept-panel {
    min-height: auto !important;
  }

  /* Math grid (compare page) */
  .math-grid {
    grid-template-columns: 1fr !important;
  }
  .math-vedio {
    margin-top: 24px;
  }
  .math-delta {
    flex-direction: column !important;
    text-align: center;
  }
  .math-delta .md-text {
    text-align: center !important;
    max-width: 100% !important;
  }
  .math-delta .md-n {
    font-size: 38px !important;
  }

  /* Pricing tiers */
  .cards {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }
  .card {
    padding: 24px !important;
  }

  /* Solutions mega cards */
  .mega {
    grid-template-columns: 1fr !important;
  }
}

/* ─── 5. WHEEL / CAROUSEL — looser sizing ───────────────────── */
@media (max-width: 640px) {
  .case-grid,
  .test-grid {
    padding: 16px !important;
  }
  .case-card,
  .test-card {
    width: 220px !important;
  }
  .case-nav {
    display: none !important;
  }
}

/* ─── 6. COMPARE TABLE — horizontal scroll for legacy compare-table only.
        .hth-frame on the compare page handles its own mobile layout below. */
@media (max-width: 900px) {
  .compare-table-wrap {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .compare-table {
    min-width: 720px !important;
  }
}

/* ─── 7. FILTER PILLS — wrap nicely on narrow screens ───────── */
@media (max-width: 640px) {
  .filter-row {
    flex-wrap: wrap !important;
    gap: 8px !important;
    justify-content: center;
  }
  .filter-pill {
    font-size: 12px !important;
    padding: 8px 14px !important;
  }
}

/* ─── 8. TYPOGRAPHY — reduce wide-screen clamp values ───────── */
@media (max-width: 640px) {
  body {
    font-size: 15px !important;
  }
  .panel-headline,
  .panel-name {
    font-size: clamp(22px, 6.5vw, 32px) !important;
  }
}

/* ─── 9. TOUCH TARGETS — buttons + anchors min 44px ─────────── */
@media (max-width: 900px) {
  .btn-lg-primary,
  .btn-lg-secondary,
  .case-play,
  .cu-card-play,
  .test-card-play,
  .case-story-play {
    min-height: 44px;
  }
}

/* ─── 10. CASE STORY (Skatteguiden) — fit on phone ──────────── */
@media (max-width: 640px) {
  .case-story-video {
    max-width: 100% !important;
    aspect-ratio: 9 / 16 !important; /* most clips are vertical */
  }
  .case-story-quote {
    font-size: 18px !important;
    padding: 0 12px;
  }
  /* Stay 3-col on mobile, but keep gap: 1px so the thin separator lines show
     (same as BEVISET .case-stats — without this we get visual mismatch). */
  .case-story-metrics {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 1px !important;
  }
}

/* ─── 11. OBJ list / FAQ / paths — comfortable on mobile ────── */
@media (max-width: 900px) {
  .obj {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    padding: 20px !important;
  }
  .paths {
    grid-template-columns: 1fr !important;
  }
  .path-card {
    padding: 24px !important;
  }
  .faq-q {
    font-size: 15px !important;
    padding: 18px 20px !important;
  }
  .faq-a-inner {
    font-size: 14px !important;
    padding: 0 20px 18px !important;
  }
}

/* ─── 12. TESTIMONIAL CARDS — readable on phone ─────────────── */
@media (max-width: 640px) {
  .test-card-quote {
    font-size: 13px !important;
  }
  .test-card-name {
    font-size: 14px !important;
  }
  .test-card-role {
    font-size: 11px !important;
  }
}

/* ─── 13. ACCESSIBILITY — keyboard focus rings ──────────────── */
/* Visible focus only when navigating via keyboard (not on mouse click) */
:focus-visible {
  outline: 2px solid #c4b5fd;
  outline-offset: 3px;
  border-radius: 4px;
}
button:focus-visible,
a:focus-visible,
.cu-card:focus-visible,
.test-card:focus-visible,
.case-card:focus-visible {
  outline: 2px solid #a78bfa;
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
}
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid #a78bfa;
  outline-offset: 0;
  border-color: #7c3aed !important;
}

/* ─── PERFORMANCE: skip the hero video on mobile + reduced-data devices ──
   The cover.mp4 background video is 1080p and decodes constantly. On a
   phone (or any low-end device) it tanks scroll perf for no visual gain
   — the .hero-bg image underneath is already a good fallback. */
@media (max-width: 900px) {
  .hero-bg-video {
    display: none !important;
  }
}
@media (prefers-reduced-data: reduce) {
  .hero-bg-video {
    display: none !important;
  }
}

/* ─── 14. REDUCED MOTION — respect user preference ──────────── */
@media (prefers-reduced-motion: reduce) {
  .hero-bg-video {
    display: none !important;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  /* Pause looping background videos */
  .hero-bg-video {
    /* Browser still plays but at least no fade-in */
    transition: none !important;
  }
}

/* ─── 15. SR-ONLY utility — for screen-reader-only labels ──── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ─── 17. HOME — engine-pipeline + compare sparkles ─────────────
   Pipeline cards are absolutely positioned for a 1240px container,
   so they need to stack until the desktop layout fits. Sparkles
   on the .compare-vedio card extend `inset: -60px` past the wrap
   and cause horizontal overflow on narrow viewports. */
@media (max-width: 1310px) {
  .engine-pipeline {
    height: auto;
    margin: 40px auto 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 540px;
  }
  .engine-pipeline::before {
    width: 100%;
    height: 500px;
  }
  .engine-pipeline .pipeline-track,
  .engine-pipeline .pipeline-clip {
    display: none;
  }
  .pipeline-slot {
    position: static;
    width: 100% !important;
    left: auto !important;
    top: auto !important;
    --tilt: 0deg !important;
  }
  .pipeline-card {
    transform: translateY(30px) rotate(0deg);
  }
  .pipeline-card.revealed,
  .pipeline-card.revealed:hover {
    transform: translateY(0) rotate(0deg);
  }

  .vedio-sparkles {
    display: none;
  }
}

/* ─── 16. CALENDLY POPUP — full-screen on mobile ─────────────
   Calendly's default popup is a centered modal that gets squeezed
   on a 375px viewport. Force it full-screen with a clearly visible
   close button at top-right. */
@media (max-width: 900px) {
  /* Hide the site nav and hamburger while Calendly is showing — they
     overlap the Calendly close button + the booking content. */
  body:has(.calendly-overlay) > nav,
  body:has(.calendly-overlay) .mobile-burger,
  body:has(.calendly-overlay) .grain {
    display: none !important;
  }

  .calendly-overlay {
    background: rgba(13, 10, 20, 0.96) !important;
    -webkit-backdrop-filter: blur(0) !important;
    backdrop-filter: blur(0) !important;
    z-index: 99999 !important;
  }
  .calendly-overlay .calendly-popup {
    /* Size by insets, not 100vw/100vh — Brave Android + iOS Safari
       address-bar both compute these inconsistently. */
    inset: 0 !important;
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    transform: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }
  .calendly-overlay .calendly-popup-content {
    width: 100% !important;
    height: 100% !important; /* fills parent (which fills viewport via insets) */
    max-height: 100% !important;
    border-radius: 0 !important;
    overflow: hidden;
  }
  .calendly-overlay .calendly-popup-content > iframe {
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
  }
  /* Close button — top-right, large + obvious. Only target Calendly's own
     .calendly-popup-close button (not their click-to-close backdrop, which
     also matches .calendly-close-overlay / [aria-label="Close"] and was
     creating a phantom 2nd X on the left side of the screen). */
  .calendly-overlay .calendly-popup-close {
    position: fixed !important;
    top: 14px !important;
    right: 14px !important;
    width: 44px !important;
    height: 44px !important;
    background: rgba(255, 255, 255, 0.96) !important;
    border-radius: 50% !important;
    border: none !important;
    color: #0d0a14 !important;
    font-size: 22px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 100000 !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    /* Visual cross — Calendly's own X is sometimes tiny / hidden behind their iframe */
    background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 2 L14 14 M14 2 L2 14' stroke='%230d0a14' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 16px 16px !important;
    color: transparent !important; /* hide native × glyph if any */
    cursor: pointer !important;
  }
}
