/* One scene is one visible viewport. The cinematic scrollport is isolated from
   document scrolling, which otherwise collapses browser controls mid-gesture. */
:root {
  --scene-height: 100dvh;
  --scene-top: clamp(108px, 14dvh, 180px);
  --scene-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
}
html[data-scrollport="ready"] {
  height: 100%;
  overflow: hidden;
  overscroll-behavior-y: none;
  scroll-snap-type: none;
}
html[data-scrollport="ready"] body {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
html[data-scrollport="ready"] .site-viewport {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
}
html[data-scrollport="ready"] .story-scrollport {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  scrollbar-width: none;
}
html[data-intro="ready"] .story-scrollport {
  overflow-y: auto;
  overscroll-behavior: none;
  scroll-snap-type: y mandatory;
}
html[data-connection-dialog="open"] .story-scrollport {
  overflow: hidden;
}
/* Decorative fixed UI must not intercept wheel/touch meant for the scene. */
.site-header,
.controls,
.scene-nav,
.story-position {
  pointer-events: none;
}
.site-header a,
.controls button,
.scene-nav a {
  pointer-events: auto;
}
html[data-intro="ready"] #story > .story-section {
  height: var(--scene-height);
  min-height: 0;
  overflow: clip;
}
.story-content {
  height: 100%;
  min-height: 0;
  padding: var(--scene-top) 0 var(--scene-bottom);
}
.life-copy {
  padding-top: clamp(130px, 21dvh, 250px);
}
.home-composition .life-copy {
  padding-top: 0;
}
.feature-layout,
.home-composition {
  min-height: 0;
}
.phone-anchor {
  width: min(
    clamp(220px, 21vw, 300px),
    calc((var(--scene-height) - var(--scene-top) - var(--scene-bottom) - 24px) * 411 / 869)
  );
}
.module-list {
  margin-top: clamp(20px, 4dvh, 50px);
}
.module-list > * {
  min-height: clamp(62px, 10dvh, 105px);
}
.install h2 {
  font-size: clamp(52px, min(7.6vw, 12dvh), 122px);
}
.install .install-description {
  margin: clamp(14px, 2.8dvh, 28px) auto;
}
.install .install-bottom {
  margin-top: clamp(20px, 4dvh, 48px);
  padding-top: clamp(14px, 2.6dvh, 25px);
}
@media (max-width: 640px) {
  :root {
    --scene-top: 120px;
    --scene-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
  .life-copy {
    padding-top: clamp(130px, 20dvh, 175px);
  }
  .home-composition {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
  }
  .home-composition .phone-anchor {
    position: relative;
    right: auto;
    bottom: auto;
    align-self: flex-end;
    margin: auto 14px 0 0;
    width: min(150px, calc((var(--scene-height) - 420px) * 411 / 869));
  }
  .feature-layout {
    gap: 16px;
    justify-content: space-between;
  }
  .feature .product-visual {
    gap: 8px;
    align-items: stretch;
    min-height: 0;
  }
  .feature .phone-anchor {
    width: min(180px, calc((var(--scene-height) - 430px) * 411 / 869));
    flex-shrink: 0;
  }
  .module-list {
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
    margin-top: 24px;
  }
  .module-list > * {
    min-height: clamp(78px, 12dvh, 105px);
    gap: 10px;
  }
  .module-list img {
    width: 34px;
    height: 34px;
  }
  .module-list > * > span:nth-child(2) {
    font-size: 13px;
  }
  .module-list small {
    font-size: 10px;
    line-height: 1.5;
  }
  .module-list > * > span:last-child:not(:nth-child(2)) {
    display: none;
  }
  .install h2 {
    font-size: clamp(42px, min(13vw, 8dvh), 52px);
  }
}
/* Compact portrait: spend the available height on content and the actual phone,
   rather than preserving desktop-sized padding or extending the section. */
@media (max-width: 640px) and (max-height: 740px) {
  :root {
    --scene-top: 100px;
    --scene-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
  }
  .site-header {
    padding-top: calc(16px + env(safe-area-inset-top, 0px));
    padding-bottom: 12px;
  }
  .hero-copy {
    padding-top: 100px;
  }
  .hero-eyebrow {
    margin-bottom: 14px;
  }
  .hero-description {
    margin-top: 14px;
  }
  .hero-actions {
    margin-top: 16px;
    gap: 4px;
  }
  .story-content h2,
  .home-composition h2 {
    font-size: clamp(30px, 8.5vw, 40px);
  }
  .feature-copy h2 {
    font-size: 28px;
  }
  .section-kicker,
  .feature-copy .section-kicker {
    margin-bottom: 14px;
  }
  .life-copy {
    padding-top: 120px;
  }
  .life-description {
    margin-top: 18px;
    font-size: 15px;
  }
  .life-footnote {
    margin-top: 20px;
  }
  .feature-description {
    font-size: 12px;
    margin-top: 12px;
  }
  .feature .phone-anchor {
    width: min(170px, calc((var(--scene-height) - 355px) * 411 / 869));
  }
  .home .life-description {
    font-size: 13px;
    margin-top: 14px;
  }
  .text-link {
    margin-top: 6px;
  }
  .module-list {
    margin-top: 18px;
  }
  .module-list > * {
    min-height: 75px;
  }
  .module-note {
    margin-top: 16px;
  }
  .install h2 {
    font-size: clamp(38px, 7.5dvh, 52px);
  }
}
/* Landscape is a two-column composition even on a phone. Width alone does not
   tell us whether a tall phone + copy can fit vertically. */
@media (min-width: 641px) and (max-height: 900px) {
  :root {
    --scene-top: clamp(84px, 14dvh, 120px);
    --scene-bottom: calc(58px + env(safe-area-inset-bottom, 0px));
  }
  .site-header {
    padding-top: calc(18px + env(safe-area-inset-top, 0px));
    padding-bottom: 14px;
  }
  .hero-copy {
    padding-top: var(--scene-top);
  }
  .hero-title {
    font-size: clamp(44px, min(7.4vw, 12dvh), 88px);
  }
  .hero-eyebrow {
    margin-bottom: 14px;
  }
  .hero-description {
    margin-top: 18px;
    font-size: 16px;
  }
  .hero-actions {
    margin-top: 20px;
  }
  .story-content h2,
  .home-composition h2 {
    font-size: clamp(36px, min(6vw, 9dvh), 72px);
  }
  .feature-copy h2 {
    font-size: clamp(28px, min(4.7vw, 7.6dvh), 64px);
  }
  .section-kicker {
    margin-bottom: 18px;
  }
  .life-copy {
    padding-top: var(--scene-top);
  }
  .life-description {
    margin-top: 20px;
    font-size: clamp(15px, 2.6dvh, 21px);
  }
  .life-footnote {
    margin-top: 26px;
  }
  .feature-description {
    font-size: 14px;
    margin-top: 16px;
  }
  .feature-details,
  .feature-note,
  .ticket-steps {
    margin-top: 20px;
  }
  .feature-details > div,
  .ticket-steps li {
    padding: 9px 0;
  }
  .visual-caption {
    font-size: 9px;
  }
  .feature .product-visual {
    gap: 12px;
  }
  .install h2 {
    font-size: clamp(38px, 10dvh, 90px);
  }
}
@media (orientation: landscape) and (max-height: 500px) {
  :root {
    --scene-top: calc(72px + env(safe-area-inset-top, 0px));
    --scene-bottom: calc(46px + env(safe-area-inset-bottom, 0px));
  }
  .site-header {
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    padding-bottom: 8px;
  }
  .brand {
    width: 110px;
  }
  .hero-copy {
    padding-top: var(--scene-top);
  }
  .life-copy {
    padding-top: var(--scene-top);
  }
  .hero-eyebrow {
    font-size: 8px;
    margin-bottom: 8px;
  }
  .hero-title {
    font-size: 38px;
  }
  .hero-description {
    font-size: 12px;
    margin-top: 10px;
  }
  .hero-actions {
    margin-top: 12px;
  }
  .hero-primary,
  .hero-secondary {
    font-size: 12px;
    min-height: 44px;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .story-content h2,
  .home-composition h2,
  .feature-copy h2 {
    font-size: 30px;
  }
  .section-kicker {
    font-size: 8px;
    margin-bottom: 10px;
  }
  .life-description,
  .feature-description {
    font-size: 12px;
    margin-top: 12px;
    line-height: 1.55;
  }
  .life-footnote {
    font-size: 11px;
    margin-top: 14px;
  }
  .feature-details,
  .feature-note,
  .ticket-steps {
    display: none;
  }
  .scene-next {
    bottom: 40px;
    font-size: 10px;
  }
  .story-position {
    bottom: 18px;
  }
  .controls {
    bottom: calc(4px + env(safe-area-inset-bottom, 0px));
  }
  .module-list {
    grid-template-columns: repeat(3, 1fr);
    gap: 0 24px;
    margin-top: 16px;
  }
  .module-list > * {
    min-height: 62px;
    gap: 10px;
  }
  .module-list img {
    width: 32px;
    height: 32px;
  }
  .module-list > * > span:nth-child(2) {
    font-size: 13px;
  }
  .module-list small {
    font-size: 9px;
    margin-top: 3px;
  }
  .module-note {
    margin-top: 12px;
    font-size: 10px;
  }
  .install h2 {
    font-size: 30px;
  }
  .install .install-description {
    font-size: 12px;
    margin: 12px auto;
    line-height: 1.5;
  }
  .install .connection-open {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 12px;
  }
  .install .install-bottom {
    margin-top: 14px;
    padding-top: 12px;
    font-size: 10px;
  }
  .install-content {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    column-gap: 24px;
    align-content: center;
    align-items: center;
    text-align: left;
  }
  .install .section-kicker {
    grid-column: 1;
    grid-row: 1;
  }
  .install h2 {
    grid-column: 1;
    grid-row: 2 / 5;
  }
  .install .install-description {
    grid-column: 2;
    grid-row: 2;
    margin: 0 0 12px;
  }
  .install .connection-open {
    grid-column: 2;
    grid-row: 3;
  }
  .install .install-bottom {
    grid-column: 2;
    grid-row: 4;
  }
}
@media (orientation: landscape) and (max-height: 500px) and (max-width: 640px) {
  .hero-eyebrow span {
    display: inline;
  }
  .hero-title,
  .hero-rest,
  .hero-word {
    font-size: 30px;
  }
  .hero-word {
    display: inline;
  }
  .hero-actions {
    flex-direction: row;
    gap: 20px;
  }
  .hero-primary {
    width: auto;
  }
  .home-composition,
  .feature-layout {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    align-items: center;
    gap: 16px;
  }
  .feature-layout.reverse {
    grid-template-columns: 0.85fr 1.15fr;
  }
  .home-composition h2,
  .feature-copy h2 {
    font-size: 24px;
  }
  .home .life-description,
  .feature-description {
    font-size: 11px;
    margin-top: 10px;
  }
  .home .text-link {
    font-size: 9px;
    gap: 8px;
    margin-top: 4px;
  }
  .feature .phone-anchor,
  .home-composition .phone-anchor {
    width: calc((var(--scene-height) - var(--scene-top) - var(--scene-bottom) - 28px) * 411 / 869);
    align-self: center;
    justify-self: center;
    margin: 0;
  }
  .feature .product-visual {
    align-items: center;
  }
  .visual-caption {
    font-size: 8px;
  }
  .module-list {
    gap: 0 12px;
    margin-top: 12px;
  }
  .module-list > * {
    min-height: 50px;
    gap: 6px;
  }
  .module-list img {
    width: 24px;
    height: 24px;
  }
  .module-list > * > span:nth-child(2) {
    font-size: 11px;
  }
  .module-list small {
    font-size: 8px;
  }
  .module-note {
    font-size: 9px;
    margin-top: 8px;
  }
  .modules h2 {
    font-size: 24px;
  }
  .install h2 {
    font-size: 26px;
  }
}
@media (orientation: landscape) and (max-height: 360px) {
  .scene-next {
    display: none;
  }
}
