:root {
  color-scheme: light;
  --scene-fallback: #ded8cc;
  --ink: #11110f;
  --graphite: #171816;
  --glass: #080a09;
  --gold: #ffd21f;
  --gold-deep: #edb900;
  --camera-x: 0px;
  --camera-y: 0px;
  --camera-focus-x: 0px;
  --camera-focus-y: 0px;
  --parallax-x: 0px;
  --parallax-y: 0px;
  --room-x: 0px;
  --room-y: 0px;
  --scene-width: 100vw;
  --scene-height: 100vh;
  --scene-left: 0px;
  --scene-top: 0px;
  --brand-x: 12.5vw;
  --brand-y: 7vh;
  --light-wall-x: 31%;
  --light-wall-y: 60%;
  --light-wall-rx: 38%;
  --light-wall-ry: 30%;
  --light-floor-x: 24%;
  --light-floor-y: 82%;
  --light-floor-rx: 46%;
  --light-floor-ry: 18%;
  --light-rgb: 255 242 201;
  --light-wall-shift-x: 0px;
  --light-wall-shift-y: 0px;
  --light-floor-shift-x: 0px;
  --light-floor-shift-y: 0px;
  --thermostat-x: 62vw;
  --thermostat-y: 39vh;
  --camera-origin-x: var(--thermostat-x);
  --camera-origin-y: var(--thermostat-y);
  --close-camera-x: calc(50vw - var(--thermostat-x));
  --close-camera-y: calc(50vh - var(--thermostat-y));
  --camera-scale: 1;
  --close-camera-scale: 6.7460317;
  --thermostat-width: clamp(101px, 10.71vw, 157.5px);
  --thermostat-layout-width: 1062.5px;
  --thermostat-render-scale: 0.0741176;
  --thermostat-shadow-color: 37 29 20;
  --thermostat-shadow-core: 0.24;
  --thermostat-shadow-cast: 0.14;
  --thermostat-shadow-x: -49.2%;
  --thermostat-shadow-y: -48.8%;
  --thermostat-shadow-cast-x: 1px;
  --thermostat-shadow-cast-y: 1.5px;
  --thermostat-shadow-blur: 1.7px;
  --thermostat-shadow-cast-blur: 2.4px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--scene-fallback);
}

body {
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button {
  color: inherit;
  font: inherit;
}

button:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
}

.experience {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100svh;
  isolation: isolate;
  overflow: hidden;
  background: var(--scene-fallback);
  color: var(--ink);
}

.ambient-light {
  position: absolute;
  z-index: 2;
  top: var(--scene-top);
  left: var(--scene-left);
  width: var(--scene-width);
  height: var(--scene-height);
  pointer-events: none;
  mix-blend-mode: soft-light;
  will-change: opacity, transform;
}

.ambient-light--wall {
  transform: translate3d(var(--light-wall-shift-x), var(--light-wall-shift-y), 0);
  background: radial-gradient(
    ellipse var(--light-wall-rx) var(--light-wall-ry) at var(--light-wall-x) var(--light-wall-y),
    rgb(var(--light-rgb) / 0.92),
    rgb(var(--light-rgb) / 0.34) 46%,
    transparent 76%
  );
}

.ambient-light--floor {
  transform: translate3d(var(--light-floor-shift-x), var(--light-floor-shift-y), 0);
  background: radial-gradient(
    ellipse var(--light-floor-rx) var(--light-floor-ry) at var(--light-floor-x) var(--light-floor-y),
    rgb(var(--light-rgb) / 0.76),
    transparent 74%
  );
}

.wall-scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  transform-origin: var(--camera-origin-x) var(--camera-origin-y);
  transform:
    translate3d(
      calc(var(--camera-x) + var(--camera-focus-x)),
      calc(var(--camera-y) + var(--camera-focus-y)),
      0
    )
    scale(var(--camera-scale));
  background: var(--scene-fallback);
  will-change: transform;
}

.room-photo {
  position: absolute;
  top: var(--scene-top);
  left: var(--scene-left);
  display: block;
  width: var(--scene-width);
  height: var(--scene-height);
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  user-select: none;
}

.experience[data-scene="warm-dark"] .room-photo {
  top: var(--warm-dark-photo-top, var(--scene-top));
  left: var(--warm-dark-photo-left, var(--scene-left));
  width: var(--warm-dark-photo-width, var(--scene-width));
  height: var(--warm-dark-photo-height, var(--scene-height));
}

