/* Mark selected icons even when the active paint changes the accent color. */
:is(.spatial-mobile, :where(#viewer-dock, .snapshot-controls))
  :is(.icon-control, .holiday-switch, .photo-icon, .van-paint-options button) { position: relative; }
:is(.spatial-mobile, :where(#viewer-dock, .snapshot-controls))
  :is(.icon-control[aria-checked="true"], .holiday-switch[aria-checked="true"], .photo-icon[aria-pressed="true"], .van-paint-options button[aria-pressed="true"])::before {
  content: "";
  position: absolute;
  inset: .33rem .29rem auto auto;
  width: .39rem;
  height: .21rem;
  border: solid currentColor;
  border-width: 0 0 1.5px 1.5px;
  transform: rotate(-45deg);
  pointer-events: none;
}

/* Keep the disclosures and upgrade sheet identifiable on touch screens. */
@media (max-width: 720px) and (orientation: portrait) {
  .spatial-mobile #pricing .spatial-copy {
    max-height: calc(100svh - var(--spatial-nav-height) - var(--mobile-bottom) - var(--control-dock-space) - 7.35rem);
  }
  #pricing .pricing-presets {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    margin-block: .15rem;
  }
  #pricing #build-presets-title {
    position: static;
    width: auto;
    height: auto;
    clip-path: none;
    line-height: 2rem;
  }
  #pricing .pricing-preset-details summary {
    display: flex;
    gap: .3rem;
    width: auto;
    height: 2rem;
    padding-inline: .35rem;
    font-size: .74rem;
  }
  #pricing .pricing-preset-details summary svg { width: 1rem; height: 1rem; }
  #pricing .pricing-preset-choices { max-width: none; }
  #pricing .pricing-preset-details dl { margin-block-end: .5rem; }
  #pricing #expand-pricing {
    display: inline-flex;
    gap: .25rem;
    width: auto;
    padding-inline: .5rem;
    font-size: .73rem;
    white-space: nowrap;
  }
  #pricing #expand-pricing svg { width: .9rem; }
  #pricing .quote-total { flex-wrap: wrap; gap: .15rem .45rem; }
  #pricing .section-heading > .live-price-benefit {
    margin-block: .1rem .2rem;
    font-size: .8rem;
    line-height: 1.35;
  }
  #pricing .pricing-effects > .customer-example { grid-column: 1 / -1; font-size: .75rem; }
  #pricing .pricing-effects:not(:has(#pricing-fabric[aria-checked="true"])) > .customer-example { display: none; }
  .spatial-mobile :is([data-build-preset][aria-pressed="true"] > span,
    [data-layout][aria-pressed="true"] strong)::after {
    content: "";
    display: inline-block;
    width: .42rem;
    height: .24rem;
    margin-inline-start: .3rem;
    border: solid currentColor;
    border-width: 0 0 1.5px 1.5px;
    vertical-align: .2em;
    transform: rotate(-45deg);
  }
}

