/* The hotel floors menu: the menu of a small hotel as its own building, in isometric, alone on a white page. The
   script draws the floors in the svg and moves them on springs; the links are real links beside it, joined to their
   floor by a hairline. On a real site the button sits in the header and the card drops below it. */
:root {
  --page: #ffffff;          /* the page */
  --card: #fbf9f5;          /* the card the building stands on */
  --edge: #e9e3d9;          /* the hairline round the card */
  --ink: #26231f;           /* the names of the floors, and the drawings on them */
  --note: #8c8478;          /* the line under each name */
  --slab-top: #f2ede4;      /* the floor of each slab */
  --slab-left: #ddd5c8;     /* the side of the slab in the light */
  --slab-right: #c7bcab;    /* the side of the slab in the shade */
  --lit: #fffaf0;           /* the floor that is open, with its lights on */
  --accent: #1d5a70;        /* the button, the open floor and its line */
  --button-text: #f5f1ea;   /* the words on the button */
}

* {
  box-sizing: border-box;
}

/* a tap is a click at once: no wait for a double tap */
html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Instrument Sans Variable', 'Instrument Sans', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

a,
button {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

a:focus,
button:focus {
  outline: none;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stage {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 24px 16px;
}

/* ---------------------------------------------------------------- the frame */
.hotel {
  position: relative;
  width: min(380px, 100%);
  height: 500px;
}

/* ---------------------------------------------------------------- the button */
/* the script moves it: in the middle of the frame while the menu is closed, at the top while it is open */
.call {
  position: absolute;
  left: 50%;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 11px;
  height: 50px;
  margin: 0;
  padding: 0 24px 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--button-text);
  font: inherit;
  font-size: 16px;
  font-variation-settings: 'wdth' 100;
  font-weight: 560;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.16) inset, 0 10px 18px -12px rgba(29, 90, 112, 0.9);
}

.call__icon {
  width: 22px;
  height: 22px;
  flex: none;
  overflow: visible;
}

/* the three little floors of the icon: they part under the pointer, like the building does */
.call__icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linejoin: round;
  transition: transform 0.5s cubic-bezier(0.34, 1.9, 0.5, 1);
}

@media (hover: hover) and (pointer: fine) {
  .call:hover [data-icon-floor]:nth-child(2) {
    transform: translateY(-1.5px);
  }

  .call:hover [data-icon-floor]:nth-child(3) {
    transform: translateY(-3.5px);
  }
}

.call.is-open [data-icon-floor]:nth-child(2) {
  transform: translateY(-1.5px);
}

.call.is-open [data-icon-floor]:nth-child(3) {
  transform: translateY(-3.5px);
}

.call:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* Menu and Close share one place; the word that is not shown waits below it, out of the mask */
.call__words {
  display: grid;
  overflow: clip;
  height: 1.35em;
  line-height: 1.35em;
}

.call__word {
  grid-area: 1 / 1;
}

/* ---------------------------------------------------------------- the card */
.card {
  position: absolute;
  left: 0;
  right: 0;
  top: 66px;
  z-index: 2;
  padding: 10px;
  border: 1px solid var(--edge);
  border-radius: 22px;
  background: var(--card);
  box-shadow: 0 30px 50px -36px rgba(38, 35, 31, 0.45), 0 2px 6px -3px rgba(38, 35, 31, 0.12);
  visibility: hidden;
  transform-origin: 50% 0;
}

.card.is-open {
  visibility: visible;
}

.building {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

/* the drawings: hairlines that stay a hairline whatever the matrix of the floor */
.building .plan * {
  fill: none;
  stroke: var(--ink);
  stroke-width: 0.85;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  transition: stroke 0.35s ease;
}

.building .plan .water {
  stroke: var(--accent);
}

.building .face {
  stroke: rgba(38, 35, 31, 0.28);
  stroke-width: 0.7;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  transition: fill 0.4s ease;
}

.building .face--top {
  fill: var(--slab-top);
}

.building .face--left {
  fill: var(--slab-left);
}

.building .face--right {
  fill: var(--slab-right);
}

.building .slab.is-open .face--top {
  fill: var(--lit);
}

.building .slab.is-open .plan * {
  stroke: var(--accent);
}

.building .slab {
  cursor: pointer;
}

.building .leader {
  fill: none;
  stroke: rgba(38, 35, 31, 0.35);
  stroke-width: 0.8;
  vector-effect: non-scaling-stroke;
  transition: stroke 0.35s ease;
}

.building .leader.is-open {
  stroke: var(--accent);
}

/* ---------------------------------------------------------------- the links */
/* the box of the drawing: the script places each link in it, beside its floor */
.floors {
  position: absolute;
  inset: 10px;
  container-type: inline-size;
  pointer-events: none;
}

.floors__list {
  display: contents;
}

.floor {
  position: absolute;
  left: 70%;
  top: 0;
  display: grid;
  gap: 0.1em;
  padding: 0.35em 0.5em;
  margin-left: -0.5em;
  border-radius: 8px;
  transform: translateY(-50%);
  pointer-events: auto;
  cursor: pointer;
  white-space: nowrap;
}

.floor__name {
  font-size: max(12.5px, calc(15 / 340 * 100cqw));
  line-height: 1.15;
  font-weight: 520;
  font-variation-settings: 'wdth' 100;
  transition: color 0.3s ease, font-variation-settings 0.45s cubic-bezier(0.34, 1.6, 0.5, 1);
}

.floor__note {
  font-size: max(10.5px, calc(11.5 / 340 * 100cqw));
  line-height: 1.2;
  color: var(--note);
}

.floor.is-open .floor__name {
  color: var(--accent);
  font-variation-settings: 'wdth' 92;
  font-weight: 640;
}

.floor__note {
  position: relative;
}

/* the floor you are on says so in place of its line */
.floor__note::after {
  content: 'You are here';
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  visibility: hidden;
}

.floor[aria-current='page'] .floor__note {
  color: transparent;
}

.floor[aria-current='page'] .floor__note::after {
  visibility: visible;
}

.floor:focus-visible {
  outline: 1.5px solid var(--accent);
  outline-offset: 0;
}

@media (max-width: 420px) {
  .hotel {
    height: 470px;
  }
}