.experience[data-scene="warm-dark"] {
  --ink: #f1e9dc;
  --scene-fallback: #3d342d;
  --thermostat-shadow-color: 0 0 0;
  --thermostat-shadow-core: 0.32;
  --thermostat-shadow-cast: 0.18;
  --thermostat-shadow-x: -49%;
  --thermostat-shadow-y: -48.7%;
  --thermostat-shadow-cast-x: 1.2px;
  --thermostat-shadow-cast-y: 1.8px;
  --thermostat-shadow-blur: 1.6px;
  --thermostat-shadow-cast-blur: 2.8px;
}

.experience[data-scene="cool-neutral"] {
  --scene-fallback: #c5c3c0;
  --thermostat-shadow-color: 31 33 34;
  --thermostat-shadow-core: 0.22;
  --thermostat-shadow-cast: 0.12;
  --thermostat-shadow-x: -49.2%;
  --thermostat-shadow-y: -49%;
  --thermostat-shadow-cast-x: 1px;
  --thermostat-shadow-cast-y: 1.4px;
  --thermostat-shadow-cast-blur: 2.2px;
}

.experience[data-scene="soft-sage"] {
  --scene-fallback: #cdd1c4;
  --thermostat-shadow-color: 37 42 32;
  --thermostat-shadow-core: 0.23;
  --thermostat-shadow-cast: 0.13;
  --thermostat-shadow-x: -49.2%;
  --thermostat-shadow-y: -48.8%;
  --thermostat-shadow-cast-x: 1px;
  --thermostat-shadow-cast-y: 1.5px;
  --thermostat-shadow-cast-blur: 2.4px;
}

.experience[data-scene="warm-dark"] .brand-copy p {
  color: #d7ccbc;
}

.experience[data-scene="warm-dark"] .brand-copy {
  text-shadow: 0 1px 6px rgb(24 16 9 / 0.22);
}

.wall-scene::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgb(50 38 24 / 0.06), transparent 11%, transparent 86%, rgb(50 38 24 / 0.08)),
    linear-gradient(0deg, rgb(45 32 18 / 0.05), transparent 23%);
}

.wall-grain {
  position: absolute;
  inset: 0;
  opacity: 0.09;
  mix-blend-mode: multiply;
  background-image:
    repeating-linear-gradient(88deg, transparent 0 31px, rgb(68 52 30 / 0.018) 32px 33px),
    repeating-linear-gradient(3deg, transparent 0 46px, rgb(255 255 255 / 0.17) 47px 48px);
}

.brand-lockup {
  position: absolute;
  z-index: 6;
  top: max(var(--brand-y), calc(env(safe-area-inset-top) + 28px));
  left: max(var(--brand-x), calc(env(safe-area-inset-left) + 28px));
  display: flex;
  align-items: center;
  gap: 14px;
  filter: blur(0);
  transition: opacity 700ms ease, filter 700ms ease;
}

.brand-copy {
  white-space: nowrap;
}

.brand-mark {
  display: block;
  width: clamp(71.5px, 6.4064vw, 93.5px);
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
}

.brand-copy h1,
.brand-copy p {
  margin: 0;
}

.brand-copy h1 {
  font-size: clamp(1.12rem, 1.4vw, 1.456rem);
  font-weight: 720;
  letter-spacing: -0.025em;
}

.brand-copy p {
  margin-top: 3px;
  color: #57544d;
  font-size: clamp(0.84rem, 0.918vw, 0.986rem);
  font-weight: 600;
  letter-spacing: 0.025em;
}

.thermostat {
  position: absolute;
  z-index: 4;
  top: var(--thermostat-y);
  left: var(--thermostat-x);
  width: var(--thermostat-layout-width);
  aspect-ratio: 590 / 399;
  transform: translate3d(-50%, -50%, 0) scale(var(--thermostat-render-scale));
  transform-origin: center;
}

.console-shadow {
  position: absolute;
  z-index: 3;
  top: var(--thermostat-y);
  left: var(--thermostat-x);
  width: var(--thermostat-width);
  aspect-ratio: 590 / 399;
  pointer-events: none;
  transform: translate3d(var(--thermostat-shadow-x), var(--thermostat-shadow-y), 0);
  background: rgb(var(--thermostat-shadow-color) / var(--thermostat-shadow-core));
  -webkit-mask: url("assets/thermostat-housing-s1200-clean-r1.png") center / contain no-repeat;
  mask: url("assets/thermostat-housing-s1200-clean-r1.png") center / contain no-repeat;
  filter:
    blur(var(--thermostat-shadow-blur))
    drop-shadow(
      var(--thermostat-shadow-cast-x)
      var(--thermostat-shadow-cast-y)
      var(--thermostat-shadow-cast-blur)
      rgb(var(--thermostat-shadow-color) / var(--thermostat-shadow-cast))
    );
  transition: opacity 500ms ease;
}