/* A portrait tablet has width for details and height for a separate product view. */
@media (min-width: 721px) and (max-width: 1024px) and (orientation: portrait) {
  .spatial .hero-copy {
    display: grid;
    align-items: end;
    width: 100%;
    padding: 2rem var(--spatial-gutter) max(3rem, 6svh);
  }
  .spatial .hero-copy > div { max-width: min(100%, 42rem); }
  .spatial .hero-copy h1 { font-size: clamp(2.5rem, 5.8vw, 3.65rem); }
  .spatial .hero-description { max-width: 54ch; }
  .spatial .hero-actions { display: flex; align-items: center; gap: .65rem; }
  .spatial .hero-actions .holiday-switch { margin-block-start: 0; }
  .spatial .spatial-photo-frame { left: 50%; right: auto; top: 50%; transform: translate(-61%, -50%); }
  .spatial .spatial-hero-backdrop .spatial-photo-frame {
    transform: translate(-61%, calc(-50% + var(--portrait-scenery-y, 0px)));
  }
  .spatial .spatial-hero-backdrop::after {
    background: linear-gradient(180deg, transparent 20%, transparent calc(var(--portrait-copy-top) - 5rem),
      #101817e6 var(--portrait-copy-top), #101817 var(--portrait-plate-bottom));
  }
  .spatial:not(.spatial-mobile) :is(#cutaway, #floorplan, #pricing, #snapshot) .chapter-card {
    --viewer-layout: portrait-stack;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    justify-items: center;
    align-items: start;
    align-self: stretch;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    overflow: visible;
    pointer-events: none;
  }
  .spatial .chapter :is(.spatial-copy, .spatial-actions) { width: min(100%, 43rem); }
  .spatial :is(#cutaway, #floorplan, #pricing, #snapshot) .spatial-copy { grid-area: 1 / 1; width: min(100%, 43rem); }
  .spatial :is(#cutaway, #floorplan, #pricing, #snapshot) .spatial-actions { grid-area: 3 / 1; width: min(100%, 43rem); }
  .spatial :is(#cutaway, #floorplan) :is(.spatial-copy, .spatial-actions) {
    padding: var(--glass-pad);
    border: 1px solid var(--glass-edge);
    border-color: var(--glass-bevel);
    border-radius: var(--glass-radius);
    background: var(--glass-film);
    box-shadow: var(--glass-shadow);
    -webkit-backdrop-filter: var(--glass-filter);
    backdrop-filter: var(--glass-filter);
  }
  .spatial .chapter h2 + p { margin-bottom: 0; }
  .spatial #cutaway .cutaway-switches { display: flex; gap: 1rem; max-width: none; }
  .spatial #floorplan .spatial-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
    gap: .4rem 1rem;
  }
  #floorplan .floor-options { grid-area: 1 / 1; }
  #floorplan #layout-message { grid-area: 2 / 1; }
  #floorplan .plan-editor { grid-area: 1 / 2 / span 2; margin: 0; }
  .spatial #pricing .spatial-copy { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem 1rem; }
  #pricing .spatial-copy > .eyebrow { grid-column: 1 / -1; }
  #pricing .section-heading { display: block; grid-row: 2 / span 2; }
  #pricing :is(.pricing-presets, .pricing-effects) { grid-column: 2; margin: 0; }
  #pricing .pricing-effect-switches { display: flex; gap: 1rem; }
  #pricing .pricing-effect-switches .scene-switch { width: auto; }
  .spatial #pricing .quote-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 1rem; }
  .spatial #snapshot .spatial-actions { display: block; text-align: center; }
  #snapshot .snapshot-controls { justify-content: center; }
}

/* Keep primary actions in sight when browser chrome or zoom reduces the height. */
@media (min-width: 650px) and (max-height: 680px) and (orientation: landscape) {
  .spatial #pricing .chapter-card {
    display: grid;
    width: 100%;
    height: 100%;
    max-height: 100%;
    align-self: stretch;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 1.15fr);
    grid-template-rows: minmax(0, 1fr);
  }
  .spatial #pricing[data-spatial-ready="true"] .chapter-card { overflow: visible; pointer-events: none; }
  .spatial #pricing :is(.spatial-copy, .spatial-actions) {
    min-height: 0;
    max-height: 100%;
    align-self: center;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--glass-edge) transparent;
  }
  .spatial #pricing .spatial-copy { grid-area: 1 / 1; overflow-y: auto; }
  .spatial #pricing .spatial-actions { grid-area: 1 / 3; display: flex; flex-direction: column; overflow: hidden; }
  #pricing .spatial-actions > :not(.quote-options, #power-status) { flex: none; }
  #pricing .spatial-actions > .quote-options { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  #pricing #power-status:not(:empty) { max-height: 3rem; overflow-y: auto; }
  #pricing .quote-actions { margin-top: .4rem; }
}
@media (min-width: 650px) and (max-height: 620px) and (orientation: landscape) {
  .spatial #snapshot .chapter-card { width: clamp(16rem, 30vw, 22rem); max-height: 100%; align-self: center; }
  .spatial #snapshot .snapshot-controls { display: flex; align-items: center; justify-content: flex-start; gap: .25rem .5rem; }
  #snapshot .snapshot-switches { display: contents; }
  #snapshot .snapshot-controls .scene-switch { min-height: 2.35rem; }
}

@media (min-width: 650px) and (max-width: 720px) and (max-height: 550px) and (orientation: landscape) {
  .spatial:not([data-viewer-only])[data-spatial-scene="snapshot"] #viewer {
    left: calc(16.5rem + var(--spatial-gutter));
    top: var(--spatial-nav-height);
    bottom: var(--spatial-floor);
  }
  .spatial #snapshot .chapter-card {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    height: fit-content;
    max-height: 100%;
    padding-block: 0;
  }
  .spatial #snapshot .spatial-copy { min-height: 0; overflow-y: auto; scrollbar-width: thin; }
  .spatial #snapshot .spatial-copy h2 { margin-block: .25rem; font-size: 1.4rem; }
  .spatial #snapshot .spatial-actions { flex: none; }
}

@media (min-width: 650px) and (max-width: 900px) and (max-height: 550px) and (orientation: landscape) {
  .spatial .offer-grid { grid-template-columns: 1fr 1fr; align-items: start; gap: 1.25rem; }
  .spatial .offer h2 { font-size: clamp(1.7rem, 3.8vw, 2.2rem); }
  .spatial .credit h3 { font-size: 1.5rem; }
  .spatial .offer .offer-actions {
    position: sticky;
    bottom: 0;
    margin-top: .4rem;
    padding-block: .35rem;
    background: #dfe7b7;
  }
  .spatial[data-van-paint="red"] .offer .offer-actions { background: #dde8f6; }
}

@media (min-width: 650px) and (max-height: 820px) and (orientation: landscape) {
  .spatial .proof-grid {
    display: grid;
    width: min(100%, 65rem);
    grid-template-columns: minmax(12rem, .8fr) minmax(0, 1.65fr);
    grid-template-rows: auto auto;
    align-content: center;
    align-items: end;
    gap: .5rem clamp(1.25rem, 3vw, 2.75rem);
  }
  .proof-grid > header { grid-area: 1 / 1; }
  .proof-grid > :is(.arkto-configurator-link, .proof-links) { grid-area: 2 / 1; align-self: start; margin-top: 0; }
  .proof-grid > .arkto-video-cover { grid-area: 1 / 2 / span 2; align-self: center; }
}

@media (max-width: 374px) and (orientation: portrait) {
  #proof .proof-links { column-gap: .4rem; }
  #proof .proof-links a {
    font-size: clamp(.8rem, 4vw, .88rem);
    gap: .2em;
  }
}
