/*
 * NovyraX homepage responsive composition.
 * Desktop: keep the existing visual language; repair the CALIBRA two-column stage.
 * Mobile: curate the homepage instead of compressing every desktop section.
 */

/* Brand typography: strong geometric sans + restrained editorial serif. */
.hero-title.hero-title-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.015em;
  max-width: 100%;
  margin: 0 0 1.05rem !important;
  color: var(--text-hi, #171717);
  font-family: var(--font-headline, 'Space Grotesk', sans-serif);
  font-size: clamp(3rem, 5.35vw, 5.1rem);
  font-weight: 700;
  line-height: 0.91;
  letter-spacing: -0.065em;
  text-transform: none;
  overflow-wrap: normal;
  word-break: normal;
}

.hero-title-brand .hero-title-line {
  display: block;
  max-width: 100%;
  white-space: nowrap;
}

.hero-title-brand .hero-title-line-strong {
  font-family: var(--font-headline, 'Space Grotesk', sans-serif);
  font-style: normal;
  font-weight: 700;
  letter-spacing: -0.065em;
  text-transform: uppercase;
}

.hero-title-brand .hero-title-line-accent {
  color: var(--text-hi, #171717);
  font-family: var(--font-cursive, 'Newsreader', Georgia, serif);
  font-size: 1.08em;
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 0.88;
  text-transform: none;
}

.hero-tagline {
  font-family: var(--font-headline, 'Space Grotesk', sans-serif);
  font-weight: 500;
}

.hero-tagline .cursive-accent {
  font-family: var(--font-cursive, 'Newsreader', Georgia, serif);
  font-weight: 500;
  font-style: italic;
}

/* The same composition scales deliberately at tablet and phone widths. */
@media (min-width: 768px) and (max-width: 1024px) {
  .hero-title.hero-title-brand {
    font-size: clamp(2.55rem, 5.1vw, 3.55rem);
  }
}

@media (max-width: 767px) {
  .hero-title.hero-title-brand {
    max-width: 100%;
    margin-bottom: 0.8rem !important;
    font-size: clamp(2rem, 8.65vw, 2.85rem);
    line-height: 0.93;
    letter-spacing: -0.06em;
  }

  .hero-title-brand .hero-title-line-strong {
    letter-spacing: -0.06em;
  }

  .hero-title-brand .hero-title-line-accent {
    font-size: 1.06em;
    letter-spacing: -0.04em;
  }
}

@media (max-width: 380px) {
  .hero-title.hero-title-brand {
    font-size: 1.9rem;
  }
}

.mobile-trust-line {
  display: none;
}

/* Keep fixed navigation and support controls from covering CALIBRA content. */
body.is-in-calibra-showcase .floating-dock {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: translate(-50%, 14px) !important;
}

body.is-in-calibra-showcase .rag-chatbot-root .rag-toggle-btn:not(.active) {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Poster-first product media prevents a blank autoplay frame from occupying the stage. */
#flagship-metrology .monitor-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  isolation: isolate;
  background: #0D1117;
}

#flagship-metrology .monitor-poster-image {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
}

#flagship-metrology .monitor-video {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  aspect-ratio: auto;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

#flagship-metrology .monitor-media.is-playing .monitor-video {
  opacity: 1;
  pointer-events: auto;
}

#flagship-metrology .monitor-media.is-playing .monitor-poster-image,
#flagship-metrology .monitor-media.is-playing .monitor-play-button {
  opacity: 0;
  pointer-events: none;
}

#flagship-metrology .monitor-play-button {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  min-height: 46px;
  padding: 0.65rem 1rem;
  border: 1px solid rgba(223, 186, 115, 0.65);
  border-radius: 999px;
  background: rgba(10, 12, 16, 0.82);
  color: #F8FAFC;
  font: 600 0.78rem/1 var(--font-body, Inter, sans-serif);
  letter-spacing: 0.02em;
  cursor: pointer;
  transform: translate(-50%, -50%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
  transition: background-color 180ms ease, border-color 180ms ease, opacity 180ms ease;
}

#flagship-metrology .monitor-play-button:hover {
  background: rgba(10, 12, 16, 0.96);
  border-color: #DFBA73;
}

#flagship-metrology .monitor-play-icon {
  display: inline-grid;
  width: 26px;
  height: 26px;
  place-items: center;
  padding-left: 2px;
  border-radius: 50%;
  background: #DFBA73;
  color: #101114;
  font-size: 0.72rem;
}