.thermostat-housing {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: saturate(0.88) brightness(0.88);
  transition: filter 420ms ease;
  pointer-events: none;
  user-select: none;
}

.thermostat-screen {
  position: absolute;
  z-index: 2;
  top: 7.8%;
  right: 6.1%;
  bottom: 8%;
  left: 6.1%;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 0.045);
  border-radius: 5.5% / 8.6%;
  container-type: inline-size;
  background:
    radial-gradient(circle at 72% 18%, rgb(98 101 92 / 0.12), transparent 32%),
    linear-gradient(145deg, #111412, var(--glass) 66%, #030403);
  box-shadow:
    inset 0 0 0 1px rgb(0 0 0 / 0.8),
    inset 0 10px 22px rgb(255 255 255 / 0.025),
    0 0 0 1px rgb(255 255 255 / 0.025);
  transition: box-shadow 1100ms ease, background 1100ms ease;
}

.screen-reflection {
  position: absolute;
  z-index: 3;
  inset: -55% 36% 20% -15%;
  pointer-events: none;
  transform: rotate(18deg);
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / 0.075), transparent);
  opacity: 0.5;
}

.screen-idle {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  opacity: 0.34;
  transition: opacity 320ms ease;
}

.idle-temperature {
  color: #e3e3da;
  font-size: 29cqw;
  font-weight: 300;
  letter-spacing: -0.08em;
  line-height: 0.94;
}

