/**
 * Orbyt Pay — flexible layouts for all screens (mobile-first)
 * Loaded last — overrides fixed widths & overflow issues
 */

:root {
  --nav-h: 72px;
  --page-pad: clamp(16px, 4.5vw, 28px);
  --section-pad-y: clamp(48px, 10vw, 100px);
  --sat-orbit-r: min(200px, 34vw);
  --touch-min: 44px;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--nav-h) + 12px);
}

body {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  padding-bottom: env(safe-area-inset-bottom);
}

.site-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

.container {
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: max(var(--page-pad), env(safe-area-inset-left)) max(var(--page-pad), env(safe-area-inset-right));
}

/* Media never breaks layout */
img, svg, video, picture {
  max-width: 100%;
  height: auto;
}

canvas#orbyt-flow-canvas,
canvas#orb-canvas {
  width: 100% !important;
  max-width: 100vw;
}

section {
  padding-block: var(--section-pad-y);
}

/* ─── NAV — mobile fixed & touch-friendly ─── */
.nav {
  padding-top: max(12px, env(safe-area-inset-top));
  padding-bottom: 12px;
}

.nav-inner {
  flex-wrap: nowrap;
  gap: 12px;
}

.nav-logo {
  min-width: 0;
  flex-shrink: 1;
}

.nav-logo img,
.nav-brand-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.nav-toggle {
  display: none;
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.nav-mobile-cta {
  display: none;
}

body.nav-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

/* ─── HERO — flexible height (not forced 100vh on mobile) ─── */
.hero--orbyt {
  min-height: auto;
  padding: calc(var(--nav-h) + env(safe-area-inset-top) + 16px) 0 clamp(40px, 8vw, 80px);
}

.hero-orbyt-grid {
  min-height: auto;
  gap: clamp(24px, 5vw, 48px);
}

.hero-text-col {
  min-width: 0;
}

.hero-orbytpay-mega {
  font-size: clamp(2.25rem, 11vw, 7rem);
  word-break: break-word;
  overflow-wrap: break-word;
}

.hero-headline-sub {
  max-width: 100%;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-actions .btn {
  min-height: var(--touch-min);
}

/* Inner page heroes */
.page-hero--visual {
  padding: calc(var(--nav-h) + env(safe-area-inset-top) + 32px) 0 clamp(32px, 6vw, 60px);
}

.page-hero-flex {
  flex-wrap: wrap;
  gap: 16px;
}

.page-hero--visual h1 {
  font-size: clamp(1.5rem, 5.5vw, 2.5rem);
  line-height: 1.15;
}

/* ─── MOON & satellites — scale with viewport ─── */
.ledger-moon-stage {
  --sat-orbit-r: min(200px, 34vw);
  width: min(420px, 88vw);
  height: min(420px, 88vw);
}

@keyframes moonSatOrbit {
  from { transform: rotate(0deg) translateX(var(--sat-orbit-r)) rotate(0deg); }
  to { transform: rotate(360deg) translateX(var(--sat-orbit-r)) rotate(-360deg); }
}

.moon-caption {
  max-width: 90vw;
  white-space: normal;
  text-align: center;
  font-size: clamp(0.55rem, 2.5vw, 0.68rem);
}

/* ─── Content & FAQ ─── */
.content-block {
  width: 100%;
  max-width: 800px;
  padding-inline: 0;
  overflow-wrap: break-word;
}

.content-block h2 { font-size: clamp(1.35rem, 4vw, 1.75rem); }
.content-block p,
.content-block li { font-size: clamp(0.9rem, 2.5vw, 1rem); }

.code-block,
.content-block pre {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.faq-question {
  padding: 20px 36px 20px 0;
  font-size: clamp(0.9rem, 2.8vw, 1.05rem);
  min-height: var(--touch-min);
}

/* ─── Diagrams — scroll on narrow screens ─── */
.money-flow-wrap,
.protocol-visual,
.sync-visual,
.money-cap-grid {
  max-width: 100%;
}

.money-flow-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.protocol-visual,
.sync-visual {
  flex-wrap: wrap;
  justify-content: center;
  padding: clamp(24px, 5vw, 48px) clamp(12px, 3vw, 24px);
}

.money-cap-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr));
  gap: 12px;
}

/* ─── Orbit ecosystem — scales down ─── */
.orbit-section-wrap {
  width: 100%;
  overflow: hidden;
  display: flex;
  justify-content: center;
}

.orbit-container {
  width: min(600px, 92vw);
  height: min(600px, 92vw);
  max-width: 100%;
}

/* ─── Network & footer ─── */
.network-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}

.trust-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 12px;
  padding: 14px var(--page-pad);
  text-align: center;
}

.trust-strip span { white-space: nowrap; }

/* ─── Glyph & visual grids ─── */
.glyph-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 100px), 1fr));
}

.ob-icons {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
}

.card-grid--visual {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr));
}

.visual-universe-inner {
  grid-template-columns: 1fr;
  gap: clamp(24px, 5vw, 48px);
}

.vu-moon-wrap .ledger-moon-stage {
  margin-inline: auto;
}

/* ─── Musk blocks ─── */
.musk-quote {
  font-size: clamp(1.75rem, 7vw, 4.5rem);
}

.musk-telemetry {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
}

.musk-tel-cell {
  border-right: none;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.musk-spec-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
}

.musk-fullbleed-track span {
  font-size: clamp(2rem, 12vw, 7rem);
}

.orbit-brand-glyphs {
  width: 100%;
  justify-content: center;
}

