/* Scoped gameplay preview; paper, window and motion states do not affect other sections. */

.gameplay-demo .briefing-heading h2 {
  font: 600 clamp(34px, 3.5vw, 46px)/1.1 var(--font-heading);
  margin: 0 0 var(--space-4);
}

.gameplay-demo .faction {
  width: 100%;
  max-width: 340px;
  justify-self: center;
}

.gameplay-demo .demo-layout {
  display: grid;
  max-width: 1040px;
  margin-inline: auto;
  grid-template-columns: 1.2fr 1fr;
  gap: 48px;
  align-items: center;
}

.gameplay-demo .dispatch {
  position: relative;
  padding: 10px 0 0;
}

.gameplay-demo .dispatch::before {
  content: '';
  position: absolute;
  inset: 10px 9px 65px;
  background: #e7dfca;
  transform: rotate(-2deg);
  border-radius: 12px;
  border: 1px solid #b2a989;
}

.gameplay-demo .paper {
  position: relative;
  background: #f4f3dc;
  color: #26251e;
  border: 1px solid #c6c3a3;
  border-radius: 12px;
  padding: 24px 28px 40px;
  min-height: var(--sheet-height, 400px);
  box-shadow: 0 12px 30px #0003;
}

.gameplay-demo .paper h2 {
  font: 700 34px/1.1 var(--font-heading);
  margin: 0 0 20px;
}

.gameplay-demo .paper h2:focus {
  outline: none;
}

.gameplay-demo .briefing-body {
  font: 500 24px/1.4 var(--font-heading);
}

.gameplay-demo .briefing-body p {
  margin: 0 0 20px;
}

.gameplay-demo .instructions {
  padding-left: 24px;
  font: 400 14px/1.7 var(--font-body);
}

.gameplay-demo .instructions li {
  padding: 0 0 16px 6px;
}

.gameplay-demo .instructions strong {
  display: block;
  font: 700 26px/1.2 var(--font-heading);
  margin-bottom: 5px;
}

.gameplay-demo .instructions li::marker {
  color: var(--red);
  font-weight: 700;
}

.gameplay-demo .options {
  border-top: 1px solid #c5c4aa;
  padding-top: 10px;
  display: grid;
  gap: 10px;
}

.gameplay-demo .options button,
.gameplay-demo .options a {
  display: block;
  width: 100%;
  background: #ecebd3;
  color: #302e25;
  border: 2px solid #d2ceb0;
  border-radius: 7px;
  font: 400 13px/1.55 var(--font-body);
  text-align: left;
  padding: 14px 16px;
  cursor: pointer;
  text-decoration: none;
}

.gameplay-demo .options button:hover:not(:disabled),
.gameplay-demo .options a:hover {
  background: #e2dec1;
  border-color: #a48b5d;
}

.gameplay-demo .options button:disabled {
  cursor: wait;
  opacity: .7;
}

.gameplay-demo .options :focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 3px;
}

.gameplay-demo .despatch-box {
  position: relative;
  z-index: 1;
  margin: -26px 16px 0;
  background: #941f1e;
  border: 2px solid #b88c4b;
  border-radius: 12px;
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 14px 25px #0005;
}

.gameplay-demo .despatch-box>span {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .15em;
}

.gameplay-demo .box-mark {
  margin-left: auto;
  color: #e6cfc0;
  font-size: 25px!important;
}

.gameplay-demo .box-handle {
  position: absolute;
  top: -8px;
  left: 38%;
  right: 38%;
  height: 9px;
  border: 2px solid #b88c4b;
  background: #631816;
  border-radius: 4px 4px 0 0;
  z-index: -1;
}

.gameplay-demo .faction-window {
  position: relative;
  width: 100%;
  aspect-ratio: 1/1.12;
  --curtain:25%;
  --light:.725;
}

.gameplay-demo .faction-window::before {
  content: '';
  position: absolute;
  left: -2%;
  right: -2%;
  top: -8px;
  height: 10px;
  z-index: 7;
  background: #cab6a3;
  border-top: 1px solid #d8c7b4;
  border-bottom: 2px solid #99846d;
  border-radius: 2px;
  pointer-events: none;
}

.gameplay-demo .interior {
  position: absolute;
  inset: 4% 4% 4%;
  background: #171611;
  overflow: hidden;
}

.gameplay-demo .room-light {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 25%, #b7a94e, #827638 50%, #4a3d23);
  opacity: var(--light);
  transition: opacity 900ms;
}

.gameplay-demo .light-cone {
  position: absolute;
  inset: 31% 0 0;
  background: #e2d67450;
  clip-path: polygon(50% 0,100% 100%,0 100%);
  opacity: var(--light);
  transition: opacity 900ms;
}

.gameplay-demo .lamp {
  position: absolute;
  height: 35%;
  width: auto;
  left: 50%;
  top: -4%;
  transform: translateX(-50%);
  z-index: 3;
}

.gameplay-demo .frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 6;
  pointer-events: none;
}

.gameplay-demo .window-caption {
  position: absolute;
  left: -2%;
  right: -2%;
  bottom: 0;
  z-index: 7;
  padding: 10px;
  text-align: center;
  background: var(--stone);
  color: #262019;
  border-bottom: 3px solid var(--stone-shadow);
  font: 700 20px var(--font-heading);
  text-transform: uppercase;
}

