/* Shared fixes for the existing native ConvivioPOS pages; no navigation styles. */

/* Preserve the existing scrolling route in narrow windows. */
body:is(.cv-motion-theme,.cv-realistic-theme,.cv-table-theme,.cvp-theme)
  :is(.cvx-service-layer,.cvt-service-layer,.cvp-service-layer) {
  display:block !important;
}

/* Compact controllers retain the original, accessible four descriptions below
   the track. This visual index stays beneath the drawing throughout the track. */
.restaurant-story .cv-service-phase-rail { display:none; }
.restaurant-story[data-cv-service-rail-ready]:is(.cvx-story-compact,.cvt-story-compact,.cvp-compact)
  .rs-sticky > .rs-steps {
  /* Keep the original width, height and document space for the controllers.
     Its four full descriptions remain in the accessibility tree. */
  opacity:0 !important;
  clip-path:inset(50%);
  pointer-events:none;
}
.restaurant-story:is(.cvx-story-compact,.cvt-story-compact,.cvp-compact)
  :is(.cvx-story-panel,.cvt-story-panel,.cvp-story-panel) {
  grid-template-columns:minmax(0,1fr) !important;
  grid-template-rows:minmax(0,1fr) auto !important;
  align-items:stretch !important;
  gap:8px !important;
  min-width:0;
  min-height:0;
}
.restaurant-story:is(.cvx-story-compact,.cvt-story-compact,.cvp-compact)
  :is(.cvx-story-panel,.cvt-story-panel,.cvp-story-panel) > .rs-stage {
  grid-column:1;
  grid-row:1;
  min-width:0 !important;
  min-height:0 !important;
  width:100% !important;
  height:100% !important;
  margin:0 !important;
}
.restaurant-story:is(.cvx-story-compact,.cvt-story-compact,.cvp-compact)
  :is(.cvx-phase-label,.cvt-phase-label,.cvp-phase-label) { display:none !important; }
.restaurant-story:is(.cvx-story-compact,.cvt-story-compact,.cvp-compact)
  .cv-service-phase-rail {
  grid-column:1;
  grid-row:2;
  display:grid !important;
  grid-template-columns:repeat(2,minmax(0,1fr));
  grid-template-rows:repeat(2,auto);
  gap:6px;
  min-width:0;
  min-height:0;
  margin:0;
  padding:0;
}
.restaurant-story .cv-service-phase-item {
  display:grid;
  grid-template-columns:auto minmax(0,1fr);
  align-items:center;
  gap:6px;
  min-width:0;
  min-height:0;
  box-sizing:border-box;
  padding:7px 9px;
  border:1px solid #01313c25;
  border-radius:12px;
  background:#fff;
  color:#01313c;
}
.restaurant-story .cv-service-phase-item[data-cv-active="true"] {
  background:#f9e4d9;
  border-color:#df5025;
}
.restaurant-story .cv-service-phase-number {
  color:#df5025;
  font-size:11px;
  font-weight:650;
  line-height:1.2;
}
.restaurant-story .cv-service-phase-title {
  min-width:0;
  font-size:13px;
  font-weight:650;
  line-height:1.2;
  overflow-wrap:normal;
}

/* A scene has its own flow box even while its vector or PNG layers move.
   Contained PNGs keep their natural proportions; the motion cannot cross into
   the preceding free-use/donation paragraph or the application screenshot. */
