/* ──────────────────────────────────────────────────────────────
   Mobile-first responsive layer — AI App Store marketing site
   Loaded after styles.css, royal.css, configurator.css
   ────────────────────────────────────────────────────────────── */

/* ── Nav chrome: icon-first CTAs, consistent Inter / Space Grotesk ── */
.nav-inner--royal {
  flex-wrap: nowrap;
  gap: clamp(0.5rem, 2vw, 1rem);
}

.nav-inner--royal .logo--royal {
  flex: 0 1 auto;
  min-width: 0;
}

.logo__text {
  min-width: 0;
}

.logo__wordmark--royal {
  white-space: nowrap;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  margin-left: auto;
}

.nav-actions .btn--nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.8125rem;
  line-height: 1;
  padding: 0.5rem 0.875rem;
  white-space: nowrap;
  min-height: 40px;
  border-radius: var(--radius-pill);
}

.nav-actions .btn--nav svg,
.nav-actions .btn--nav i svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 2;
}

.nav-actions .btn--nav-icon svg {
  width: 20px;
  height: 20px;
}

.nav-actions .btn--nav-icon {
  width: 40px;
  min-width: 40px;
  padding: 0;
}

.nav-actions .btn--nav-lang {
  min-width: 44px;
  padding-inline: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.nav-actions .btn--nav-cta .nav-btn__label {
  display: inline;
}

.nav-actions .btn--nav-cta.btn--book {
  overflow: hidden;
}

.mobile-menu nav a {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.9375rem;
  letter-spacing: 0.02em;
  text-transform: none;
}

.btn--mobile-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-weight: 500;
  white-space: nowrap;
  width: 100%;
}

.btn--mobile-action svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Desktop inline nav from 1024px; tablet uses hamburger drawer */
@media (min-width: 1024px) {
  .desktop-nav--royal {
    display: flex !important;
    flex: 1 1 auto;
    justify-content: center;
    align-items: center;
    gap: clamp(0.65rem, 1.8vw, 1.5rem);
    min-width: 0;
    margin-inline: 0.25rem;
  }

  .menu-toggle {
    display: none !important;
  }
}

@media (max-width: 1023px) {
  .desktop-nav--royal {
    display: none !important;
  }

  .menu-toggle {
    display: flex !important;
    flex-shrink: 0;
  }

  #mobile-menu:not([hidden]) {
    display: flex !important;
    flex-direction: column;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .nav-actions {
    display: flex !important;
    flex-shrink: 0;
  }

  .nav-actions .btn--nav-cta .nav-btn__label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .nav-inner--royal .nav-actions .btn--nav.btn--nav-cta {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
    padding: 0 !important;
  }

  .nav-inner--royal .nav-actions .btn--nav.btn--nav-icon {
    width: 40px;
    min-width: 40px;
    padding: 0 !important;
  }
}

/* Tagline hidden below desktop; wordmark stays full width */
@media (max-width: 1023px) {
  .logo__tagline--royal {
    display: none;
  }

  .logo__crest.brand-mark {
    width: 36px;
    height: 36px;
  }
}

/* Main: room for fixed mobile CTA + home indicator */
#main-content {
  padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 768px) {
  #main-content {
    padding-bottom: 0;
  }
}

/* Section rhythm — full-screen panels use immersive-sections.css */
.workloads-light:not(.section-panel),
.hero:not(.section-panel),
.logo-cloud:not(.section-panel),
.categories:not(.section-panel):not(.categories--inline),
.apps:not(.section-panel),
.why:not(.section-panel),
.how:not(.section-panel),
.stats:not(.section-panel),
.reviews:not(.section-panel),
.pricing:not(.section-panel),
.faq:not(.section-panel),
.cta-final:not(.section-panel) {
  padding-block: var(--space-section-y);
}

.hero:not(.section-panel) {
  padding-block-start: clamp(4.5rem, 14vw, 6rem);
}

#hero.section-panel {
  padding-block-start: clamp(5.5rem, 16vw, 8.5rem);
}

/* Typography: prevent overflow on narrow viewports */
h1, h2, h3 {
  overflow-wrap: break-word;
  hyphens: auto;
}

p {
  max-width: min(var(--line-prose), 100%);
}

/* Nav mobile: theme + menu; auth in drawer */
@media (max-width: 767px) {
  .nav-inner {
    gap: 0.5rem;
  }

  .nav-actions .btn--nav {
    display: none;
  }

  .nav-inner--royal .logo--royal {
    max-width: none;
  }

  .logo__wordmark--royal {
    font-size: clamp(0.9375rem, 3.8vw, 1.0625rem);
  }

  .logo__crest.brand-mark {
    width: 38px;
    height: 38px;
    box-shadow: none;
  }

  .logo__crest:not(.brand-mark) svg {
    width: 18px;
    height: 18px;
  }
}

