/* ==========================================================================
   PHASE 2 — The Living Facade: 24 windows on the inn wall
   (loaded after styles.css)
   ========================================================================== */
.stage-exterior .exterior-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1;
}
.stage-exterior .exterior-backdrop img {
  filter: brightness(0.9) saturate(1.05);
  object-position: center 35%;
}
.stage-exterior .exterior-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8, 12, 16, 0.55) 0%, rgba(8, 12, 16, 0) 22%, rgba(8, 12, 16, 0) 55%, rgba(8, 12, 16, 0.65) 100%);
}

.facade.exterior-content {
  max-width: 1180px;
  padding: 18px 14px 40px 14px;
  z-index: 6;
}

.facade-sign {
  text-align: center;
  margin: 0 auto;
  padding: 6px 12px 0 12px;
  min-height: clamp(220px, 40vh, 430px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85);
}
.facade-sign-kicker {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent-amber-glow);
}
.facade-sign-name {
  font-family: var(--font-display);
  font-size: clamp(32px, 6vw, 54px);
  font-weight: 700;
  line-height: 1.05;
  color: #FFF4DE;
  margin: 2px 0 6px 0;
}
.facade-progress {
  font-family: var(--font-prose);
  font-size: 16px;
  line-height: 1.5;
  color: #F6EFE2;
  max-width: 560px;
  margin: 0;
  padding: 6px 14px;
  border-radius: 18px;
  background: rgba(15, 12, 10, 0.45);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

/* The timber wall the windows are set into */
.window-wall {
  position: relative;
  border-radius: 16px 16px 10px 10px;
  padding: 34px 14px 22px 14px;
  background:
    repeating-linear-gradient(180deg, rgba(0, 0, 0, 0) 0 34px, rgba(0, 0, 0, 0.35) 34px 36px),
    linear-gradient(180deg, #5A3824 0%, #4A2C1B 45%, #3A2214 100%);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 220, 180, 0.15);
  border: 2px solid #2A180E;
}
.window-wall-eave {
  position: absolute;
  left: -8px;
  right: -8px;
  top: -14px;
  height: 30px;
  border-radius: 18px 18px 8px 8px;
  background:
    radial-gradient(circle at 10px 26px, #FFFFFF 10px, transparent 11px) 0 0 / 34px 30px repeat-x,
    linear-gradient(180deg, #F4FAFF 0%, #DCEAF3 100%);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}

.window-grid.shutter-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 22px 16px;
  margin: 0 0 18px 0;
}
@media (max-width: 1023px) {
  .window-grid.shutter-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 20px 14px; }
}
@media (max-width: 767px) {
  .window-grid.shutter-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 12px; }
  .window-wall { padding: 30px 10px 18px 10px; }
}

/* A single window */
.adv-window {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.adv-window .aw-frame {
  position: relative;
  width: 100%;
  padding-top: 120%; /* 5:6 box (padding trick: aspect-ratio is unreliable in some WebViews) */
  height: 0;
  border-radius: 46% 46% 6px 6px / 22% 22% 6px 6px;
  border: 5px solid #2B190F;
  box-shadow: inset 0 0 0 2px #7A4A2C, 0 4px 10px rgba(0, 0, 0, 0.5);
  background: #0E1620;
  overflow: hidden;
  perspective: 420px;
}
.adv-window .aw-glass {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 70%, #24384A 0%, #0E1620 80%);
}
.adv-window .aw-scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
}
.adv-window .aw-mullions {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent calc(50% - 2px), #2B190F calc(50% - 2px), #2B190F calc(50% + 2px), transparent calc(50% + 2px)),
    linear-gradient(180deg, transparent calc(45% - 2px), #2B190F calc(45% - 2px), #2B190F calc(45% + 2px), transparent calc(45% + 2px));
  z-index: 2;
}
.adv-window .aw-shutter {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  z-index: 3;
  background:
    linear-gradient(135deg, transparent 46%, rgba(0, 0, 0, 0.28) 46%, rgba(0, 0, 0, 0.28) 54%, transparent 54%),
    repeating-linear-gradient(90deg, #6B4128 0 9px, #5C3721 9px 11px);
  box-shadow: inset 0 0 0 2px #3A2214;
  transition: transform 0.6s cubic-bezier(0.3, 0.8, 0.3, 1.1), opacity 0.6s ease;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.adv-window .aw-left { left: 0; transform-origin: left center; }
.adv-window .aw-right { right: 0; transform-origin: right center; }
.adv-window .aw-num {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: #F3D9A8;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.adv-window .aw-sill {
  display: block;
  width: 112%;
  height: 9px;
  margin-top: -3px;
  border-radius: 4px;
  background: linear-gradient(180deg, #FFFFFF 0%, #DCEAF3 60%, #6B4128 61%, #3A2214 100%);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.45);
}
.adv-window .aw-tag {
  margin-top: 5px;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  color: #F6EFE2;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Locked: shutters closed, dim */
.adv-window.is-locked .aw-frame { filter: saturate(0.6) brightness(0.8); }
.adv-window.is-locked .aw-num { color: #C9D5DC; }
.adv-window.is-locked .aw-tag { color: #C9D5DC; font-weight: 600; }

/* Next traveler: shutters folded back, silhouette behind frost */
.adv-window.is-next .aw-frame { filter: none; }
.adv-window.is-next .aw-left { transform: rotateY(-100deg); opacity: 0.85; }
.adv-window.is-next .aw-right { transform: rotateY(100deg); opacity: 0.85; }
.adv-window.is-next .aw-scene { filter: blur(2.5px) brightness(0.16) contrast(1.4); transform: scale(1.06); }
.adv-window.is-next .aw-glass::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 40%, rgba(220, 236, 246, 0.08) 0%, rgba(220, 236, 246, 0.42) 100%);
}
.adv-window.is-next .aw-num { left: 8px; top: 6px; transform: none; font-size: 18px; }
.adv-window.is-next .aw-tag { color: var(--accent-frost-ice); }

/* Tonight / ready: shutters closed, warm light leaking through */
.adv-window.is-tonight .aw-frame,
.adv-window.is-ready .aw-frame {
  box-shadow: inset 0 0 0 2px #C48A3A, 0 0 18px rgba(255, 190, 100, 0.55), 0 4px 10px rgba(0, 0, 0, 0.5);
}
.adv-window.is-tonight .aw-glass,
.adv-window.is-ready .aw-glass {
  background: radial-gradient(ellipse at 50% 65%, #FFD58A 0%, #E8873A 45%, #5A2A12 100%);
}
.adv-window.is-tonight .aw-left { transform: rotateY(-16deg); }
.adv-window.is-tonight .aw-right { transform: rotateY(16deg); }
.adv-window.is-tonight .aw-frame { animation: windowBreath 2.6s ease-in-out infinite; }
.adv-window.is-tonight .aw-tag {
  color: #1F1612;
  background: var(--accent-amber-glow);
  padding: 2px 10px;
  border-radius: 9999px;
}
.adv-window.is-ready .aw-tag { color: var(--accent-amber-glow); }
.adv-window .aw-candle {
  position: absolute;
  left: 50%;
  bottom: 18%;
  width: 14%;
  height: 26%;
  transform: translateX(-50%);
  border-radius: 3px;
  background: linear-gradient(180deg, #FFF6E0, #E9D3A8);
}
.adv-window .aw-candle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -60%;
  width: 70%;
  height: 60%;
  transform: translateX(-50%);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: radial-gradient(circle at 50% 70%, #FFFBEA 0%, #FFC94D 55%, rgba(255, 140, 40, 0) 75%);
  animation: candleFlicker 1.4s ease-in-out infinite alternate;
}

/* Sealed: the night's scene glows warm behind the panes */
.adv-window.is-sealed .aw-left { transform: rotateY(-100deg); opacity: 0.9; }
.adv-window.is-sealed .aw-right { transform: rotateY(100deg); opacity: 0.9; }
.adv-window.is-sealed .aw-scene { filter: sepia(0.25) saturate(1.15) brightness(1.02); }
.adv-window.is-sealed .aw-glass::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 60%, rgba(255, 200, 120, 0) 40%, rgba(255, 170, 80, 0.35) 100%);
}
.adv-window.is-sealed .aw-frame {
  box-shadow: inset 0 0 0 2px #E0A458, 0 0 16px rgba(255, 196, 110, 0.5), 0 4px 10px rgba(0, 0, 0, 0.5);
}
.adv-window.is-sealed .aw-num {
  left: 6px;
  top: 5px;
  transform: none;
  font-size: 15px;
  font-family: var(--font-ui);
  color: #1F1612;
  background: rgba(255, 226, 170, 0.92);
  border-radius: 9999px;
  padding: 1px 7px;
  text-shadow: none;
}
.adv-window.is-sealed .aw-tag { color: var(--accent-amber-glow); }

/* Opening: shutters swing wide, light floods */
.adv-window.is-opening .aw-left { transform: rotateY(-110deg); }
.adv-window.is-opening .aw-right { transform: rotateY(110deg); }
.adv-window.is-opening .aw-frame { animation: windowFlood 0.62s ease-out forwards; }
.adv-window.is-opening .aw-num { opacity: 0; }
.adv-window.is-jiggle .aw-frame { animation: windowJiggle 0.42s ease-in-out; }
.adv-window:focus-visible .aw-frame { outline: 3px solid var(--accent-amber-glow); outline-offset: 3px; }

@keyframes windowBreath {
  0%, 100% { box-shadow: inset 0 0 0 2px #C48A3A, 0 0 14px rgba(255, 190, 100, 0.45), 0 4px 10px rgba(0, 0, 0, 0.5); }
  50% { box-shadow: inset 0 0 0 2px #FFD28A, 0 0 30px rgba(255, 200, 110, 0.85), 0 4px 10px rgba(0, 0, 0, 0.5); }
}
@keyframes windowFlood {
  0% { filter: brightness(1); }
  60% { filter: brightness(1.6); box-shadow: 0 0 46px rgba(255, 210, 140, 0.95); }
  100% { filter: brightness(1.25); box-shadow: 0 0 36px rgba(255, 210, 140, 0.8); }
}
@keyframes windowJiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-2.5deg); }
  75% { transform: rotate(2.5deg); }
}
@keyframes candleFlicker {
  from { transform: translateX(-50%) scale(1, 1); opacity: 0.92; }
  to { transform: translateX(-52%) scale(0.92, 1.08); opacity: 1; }
}

/* The Great Door (25) */
.great-door {
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: 640px;
  margin: 8px auto 6px auto;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(20, 12, 8, 0.55);
  border: 1px solid rgba(232, 155, 72, 0.3);
}
.great-door-arch {
  position: relative;
  flex: 0 0 auto;
  width: 92px;
  height: 120px;
  border-radius: 46px 46px 6px 6px;
  border: 5px solid #2B190F;
  background:
    linear-gradient(90deg, transparent calc(50% - 1.5px), #2B190F calc(50% - 1.5px), #2B190F calc(50% + 1.5px), transparent calc(50% + 1.5px)),
    repeating-linear-gradient(90deg, #7A4A2C 0 10px, #6B4128 10px 12px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.55);
}
.great-door-wreath {
  position: absolute;
  left: 50%;
  top: 22px;
  width: 38px;
  height: 38px;
  transform: translateX(-50%);
  border-radius: 50%;
  border: 7px solid #2F5E45;
  box-shadow: 0 0 0 2px #1E3E2D, inset 0 0 0 2px #1E3E2D;
}
.great-door-num {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: #E8C27A;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.8);
}
.great-door.is-ready .great-door-arch { animation: doorGlow 2.6s ease-in-out infinite; }
.great-door.is-locked .great-door-arch { filter: brightness(0.75) saturate(0.7); }
.great-door-copy { flex: 1 1 auto; text-align: left; }
.great-door-kicker {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent-amber-glow);
}
.great-door-text {
  font-family: var(--font-prose);
  font-size: 16px;
  line-height: 1.5;
  color: #F6EFE2;
  margin: 4px 0 10px 0;
}
.great-door-btn {
  display: inline-block;
  margin: 0 8px 8px 0;
  border: none;
  border-radius: 9999px;
  padding: 10px 20px;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  color: #1F1612;
  background: linear-gradient(135deg, #E89B48 0%, #D27623 100%);
}
.great-door-btn[disabled] { cursor: not-allowed; color: #C9B39C; background: rgba(255, 255, 255, 0.08); }
.great-door-btn.is-ghost { background: transparent; color: var(--accent-amber-glow); border: 1px solid var(--accent-amber-glow); }
@keyframes doorGlow {
  0%, 100% { box-shadow: 0 0 18px rgba(255, 210, 138, 0.45), 0 6px 16px rgba(0, 0, 0, 0.55); }
  50% { box-shadow: 0 0 40px rgba(255, 210, 138, 0.9), 0 6px 16px rgba(0, 0, 0, 0.55); }
}

.facade .exterior-footer-cta { text-align: center; margin-top: 8px; }

/* Tablets: drop the meter words (icons + numbers stay) so the HUD never overlaps its buttons */
@media (min-width: 768px) and (max-width: 1100px) {
  .meter-label { display: none; }
  .hud-meters { min-width: 0; overflow: hidden; }
  .hearth-hud { gap: 8px; padding: 10px 12px; }
}

/* Compact one-row HUD on phones */
@media (max-width: 767px) {
  .hearth-hud { flex-wrap: nowrap; padding: 6px 8px; gap: 6px; }
  .hud-brand { display: none; }
  .hud-meters { order: 0; width: auto; flex: 1 1 auto; justify-content: space-between; padding: 4px 8px; }
  .hud-actions { display: flex; gap: 4px; flex: 0 0 auto; }
  .btn-hud-primary.is-compact { width: 36px; height: 34px; padding: 0; font-size: 17px; }
  .meter-track { width: 18px; }
  .great-door { gap: 12px; padding: 12px; }
  .great-door-arch { width: 74px; height: 100px; }
}

@media (prefers-reduced-motion: reduce) {
  .adv-window .aw-shutter { transition: none; }
  .adv-window.is-tonight .aw-frame,
  .great-door.is-ready .great-door-arch,
  .adv-window .aw-candle::before { animation: none; }
}