body:is(.cv-motion-theme,.cv-realistic-theme,.cv-table-theme,.cvp-theme) .hero-layout
  > :is(.cvx-hero-scene,.cvt-hero-scene,.cvp-context-scene) {
  position:relative;
  flex:0 0 auto !important;
  aspect-ratio:1000/640;
  min-width:0;
  min-height:0;
  overflow:hidden;
  overflow:clip;
  margin-block:22px !important;
  isolation:isolate;
}
body:is(.cv-motion-theme,.cv-realistic-theme,.cv-table-theme,.cvp-theme)
  .hero-layout:not(.cvx-hero-ready):not(.cvt-hero-ready):not(.cvp-hero-ready)::after {
  flex:0 0 auto !important;
  aspect-ratio:1000/640;
  min-height:0;
  margin-block:22px !important;
}
body:is(.wp-theme-conviviopos-blocks,.cv-motion-theme,.cv-realistic-theme,.cv-table-theme,.cvp-theme)
  .hero-copy {
  position:relative;
  flex-shrink:0 !important;
  min-height:0;
}
@media(max-width:1100px),(max-height:600px) {
  body:is(.wp-theme-conviviopos-blocks,.cv-motion-theme,.cv-realistic-theme,.cv-table-theme,.cvp-theme)
    .hero-layout { row-gap:20px !important; }
  body:is(.wp-theme-conviviopos-blocks,.cv-motion-theme,.cv-realistic-theme,.cv-table-theme,.cvp-theme)
    .hero-copy > .quiet { margin-bottom:8px; }
  body.cv-table-theme .hero-layout > .cvt-hero-scene,
  body.cv-realistic-theme .hero-layout > .cvx-hero-scene,
  body.cv-table-theme .hero-layout:not(.cvt-hero-ready)::after,
  body.cv-realistic-theme .hero-layout:not(.cvx-hero-ready)::after {
    /* These two home artworks are native square PNGs. */
    aspect-ratio:1/1;
  }
  body.cv-table-theme .hero-layout > .cvt-hero-scene > .cvt-world,
  body.cv-realistic-theme .hero-layout > .cvx-hero-scene > .cvx-world {
    width:100% !important;
    height:100% !important;
    max-height:100%;
  }
  body.wp-theme-conviviopos-blocks:not(.wp-child-theme-conviviopos-service):not(.wp-child-theme-conviviopos-service-realistic):not(.wp-child-theme-conviviopos-table):not(.wp-child-theme-conviviopos-plates)
    .restaurant-story .rs-steps {
    display:grid !important;
    grid-template-columns:repeat(2,minmax(0,1fr));
    min-width:0;
    min-height:0;
  }
}
@media(max-width:1100px) and (max-height:500px) {
  /* The original theme has no child panel: its original four titles stay in
     normal flow beneath a smaller, proportionally contained native SVG. */
  body.wp-theme-conviviopos-blocks:not([class*="wp-child-theme-"])
    .restaurant-story .rs-stage {
    margin:12px 0;
    min-height:0;
  }
  body.wp-theme-conviviopos-blocks:not([class*="wp-child-theme-"])
    .restaurant-story .rs-canvas {
    max-height:clamp(72px,calc(100svh - var(--cv-navigation-scroll-offset,110px) - 100px),170px);
    width:100%;
    height:auto;
  }
  body.wp-theme-conviviopos-blocks:not([class*="wp-child-theme-"])
    .restaurant-story .rs-steps { gap:6px; }
  body.wp-theme-conviviopos-blocks:not([class*="wp-child-theme-"])
    .restaurant-story .rs-step {
    position:relative;
    min-width:0;
    min-height:0;
    padding:7px 8px;
    gap:6px;
  }
  body.wp-theme-conviviopos-blocks:not([class*="wp-child-theme-"])
    .restaurant-story .rs-step h3 { font-size:13px;line-height:1.2;margin:0; }
  body.wp-theme-conviviopos-blocks:not([class*="wp-child-theme-"])
    .restaurant-story .rs-step-number { font-size:11px;line-height:1.2; }
  body.wp-theme-conviviopos-blocks:not([class*="wp-child-theme-"])
    .restaurant-story .rs-step p {
    position:absolute;
    width:calc(100% - 30px);
    opacity:0;
    clip-path:inset(50%);
    pointer-events:none;
  }
}
@media(prefers-reduced-motion:reduce) {
  .restaurant-story .cv-service-phase-rail { display:none !important; }
  .restaurant-story[data-cv-service-rail-ready] .rs-steps {
    opacity:1 !important;
    clip-path:none;
    pointer-events:auto;
  }
  body.wp-theme-conviviopos-blocks:not([class*="wp-child-theme-"])
    .restaurant-story .rs-step p {
    position:static;
    width:auto;
    opacity:1;
    clip-path:none;
    pointer-events:auto;
  }
}

/* Sticky positioning remains native. A neutral translate3d on the stage creates
   an unnecessary moving raster layer on iOS; animate its inner art instead. */
.restaurant-story :is(.cvx-story-panel,.cvt-story-panel,.cvp-story-panel),
.restaurant-story :is(.cvx-story-panel,.cvt-story-panel,.cvp-story-panel) > .rs-stage {
  transform:none !important;
  will-change:auto !important;
}