.gameplay-demo .cast {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.gameplay-demo .figure {
  position: absolute;
  bottom: -12px;
  height: 57%;
  width: auto;
  max-width: none;
}

.gameplay-demo .centre {
  left: 50%;
  transform: translateX(-50%);
}

.gameplay-demo .left {
  left: 12%;
}

.gameplay-demo .right {
  right: 12%;
  animation-delay: -1s!important;
}

.gameplay-demo .bob {
  animation: bob 2.5s ease-in-out infinite;
}

.gameplay-demo .walker {
  position: absolute;
  bottom: -12px;
  height: 57%;
  width: 32%;
  left: 0;
  animation: pacing 14s ease-in-out infinite;
}

.gameplay-demo .walker .figure {
  height: 100%;
  left: 0;
  bottom: 0;
  animation: facing 14s steps(1, end) infinite;
}

.gameplay-demo [data-mood='panic'] .bob {
  animation-duration: 1.4s;
}

.gameplay-demo .curtain {
  position: absolute;
  top: 0;
  bottom: 0;
  width: var(--curtain);
  z-index: 4;
  background: repeating-linear-gradient(90deg,#2a1c0f,#4d351a 12px,#332210 24px);
  box-shadow: 0 0 15px #0004;
  transition: width 1100ms ease;
}

.gameplay-demo .curtain-left {
  left: 0;
}

.gameplay-demo .curtain-right {
  right: 0;
}

.gameplay-demo .critical .room-light {
  animation: flicker 3s ease-in-out infinite;
}

.gameplay-demo .reaction {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.gameplay-demo .motion-toggle {
  position: absolute;
  z-index: 8;
  bottom: 1px;
  right: 0;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #554735;
  cursor: pointer;
  border-radius: 50%;
}

.gameplay-demo .motion-toggle::before {
  content: '';
  position: absolute;
  inset: 7px;
  border: 1px solid #55473566;
  border-radius: 50%;
  background: #5547350f;
}

.gameplay-demo .motion-toggle:hover::before {
  background: #55473528;
}

.gameplay-demo .motion-toggle svg {
  position: relative;
  width: 14px;
  height: 14px;
}

.gameplay-demo .play-icon {
  fill: currentColor;
}

.gameplay-demo .pause-icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
}

.gameplay-demo .motion-toggle[data-paused='true'] .pause-icon,
.gameplay-demo .motion-toggle[data-paused='false'] .play-icon,
.gameplay-demo .motion-toggle[hidden] {
  display: none;
}

.gameplay-demo .motion-toggle:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.gameplay-demo .paper-arrives {
  animation: paper-arrives 500ms ease-out;
}

@keyframes paper-arrives {
  from {
    transform: translateY(20px) rotate(1deg);
    opacity: .5;
  }

  to {
    transform: none;
    opacity: 1;
  }

}

@keyframes bob {
  0%,100% {
    margin-bottom: 0;
  }

  50% {
    margin-bottom: 5px;
  }

}

@keyframes pacing {
  0%,100% {
    left: 4%;
  }

  50% {
    left: 68%;
  }

}

@keyframes facing {
  0%,100% {
    transform: scaleX(1);
  }

  50% {
    transform: scaleX(-1);
  }

}

@keyframes flicker {
  0%,100% {
    filter: brightness(1);
  }

  50% {
    filter: brightness(.6);
  }

}

.gameplay-demo.motion-paused .walker,
.gameplay-demo.motion-paused .walker .figure,
.gameplay-demo.motion-paused .bob,
.gameplay-demo.motion-paused .room-light {
  animation-play-state: paused;
}

@media (max-width: 800px) {
  .gameplay-demo .demo-layout {
    gap: 32px;
    grid-template-columns: 1.2fr 1fr;
  }

  .gameplay-demo .paper {
    padding: 24px 22px 44px;
  }

  .gameplay-demo .paper h2 {
    font-size: 32px;
  }

  .gameplay-demo .briefing-body {
    font-size: 22px;
  }

}

@media (max-width: 650px) {
  .gameplay-demo .demo-layout {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 24px;
  }

  .gameplay-demo .faction {
    order: -1;
    position: relative;
    width: clamp(150px, 42vw, 180px);
    margin-inline: auto;
    padding: 0 0 32px;
  }

  .gameplay-demo .faction-window {
    width: 100%;
  }

  .gameplay-demo .window-caption {
    bottom: -32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    padding: 0 36px 0 8px;
  }

  .gameplay-demo .motion-toggle {
    bottom: -38px;
  }

  .gameplay-demo .motion-toggle::before {
    inset: 11px;
  }

  .gameplay-demo .motion-toggle svg {
    width: 11px;
    height: 11px;
  }

  .gameplay-demo .paper {
    min-height: var(--sheet-height, 0px);
    padding: 24px 20px 44px;
  }

  .gameplay-demo .paper h2 {
    font-size: clamp(28px, 7vw, 32px);
    line-height: 1.15;
  }

  .gameplay-demo .instructions {
    padding-left: 20px;
  }

  .gameplay-demo .instructions strong {
    font-size: 24px;
  }

  .gameplay-demo .instructions li {
    padding-bottom: 14px;
  }

  .gameplay-demo .options button,
.gameplay-demo .options a {
    padding: 12px;
  }

  .gameplay-demo .despatch-box {
    margin-inline: 10px;
    padding: 18px;
  }

}

@media (prefers-reduced-motion: reduce) {
  .gameplay-demo *,
.gameplay-demo *::before,
.gameplay-demo *::after {
    animation: none!important;
    transition: none!important;
  }

}

/* Platform marks clipped from the existing store badge artwork. */
.gameplay-demo .options .platform-option {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gameplay-demo .platform-icon {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 5px;
  background-color: #000;
  background-repeat: no-repeat;
  background-size: auto 48px;
  background-position: -5px center;
}

.gameplay-demo .platform-apple { background-image: url('../../img/store_badges/appstore.png'); }
.gameplay-demo .platform-googleplay { background-image: url('../../img/store_badges/googleplay.png'); }
.gameplay-demo .platform-steam { background-image: url('../../img/store_badges/steam.png'); background-position: -8px center; }