@media (prefers-reduced-motion: reduce) {
  #flagship-metrology .monitor-video,
  #flagship-metrology .monitor-play-button {
    transition: none;
  }
}

/* Tablet sizing: avoid intrinsic-width overflow before the mobile breakpoint. */
@media (min-width: 768px) and (max-width: 900px) {
  #flagship-metrology .metrology-sticky-grid {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
  }

  #flagship-metrology .metrology-stage-col,
  #flagship-metrology .metrology-flow-col {
    min-width: 0;
    width: 100%;
  }

  #flagship-metrology .metrology-sticky-stage {
    position: relative;
    top: auto;
    height: auto;
    min-height: 0;
  }
}

@media (max-width: 767px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
  }

  main,
  main > section,
  main .container {
    min-width: 0;
    max-width: 100%;
  }

  /* A shorter, intentional mobile journey. Dedicated routes still retain
     the full technical depth; the homepage keeps the essentials. */
  #novyrax-intelligence,
  #flagship-metrology,
  #deployable-systems,
  #industries,
  main > section[aria-label="Why NOVYRAX"] {
    display: none !important;
  }

  .chapter-nav-rail,
  .floating-dock {
    display: none !important;
  }

  .section {
    padding: 2.75rem 0;
  }

  .section .container {
    padding-left: 1.15rem;
    padding-right: 1.15rem;
  }

  .section-header {
    margin-bottom: 1.35rem !important;
    gap: 0.35rem;
  }

  /* Mobile content must not depend on an off-screen reveal observer to become readable. */
  .section-header.editorial-reveal-header .label,
  .section-header.editorial-reveal-header > p {
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
  }

  .section-header.editorial-reveal-header h2 {
    overflow: visible !important;
  }

  .section-header .masked-text-wrap {
    display: inline !important;
    overflow: visible !important;
  }

  .section-header .masked-text-inner {
    display: inline !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .section-header h2 {
    font-size: clamp(1.8rem, 8vw, 2.35rem);
    line-height: 1.06;
    letter-spacing: -0.04em;
  }

  .section-header > p,
  .section-header p:not(.eyebrow) {
    max-width: 42ch;
    margin-top: 0.45rem;
    font-size: 0.92rem;
    line-height: 1.55;
  }

  /* Hero: headline first, 3D mark as a small signature beside the tagline. */
  .hero-section {
    min-height: 0;
    height: auto;
    padding-top: calc(var(--nav-h, 72px) + 1rem);
    padding-bottom: 1.25rem;
    overflow: hidden;
  }

  .hero-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 104px;
    grid-template-rows: auto auto auto auto auto;
    column-gap: 0.65rem;
    row-gap: 0;
    width: 100%;
    max-width: 620px;
    margin: 0 auto;
    padding: 0 1.15rem;
    align-items: start;
  }

  .hero-left {
    display: contents;
  }

  .hero-eyebrow-wrap {
    grid-column: 1 / -1;
    grid-row: 1;
    margin: 0 0 0.9rem;
    max-width: 100%;
  }

  .brand-eyebrow-badge {
    max-width: 100%;
    font-size: 0.58rem;
    line-height: 1.35;
    letter-spacing: 0.075em;
    padding: 0.34rem 0.65rem;
    white-space: normal;
  }

  .hero-title {
    grid-column: 1 / -1;
    grid-row: 2;
    max-width: 19ch;
    margin: 0 0 0.75rem !important;
    font-size: clamp(2rem, 8.2vw, 2.55rem);
    line-height: 1.02;
    letter-spacing: -0.045em;
    overflow-wrap: normal;
    word-break: normal;
  }

  .hero-title .cursive-accent {
    white-space: normal;
  }

  .hero-tagline {
    grid-column: 1;
    grid-row: 3;
    align-self: center;
    max-width: 25ch;
    margin: 0;
    padding: 0;
    font-size: 0.9rem;
    line-height: 1.45;
  }

  .hero-right {
    grid-column: 2;
    grid-row: 3;
    align-self: center;
    justify-self: end;
    width: 96px;
    height: 96px;
    margin: 0;
    padding: 0;
  }

  .hero-canvas-wrap {
    width: 96px;
    height: 96px;
    max-width: 96px;
    min-width: 96px;
    aspect-ratio: 1;
    margin: 0;
    overflow: hidden;
    border: 1px solid rgba(223, 186, 115, 0.34);
    border-radius: 50%;
    background:
      radial-gradient(circle at 50% 38%, rgba(223, 186, 115, 0.11), transparent 68%),
      rgba(12, 14, 18, 0.72);
    box-shadow:
      inset 0 0 22px rgba(223, 186, 115, 0.06),
      0 10px 26px rgba(0, 0, 0, 0.24);
  }

  .liquid-aperture-glow,
  .liquid-orbital-ring {
    display: none !important;
  }

  .liquid-aperture-blob {
    inset: 0;
    border-radius: 50%;
    animation: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: inset 0 0 16px rgba(223, 186, 115, 0.06);
  }

  #heroCanvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    border-radius: 50%;
    touch-action: pan-y;
  }

  .hero-mobile-emblem {
    display: none;
  }

  .emblem-caption,
  .logo-drag-hint {
    display: none !important;
  }

  .hero-sub {
    grid-column: 1 / -1;
    grid-row: 4;
    max-width: 52ch;
    margin: 0.95rem 0 1.1rem;
    font-size: 0.9rem;
    line-height: 1.55;
  }

  .hero-left .btn-row {
    grid-column: 1 / -1;
    grid-row: 5;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 0.65rem;
    margin: 0;
  }

  .hero-left .btn-row .btn {
    width: 100%;
    min-height: 48px;
    height: 48px;
    padding: 0 1rem;
    font-size: 0.8rem;
    white-space: normal;
  }

  #cta-products,
  .hero-stats {
    display: none !important;
  }

  /* Make the trust case the first substantive section after the hero. */
  #principles {
    padding-top: 2.5rem;
    padding-bottom: 2.9rem;
  }

  #principles .section-header {
    margin-bottom: 1.15rem !important;
  }

  #principles .section-header > p {
    max-width: 34ch;
  }

  #principles .mobile-trust-line {
    display: block;
    max-width: 38ch;
    margin: 0 0 1rem;
    padding: 0.8rem 0 0.8rem 0.9rem;
    border-left: 2px solid rgba(223, 186, 115, 0.72);
    color: var(--text-mid, #CBD5E1);
    font-size: 0.9rem;
    line-height: 1.55;
  }

  #principles .bento,
  #services .bento {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.7rem;
  }

  #principles .bento > .card {
    grid-column: 1 / -1 !important;
    min-width: 0;
    padding: 1.05rem 1.1rem;
  }

  /* Keep the three most useful trust signals; remove duplicated detail. */
  #principles .bento > .card:nth-child(2),
  #principles .bento > .card:nth-child(3) {
    display: none !important;
  }

  #principles .bento > .card h3,
  #services .bento > .card h3 {
    margin-bottom: 0.35rem;
    font-size: 1.03rem;
    line-height: 1.28;
  }

  #principles .bento > .card p,
  #services .bento > .card p {
    margin-top: 0.25rem !important;
    margin-bottom: 0;
    font-size: 0.86rem;
    line-height: 1.5;
  }

  #principles > .container > .btn-row {
    display: none !important;
  }

  #services {
    padding-top: 2.5rem;
    padding-bottom: 2.75rem;
  }

  #services .bento > .card {
    grid-column: 1 / -1 !important;
    padding: 1rem 1.1rem;
  }

  #services .bento > .card:nth-child(n + 5) {
    display: none !important;
  }

  /* Product descriptions stay available; heavy demonstrations and spec lists do not. */
  #flagship-products {
    padding-top: 2.5rem;
    padding-bottom: 2.75rem;
  }

  #flagship-products .emergent-tabs-wrap,
  #flagship-products .emergent-tablist,
  #flagship-products .emergent-panel,
  #flagship-products .emergent-product-layout,
  #flagship-products .emergent-product-content {
    min-width: 0;
    max-width: 100%;
    width: 100%;
  }

  #flagship-products .emergent-tablist {
    display: flex;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    margin-top: 0;
    margin-bottom: 0.9rem;
    gap: 0.45rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding: 0 0 0.55rem;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
  }

  #flagship-products .emergent-tablist::-webkit-scrollbar {
    display: none;
  }

  #flagship-products .emergent-tab-btn {
    flex: 0 0 auto;
    max-width: 82vw;
    min-height: 42px;
    padding: 0.65rem 0.8rem;
    font-size: 0.76rem;
    white-space: nowrap;
    scroll-snap-align: start;
  }

  #flagship-products .emergent-panel {
    padding: 1.1rem 0 0;
  }

  #flagship-products .emergent-product-layout {
    display: block;
  }

  #flagship-products .emergent-product-content {
    padding: 1.15rem;
  }

  #flagship-products .card-depth-title {
    margin-bottom: 0.6rem !important;
    font-size: 1.4rem !important;
    line-height: 1.15 !important;
  }

  #flagship-products .card-depth-body {
    margin-bottom: 1rem !important;
    font-size: 0.9rem !important;
    line-height: 1.55 !important;
  }

  #flagship-products .card-depth-specs,
  #flagship-products .emergent-product-asset,
  #flagship-products video,
  main video {
    display: none !important;
  }

  #flagship-products .card-depth-action {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.6rem !important;
  }

  #flagship-products .card-depth-action > a {
    width: 100%;
    min-height: 44px;
    white-space: normal;
    justify-content: center;
  }

  #flagship-products .card-depth-action > a:nth-child(n + 3) {
    display: none !important;
  }

  /* A compact, readable process summary instead of the desktop-length matrix. */
  #workflow {
    padding-top: 2.5rem;
    padding-bottom: 2.75rem;
  }

  #workflow .lifecycle-pipeline {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.7rem;
  }

  #workflow .lifecycle-stage {
    min-width: 0;
    padding: 1.05rem 1.1rem;
  }

  #workflow .stage-header {
    margin-bottom: 0.55rem;
  }

  #workflow .stage-title {
    margin-bottom: 0.4rem;
    font-size: 1rem;
    line-height: 1.3;
  }

  #workflow .stage-desc {
    margin-bottom: 0;
    font-size: 0.86rem;
    line-height: 1.5;
  }

  #workflow .stage-deliverables,
  #workflow .stage-duration {
    display: none !important;
  }

  /* Keep one clear project route at the end of the mobile journey. */
  main > section[aria-label="Work With Us and Careers"] {
    padding-top: 2.5rem;
    padding-bottom: 2.75rem;
  }

  main > section[aria-label="Work With Us and Careers"] .section-header {
    margin-bottom: 1.15rem !important;
  }

  main > section[aria-label="Work With Us and Careers"] .cta-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
  }

  main > section[aria-label="Work With Us and Careers"] .cta-grid > .card {
    grid-column: 1 / -1 !important;
    min-width: 0;
    padding: 1.2rem !important;
  }

  main > section[aria-label="Work With Us and Careers"] .cta-grid > .card:nth-child(2) {
    display: none !important;
  }

  main > section[aria-label="Work With Us and Careers"] .cta-grid .btn-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.6rem;
    margin: 0;
  }

  main > section[aria-label="Work With Us and Careers"] .cta-grid .btn {
    width: 100%;
    min-height: 46px;
    white-space: normal;
  }

  .signal-divider {
    opacity: 0.35;
  }

  .site-footer .footer-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
  }

  .site-footer .footer-grid > div:nth-child(2) {
    display: none;
  }

  .site-footer .footer-brand-desc {
    max-width: 34ch;
  }

  /* Avoid mobile-only animations that compete with reading or battery life. */
  .hero-section *,
  #principles *,
  #services *,
  #flagship-products *,
  #workflow * {
    scroll-margin-top: calc(var(--nav-h, 72px) + 12px);
  }
}

