/* World 50 — Mobile view toggle + phone frame + mobile content overrides
 * Loaded only on user-facing prototypes.
 */

/* ============================
   Floating toggle button
============================ */
#w50-view-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  background: rgba(20, 33, 61, 0.94);
  color: #fff;
  border-radius: 999px;
  padding: 4px 4px 4px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  font-family: 'Inter', system-ui, sans-serif;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  user-select: none;
}
#w50-view-toggle .vt-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.45);
  font-weight: 600;
}
#w50-view-toggle .vt-btn {
  background: transparent;
  color: rgba(255, 255, 255, 0.65);
  border: 0;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}
#w50-view-toggle .vt-btn:hover { color: #fff; }
#w50-view-toggle .vt-btn.active {
  background: #C9A227;
  color: #fff;
  box-shadow: 0 2px 8px rgba(201, 162, 39, 0.35);
}
#w50-view-toggle .vt-btn svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ============================
   Phone frame stage (mobile mode)
============================ */
body.w50-mobile-active { overflow: hidden !important; }

#w50-phone-stage {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 50% 25%, rgba(184, 134, 11, 0.10) 0%, transparent 55%),
    linear-gradient(180deg, #0a1424 0%, #050a14 100%);
  z-index: 1;
  padding: 24px;
  overflow: auto;
}