.idle-status {
  margin-top: 0.5em;
  color: #a7aaa2;
  font-size: 4.5cqw;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.screen-awake {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  grid-template-rows: auto 1fr auto;
  gap: 0 5%;
  align-items: center;
  padding: 5.5% 6%;
  color: #f7f6ef;
  opacity: 0;
  transition: opacity 360ms ease 100ms;
}

.screen-brand {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 2.4%;
  color: #dadbd4;
  font-size: 3.6cqw;
  font-weight: 630;
  letter-spacing: -0.015em;
}

.screen-brand img {
  display: block;
  width: 9cqw;
  height: auto;
  aspect-ratio: 1;
}

.temperature {
  align-self: center;
  display: flex;
  align-items: flex-start;
  line-height: 0.84;
}

.temperature-value {
  font-size: 32cqw;
  font-weight: 260;
  letter-spacing: -0.09em;
}

.temperature-degree {
  margin-top: 0.04em;
  color: var(--gold);
  font-size: 11cqw;
  font-weight: 420;
}

.comfort-line {
  align-self: center;
  max-width: 11ch;
  margin: 0;
  color: #e6e6dd;
  font-size: 6cqw;
  font-weight: 560;
  letter-spacing: -0.035em;
  line-height: 1.08;
}

.appointment-button {
  grid-column: 1 / -1;
  min-height: max(10cqw, 44px);
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 0.78em 1.1em;
  border: 1px solid rgb(255 255 255 / 0.08);
  border-radius: 3cqw;
  background: linear-gradient(180deg, #ffdb35, var(--gold));
  box-shadow: 0 8px 20px rgb(0 0 0 / 0.22), inset 0 1px rgb(255 255 255 / 0.44);
  color: #11120f;
  font-size: 4.2cqw;
  font-weight: 720;
  letter-spacing: -0.015em;
  cursor: pointer;
  transition: background-color 180ms ease, transform 180ms ease;
}

.appointment-button:hover {
  background: #ffe05b;
}

.appointment-button:active {
  transform: scale(0.985);
}

.appointment-button svg,
.wake-control svg {
  width: 1.25em;
  height: 1.25em;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.wake-control {
  position: absolute;
  z-index: 10;
  right: max(5%, calc(env(safe-area-inset-right) + 22px));
  bottom: max(6%, calc(env(safe-area-inset-bottom) + 22px));
  min-width: 176px;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 18px 0 21px;
  border: 1px solid rgb(21 20 17 / 0.13);
  border-radius: 999px;
  background: rgb(246 241 232 / 0.82);
  box-shadow: 0 5px 18px rgb(53 42 26 / 0.09), inset 0 1px rgb(255 255 255 / 0.58);
  color: #1a1916;
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: opacity 400ms ease, transform 400ms cubic-bezier(0.22, 1, 0.36, 1), background 180ms ease;
}

.wake-control:hover {
  background: rgb(255 252 245 / 0.96);
  transform: translateY(-2px);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.experience[data-state="presence"] .brand-lockup,
.experience[data-state="close"] .brand-lockup {
  opacity: 0;
  filter: blur(8px);
  transition: opacity 700ms ease, filter 700ms ease;
}

.experience[data-state="returning"] .brand-lockup {
  opacity: 0;
  filter: blur(10px);
  transition: none;
}

.experience[data-state="quiet"] .brand-lockup {
  opacity: 1;
  filter: blur(0);
  transition:
    opacity var(--brand-reveal-duration, 1500ms) ease,
    filter var(--brand-reveal-duration, 1500ms) ease;
}

.experience[data-state="presence"] .thermostat-housing,
.experience[data-state="close"] .thermostat-housing {
  filter: none;
}

.experience[data-state="presence"] .thermostat-screen,
.experience[data-state="close"] .thermostat-screen {
  background:
    radial-gradient(circle at 68% 23%, rgb(106 112 101 / 0.2), transparent 34%),
    linear-gradient(145deg, #171b18, #090b0a 63%, #030403);
  box-shadow:
    inset 0 0 0 1px rgb(0 0 0 / 0.85),
    inset 0 10px 24px rgb(255 255 255 / 0.04),
    0 0 34px rgb(255 214 42 / 0.09);
}

.experience[data-state="presence"] .screen-idle,
.experience[data-state="close"] .screen-idle {
  opacity: 0;
}

.experience[data-state="presence"] .screen-awake,
.experience[data-state="close"] .screen-awake {
  opacity: 1;
}

.experience[data-state="presence"] .console-shadow,
.experience[data-state="close"] .console-shadow {
  opacity: 0.9;
}

.experience[data-state="presence"] .wake-control,
.experience[data-state="close"] .wake-control,
.experience[data-state="returning"] .wake-control {
  pointer-events: none;
  opacity: 0;
  transform: translateY(10px);
}

@media (max-width: 900px) and (orientation: landscape) {
  .brand-lockup {
    top: max(var(--brand-y), calc(env(safe-area-inset-top) + 14px));
    left: max(var(--brand-x), calc(env(safe-area-inset-left) + 18px));
  }

  .brand-mark {
    width: clamp(57.2px, 8.624vw, 75.9px);
  }

  .experience[data-state="close"] .brand-lockup {
    opacity: 0;
  }

  .wake-control {
    right: max(4%, calc(env(safe-area-inset-right) + 14px));
    bottom: max(5%, calc(env(safe-area-inset-bottom) + 14px));
    min-height: 48px;
  }

}

@media (max-width: 720px) and (orientation: portrait) {
  .brand-lockup {
    top: max(var(--brand-y), calc(env(safe-area-inset-top) + 22px));
    left: max(var(--brand-x), calc(env(safe-area-inset-left) + 20px));
    gap: 10px;
  }

  .brand-mark {
    width: 64.7px;
  }

  .brand-copy h1 {
    font-size: 1.154rem;
    font-weight: 720;
  }

  .brand-copy p {
    font-size: 0.875rem;
    font-weight: 600;
  }

  .wake-control {
    right: auto;
    bottom: max(7%, calc(env(safe-area-inset-bottom) + 24px));
    left: 50%;
    min-width: min(72vw, 264px);
    min-height: 50px;
    transform: translateX(-50%);
  }

  .wake-control:hover {
    transform: translateX(-50%);
  }

  .experience[data-state="close"] .brand-lockup {
    opacity: 0;
  }

  .experience[data-state="close"] .wake-control {
    transform: translate(-50%, 10px);
  }

  .experience[data-state="returning"] .wake-control {
    transform: translate(-50%, 10px);
  }

  .screen-awake {
    gap: 0 4%;
    padding: 5.5%;
  }

}

@media (prefers-contrast: more) {
  .brand-copy p {
    color: #292824;
  }

  .wake-control {
    border-width: 2px;
    border-color: #11110f;
    background: #fffdf7;
  }

  .appointment-button {
    border: 2px solid #fff;
  }

  .experience[data-scene="warm-dark"] .brand-copy p {
    color: #fff;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }

  .wall-scene,
  .thermostat,
  .console-shadow,
  .brand-lockup,
  .ambient-light {
    --parallax-x: 0px;
    --parallax-y: 0px;
  }

  .ambient-light {
    transform: none !important;
  }
}
