/* The rooms grid to room transition: the app of a made-up smart home brand (Wenlo Home) on a near black page.
   Four room tiles with a line floor plan; the chosen one grows into the room page and its lights switch on. */
:root {
  --page: #0a0a0b;            /* the page */
  --page-light: #17150f;      /* the warm haze behind the app */
  --app: #121214;             /* the body of the app */
  --tile: #19191c;            /* a room tile */
  --tile-hi: #1f1f23;         /* the top of a tile, where the light lands */
  --well: #0e0e10;            /* the well behind the slider and the scenes */
  --ink: #f3f0ea;             /* the words */
  --muted: #8d8a84;           /* the small words */
  --line: rgba(243, 240, 234, 0.07); /* the hairlines */
  --plan: rgba(243, 240, 234, 0.42); /* the furniture lines of the plans */
  --wall: rgba(243, 240, 234, 0.78); /* the walls of the plans */
  --accent: #ffb25e;          /* warm light: the lamps, the slider, the active scene */
  --accent-ink: #2a1703;      /* the words on the accent */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  background:
    radial-gradient(60% 55% at 50% 40%, var(--page-light), transparent 72%),
    var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', 'Mona Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.stage {
  position: relative;
  height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
}

/* ---------------------------------------------------------------- the app */
.app {
  position: relative;
  width: min(92vw, 400px, 66vh);
  aspect-ratio: 0.69;
  border-radius: clamp(20px, 7.5vmin, 30px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 30%),
    var(--app);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 2px 4px rgba(0, 0, 0, 0.4),
    0 18px 40px -12px rgba(0, 0, 0, 0.7),
    0 50px 90px -30px rgba(0, 0, 0, 0.8);
  container-type: size;
  overflow: hidden;
  isolation: isolate;
}

.app__rim {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(40% 30% at var(--rx, 50%) var(--ry, 0%), rgba(255, 210, 160, 0.38), transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: 30;
}

.home {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 6.5cqw 5.5cqw 5.5cqw;
  gap: 4.5cqw;
}

.home__head {
  display: grid;
  gap: 1.2cqw;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 2cqw;
  color: var(--muted);
  font-size: 3.2cqw;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.brand__mark {
  width: 4.6cqw;
  height: 4.6cqw;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.home__title {
  margin: 1.5cqw 0 0;
  font-size: 7.6cqw;
  font-weight: 600;
  font-stretch: 92%;
  letter-spacing: -0.025em;
  line-height: 1.02;
}

.home__sum {
  margin: 0;
  color: var(--muted);
  font-size: 3.3cqw;
}

.home__sum .roll {
  color: var(--accent);
}

/* ---------------------------------------------------------------- the rooms grid */
.grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 3cqw;
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 3cqw 3.4cqw 3.4cqw;
  border-radius: 5cqw;
  background: linear-gradient(180deg, var(--tile-hi), var(--tile));
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.055) inset,
    0 1px 0 rgba(255, 255, 255, 0.07) inset,
    0 10px 22px -14px rgba(0, 0, 0, 0.9);
  text-align: left;
  overflow: hidden;
}

.tile:nth-child(1) { grid-area: 1 / 1; }
.tile:nth-child(2) { grid-area: 1 / 2; }
.tile:nth-child(3) { grid-area: 2 / 1; }
.tile:nth-child(4) { grid-area: 2 / 2; }

.tile__glint {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(70% 55% at var(--gx, 50%) var(--gy, 0%), rgba(255, 190, 120, 0.1), transparent 70%);
  opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.tile__plan {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: block;
}

.tile__go {
  position: absolute;
  top: 2.6cqw;
  right: 2.6cqw;
  width: 5.6cqw;
  height: 5.6cqw;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.07);
  opacity: 0;
  transform: translate(-3px, 3px) scale(0.8);
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tile__go svg {
  width: 52%;
  height: 52%;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tile__name {
  margin-top: 1.6cqw;
  font-size: 3.7cqw;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 0.6cqw;
  color: var(--muted);
  font-size: 2.9cqw;
  white-space: nowrap;
}

.tile__lights .roll {
  color: var(--ink);
}

.tile.is-lit .tile__lights .roll {
  color: var(--accent);
}

.tile__temp,
.room__temp,
.dim__value {
  font-family: 'Geist Mono Variable', 'Geist Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

.tile.is-hover .tile__glint {
  opacity: 1;
}

.tile.is-hover .tile__go {
  opacity: 1;
  transform: none;
}

.tile.is-hover .plan__line {
  stroke: rgba(243, 240, 234, 0.6);
}

@media (hover: hover) {
  .tile:hover .tile__glint {
    opacity: 1;
  }
  .tile:hover .tile__go {
    opacity: 1;
    transform: none;
  }
  .tile:hover .plan__line {
    stroke: rgba(243, 240, 234, 0.6);
  }
  .back:hover {
    background: rgba(255, 255, 255, 0.11);
  }
  .scene:hover {
    color: var(--ink);
  }
}

/* ---------------------------------------------------------------- the plans */
.plan__wall {
  fill: none;
  stroke: var(--wall);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.plan__line {
  fill: none;
  stroke: var(--plan);
  stroke-width: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.4s ease;
}

.plan__soft {
  fill: none;
  stroke: rgba(243, 240, 234, 0.16);
  stroke-width: 0.8;
  stroke-dasharray: 2 2.4;
}

.plan__floor {
  fill: rgba(255, 255, 255, 0.018);
}

.plan__glass {
  fill: none;
  stroke: rgba(160, 190, 210, 0.5);
  stroke-width: 0.8;
}

.plan__lamp {
  fill: var(--app);
  stroke: rgba(243, 240, 234, 0.5);
  stroke-width: 1;
}

.plan__lamp.is-on {
  fill: var(--accent);
  stroke: #fff1dc;
}

.plan__hit {
  fill: transparent;
  cursor: pointer;
}

.plan__glow {
  mix-blend-mode: screen;
}

/* ---------------------------------------------------------------- the room page */
.room {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 5cqw 5.5cqw 5.5cqw;
  gap: 2.6cqh;
  border-radius: clamp(20px, 7.5vmin, 30px);
  background:
    radial-gradient(80% 50% at 50% 42%, rgba(255, 170, 90, var(--warm, 0)), transparent 70%),
    linear-gradient(180deg, var(--tile-hi), var(--tile) 45%, var(--app));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  z-index: 10;
  overflow: hidden;
}

.room[hidden] {
  display: none;
}

.room__bar {
  display: flex;
  align-items: center;
  gap: 3cqw;
}

.back {
  flex: none;
  width: 9.5cqw;
  height: 9.5cqw;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  transition: background 0.3s ease;
}

.back svg {
  width: 48%;
  height: 48%;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.room__title {
  flex: 1;
  margin: 0;
  font-size: 6.8cqw;
  font-weight: 600;
  font-stretch: 92%;
  letter-spacing: -0.025em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room__temp {
  color: var(--muted);
  font-size: 3.6cqw;
}

.room__meta {
  margin: -1cqh 0 0 12.5cqw;
  color: var(--muted);
  font-size: 3.3cqw;
}

.room__meta .roll {
  color: var(--accent);
}

.room__plan {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
}

.room__plan svg {
  width: 100%;
  height: 100%;
  display: block;
}

.roll {
  display: inline-block;
  position: relative;
  overflow: hidden;
  vertical-align: bottom;
  font-variant-numeric: tabular-nums;
}

.roll__in {
  display: inline-block;
}

/* the brightness */
.dim {
  display: grid;
  gap: 2cqw;
  padding: 3.2cqw 3.8cqw 3.6cqw;
  border-radius: 4.5cqw;
  background: var(--well);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.045) inset;
}

.dim__top {
  display: flex;
  justify-content: space-between;
  font-size: 3.2cqw;
  color: var(--muted);
}

.dim__value {
  color: var(--ink);
}

.dim__track {
  position: relative;
  height: 2.2cqw;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.07);
  cursor: pointer;
  touch-action: none;
  outline: none;
}

.dim__track::before {
  content: '';
  position: absolute;
  inset: -3cqw 0;
}

.dim__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #a5642a, var(--accent));
}

.dim__thumb {
  position: absolute;
  top: 50%;
  left: 0;
  width: 5cqw;
  height: 5cqw;
  margin: -2.5cqw 0 0 -2.5cqw;
  border-radius: 50%;
  background: #fff7ec;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 4px 10px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.6) inset;
}

/* the scenes */
.scenes {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 1.2cqw;
  border-radius: 4.5cqw;
  background: var(--well);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.045) inset;
}

.scenes__pill {
  position: absolute;
  top: 1.2cqw;
  bottom: 1.2cqw;
  left: 1.2cqw;
  width: calc(50% - 1.2cqw);
  border-radius: 3.4cqw;
  background: linear-gradient(180deg, #ffc17a, var(--accent));
  box-shadow: 0 6px 18px -6px rgba(255, 160, 70, 0.55), 0 1px 0 rgba(255, 255, 255, 0.5) inset;
  opacity: 0;
}

.scene {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.8cqw;
  height: 10cqw;
  color: var(--muted);
  font-size: 3.5cqw;
  font-weight: 550;
  transition: color 0.35s ease;
}

.scene svg {
  width: 4.2cqw;
  height: 4.2cqw;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.scene.is-on {
  color: var(--accent-ink);
}

/* ---------------------------------------------------------------- the pointer of the walk on its own */
.cursor {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  fill: var(--ink);
  stroke: #000;
  stroke-width: 1.2;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
  opacity: 0;
  pointer-events: none;
  z-index: 50;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
