/* ========================================================================== 
   AKFA Energy 0.8.0 — immersive screen-by-screen experience
   Loaded after the v0.7 visual layer. This file intentionally contains only
   layout and interaction overrides; the calculation model is unchanged.
   ========================================================================== */

:root {
  --v8-header-height: 68px;
  --v8-pilot-height: 28px;
  --v8-stage-height: calc(100svh - var(--v8-header-height));
  --v8-first-stage-height: calc(100svh - var(--v8-header-height) - var(--v8-pilot-height));
  --v8-screen-index: 0;
  --v8-screen-progress: 0%;
  --v8-screen-accent: #ed1c2b;
  --v8-screen-ease: cubic-bezier(.16, .84, .24, 1);
  --v8-screen-shadow: 0 34px 100px rgba(15, 24, 38, .13);
  --v8-stage-padding: clamp(16px, 2.6vh, 30px);
}

html[data-v8-ready="true"] {
  scroll-behavior: smooth;
}

html[data-screen-mode="on"] {
  scroll-snap-type: y proximity;
  overscroll-behavior-y: none;
}

body {
  overflow-x: clip;
}

body.mobile-menu-open,
body:has(dialog[open]) {
  overscroll-behavior: contain;
}

.screen-deck {
  position: relative;
}

[data-fullpage-screen],
[data-result-screen] {
  position: relative;
  isolation: isolate;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

[data-fullpage-screen]::after,
[data-result-screen]::after {
  content: attr(data-screen-order);
  position: absolute;
  z-index: -1;
  right: max(18px, calc((100vw - var(--v7-container)) / 2));
  top: 50%;
  translate: 0 -50%;
  color: rgba(36, 49, 68, .025);
  font-size: clamp(110px, 15vw, 230px);
  font-weight: 900;
  line-height: .75;
  letter-spacing: -.09em;
  pointer-events: none;
  user-select: none;
}

[data-fullpage-screen] > .container,
[data-result-screen] {
  transition:
    transform .84s var(--v8-screen-ease),
    opacity .58s ease,
    filter .58s ease;
  transform-origin: 50% 50%;
}

html[data-screen-mode="on"][data-screen-layout="immersive"] [data-screen-state="before"] > .container,
html[data-screen-mode="on"][data-screen-layout="immersive"] [data-screen-state="before"].result-screen {
  opacity: .64;
  filter: saturate(.82) contrast(.98);
  transform: translate3d(0, -24px, 0) scale(.992);
}

html[data-screen-mode="on"][data-screen-layout="immersive"] [data-screen-state="after"] > .container,
html[data-screen-mode="on"][data-screen-layout="immersive"] [data-screen-state="after"].result-screen {
  opacity: .72;
  filter: saturate(.88) contrast(.99);
  transform: translate3d(0, 30px, 0) scale(.99);
}

html[data-screen-mode="on"] [data-screen-state="active"] > .container,
html[data-screen-mode="on"] [data-screen-state="active"].result-screen {
  opacity: 1;
  filter: none;
  transform: translate3d(0, 0, 0) scale(1);
}

/* A subtle light sweep marks the active screen without covering controls. */
[data-fullpage-screen]::before,
[data-result-screen]::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  opacity: 0;
  background:
    linear-gradient(112deg, transparent 15%, rgba(255,255,255,.36) 42%, transparent 63%),
    radial-gradient(circle at 90% 14%, rgba(237,28,43,.07), transparent 26rem);
  transform: translateX(-16%);
  transition: opacity .55s ease, transform 1.05s var(--v8-screen-ease);
  pointer-events: none;
}

[data-screen-state="active"]::before {
  opacity: .72;
  transform: translateX(0);
}

/* Header controls ---------------------------------------------------------- */
.screen-mode-toggle {
  position: relative;
}

.screen-mode-toggle__state {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 7px;
  height: 7px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #9ba5b5;
  transition: background .25s ease, box-shadow .25s ease;
}

html[data-screen-mode="on"] .screen-mode-toggle {
  color: var(--v7-red);
  background: #fff;
  box-shadow: 0 8px 24px rgba(237,28,43,.12), inset 0 0 0 1px rgba(237,28,43,.15);
}

html[data-screen-mode="on"] .screen-mode-toggle__state {
  background: #16ab6b;
  box-shadow: 0 0 0 4px rgba(22,171,107,.14);
}

.mobile-screen-mode {
  width: 100%;
  min-height: 50px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 8px 11px;
  color: #232b38;
  background: rgba(255,255,255,.76);
  border: 1px solid rgba(85,99,120,.12);
  border-radius: 14px;
  text-align: left;
}

.mobile-screen-mode .icon {
  width: 18px;
  height: 18px;
}

.mobile-screen-mode span {
  font-size: 12px;
  font-weight: 780;
}