/* Category pills: horizontal scroll on small screens */
.category-pills {
  flex-wrap: nowrap;
  justify-content: flex-start;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  gap: 0.5rem;
  padding-bottom: 0.35rem;
  margin-inline: calc(-1 * var(--space-page-x));
  padding-inline: max(var(--space-page-x), env(safe-area-inset-left, 0px));
  scrollbar-width: thin;
}

.category-pills .pill {
  flex: 0 0 auto;
  scroll-snap-align: start;
}

@media (min-width: 640px) {
  .category-pills {
    flex-wrap: wrap;
    justify-content: center;
    overflow-x: visible;
    margin-inline: 0;
    padding-inline: 0;
  }
}

/* ── Hero (royal): text-first on phones/tablets; hide non-responsive decor ── */
@media (max-width: 900px) {
  #hero.hero--royal.section-panel {
    padding-block-start: clamp(4.25rem, 11vw, 5.5rem);
    padding-block-end: clamp(1.75rem, 5vw, 2.75rem);
    min-height: auto;
    overflow: visible;
  }

  #hero .hero__visual--royal {
    display: none !important;
  }

  #hero .hero__inner.hero__inner--royal {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  #hero .hero__text--royal,
  #hero .hero__title-royal,
  #hero .hero__subhead {
    text-align: center;
  }

  #hero .hero__eyebrow {
    font-size: 0.65rem;
    letter-spacing: 0.16em;
    margin-inline: auto;
    max-width: 100%;
    justify-content: center;
    text-align: center;
  }

  #hero .hero__title-royal {
    font-size: clamp(1.65rem, 7.2vw, 2.35rem);
    line-height: 1.08;
  }

  #hero .hero__subhead {
    font-size: 1rem;
    margin-bottom: 1.15rem;
  }

  #hero .hero__ctas--royal {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: min(100%, 19.5rem);
    margin-inline: auto;
    gap: 0.6rem;
  }

  #hero .hero__ctas--royal .btn,
  #hero .hero__ctas--royal .hero-cta-liquid {
    width: 100%;
    flex: none;
    min-width: 0;
    max-width: 100%;
  }

  #hero .hero__ctas--royal .btn--lg {
    padding: 0.62rem 1rem;
    font-size: 0.875rem;
    justify-content: center;
  }

  #hero .hero__trust--royal {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
  }

  .particle-globe-wrap .particle-globe,
  .particle-globe-wrap .particle-globe__count {
    display: none !important;
  }

  /* Zigzag rows: compact panels on mobile; static globe for store-globe */
  .zigzag-band .zigzag-row.section-panel {
    min-height: auto;
    justify-content: flex-start;
    padding-block: clamp(3rem, 10vw, 5rem);
  }

  #store-globe .zigzag-row__visual {
    order: -1;
    min-height: auto;
    max-width: min(100%, 13.5rem);
    margin-inline: auto;
    display: flex;
    justify-content: center;
  }

  #store-globe .particle-globe-wrap {
    max-width: 12.5rem;
  }

  .particle-globe-wrap .particle-globe__static {
    display: block;
  }

  .zigzag-row__visual {
    min-height: 0;
  }

  .zigzag-row__content {
    margin-inline: auto;
    text-align: center;
    width: 100%;
  }

  .zigzag-row__cta {
    display: flex;
    justify-content: center;
  }

  .zigzag-accordion__item summary,
  .zigzag-accordion__panel {
    text-align: left;
  }

  .zigzag-row__lead--desktop {
    display: none;
  }

  /* Security vault: stacked mobile layout — no overlapping 3D chips */
  #security-zigzag .zigzag-row__visual {
    order: -1;
    min-height: auto;
    max-width: min(100%, 20rem);
    margin-inline: auto;
    overflow: visible;
  }

  #security-zigzag .zigzag-visual--vault {
    max-width: 100%;
    min-height: auto;
    perspective: none;
  }

  #security-zigzag .zigzag-vault {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: auto auto auto;
    gap: 0.65rem 0.5rem;
    height: auto;
    min-height: 0;
    padding-bottom: 0.25rem;
  }

  #security-zigzag .zigzag-vault::before {
    display: none;
  }

  #security-zigzag .zigzag-vault__globe {
    position: relative;
    left: auto;
    top: auto;
    grid-column: 1 / -1;
    grid-row: 1;
    width: min(72%, 10.5rem);
    height: auto;
    aspect-ratio: 1;
    margin-inline: auto;
    transform: none;
    opacity: 0.85;
  }

  #security-zigzag .zigzag-vault__panel {
    position: relative;
    top: auto;
    left: auto;
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    max-width: none;
    padding: 1.1rem 1rem;
    transform: none !important;
    animation: vault-border-glow 4s ease-in-out infinite;
  }

  #security-zigzag .zigzag-vault__icon {
    width: 2.5rem;
    height: 2.5rem;
    margin-bottom: 0.5rem;
    animation: vault-icon-pulse 3.2s ease-in-out infinite;
  }

  #security-zigzag .zigzag-vault__title {
    font-size: 1rem;
    margin-bottom: 0.65rem;
  }

  #security-zigzag .zigzag-vault__list li {
    font-size: 0.78rem;
    align-items: flex-start;
    line-height: 1.4;
  }

  #security-zigzag .zigzag-vault__chip {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    grid-row: 3;
    justify-self: center;
    padding: 0.35rem 0.5rem;
    font-size: 0.62rem;
    white-space: normal;
    text-align: center;
    line-height: 1.25;
    transform: none !important;
    animation: none !important;
    max-width: 100%;
  }

  #security-zigzag .zigzag-vault__chip--1 {
    grid-column: 1;
  }

  #security-zigzag .zigzag-vault__chip--2 {
    grid-column: 2;
  }

  #security-zigzag .zigzag-vault__chip--3 {
    grid-column: 3;
  }

  #security-zigzag .zigzag-vault__chip--accent {
    animation: vault-chip-accent-glow 3s ease-in-out infinite !important;
  }
}

