/* door-v1.css */
.door-overlay {
    position: fixed;
    isolation: isolate;
    background: transparent;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    opacity: 1;
    transition: opacity 380ms ease;
    overscroll-behavior: none;
    touch-action: none;
}
.door-overlay.fade-out{
  opacity: 0;
  pointer-events: none;
}
.door-overlay.opening{
  pointer-events: none;
}
/*  */
    /* body.door-active header, */
    body.door-active main,
    /* body.door-entering header, */
    body.door-entering main{
        transform-origin: top center;
        transition: transform 2.5s ease;
    }
    /* body.door-active header, */
    body.door-active:not(.door-entering) main{
      transform: scale(0.8);
      pointer-events: none;
    }
    /* body.door-entering header, */
    body.door-entering main{
        transform: scale(1);
        pointer-events: auto;
    }
/*  */

/* OUTSIDE VIEW */
.scene {
  position: relative;
  width: min(74vw, 320px);
  height: calc(min(74vw, 320px) * 1.55);
  transition: transform 2.5s ease;
  transform-origin: center center;
  will-change: transform;
  perspective: 1100px;
  perspective-origin: 50% 60%;
}
/* This makes a "hole" the size of the door, and covers everything else */
.door-portal {
  position: absolute;
  inset: 0;
  background: transparent;
  box-shadow: 0 0 0 200vmax var(--bg3);
  z-index: 0;
  pointer-events: none;
}
/* Keep door + hint above the curtain */
.door-3d {
  position: relative;
  z-index: 1;
}
.scene.zoom {
  transform: scale(var(--zoomScale, 4));
  transition-delay: 140ms;
}
.door-3d {
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  transform-style: preserve-3d;
  perspective: 1000px;
  display: block;
}
/* Real door frame (now DIV so sizing works) */
.door-frame {
  position: relative;
  width: 100%;
  height: 100%;
  outline: 0.6rem ridge #5b3a1b;
  outline-offset: -0.2rem;
  transform-style: preserve-3d;
}
/* --- GLASS DOOR LEAF (replace your .door-leaf block with this) --- */
.door-leaf {
  position: absolute;
  inset: 0;
  backdrop-filter: blur(0.1rem);
  -webkit-backdrop-filter: blur(0.1rem);
  z-index: 2;
  display: flex;
  padding: 1rem;
  flex-direction: column;
  align-items: center;
  transform-origin: right center;
  transform-style: preserve-3d;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  will-change: transform;
  transition: transform 2.5s cubic-bezier(.2,.85,.2,1);
}

/* glossy streak */
.door-leaf::before{
  content:"";
  position:absolute;
  inset:0;
  border-radius: inherit;
  background: linear-gradient(
    110deg,
    rgba(255,255,255,0.38),
    rgba(255,255,255,0.00) 38%,
    rgba(255,255,255,0.12) 70%,
    rgba(255,255,255,0.00)
  );
  opacity: 0.55;
  pointer-events:none;
  transform: translateZ(0.5px);
}
/* Door knob */
.door-leaf::after{
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  left: 0.75rem;
  right: auto;
  top: 50%;
  transform: translateY(-50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffe7a6, #c4912e 62%, #7a5616);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.25), inset 0 0 2px rgba(255,255,255,0.35);
}
/* OPEN state */
.door-3d.open .door-leaf{
  transform: rotateY(-115deg) translateZ(0);
}
.door-3d:hover {
  opacity: 1;
}
/*  */
.door-img {
  position: absolute;
  top: -5rem; 
  margin: 0;
  height: 4rem;
  pointer-events: none;
  width: auto;
  z-index: 999999;
}
@media (prefers-color-scheme: dark)  { 
    .door-img {
      filter: invert(1);
    }
}
.door-hint {
  display: flex;
  flex-direction: column;
  pointer-events: none;
  padding: 0.5rem;
  width: 100%;
  color: var(--txt2);
  border-radius: 0.5rem;
  border: 0.1rem outset #5b3a1b;
  background: linear-gradient(145deg, #180c01, #120000);
}
.door-hint p {
  font-size: 0.7rem;
}
.door-hint p:first-child {
  font-weight: bold;
  color: var(--cool);
}
.door-hint p:last-child {
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
}
.door-hint p:last-child span:first-child {
  margin: 0.2rem 0;
  color: #d163ec;
}
/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  .scene{ transition: none; }
  .door-leaf{ transition: none; }
  body.door-active > :not(#front_door){ transition: none; }
  .door-overlay{ transition: none; }
}