/* ─── Sitemap ─── */
.sitemap-list {
  grid-template-columns: 1fr;
}

.sitemap-stats {
  grid-template-columns: repeat(2, 1fr);
}

.sitemap-network-list {
  grid-template-columns: 1fr;
}

/* ─── TABLET (≤1024px) ─── */
@media (max-width: 1024px) {
  :root { --nav-h: 68px; }

  .hero-orbyt-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-moon-col { order: -1; }
  .orbit-brand-glyphs--hero { justify-content: center; }
  .musk-hero-meta { justify-content: center; }
  .hero-headline-sub { margin-inline: auto; }
  .hero-headline-micro { margin-inline: auto; }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
  }

  .orbit-ring-1 { width: 50%; height: 50%; }
  .orbit-ring-2 { width: 75%; height: 75%; }
  .orbit-ring-3 { width: 95%; height: 95%; }

  .orbit-center {
    width: clamp(72px, 18vw, 120px);
    height: clamp(72px, 18vw, 120px);
    font-size: clamp(0.6rem, 2.5vw, 0.9rem);
  }

  .orbit-node {
    width: clamp(52px, 14vw, 80px);
    height: clamp(52px, 14vw, 80px);
    font-size: clamp(0.5rem, 2vw, 0.7rem);
  }
}

/* ─── MOBILE (≤768px) ─── */
@media (max-width: 768px) {
  :root {
    --nav-h: 64px;
    --sat-orbit-r: min(150px, 30vw);
  }

  .nav-links { display: none; }

  .nav-toggle { display: flex; }

  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.97);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    padding: 12px max(var(--page-pad), env(safe-area-inset-left)) 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    gap: 4px;
    max-height: min(70vh, 480px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 200;
  }

  .nav-links.open a {
    display: flex;
    align-items: center;
    min-height: var(--touch-min);
    padding: 12px 16px;
    border-radius: 4px;
    width: 100%;
  }

  .nav-right .nav-cta-btn {
    display: none;
  }

  .nav-mobile-cta {
    display: list-item;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.08);
    list-style: none;
  }

  .nav-mobile-cta .btn {
    width: 100%;
    justify-content: center;
    min-height: var(--touch-min);
  }

  .nav-links.open::after {
    content: none;
  }

  .nav-domain { display: none; }

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

  .hero-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .ledger-moon-stage {
    width: min(300px, 90vw);
    height: min(300px, 90vw);
  }

  .ledger-moon-stage--showcase {
    width: min(340px, 92vw);
    height: min(340px, 92vw);
  }

  .moon-orbytpay {
    font-size: clamp(1.1rem, 4.5vw, 1.8rem);
  }

  .moon-satellite .moon-sat-label {
    font-size: 0.45rem;
  }

  .satellite-unit {
    transform: scale(0.8);
  }

  .obg-connector { display: none; }

  .obg-item {
    min-width: 0;
    flex: 1 1 28%;
    padding: 10px 8px;
  }

  .obg-symbol { font-size: 1.35rem; }

  .footer-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .footer-col a { display: block; padding: 6px 0; }

  .section-header { text-align: center; }

  .visual-glyphs,
  .visual-rails,
  .visual-universe,
  .visual-ob,
  .musk-manifesto,
  .musk-final {
    padding-block: clamp(48px, 10vw, 80px);
  }

  .moon-showcase {
    padding-block: clamp(56px, 12vw, 100px);
  }

  .orbit-container {
    width: min(340px, 94vw);
    height: min(340px, 94vw);
  }

  .page-hero-moon-stage {
    width: 80px;
    height: 80px;
  }

  .sitemap-lead { font-size: 0.95rem; }
}

/* ─── SMALL PHONE (≤480px) ─── */
@media (max-width: 480px) {
  :root {
    --sat-orbit-r: min(120px, 28vw);
    --page-pad: 14px;
  }

  .ledger-moon-stage {
    width: min(260px, 92vw);
    height: min(260px, 92vw);
  }

  .glyph-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .glyph-cell {
    padding: 20px 10px;
    min-height: 96px;
  }

  .glyph-icon { font-size: 1.75rem; }

  .musk-tel-cell {
    padding: 14px 12px;
  }

  .musk-final-title {
    font-size: clamp(1.75rem, 8vw, 2.5rem);
  }

  .marquee-track { gap: 24px; }

  .network-link {
    padding: 16px;
  }

  .orbit-container {
    width: min(300px, 96vw);
    height: min(300px, 96vw);
  }
}

/* ─── LANDSCAPE PHONE ─── */
@media (max-height: 500px) and (orientation: landscape) {
  .hero--orbyt {
    min-height: auto;
    padding-top: calc(var(--nav-h) + 8px);
  }

  .hero-orbyt-grid {
    grid-template-columns: 1fr 1fr;
    text-align: left;
  }

  .hero-moon-col { order: 0; }

  .ledger-moon-stage {
    width: min(220px, 40vw);
    height: min(220px, 40vw);
  }
}

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .marquee-track,
  .musk-telemetry-scroll,
  .musk-fullbleed-track {
    animation: none;
  }
}

/* ─── LARGE SCREENS ─── */
@media (min-width: 1280px) {
  .hero--orbyt {
    min-height: 100svh;
  }

  .hero-orbyt-grid {
    grid-template-columns: 1.05fr 0.95fr;
    gap: 56px;
  }

  .ledger-moon-stage {
    width: min(460px, 42vw);
    height: min(460px, 42vw);
  }
}