@media (max-width: 380px) {
  #security-zigzag .zigzag-vault {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto auto;
  }

  #security-zigzag .zigzag-vault__chip--1,
  #security-zigzag .zigzag-vault__chip--2,
  #security-zigzag .zigzag-vault__chip--3 {
    grid-column: 1;
  }

  #security-zigzag .zigzag-vault__chip--1 {
    grid-row: 3;
  }

  #security-zigzag .zigzag-vault__chip--2 {
    grid-row: 4;
  }

  #security-zigzag .zigzag-vault__chip--3 {
    grid-row: 5;
  }
}

@media (min-width: 901px) {
  .zigzag-row__lead--mobile {
    display: none;
  }
}

/* App cards */
.app-card__footer {
  flex-wrap: wrap;
  gap: 0.75rem;
}

.app-card__footer .btn {
  width: 100%;
}

@media (min-width: 400px) {
  .app-card__footer .btn {
    width: auto;
  }
}

/* Hero CTAs: full-width buttons on narrow phones */
.hero__ctas {
  flex-direction: column;
  align-items: stretch;
  width: 100%;
}

.hero__ctas .btn {
  width: 100%;
}

@media (min-width: 480px) {
  .hero__ctas {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    width: auto;
  }

  .hero__ctas .btn {
    width: auto;
    flex: 1 1 auto;
    min-width: min(100%, 12rem);
  }
}

/* Pricing toggle & billing */
.pricing-toggle,
.pricing__billing {
  flex-wrap: wrap;
  row-gap: 0.5rem;
}

.pricing__billing button {
  min-height: 44px;
}

/* Forms: stack on mobile */
.cta-form,
.newsletter-form {
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  max-width: 100%;
}

.cta-form input[type="email"],
.newsletter-form input[type="email"] {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
}

.cta-form .btn,
.newsletter-form .btn {
  width: 100%;
}

@media (min-width: 480px) {
  .cta-form,
  .newsletter-form {
    flex-direction: row;
    max-width: 480px;
  }

  .cta-form .btn,
  .newsletter-form .btn {
    width: auto;
    flex-shrink: 0;
  }
}

/* FAQ */
.faq__question {
  font-size: clamp(0.9rem, 2.8vw, 1rem);
  padding: 1rem 1rem;
}

/* Carousel */
.carousel__slide p {
  font-size: clamp(1rem, 3.5vw, 1.1rem);
}

/* Footer newsletter */
.footer__newsletter .newsletter-form {
  max-width: 100%;
}

/* Sticky CTA respects safe area */
.mobile-sticky-cta {
  padding: 0.75rem max(1rem, env(safe-area-inset-right, 0px))
    calc(0.75rem + env(safe-area-inset-bottom, 0px))
    max(1rem, env(safe-area-inset-left, 0px));
}

.mobile-sticky-cta .btn {
  flex: 1 1 0;
  min-width: 0;
}