@media (max-width: 380px) {
  .hero-split {
    grid-template-columns: minmax(0, 1fr) 88px;
    column-gap: 0.45rem;
  }

  .hero-right,
  .hero-canvas-wrap {
    width: 84px;
    height: 84px;
    min-width: 84px;
    max-width: 84px;
  }

  .hero-title {
    font-size: 1.9rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  #heroCanvas {
    animation: none !important;
  }

  .liquid-aperture-blob {
    animation: none !important;
  }
}

/* Sticky positioning must not be trapped by transformed/overflowing ancestors. */
@media (min-width: 901px) {
  #flagship-metrology,
  #flagship-metrology > .container,
  #flagship-metrology .metrology-sticky-grid {
    overflow: visible;
    transform: none;
  }
}

/* Final CALIBRA desktop behavior: pin only the demo; let the benefit cards scroll. */
@media (min-width: 901px) {
  #flagship-metrology,
  #flagship-metrology > .container,
  #flagship-metrology .metrology-sticky-grid {
    overflow: visible !important;
    transform: none !important;
  }

  #flagship-metrology .metrology-sticky-grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    align-items: start !important;
    gap: clamp(1.5rem, 3.5vw, 3.5rem) !important;
  }

  #flagship-metrology .metrology-stage-col {
    position: sticky !important;
    top: calc(var(--nav-h, 68px) + 1.5rem) !important;
    align-self: start !important;
    height: auto !important;
    min-width: 0 !important;
    overflow: visible !important;
  }

  #flagship-metrology .metrology-sticky-stage {
    position: relative !important;
    top: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
  }
}
