/* Under-construction dialog and its scene (views/partials/site/environments.liquid).
   Uses rcl-link.css tokens and utilities. */

.lk > .lk-env {
  --lk-env-bg: #F8F9F7;              /* illustration stage colour */
  --lk-fg: var(--lk-ink);
  --lk-fg-2: var(--lk-ink-2);
  --lk-fg-3: var(--lk-ink-3);
  --lk-bg: var(--lk-env-bg);
  --rcl-focus-ring: var(--lk-accent-text);
  color: var(--lk-ink);
  background: var(--lk-env-bg);
  padding-block: var(--lk-pad-y) clamp(32px, 1.25rem + 2.5vw, 64px);
}

.lk-env__head { max-width: 46rem; margin-bottom: clamp(8px, 1.5vw, 20px); }
.lk-env__head .lk-lede { margin-top: 20px; }
@media (min-width: 960px) {
  /* Title left, lede right, to keep the band compact. */
  .lk-env__head {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
    gap: 0 48px;
    align-items: end;
    max-width: none;
  }
  .lk-env__head .lk-index { grid-column: 1 / -1; }
  .lk-env__head .lk-lede { margin: 0; justify-self: end; }
}
.lk-env__fig { margin: 0; }
.lk-env__sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- stage --------------------------------------------------------------- */
.lk-env__stage {
  position: relative;
  max-width: 1440px;
  margin-inline: auto;
  aspect-ratio: 1550 / 864;
  overflow: hidden;
}
/* The canvas is the 1600 x 900 box every layer is registered to. Narrow
   screens enlarge and offset the whole canvas as one, never per layer. */
.lk-env__canvas { position: absolute; left: -1.613%; top: -2.546%; width: 103.226%; height: 104.167%; }
.lk-env__chapter { position: absolute; inset: 0; opacity: 0; visibility: hidden; }
.lk-env__chapter.is-active { opacity: 1; visibility: visible; }
.lk-env__layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  pointer-events: none;
  user-select: none;
  overflow: visible;
}

/* Static (no-JS) state: lift docked, door parked open. The porter and the
   kneeling technician's cable are drawn by the script, so are absent without JS. */
.lk-env [data-l="dc_active_rack_door"],
.lk-env [data-l="dc_active_rack_door_mid"] { opacity: 0; }

/* While playing, moving layers are promoted to their own compositing layer. */
.lk-env.is-playing [data-l="dc_lift_platform"],
.lk-env.is-playing [data-l="dc_network_appliance"],
.lk-env.is-playing [data-l="dc_lift_mast"],
.lk-env.is-playing [data-l="dc_worker_lift"] { will-change: transform; }

/* Appliance occlusion (viewBox %): --bay is the vacant slot in C6's front
   plane, where the seated copy shows; --out is everything in front of that
   plane, so the part already inside the cabinet is hidden. */
.lk-env__clip { position: absolute; inset: 0; }
.lk-env__clip--bay {
  clip-path: polygon(53.548% 61.982%, 56.202% 59.650%, 56.202% 58.349%, 53.548% 60.681%);
}
.lk-env__clip--out {
  clip-path: polygon(53.250% 60.942%, 118.250% 3.832%, 118.250% 111.111%, 53.250% 111.111%);
}

@media (max-width: 700px) {
  /* Crop to viewBox x 450-1170, y 290-750: lift, slot, door, both workers,
     the floor opening and the front of all three rows, at one shared scale. */
  .lk-env__stage { aspect-ratio: 720 / 460; }
  .lk-env__canvas { inset: auto; left: -62.5%; top: -63.043%; width: 222.222%; height: 195.652%; }
}

/* ---- caption + controls -------------------------------------------------- */
.lk-env__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  max-width: 1440px;
  margin: clamp(8px, 1.2vw, 16px) auto 0;
  padding-top: 12px;
  border-top: 1px solid var(--lk-line-l);
}
.lk-env__cap { flex: 1 1 22rem; color: var(--lk-ink-2); font-size: var(--rcl-step--1); line-height: 1.45; }
.lk-env__ctl { display: flex; align-items: center; gap: 8px 24px; }
.lk-env__chapters { display: flex; gap: 8px 24px; }