.w50-phone-caption {
  position: fixed;
  top: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  color: rgba(255, 255, 255, 0.55);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  text-align: center;
  font-family: 'Inter', system-ui, sans-serif;
  pointer-events: none;
  white-space: nowrap;
}
.w50-phone-caption strong { color: #C9A227; font-weight: 600; }

.w50-phone {
  position: relative;
  width: 412px;
  height: 870px;
  background: linear-gradient(135deg, #1f1f1f, #0d0d0d);
  border-radius: 56px;
  padding: 12px;
  box-shadow:
    inset 0 0 0 2px #2a2a2a,
    0 30px 80px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.04);
  flex-shrink: 0;
}
.w50-phone-notch {
  position: absolute;
  top: 22px; left: 50%;
  transform: translateX(-50%);
  width: 118px; height: 32px;
  background: #000;
  border-radius: 20px;
  z-index: 5;
  box-shadow: inset 0 0 0 1px #1a1a1a;
}
.w50-phone-screen {
  width: 100%;
  height: 100%;
  background: #FAF7F2;
  border-radius: 44px;
  overflow: hidden;
  position: relative;
}
.w50-phone-screen iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.w50-phone-home {
  position: absolute;
  bottom: 12px; left: 50%;
  transform: translateX(-50%);
  width: 130px; height: 5px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 3px;
  z-index: 4;
  pointer-events: none;
}

/* Scale phone to fit shorter screens */
@media (max-height: 920px) { .w50-phone { transform: scale(0.94); transform-origin: center top; margin-top: 28px; } }
@media (max-height: 840px) { .w50-phone { transform: scale(0.84); } }
@media (max-height: 760px) { .w50-phone { transform: scale(0.76); } }
@media (max-height: 680px) { .w50-phone { transform: scale(0.68); } }

/* ============================
   Mobile content overrides
   These apply both inside the iframe AND on real mobile.
============================ */
@media (max-width: 600px) {
  /* Top bar */
  .w-topbar > div {
    padding-left: 16px !important;
    padding-right: 16px !important;
    padding-top: 12px !important;
    padding-bottom: 12px !important;
  }
  .w-topbar nav { display: none !important; }
  .w-logo { font-size: 18px !important; }
  .w-banner { font-size: 11px; padding: 6px 12px; }

  /* Containers */
  .max-w-7xl, .max-w-5xl {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  /* Display fonts — scale down */
  .w-display { font-size: 32px !important; line-height: 1.08 !important; }

  /* ---------- 01 Home ---------- */
  .hero { height: 460px !important; }
  .hero-content { padding: 24px !important; }
  .hero-content h2 { font-size: 30px !important; }
  .hero-content p { font-size: 14px !important; }
  .hero-pager { right: 18px !important; }
  .rail-section { margin: 36px 0 !important; }
  .rail-header { flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 14px !important; }
  .rail-header h3 { font-size: 22px !important; }
  .rail-header .blurb { font-size: 13px !important; }
  .card { width: 280px !important; }
  .topic-pill { font-size: 12px !important; padding: 6px 12px !important; }

  /* ---------- 02 Topic Deep-Dive ---------- */
  .topic-hero { height: 280px !important; border-radius: 6px !important; }
  .topic-hero-content { padding: 22px !important; }
  .topic-hero h1 { font-size: 32px !important; }
  .editors-note { padding: 22px !important; margin: 28px 0 !important; }
  .editors-note h2 { font-size: 22px !important; }
  .editors-note p { font-size: 16px !important; line-height: 1.55 !important; }
  .arc-step {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
    padding: 24px 0 !important;
  }
  .arc-step h3 { font-size: 22px !important; }
  .arc-step .desc { font-size: 14px !important; }
  .arc-step-thumb { width: 100% !important; max-width: 100% !important; }
  .progress-tracker { display: none !important; }
  .related-pill { font-size: 12px; padding: 5px 11px; }

  /* ---------- 03 Long-Form Reader ---------- */
  .article-title { font-size: 36px !important; }
  .article-deck { font-size: 17px !important; }
  .article-hero { aspect-ratio: 16/10 !important; margin: 24px 0 32px !important; }
  .ai-panel-body {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    padding: 18px !important;
  }
  .ai-actions {
    border-left: 0 !important;
    border-top: 1px solid var(--w-line) !important;
    padding-left: 0 !important;
    padding-top: 16px !important;
  }
  .ai-takeaways li { font-size: 14px !important; }
  .ai-panel-header { padding: 14px 16px !important; }
  .w-prose p { font-size: 16px !important; line-height: 1.65 !important; }
  .w-prose h2 { font-size: 22px !important; margin: 28px 0 12px !important; }
  .w-pullquote { font-size: 22px !important; padding: 4px 0 4px 18px !important; margin: 24px 0 !important; }
  .embed-clip-meta {
    flex-direction: column !important;
    gap: 12px !important;
    align-items: flex-start !important;
    padding: 14px !important;
  }
  .embed-clip-meta .quote { margin-right: 0 !important; font-size: 14px !important; }
  .pdf-callout {
    flex-direction: column !important;
    gap: 12px !important;
    align-items: flex-start !important;
    padding: 18px !important;
  }
  .action-bar { flex-wrap: wrap !important; gap: 6px !important; padding: 14px 0 !important; }
  .action-bar button { font-size: 11px !important; padding: 6px 10px !important; }
  .byline { flex-wrap: wrap; }
  .byline > div:last-child { margin-left: 0 !important; text-align: left !important; flex-basis: 100%; margin-top: 8px; }

  /* ---------- 04 Audience Lens ---------- */
  .lens-bar > div { flex-direction: column; align-items: flex-start !important; gap: 12px !important; }
  .lens-bar > div > div:last-child { display: none; }
  .lens-tabs { flex-wrap: wrap !important; padding: 3px !important; gap: 2px; }
  .lens-tab { padding: 6px 11px !important; font-size: 11px !important; gap: 5px !important; }
  .lens-tab .icon { width: 14px !important; height: 14px !important; font-size: 8px !important; }
  .preview-content { padding: 24px !important; }
  .preview-content h1 { font-size: 26px !important; }
  .preview-content .deck { font-size: 16px !important; }
  .preview-content .h-image { aspect-ratio: 16/10 !important; margin-bottom: 22px !important; }
  .cta-banner {
    flex-direction: column !important;
    gap: 14px !important;
    align-items: stretch !important;
    padding: 18px !important;
  }
  .cta-banner .text { width: 100%; }
  .cta-banner h4 { font-size: 18px !important; }
  .cta-banner .flex { width: 100%; flex-direction: column; gap: 8px !important; }
  .gate-cta { padding: 24px !important; }
  .gate-cta h3 { font-size: 22px !important; }
  .preview-stage .grid { grid-template-columns: 1fr !important; }

  /* ---------- 05 Search ---------- */
  .search-input-row input { font-size: 17px !important; }
  .search-input-row { padding: 14px 16px !important; }
  .facet-bar { padding: 10px 14px !important; gap: 6px !important; }
  .facet-trigger { font-size: 11px !important; padding: 5px 10px !important; }
  #clearFacets { display: none; }
  .result-row {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    padding: 16px 0 !important;
  }
  .result-row .thumb { aspect-ratio: 16/9 !important; width: 100% !important; }
  .result-row h4 { font-size: 18px !important; }
  .result-row .right-rail { display: none !important; }
  .empty-rec-card { flex-direction: column !important; padding: 12px !important; }
  .empty-rec-card .thumb { width: 100% !important; aspect-ratio: 16/9; }

  /* ---------- 06 Speaker Profile ---------- */
  .profile-hero {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
    padding: 28px 0 !important;
  }
  .profile-photo-wrap { max-width: 220px; margin: 0 auto; }
  .profile-photo-wrap .accent-bar { left: -12px !important; height: 56px !important; top: 24px !important; }
  .profile-name { font-size: 38px !important; }
  .profile-title { font-size: 15px !important; }
  .profile-stats { flex-wrap: wrap !important; gap: 18px !important; margin-top: 22px !important; }
  .stat .num { font-size: 26px !important; }
  .profile-actions { flex-wrap: wrap !important; gap: 8px !important; }
  .profile-actions .w-btn { font-size: 12px !important; padding: 8px 14px !important; }
  .bio-section { padding: 28px 0 !important; }
  .bio-text { font-size: 17px !important; }
  .quote-block { padding: 28px 0 !important; }
  .quote-block .quote { font-size: 22px !important; }
  .featured-piece { grid-template-columns: 1fr !important; }
  .featured-piece .img-wrap { aspect-ratio: 16/9 !important; }
  .featured-piece .content { padding: 22px !important; }
  .featured-piece h3 { font-size: 22px !important; }
  .content-grid { grid-template-columns: 1fr !important; }
  .related-speakers { padding: 28px 0 !important; }
  .related-speakers .grid { grid-template-columns: repeat(2, 1fr) !important; gap: 18px !important; }

  /* ---------- 07 Onboarding ---------- */
  .onb-shell { grid-template-columns: 1fr !important; }
  .onb-preview { display: none !important; }
  .onb-stage { padding: 28px 18px !important; min-height: 100vh; }
  .step-title { font-size: 28px !important; }
  .step-sub { font-size: 14px !important; }
  .step-indicator .step-dot { width: 36px !important; }
  .step-indicator .step-counter { font-size: 10px !important; }
  .topic-card { padding: 14px !important; }
  .topic-card .topic-name { font-size: 16px !important; }
  .topic-card .topic-blurb { font-size: 11px !important; }
  .speaker-tile { padding: 12px !important; }
  .speaker-tile img { width: 40px !important; height: 40px !important; }
  .cadence-option { padding: 16px 18px !important; gap: 14px !important; }
  .cadence-option .name { font-size: 16px !important; }

  /* ---------- 08 Breaking News ---------- */
  .ribbon { font-size: 11px !important; padding: 10px 14px !important; }
  .masthead { padding: 22px 0 14px !important; }
  .masthead .name { font-size: 32px !important; }
  .masthead .tag { letter-spacing: 0.18em !important; font-size: 10px !important; }
  .masthead .stamp { font-size: 11px !important; }
  .filter-row { gap: 6px !important; padding: 12px 0 !important; flex-wrap: wrap; }
  .frontpage {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
    padding: 28px 0 !important;
  }
  .headline-piece h1 { font-size: 32px !important; }
  .headline-piece .deck { font-size: 16px !important; }
  .three-up {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
    padding: 28px 0 !important;
  }
  .three-up-piece h4 { font-size: 20px !important; }
  .editors-pick-block {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    padding: 22px !important;
    margin: 28px 0 !important;
  }
  .editors-pick-block .img-wrap { aspect-ratio: 16/10 !important; }
  .editors-pick-block h3 { font-size: 22px !important; }
  .quick-list { grid-template-columns: 1fr !important; gap: 0 !important; }

  /* ---------- 11 Public Share ---------- */
  .og-frame-wrap { padding: 32px 0 !important; }
  .platform-row { flex-wrap: wrap; gap: 6px !important; padding: 0 16px; }
  .platform-pill { font-size: 10px !important; padding: 4px 11px !important; }
  .li-share, .x-share, .email-share {
    max-width: calc(100vw - 32px) !important;
    margin: 0 16px !important;
  }
  .public-banner { font-size: 11px !important; padding: 8px 12px !important; }
  .public-hero { padding: 32px 16px !important; }
  .public-eyebrow { font-size: 11px !important; }
  .public-hero h1 { font-size: 34px !important; }
  .public-hero .deck { font-size: 16px !important; margin-top: 14px !important; }
  .public-hero .byline { margin-top: 22px !important; }
  .public-img { margin: 24px 16px !important; aspect-ratio: 16/10 !important; }
  .public-teaser { padding: 0 20px !important; }
  .public-teaser p { font-size: 16px !important; }
  .member-cta { padding: 28px 22px !important; margin: 24px 16px !important; }
  .member-cta h3 { font-size: 22px !important; }
  .member-cta p { font-size: 14px !important; }
  .member-cta .actions { flex-direction: column !important; gap: 8px !important; }
  .unlock-grid {
    grid-template-columns: 1fr !important;
    padding: 0 20px !important;
  }
  .prospect-path {
    margin: 32px 16px !important;
    padding: 24px !important;
  }
  .prospect-path h3 { font-size: 19px !important; }
  .prospect-path .flex { flex-direction: column; gap: 8px !important; }
  .share-footer { margin: 28px 16px 0 !important; padding: 24px 0 !important; }

  /* Topbar toggle button trim on real mobile */
  #w50-view-toggle { bottom: 12px !important; right: 12px !important; padding: 3px 3px 3px 10px !important; }
  #w50-view-toggle .vt-label { display: none !important; }
  #w50-view-toggle .vt-btn { padding: 5px 10px !important; font-size: 11px !important; }
}

/* When inside the iframe, prevent horizontal scrollbars from showing */
html.w50-embed body { overflow-x: hidden !important; }