.mobile-screen-mode b {
  padding: 5px 8px;
  color: #697487;
  background: #eef1f5;
  border-radius: 999px;
  font-size: 9px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

html[data-screen-mode="on"] .mobile-screen-mode b {
  color: #087a48;
  background: #e8f8f0;
}

/* Screen rail -------------------------------------------------------------- */
.screen-rail {
  top: 50%;
  left: 16px;
  width: 48px;
  padding: 9px 5px;
  gap: 5px;
  transform: translateY(-50%);
  overflow: visible;
  border-radius: 20px;
  background: rgba(255,255,255,.82);
  border: 1px solid rgba(81,96,118,.12);
  box-shadow: 0 22px 60px rgba(17,28,44,.12);
  backdrop-filter: blur(22px) saturate(1.18);
}

.screen-rail__counter {
  height: 34px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
  margin-bottom: 4px;
  color: #818b9a;
  font-size: 8px;
}

.screen-rail__counter strong {
  color: #111824;
  font-size: 14px;
  letter-spacing: -.03em;
}

.screen-rail__counter em {
  font-style: normal;
}

.screen-rail__track {
  position: absolute;
  z-index: -1;
  top: 52px;
  bottom: 55px;
  left: 50%;
  width: 2px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(98,112,132,.13);
  transform: translateX(-50%);
}

.screen-rail__track i {
  display: block;
  width: 100%;
  height: var(--v8-screen-progress);
  border-radius: inherit;
  background: linear-gradient(180deg, #ff5965, var(--v7-red));
  box-shadow: 0 0 12px rgba(237,28,43,.35);
  transition: height .48s var(--v8-screen-ease);
}

.screen-rail a,
.screen-rail > button {
  position: relative;
  z-index: 1;
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  color: #7a8595;
  background: rgba(248,250,252,.86);
  border: 1px solid rgba(85,99,120,.08);
  border-radius: 13px;
  text-decoration: none;
  transition: color .25s ease, background .25s ease, transform .28s var(--v8-screen-ease), box-shadow .25s ease;
}

.screen-rail a:hover,
.screen-rail > button:hover {
  color: #151c27;
  transform: translateX(2px);
  background: #fff;
  box-shadow: 0 9px 24px rgba(22,32,48,.10);
}

.screen-rail a.is-active {
  color: #fff;
  background: linear-gradient(145deg, #ff3442, #d80f1e);
  border-color: transparent;
  box-shadow: 0 12px 26px rgba(221,20,31,.27), inset 0 1px 0 rgba(255,255,255,.32);
}

.screen-rail a .icon,
.screen-rail > button .icon {
  width: 16px;
  height: 16px;
}

.screen-rail a span,
.screen-rail > button span {
  position: absolute;
  left: 48px;
  top: 50%;
  min-width: max-content;
  padding: 8px 11px;
  color: #fff;
  background: rgba(14,20,29,.92);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(8,13,21,.20);
  font-size: 10px;
  font-weight: 760;
  opacity: 0;
  transform: translate(-6px, -50%);
  pointer-events: none;
  transition: opacity .2s ease, transform .25s var(--v8-screen-ease);
}

.screen-rail a:hover span,
.screen-rail > button:hover span,
.screen-rail a:focus-visible span,
.screen-rail > button:focus-visible span {
  opacity: 1;
  transform: translate(0, -50%);
}

.screen-rail a > b {
  position: absolute;
  right: 3px;
  bottom: 2px;
  color: currentColor;
  font-size: 5.5px;
  opacity: .5;
}

.screen-rail__history {
  margin-top: 3px;
}

.screen-rail__history > b {
  position: absolute;
  right: -3px;
  top: -3px;
  min-width: 15px;
  height: 15px;
  display: grid;
  place-items: center;
  padding: 0 3px;
  color: #fff;
  background: var(--v7-red);
  border: 2px solid #fff;
  border-radius: 999px;
  font-size: 7px;
}

/* Bottom-right screen controller ----------------------------------------- */
.screen-hud {
  position: fixed;
  z-index: 74;
  right: 24px;
  bottom: 22px;
  min-width: 270px;
  height: 58px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 8px;
  padding: 7px;
  color: #1b2330;
  background: rgba(255,255,255,.86);
  border: 1px solid rgba(86,100,122,.13);
  border-radius: 19px;
  box-shadow: 0 22px 64px rgba(13,23,38,.15);
  backdrop-filter: blur(24px) saturate(1.2);
  opacity: 0;
  transform: translateY(18px) scale(.97);
  pointer-events: none;
  transition: opacity .28s ease, transform .42s var(--v8-screen-ease);
}

html[data-screen-mode="on"][data-screen-layout="immersive"] .screen-hud {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

body.mobile-menu-open .screen-hud,
body:has(dialog[open]) .screen-hud,
body.advisor-focus-mode .screen-hud {
  opacity: 0 !important;
  pointer-events: none !important;
}

.screen-hud > button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  color: #424d5e;
  background: #f3f5f8;
  border: 0;
  border-radius: 13px;
  transition: color .2s ease, background .2s ease, transform .22s var(--v8-screen-ease);
}

.screen-hud > button:hover:not(:disabled) {
  color: #fff;
  background: var(--v7-red);
  transform: translateY(-2px);
}

.screen-hud > button:disabled {
  opacity: .28;
  cursor: default;
}

.screen-hud > button:first-child .icon,
.screen-hud > button:last-child .icon {
  width: 17px;
  height: 17px;
  transform: rotate(90deg);
}

.screen-hud > div {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 3px 9px;
}

.screen-hud small {
  grid-row: 1 / span 2;
  display: flex;
  align-items: baseline;
  gap: 2px;
  color: #8993a2;
  font-size: 8px;
}

.screen-hud small b {
  color: var(--v7-red);
  font-size: 18px;
  letter-spacing: -.05em;
}

.screen-hud small em {
  font-style: normal;
}

.screen-hud strong {
  min-width: 0;
  overflow: hidden;
  color: #1b2330;
  font-size: 11px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen-hud div > i {
  position: relative;
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9edf2;
}

.screen-hud div > i em {
  display: block;
  width: var(--v8-screen-progress);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--v7-red), #ff6670);
  transition: width .48s var(--v8-screen-ease);
}

/* Transition veil: visible for only a fraction of the smooth scroll. */
.screen-transition-layer {
  position: fixed;
  z-index: 72;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s ease;
}

.screen-transition-layer i {
  position: absolute;
  inset: -12%;
  background:
    linear-gradient(120deg, transparent 22%, rgba(255,255,255,.52) 48%, transparent 72%),
    radial-gradient(circle at 75% 30%, rgba(237,28,43,.11), transparent 30rem);
  transform: translate3d(0, 30%, 0) skewY(-5deg);
  transition: transform .72s var(--v8-screen-ease);
}

.screen-transition-layer i:last-child {
  background: radial-gradient(circle at 24% 70%, rgba(68,163,255,.09), transparent 28rem);
  transform: translate3d(0, -26%, 0) skewY(4deg);
}

body.v8-screen-transitioning .screen-transition-layer {
  opacity: .58;
}

body.v8-screen-transitioning .screen-transition-layer i {
  transform: translate3d(0, 0, 0) skewY(0);
}

/* Native scroll surfaces inside a full-screen stage ----------------------- */
[data-screen-scrollable],
.result-screen--impact,
.result-screen--system,
.result-screen--savings,
.catalog-match-section.result-screen {
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(123,136,155,.45) transparent;
}

[data-screen-scrollable]::-webkit-scrollbar,
.result-screen--impact::-webkit-scrollbar,
.result-screen--system::-webkit-scrollbar,
.result-screen--savings::-webkit-scrollbar,
.catalog-match-section.result-screen::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

[data-screen-scrollable]::-webkit-scrollbar-thumb,
.result-screen--impact::-webkit-scrollbar-thumb,
.result-screen--system::-webkit-scrollbar-thumb,
.result-screen--savings::-webkit-scrollbar-thumb,
.catalog-match-section.result-screen::-webkit-scrollbar-thumb {
  background: rgba(113,128,149,.38);
  border-radius: 999px;
}

/* Immersive desktop stages ------------------------------------------------ */
@media (min-width: 1024px) and (min-height: 680px) {
  html[data-screen-mode="on"][data-screen-layout="immersive"] {
    scroll-snap-type: y mandatory;
  }

  html[data-screen-mode="on"][data-screen-layout="immersive"] main > [data-fullpage-screen] {
    min-height: var(--v8-stage-height);
    height: var(--v8-stage-height);
    overflow: hidden;
    padding-block: var(--v8-stage-padding);
  }

  html[data-screen-mode="on"][data-screen-layout="immersive"] .hero {
    min-height: var(--v8-first-stage-height);
    height: var(--v8-first-stage-height);
    padding-block: clamp(14px, 2.2vh, 26px);
  }

  html[data-screen-mode="on"][data-screen-layout="immersive"] main > [data-fullpage-screen] > .container {
    height: 100%;
    min-height: 0;
  }

  /* Hero compaction keeps all primary actions in the first viewport. */
  .hero__layout {
    min-height: 0;
    height: 100%;
    align-items: center;
  }

  .hero__content {
    max-height: 100%;
  }

  .hero h1 {
    margin-block: clamp(10px, 1.8vh, 18px) clamp(10px, 1.5vh, 16px);
    font-size: clamp(46px, 4.1vw, 62px);
  }

  .hero__lead {
    margin-bottom: clamp(12px, 1.7vh, 20px);
  }

  .hero-lab {
    min-height: 0;
    height: min(100%, 590px);
  }

  .climate-scene,
  .hero-product-layer {
    min-height: 0;
    height: clamp(300px, 45vh, 365px);
  }

  /* How and informational screens are true single-screen presentations. */
  .how-section,
  .technology-section,
  .methodology-section {
    display: grid;
    align-items: center;
  }

  .how-section > .container,
  .technology-section > .container,
  .methodology-section > .container {
    display: grid;
    align-content: center;
  }

  .how-section .section-heading {
    margin-bottom: clamp(14px, 2vh, 24px);
  }

  .how-section .section-heading h2,
  .technology-section h2,
  .methodology-layout h2 {
    font-size: clamp(34px, 3.25vw, 48px);
  }

  .how-grid article {
    min-height: clamp(165px, 23vh, 210px);
  }

  .technology-grid {
    gap: 12px;
  }

  .technology-card {
    min-height: 0;
  }

  /* Catalog as a fixed workspace with a native-scrolling list. */
  .series-section > .container {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 10px;
  }

  .series-heading {
    min-height: 0;
    margin: 0;
    padding: 13px 15px;
    border-radius: 21px;
  }

  .series-heading h2 {
    margin-block: 3px 5px;
    font-size: clamp(31px, 2.8vw, 42px);
  }

  .series-heading p {
    max-width: 760px;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .series-heading__tools {
    grid-template-columns: 150px 206px !important;
  }

  .series-heading__stat {
    min-height: 70px;
    padding: 9px 12px;
  }

  .series-heading__stat strong {
    font-size: 29px;
  }

  .series-heading__compare {
    min-height: 50px;
  }

  .series-dashboard {
    min-height: 0;
    height: 100%;
    padding: 10px;
    overflow: hidden;
    border-radius: 25px;
  }

  .series-dashboard__feature {
    position: relative;
    top: auto;
    min-height: 0;
    height: 100%;
    padding: 14px;
    overflow-y: auto;
  }

  .series-profile-hero {
    min-height: 160px;
    height: clamp(160px, 24vh, 220px);
  }

  .series-feature__copy h3 {
    margin-block: 4px;
    font-size: clamp(27px, 2.15vw, 34px);
  }

  .series-feature__copy p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .series-feature__metrics span {
    min-height: 48px;
    padding: 7px 8px;
  }

  .series-feature-score {
    min-height: 52px;
    margin-top: 6px;
    padding: 8px 10px;
  }

  .series-feature__actions .button {
    min-height: 42px;
  }

  .series-dashboard__catalog {
    min-height: 0;
    height: 100%;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    overflow: hidden;
  }

  .series-controls {
    position: relative;
    top: auto;
    margin: 0 0 7px;
    padding: 8px;
  }

  .series-rail {
    min-height: 0;
    height: 100%;
    align-content: start;
    overflow-y: auto;
    padding-right: 5px;
  }

  .series-dashboard__footer {
    margin-top: 6px;
    padding: 8px 10px;
  }

  .series-dashboard__footer p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  /* The advisor becomes a one-screen workspace. Only the active question
     scrolls, while progress and actions remain visible. */
  .advisor-section > .container {
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr);
    gap: 7px;
  }

  .advisor-heading {
    min-height: 0;
    margin: 0;
    padding: 0 2px;
  }

  .advisor-heading h2 {
    margin-block: 3px;
    font-size: clamp(31px, 2.8vw, 42px);
  }

  .advisor-heading > p {
    max-width: 580px;
    font-size: 12px;
  }

  .advisor-mode-bar {
    min-height: 0;
    margin: 0;
    padding: 7px;
  }

  .resume-card {
    margin: 0;
  }

  .advisor-shell {
    min-height: 0;
    height: 100%;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    overflow: hidden;
  }

  .advisor-progress {
    padding: 9px 12px 7px;
  }

  .advisor-step-rail {
    margin-top: 7px;
  }

  .advisor-context-ribbon {
    min-height: 0;
    padding-block: 7px;
  }

  .advisor-layout {
    min-height: 0;
    height: 100%;
    overflow: hidden;
  }

  .advisor-main {
    min-height: 0;
    height: 100%;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
  }

  .engineer-message {
    margin-bottom: 7px;
    padding: 8px 10px;
  }

  .energy-form {
    min-height: 0;
    overflow-y: auto;
    padding-right: 6px;
  }

  .question-head {
    margin-bottom: 12px;
  }

  .question-head h3 {
    font-size: clamp(23px, 2vw, 30px);
  }

  .advisor-controls {
    position: relative;
    z-index: 3;
    margin-top: 7px;
    padding-top: 7px;
    background: linear-gradient(180deg, rgba(255,255,255,0), rgba(255,255,255,.96) 24%);
  }

  .advisor-live {
    min-height: 0;
    height: 100%;
    overflow-y: auto;
  }

  /* Once results exist, the advisor remains one full screen and the result
     sequence continues as its own set of snap screens. */
  body.v8-results-visible .advisor-section {
    min-height: var(--v8-stage-height) !important;
    height: auto !important;
    overflow: visible !important;
    padding-bottom: 0 !important;
  }

  body.v8-results-visible .advisor-section > .container {
    height: auto !important;
    display: block;
  }

  body.v8-results-visible .advisor-heading,
  body.v8-results-visible .advisor-mode-bar,
  body.v8-results-visible .resume-card,
  body.v8-results-visible .advisor-shell {
    width: 100%;
  }

  body.v8-results-visible .advisor-shell {
    height: calc(var(--v8-stage-height) - 148px);
    min-height: 580px;
    margin-top: 8px;
  }

  .results {
    margin-top: 24px;
    padding: 0;
  }

  .result-screen {
    min-height: var(--v8-stage-height);
    height: var(--v8-stage-height);
    display: grid;
    align-content: center;
    gap: 10px;
    padding: var(--v8-stage-padding) 0;
    overflow: hidden;
  }

  .result-screen--overview {
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .results-toolbar {
    margin: 0;
    padding: 9px 12px;
  }

  .results-toolbar h2 {
    font-size: clamp(26px, 2.4vw, 36px);
  }

  .result-section-nav {
    position: relative;
    top: auto;
    margin: 0;
  }

  .recommendation-hero {
    min-height: 0;
    height: 100%;
    margin: 0;
  }

  .recommendation-hero__content h3 {
    font-size: clamp(42px, 4vw, 64px);
  }

  .result-screen--impact {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    overflow-y: auto;
    padding-inline: 2px 8px;
  }

  .result-screen--impact > * {
    flex: 0 0 auto;
  }

  .options-section.result-screen,
  .catalog-match-section.result-screen,
  .result-screen--system,
  .result-screen--savings,
  .result-cta.result-screen {
    margin: 0;
  }

  .options-section.result-screen,
  .catalog-match-section.result-screen {
    align-content: start;
    overflow-y: auto;
  }

  .options-section.result-screen .option-grid {
    align-self: center;
  }

  .result-screen--system,
  .result-screen--savings {
    align-content: start;
    overflow-y: auto;
    padding-right: 7px;
  }

  .result-screen--system > section,
  .result-screen--savings > section {
    flex: 0 0 auto;
  }

  .system-studio,
  .premium-explainer,
  .savings-section,
  .confidence-section {
    margin-top: 0;
    margin-bottom: 12px;
  }

  .result-cta.result-screen {
    min-height: var(--v8-stage-height);
    height: var(--v8-stage-height);
    align-content: center;
    border-radius: 0;
  }
}

/* Flow mode and mobile ----------------------------------------------------- */
@media (max-width: 1023px), (max-height: 679px) {
  html[data-screen-mode="on"] {
    scroll-snap-type: y proximity;
  }

  [data-fullpage-screen],
  [data-result-screen] {
    min-height: calc(100svh - var(--v8-header-height));
    height: auto;
    overflow: visible;
    scroll-snap-stop: normal;
  }

  .hero {
    min-height: calc(100svh - var(--v8-header-height) - var(--v8-pilot-height));
  }

  .screen-hud,
  .screen-rail {
    display: none !important;
  }
}

@media (max-width: 760px) {
  :root {
    --v8-header-height: 62px;
    --v8-pilot-height: 28px;
  }

  html[data-screen-mode="on"] {
    scroll-snap-type: y proximity;
    overscroll-behavior-y: auto;
  }

  [data-fullpage-screen],
  [data-result-screen] {
    min-height: calc(100svh - var(--v8-header-height));
    scroll-margin-top: var(--v8-header-height) !important;
  }

  [data-fullpage-screen]::after,
  [data-result-screen]::after {
    display: none;
  }

  [data-fullpage-screen]::before,
  [data-result-screen]::before {
    opacity: .35;
  }

  .hero {
    min-height: calc(100svh - var(--v8-header-height) - var(--v8-pilot-height));
  }

  .how-section,
  .series-section,
  .advisor-section,
  .technology-section,
  .methodology-section {
    padding-top: 36px !important;
    padding-bottom: 46px !important;
  }

  .result-screen {
    padding-block: 22px;
  }

  .result-screen--overview {
    display: block;
  }

  .result-screen--impact,
  .result-screen--system,
  .result-screen--savings,
  .catalog-match-section.result-screen {
    overflow: visible;
  }

  .mobile-menu__panel {
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }
}

/* Very compact landscape devices should never be trapped by mandatory snap. */
@media (orientation: landscape) and (max-height: 560px) {
  html[data-screen-mode="on"] {
    scroll-snap-type: none;
  }
}

/* Accessibility ----------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html,
  html[data-screen-mode="on"] {
    scroll-behavior: auto !important;
    scroll-snap-type: y proximity !important;
  }

  [data-fullpage-screen] > .container,
  [data-result-screen],
  .screen-transition-layer,
  .screen-transition-layer i,
  .screen-hud,
  .screen-rail__track i {
    transition: none !important;
  }

  [data-screen-state] > .container,
  [data-screen-state].result-screen {
    opacity: 1 !important;
    filter: none !important;
    transform: none !important;
  }
}

@media print {
  .screen-hud,
  .screen-rail,
  .screen-transition-layer,
  .screen-mode-toggle,
  .mobile-screen-mode {
    display: none !important;
  }

  [data-fullpage-screen],
  [data-result-screen] {
    min-height: 0 !important;
    height: auto !important;
    overflow: visible !important;
  }
}

/* v0.8.0 final visual refinement ----------------------------------------- */
@media (min-width: 1240px) and (min-height: 680px) {
  html[data-screen-mode="on"][data-screen-layout="immersive"] .screen-rail {
    display: flex !important;
  }

  html[data-screen-mode="on"][data-screen-layout="immersive"] .screen-hud {
    display: none !important;
  }
}

@media (min-width: 1024px) and (max-width: 1239px) and (min-height: 680px) {
  html[data-screen-mode="on"][data-screen-layout="immersive"] .screen-rail {
    display: none !important;
  }
}

/* The legacy back-to-top pill duplicates the screen navigator and used to
   overlap important CTA controls in catalog and result screens. */
html[data-screen-mode="on"][data-screen-layout="immersive"] .back-to-top {
  display: none !important;
}

@media (min-width: 1024px) and (min-height: 680px) {
  .how-section > .container {
    grid-template-rows: auto minmax(0, 1fr);
    gap: clamp(18px, 2.4vh, 28px);
    align-content: center;
  }

  .how-section .section-heading {
    grid-template-columns: minmax(250px, .72fr) minmax(520px, 1.28fr);
    grid-template-areas:
      "kicker title"
      "copy title";
    align-items: end;
    gap: 8px clamp(34px, 4vw, 70px);
    width: 100%;
    margin: 0;
    padding: clamp(20px, 2.7vh, 30px) clamp(22px, 2.7vw, 38px);
    text-align: left;
    background:
      radial-gradient(circle at 86% 18%, rgba(237,28,43,.105), transparent 19rem),
      linear-gradient(135deg, rgba(255,255,255,.97), rgba(249,250,252,.92));
    border: 1px solid rgba(81,95,116,.11);
    border-radius: 28px;
    box-shadow: 0 24px 70px rgba(16,27,43,.08), inset 0 1px 0 rgba(255,255,255,.92);
    overflow: hidden;
  }

  .how-section .section-heading::after {
    content: "01  ·  02  ·  03";
    position: absolute;
    right: 28px;
    bottom: -7px;
    color: rgba(237,28,43,.055);
    font-size: clamp(54px, 7vw, 94px);
    font-weight: 900;
    line-height: .8;
    letter-spacing: -.08em;
    pointer-events: none;
  }

  .how-section .section-kicker {
    grid-area: kicker;
    align-self: end;
  }

  .how-section .section-heading h2 {
    grid-area: title;
    align-self: center;
    max-width: 760px;
    margin: 0;
    text-align: left;
    font-size: clamp(38px, 3.55vw, 54px);
    line-height: .96;
  }

  .how-section .section-heading p {
    grid-area: copy;
    align-self: start;
    max-width: 430px;
    margin: 4px 0 0;
    text-align: left;
    font-size: clamp(13px, 1.05vw, 15px);
    line-height: 1.55;
  }

  .how-grid {
    position: relative;
    align-self: stretch;
    display: grid;
    align-items: stretch;
    gap: 14px;
  }

  .how-grid::before {
    content: "";
    position: absolute;
    z-index: 0;
    left: 13%;
    right: 13%;
    top: 43px;
    height: 2px;
    background: linear-gradient(90deg, rgba(237,28,43,.08), rgba(237,28,43,.6), rgba(237,28,43,.08));
  }

  .how-grid article {
    position: relative;
    z-index: 1;
    min-height: 0;
    height: 100%;
    display: grid;
    grid-template-rows: auto minmax(16px, 1fr) auto auto;
    align-content: start;
    padding: clamp(20px, 2.3vh, 27px);
    border-color: rgba(78,92,112,.10);
    border-radius: 24px;
    box-shadow: 0 18px 48px rgba(17,27,42,.075);
    overflow: hidden;
    transition: transform .38s var(--v8-screen-ease), box-shadow .38s ease, border-color .25s ease;
  }

  .how-grid article::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0;
    background: radial-gradient(circle at 14% 12%, rgba(237,28,43,.11), transparent 17rem);
    transition: opacity .35s ease;
    pointer-events: none;
  }

  .how-grid article:hover {
    transform: translateY(-7px);
    border-color: rgba(237,28,43,.18);
    box-shadow: 0 30px 68px rgba(17,27,42,.12);
  }

  .how-grid article:hover::before {
    opacity: 1;
  }

  .how-grid article > span {
    justify-self: end;
    color: var(--v7-red);
    text-shadow: 0 10px 28px rgba(237,28,43,.16);
  }

  .how-grid .feature-icon {
    align-self: end;
    margin-bottom: 14px;
    background: rgba(255,255,255,.96);
    box-shadow: 0 12px 28px rgba(18,29,45,.09), inset 0 0 0 1px rgba(237,28,43,.09);
  }

  .how-grid h3 {
    margin-top: 0;
  }
}

/* Keep the screen control clear of browser safe areas on medium laptops. */
@media (min-width: 1024px) and (max-width: 1239px) and (min-height: 680px) {
  .screen-hud {
    right: 18px;
    bottom: 16px;
  }

  main > [data-fullpage-screen] > .container,
  .results > [data-result-screen] {
    padding-bottom: 72px;
  }
}

/* The advisor and result areas already have their own contextual navigation.
   Hiding the global rail prevents two vertical navigators from colliding. */
html[data-screen-mode="on"][data-screen-layout="immersive"][data-active-screen="advisor"] .screen-rail,
html[data-screen-mode="on"][data-screen-layout="immersive"][data-active-screen^="result-"] .screen-rail,
html[data-screen-mode="on"][data-screen-layout="immersive"][data-active-screen="options"] .screen-rail,
html[data-screen-mode="on"][data-screen-layout="immersive"][data-active-screen="catalog-match"] .screen-rail {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: translate(-16px, -50%) !important;
}

.screen-rail {
  transition: opacity .28s ease, transform .42s var(--v8-screen-ease);
}

/* Result screens live inside the advisor container. When a result child is
   active, the parent advisor is technically "before"; never fade the parent,
   otherwise the entire result workspace becomes washed out. */
body.v8-results-visible .advisor-section[data-screen-state="before"] > .container,
body.v8-results-visible .advisor-section[data-screen-state="active"] > .container {
  opacity: 1 !important;
  filter: none !important;
  transform: none !important;
}

@media (min-width: 1024px) and (min-height: 680px) {
  html[data-screen-mode="on"][data-screen-layout="immersive"] .result-dock {
    display: none !important;
  }

  .how-grid {
    height: clamp(330px, 43vh, 400px);
    align-self: center;
  }

  .how-grid article {
    grid-template-rows: auto auto auto minmax(0, 1fr);
    background:
      radial-gradient(circle at 82% 86%, rgba(237,28,43,.055), transparent 13rem),
      linear-gradient(155deg, rgba(255,255,255,.99), rgba(248,250,253,.94));
  }

  .how-grid article:nth-child(2) {
    background:
      radial-gradient(circle at 82% 86%, rgba(66,148,255,.07), transparent 13rem),
      linear-gradient(155deg, rgba(255,255,255,.99), rgba(248,250,253,.94));
  }

  .how-grid article:nth-child(3) {
    background:
      radial-gradient(circle at 82% 86%, rgba(19,176,111,.07), transparent 13rem),
      linear-gradient(155deg, rgba(255,255,255,.99), rgba(248,250,253,.94));
  }

  .how-grid .feature-icon {
    margin-bottom: 18px;
  }

  .how-grid h3 {
    margin-bottom: 10px;
  }

  .how-grid p {
    align-self: start;
    max-width: 330px;
    font-size: 14px;
    line-height: 1.55;
  }
}

/* Animated visual explanations inside the three-step screen. */
.how-visual {
  position: relative;
  align-self: end;
  min-height: 118px;
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid rgba(82,97,118,.09);
  border-radius: 18px;
  background:
    linear-gradient(rgba(77,92,114,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(77,92,114,.045) 1px, transparent 1px),
    rgba(249,251,253,.86);
  background-size: 22px 22px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.94);
}

.how-visual--object {
  display: grid;
  place-items: center;
}

.how-visual__building {
  position: relative;
  width: 88px;
  height: 76px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 13px;
  border: 2px solid rgba(30,42,58,.68);
  border-radius: 10px 10px 4px 4px;
  background: rgba(255,255,255,.82);
  box-shadow: 0 12px 28px rgba(20,31,47,.12);
}

.how-visual__building b {
  border-radius: 3px;
  background: linear-gradient(145deg, #c8e8ff, #eff8ff);
  box-shadow: inset 0 0 0 1px rgba(55,135,200,.14);
}

.how-visual__building em {
  position: absolute;
  left: 50%;
  bottom: -2px;
  width: 18px;
  height: 27px;
  border-radius: 4px 4px 0 0;
  background: #263142;
  transform: translateX(-50%);
}

.how-visual__pin {
  position: absolute;
  right: calc(50% - 71px);
  top: 17px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #ff4653, #d90f1e);
  border: 4px solid rgba(255,255,255,.95);
  border-radius: 50% 50% 50% 12px;
  box-shadow: 0 11px 24px rgba(221,18,31,.25);
  transform: rotate(-45deg);
  animation: howPinFloat 3s ease-in-out infinite;
}

.how-visual__pin .icon {
  width: 13px;
  height: 13px;
  transform: rotate(45deg);
}

.how-visual__scan {
  position: absolute;
  left: 18%;
  right: 18%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(237,28,43,.82), transparent);
  box-shadow: 0 0 12px rgba(237,28,43,.36);
  animation: howScan 3.2s ease-in-out infinite;
}

.how-visual--diagnostics {
  display: grid;
  place-items: center;
}

.how-visual__window {
  position: relative;
  width: 82px;
  height: 78px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 7px;
  border: 7px solid #fff;
  border-radius: 8px;
  background: #cceaff;
  box-shadow: 0 15px 32px rgba(25,45,69,.16), inset 0 0 0 1px rgba(36,119,185,.14);
}

.how-visual__window b {
  border-right: 1px solid rgba(63,113,153,.28);
  background: linear-gradient(155deg, rgba(255,255,255,.62), rgba(80,170,232,.16));
}

.how-visual__window b:nth-child(2) { border-right: 0; }

.how-visual__window em {
  position: absolute;
  inset: -7px;
  border: 2px solid rgba(237,28,43,.0);
  border-radius: 9px;
  animation: howDiagnosticPulse 2.8s ease-in-out infinite;
}

.how-visual__wave {
  position: absolute;
  width: 70px;
  height: 18px;
  border-top: 3px solid rgba(63,151,230,.64);
  border-radius: 50%;
  animation: howWave 2.6s ease-in-out infinite;
}

.how-visual__wave--one { left: 10%; top: 45px; }
.how-visual__wave--two { right: 8%; top: 65px; animation-delay: -.8s; }

.how-visual__diagnostic-dot {
  position: absolute;
  right: 17%;
  top: 20px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: #fff;
  background: #ed1c2b;
  border-radius: 50%;
  box-shadow: 0 0 0 7px rgba(237,28,43,.12), 0 10px 22px rgba(237,28,43,.23);
  animation: howDot 2.4s ease-in-out infinite;
}

.how-visual__diagnostic-dot .icon { width: 13px; height: 13px; }

.how-visual--result {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
  gap: 9px;
  padding: 17px 18px 14px;
}

.how-visual--result > i {
  position: relative;
  z-index: 1;
  min-height: 56px;
  display: grid;
  align-content: end;
  gap: 7px;
  padding: 8px;
  border: 1px solid rgba(76,91,112,.10);
  border-radius: 11px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 9px 20px rgba(16,27,43,.07);
  transform: translateY(5px);
}

.how-visual--result > i.is-recommended {
  min-height: 82px;
  border-color: rgba(237,28,43,.24);
  background: linear-gradient(155deg, #fff, #fff0f2);
  box-shadow: 0 13px 28px rgba(237,28,43,.13);
  transform: translateY(0);
  animation: howRecommended 3s ease-in-out infinite;
}

.how-visual--result small {
  color: #8b95a5;
  font-size: 8px;
  font-style: normal;
}

.how-visual--result b {
  display: block;
  width: 65%;
  height: 5px;
  border-radius: 999px;
  background: #cfd6df;
}

.how-visual--result .is-recommended b {
  width: 86%;
  background: linear-gradient(90deg, #ed1c2b, #ff6b75);
}

.how-visual__result-line {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 8px;
  height: 2px;
  overflow: hidden;
  border-radius: 999px;
  background: #e3e7ed;
}

.how-visual__result-line::after {
  content: "";
  display: block;
  width: 42%;
  height: 100%;
  background: linear-gradient(90deg, transparent, #1bb06e, transparent);
  animation: howResultLine 2.8s ease-in-out infinite;
}

@keyframes howPinFloat { 50% { translate: 0 -6px; } }
@keyframes howScan { 0%,100% { top: 24px; opacity: .25; } 50% { top: 93px; opacity: 1; } }
@keyframes howDiagnosticPulse { 50% { border-color: rgba(237,28,43,.48); box-shadow: 0 0 0 9px rgba(237,28,43,.08); } }
@keyframes howWave { 0%,100% { opacity: .22; transform: translateX(-7px) scaleX(.72); } 50% { opacity: .92; transform: translateX(7px) scaleX(1.08); } }
@keyframes howDot { 50% { transform: scale(1.08); box-shadow: 0 0 0 11px rgba(237,28,43,.08), 0 12px 26px rgba(237,28,43,.26); } }
@keyframes howRecommended { 50% { transform: translateY(-4px); } }
@keyframes howResultLine { 0% { transform: translateX(-110%); } 100% { transform: translateX(270%); } }

@media (max-width: 760px) {
  .how-visual { min-height: 104px; }
}

@media (prefers-reduced-motion: reduce) {
  .how-visual *,
  .how-visual *::after { animation: none !important; }
}