.lk-env__tab,
.lk-env__play {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: var(--rcl-tap-min, 44px);
  padding: 0;
  border: 0;
  background: none;
  color: var(--lk-ink-3);
  font: 500 .78rem/1 var(--rcl-font-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  cursor: pointer;
}
.lk-env__tab { position: relative; padding-bottom: 6px; }
.lk-env__tab[aria-current="true"] { color: var(--lk-ink); }
.lk-env__n { color: var(--lk-accent-text); }
.lk-env__tab:hover,
.lk-env__play:hover { color: var(--lk-ink); }
.lk-env__tab:focus-visible,
.lk-env__play:focus-visible { outline: 2px solid var(--rcl-focus-ring); outline-offset: 4px; }

/* Progress hairline under the current chapter */
.lk-env__prog { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--lk-line-l); }
.lk-env__prog > i { display: block; height: 100%; background: var(--lk-accent-text); transform: scaleX(0); transform-origin: 0 50%; }
.lk-env__tab:not([aria-current="true"]) .lk-env__prog { visibility: hidden; }

.lk-env__play svg { width: 14px; height: 14px; fill: currentColor; }
.lk-env__play .lk-env__ico-play { display: none; }
.lk-env__play.is-paused .lk-env__ico-play { display: inline; }
.lk-env__play.is-paused .lk-env__ico-pause { display: none; }

@media (max-width: 700px) {
  .lk-env__cap { flex-basis: 100%; }
}

/* ---- dialog: fills the viewport; a click outside the panel closes it ---- */
html.rcl-modal-open { overflow: hidden; }

.lk > .lk-env--modal {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: clamp(20px, 4vw, 56px);
  border: 0;
  background: transparent;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.lk > .lk-env--modal[open] { display: grid; place-items: center; }
/* see-through backdrop: the new site stays visible behind the panel, so the
   dialog reads as a notice over the site rather than the whole site */
.lk-env--modal::backdrop {
  background: rgba(6, 12, 18, .55);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.lk-env__panel {
  position: relative;
  width: min(860px, 100%);
  padding: clamp(18px, 2.4vw, 32px);
  border-radius: 10px;
  background: var(--lk-env-bg);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .06);
}
.lk-env--modal .lk-env__head { padding-right: 48px; margin-bottom: clamp(8px, 1.4vh, 16px); }
.lk-env--modal .lk-h2 { font-size: clamp(1.45rem, 1rem + 1.2vw, 2.1rem); }
.lk-env--modal .lk-env__head .lk-lede { font-size: .95rem; margin-top: 10px; }
@media (min-width: 960px) {
  .lk-env--modal .lk-env__head .lk-lede { margin: 0; }
}

.lk-env__close {
  position: absolute;
  top: clamp(8px, 1.4vw, 16px);
  right: clamp(8px, 1.4vw, 16px);
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--lk-line-l);
  border-radius: 50%;
  background: #fff;
  color: var(--lk-ink);
  cursor: pointer;
  transition: border-color .2s, color .2s;
}
.lk-env__close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.lk-env__close:hover { border-color: var(--rcl-cyan); color: var(--lk-accent-text); }
.lk-env__close:focus-visible { outline: 2px solid var(--rcl-focus-ring); outline-offset: 3px; }

/* the stage never pushes the dialog taller than the screen */
/* the stage stays well inside the screen so the site shows above and below */
.lk-env--modal .lk-env__stage { width: min(100%, calc(50dvh * 1550 / 864)); min-width: min(100%, 280px); }
@media (max-width: 700px) {
  .lk-env--modal .lk-env__stage { width: min(100%, calc(30dvh * 720 / 460)); }
}
.lk-env--modal .lk-env__bar { justify-content: space-between; }
.lk-env--modal .lk-env__bar > .rcl-btn { cursor: pointer; }