/* Timeline stays vertical until tablet landscape */
@media (min-width: 768px) and (max-width: 1023px) {
  .timeline {
    flex-direction: column;
    gap: 2rem;
  }

  .timeline__item {
    flex-direction: row;
    text-align: left;
    align-items: flex-start;
  }
}

/* Stat numbers scale down slightly on phones */
@media (max-width: 479px) {
  .stat-card__number {
    font-size: 1.75rem;
  }

  .stat-card {
    padding: 1.25rem;
  }
}

/* Reduced horizontal bleed from orbit scroll */
.apps--royal .container {
  overflow: visible;
}

/* ── Site-wide mobile polish (homepage + all subpages) ── */

html {
  -webkit-text-size-adjust: 100%;
}

img,
video,
canvas {
  max-width: 100%;
  height: auto;
}

.container,
.section-panel__inner,
.card-showcase__body,
.card-showcase__intro,
.cfg-page__shell,
.zigzag-row__grid {
  min-width: 0;
}

.section-head__title {
  overflow-wrap: break-word;
}

/* Customer showcase: swipeable cards on narrow viewports */
@media (max-width: 899px) {
  .card-showcase__head {
    flex-direction: column;
    align-items: stretch;
  }

  .card-showcase__title {
    max-width: none;
  }

  .card-showcase__head .btn {
    width: 100%;
    justify-content: center;
  }

  .card-showcase__row {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    gap: 0.75rem;
    padding-bottom: 0.35rem;
    margin-inline: calc(-1 * var(--space-page-x));
    padding-inline: max(var(--space-page-x), env(safe-area-inset-left, 0px))
      max(var(--space-page-x), env(safe-area-inset-right, 0px));
  }

  .share-card {
    flex: 0 0 min(78vw, 300px);
    min-height: 240px;
    scroll-snap-align: center;
  }

  .card-showcase__row:has(.share-card:hover) .share-card:not(:hover),
  .card-showcase__row:has(.share-card:focus-visible) .share-card:not(:focus-visible),
  .share-card:hover,
  .share-card:focus-visible {
    flex: 0 0 min(78vw, 300px);
  }
}

/* Explore apps: filter pills scroll on phones */
@media (max-width: 639px) {
  .store-catalog__filters {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    margin-inline: calc(-1 * var(--space-page-x));
    padding-inline: max(var(--space-page-x), env(safe-area-inset-left, 0px)) 1rem;
    padding-bottom: 0.35rem;
  }

  .store-catalog__pill {
    flex: 0 0 auto;
    scroll-snap-align: start;
  }
}

/* Apps catalog & module detail */
.app-catalog,
.app-page {
  padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
}

body:not(.scroll-nav-enabled) .app-catalog,
body:not(.scroll-nav-enabled) .app-page {
  padding-top: clamp(4.75rem, 12vw, 6.5rem);
}

@media (max-width: 767px) {
  #main-content.app-catalog,
  #main-content.app-page {
    padding-bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px));
  }
}

.app-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -0.25rem;
  padding: 0 0.25rem;
}

.app-metering-table {
  min-width: min(100%, 20rem);
}

.app-catalog__list {
  grid-template-columns: 1fr;
}

@media (min-width: 400px) {
  .app-catalog__list {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  }
}

.app-hero__actions .btn {
  min-height: 44px;
}

/* Configurator: single-column modules on phones */
@media (max-width: 479px) {
  .cfg-layout--page .cfg-module-grid {
    grid-template-columns: 1fr;
  }

  .cfg-overview {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
  }

  .cfg-overview__total {
    text-align: left;
  }
}

/* Code showcase dashboards */
@media (max-width: 520px) {
  .showcase-dash__kpis {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }

  .showcase-dash__charts {
    grid-template-columns: 1fr !important;
  }
}

/* Zigzag accordions: touch-friendly summaries */
.zigzag-accordion__item summary {
  min-height: 44px;
  display: flex;
  align-items: center;
}

/* Booking calendar: keep day cells tappable */
@media (max-width: 380px) {
  .booking-calendar__day {
    min-height: 2.25rem;
    font-size: 0.8rem;
  }
}

/* Tablet header: icon actions + drawer (nav links live in mobile-menu) */
@media (min-width: 768px) and (max-width: 1023px) {
  .nav-inner--royal {
    gap: 0.5rem;
  }
}

/* Footer legal row stacks on phones */
@media (max-width: 479px) {
  .footer-marketing__bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Long tokens / URLs in content */
.app-catalog__link,
.app-hero__source,
code {
  overflow-wrap: anywhere;
}
