/* scope: do not touch html/body to avoid overriding the main page layout
   This stylesheet provides only styles for the .red-switch component */

/* Wrapper to position the switch centered under the page's centered H1 */
.red-switch-wrapper {
  position: absolute;
  left: 50%;
  /* place slightly below the vertically centered H1; adjust the 80px as needed */
  top: calc(50% + 80px);
  transform: translateX(-50%);
  z-index: 9999;
  /* fix the wrapper size to match the control and prevent the transformed child from inflating the bounding box */
  /* wrapper size matches the control unscaled; scaling will reduce rendered size */
  width: 190px; /* 150px + 20px padding left + 20px padding right */
  height: 235px; /* 195px + 20px padding top + 20px padding bottom */
  box-sizing: border-box;
  overflow: hidden;
  /* start hidden; script will add the `show` class after 5s */
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease, visibility 0ms linear 220ms;
}

/* when script adds .show, reveal the control */
.red-switch-wrapper.show {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition-delay: 0ms;
}

/* Fizzy fade-in animation */
.red-switch-inner {
  display: inline-block;
  transform-origin: center top;
  opacity: 0;
  transform: translateY(-6px) scale(0.96);
}
.red-switch-wrapper.show .red-switch-inner {
  animation: fizzy-fade-in 420ms cubic-bezier(.2,.9,.3,1) forwards;
}

@keyframes fizzy-fade-in {
  0% { opacity: 0; transform: translateY(-12px) scale(0.92); }
  50% { opacity: 1; transform: translateY(2px) scale(1.02); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* DEBUG helpers: outlines and pointer events to diagnose visibility issues.
   Remove or comment these after confirming the element is visible. */
.red-switch-wrapper.debug {
  outline: 2px dashed lime;
  pointer-events: auto;
}
.red-switch.debug {
  outline: 2px dashed magenta;
}
.red-switch .red-button.debug {
  border: 2px solid cyan;
  pointer-events: auto;
}

.red-switch {
  background-color: black;
  width: 150px;
  height: 195px;
  box-shadow: 0 0 10px 2px rgba(0, 0, 0, 0.2), 0 0 1px 2px black, inset 0 2px 2px -2px white, inset 0 0 2px 15px #47434c, inset 0 0 2px 22px black;
  border-radius: 5px;
  padding: 20px;
  perspective: 700px;
  box-sizing: border-box;
  display: block;
  margin: 0 auto;
  /* ensure label itself creates a stacking context above the canvas */
  position: relative;
  z-index: 10000;
}

/* Small variant: scale to 70% */
.red-switch--small {
  transform: scale(0.6);
  transform-origin: 50% 0%; /* scale relative to top center */
}
.red-switch input {
  display: none;
}
.red-switch input:checked + .red-button {
  transform: translateZ(20px) rotateX(25deg);
  box-shadow: 0 -10px 20px #ff1818;
}
.red-switch input:checked + .red-button .red-light {
  animation: flicker 0.2s infinite 0.3s;
}
.red-switch input:checked + .red-button .red-shine {
  opacity: 1;
}
.red-switch input:checked + .red-button .red-shadow {
  opacity: 0;
}
.red-switch .red-button {
  transition: all 0.3s cubic-bezier(1, 0, 1, 1);
  transform-origin: center center -20px;
  /* avoid large 3d transform by default (it expands the element's bounding box);
     only apply the 3D tilt when the input is checked */
  transform: none;
  transform-style: preserve-3d;
  background-color: #9b0621;
  width: 100%;
  height: 100%;
  position: relative;
  cursor: pointer;
  background: linear-gradient(#980000 0%, #6f0000 30%, #6f0000 70%, #980000 100%);
  background-repeat: no-repeat;
}
.red-switch .red-button::before {
  content: "";
  background: linear-gradient(rgba(255, 255, 255, 0.8) 10%, rgba(255, 255, 255, 0.3) 30%, #650000 75%, #320000) 50% 50%/97% 97%, #b10000;
  background-repeat: no-repeat;
  width: 100%;
  height: 50px;
  transform-origin: top;
  transform: rotateX(-90deg);
  position: absolute;
  top: 0;
}
.red-switch .red-button::after {
  content: "";
  background-image: linear-gradient(#650000, #320000);
  width: 100%;
  height: 50px;
  transform-origin: top;
  transform: translateY(50px) rotateX(-90deg);
  position: absolute;
  bottom: 0;
  box-shadow: 0 50px 8px 0px black, 0 80px 20px 0px rgba(0, 0, 0, 0.5);
}
.red-switch .red-light {
  opacity: 0;
  animation: red-light-off 1s;
  position: absolute;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(#ffc97e, #ff1818 40%, transparent 70%);
}
.red-switch .red-dots {
  position: absolute;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(transparent 30%, rgba(101, 0, 0, 0.7) 70%);
  background-size: 10px 10px;
}
.red-switch .red-characters {
  position: absolute;
  width: 100%;
  height: 100%;
  background: linear-gradient(white, white) 50% 20%/5% 20%, radial-gradient(circle, transparent 50%, white 52%, white 70%, transparent 72%) 50% 80%/33% 25%;
  background-repeat: no-repeat;
}
.red-switch .red-shine {
  transition: all 0.3s cubic-bezier(1, 0, 1, 1);
  opacity: 0.3;
  position: absolute;
  width: 100%;
  height: 100%;
  background: linear-gradient(white, transparent 3%) 50% 50%/97% 97%, linear-gradient(rgba(255, 255, 255, 0.5), transparent 50%, transparent 80%, rgba(255, 255, 255, 0.5)) 50% 50%/97% 97%;
  background-repeat: no-repeat;
}
.red-switch .red-shadow {
  transition: all 0.3s cubic-bezier(1, 0, 1, 1);
  opacity: 1;
  position: absolute;
  width: 100%;
  height: 100%;
  background: linear-gradient(transparent 70%, rgba(0, 0, 0, 0.8));
  background-repeat: no-repeat;
}

@keyframes flicker {
  0% {
    opacity: 1;
  }
  80% {
    opacity: 0.8;
  }
  100% {
    opacity: 1;
  }
}
@keyframes red-light-off {
  0% {
    opacity: 1;
  }
  80% {
    opacity: 0;
  }
}