/* =========================================================
   מסך פתיחה – תחנה 1: שערי ירושלים
   ========================================================= */

/* אין עוד מרכוז flex גורף: הכותרת/טקסט מוצבים למעלה (אזור
   השמיים), והתיבה/כפתור ממוקמים על משטח האבן, כל אחד לפי
   קואורדינטות קבועות ביחס לתמונת הרקע. */

.atmosphere-bg {
  position: absolute;
  inset: 0;
  background-image: url("../assets/images/station1-opening-bg.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
}

/* שני תתי-המסכים (פתיחה ופאזל) חולקים את אותו רקע ממש (מוגדר
   פעם אחת ברמת game-viewport) - כל אחד הוא רק שכבת תוכן קדמית
   שממלאת את כל השטח. */
.scene {
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* מעבר מסך הפתיחה -> הפאזל: הכותרת/טקסט/תיבה דועכים יחד */
#screen-station1-intro.scene-fade-out {
  opacity: 0;
  pointer-events: none;
  transition: opacity 450ms ease;
}

/* הכהיה עדינה של הרקע הקולנועי מאחורי אזור הפאזל, לשמירה על
   קריאות - לא נוגעת ברקע עצמו, רק שכבה נוספת מעליו. */
.puzzle-dim-overlay {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(6, 5, 3, 0);
  transition: background 500ms ease;
  pointer-events: none;
}

#game-viewport.puzzle-active .puzzle-dim-overlay {
  background: rgba(6, 5, 3, 0.55);
}

/* ===================== כותרת + פתיח ===================== */

.station-content {
  position: absolute;
  top: 6%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  width: min(680px, 86%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(6px, 1.2vh, 12px);
  text-align: center;
}

.station-title {
  margin: 0;
  font-size: clamp(1.35rem, 2.3vw, 2.1rem);
  color: var(--color-gold);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85), 0 0 16px rgba(232, 194, 122, 0.25);
  letter-spacing: 0.02em;
}

.station-intro-text {
  margin: 0;
  font-size: clamp(0.95rem, 1.3vw, 1.15rem);
  line-height: 1.6;
  color: var(--color-parchment);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.95), 0 0 14px rgba(0, 0, 0, 0.75);
  padding: 26px 46px;
  /* ערפל כהה רך מאוד שנעלם לגמרי בקצוות - לא כרטיס/מלבן */
  background: radial-gradient(ellipse 62% 95% at 50% 50%, rgba(4, 3, 2, 0.4) 0%, rgba(4, 3, 2, 0.2) 45%, rgba(4, 3, 2, 0) 72%);
}

/* ===================== אזור התיבה ===================== */
/* .chest-platform הוא כעת רק נקודת עיגון (רוחב/גובה 0) במיקום
   הסופי שאושר על משטח האבן - תחתית-מרכז. שתי תמונות התיבה
   (סגורה/פתוחה) ממוקמות כל אחת בנפרד ביחס לאותה נקודת עיגון,
   כל אחת עם הרוחב/יחס-הממדים הטבעי שלה משלה - בלי לכפות גובה
   משותף ובלי למתוח אף אחת מהן. הרוחב של כל תמונה חושב כך
   ש"גוף" התיבה (לא הקנבס כולו) יוצא באותו רוחב תצוגה בדיוק
   בשני המצבים (נמדד ברמת אלפא: גוף סגור=473px מתוך 494,
   גוף פתוח=425px מתוך 434 - ומכאן היחס 390px/381px). */

.chest-platform {
  position: absolute;
  left: 50%;
  /* *** תוקן פעמיים: היה bottom:91px קבוע (גרם לתיבה קרובה מדי
     לשפת משטח האבן), ואז 19% (שהתברר, בבדיקה חזותית מדודה בפועל
     מול פיקסלי הרקע, כגבוה מדי - השאיר פער נראה-לעין בין בסיס
     התיבה למשטח, "מרחפת"). 16.5% ממקם את בסיס התיבה בתוך משטח
     האבן העליון, קרוב יותר לחזית שלו כדי שהמגע יהיה חד-משמעי,
     בלי לגעת בגודל התיבה עצמה. ***/
  bottom: 16.5%;
  width: 0;
  height: 0;
  outline: none;
  z-index: 2;
}

.chest-shadow {
  position: absolute;
  left: 50%;
  /* *** תוקן: bottom:-6px (במקום 0) + פחות blur + אטימות גבוהה
     יותר במרכז - צל-מגע קטן וכהה שממש "מדביק" את בסיס התיבה
     למשטח, במקום צל רחב ומטושטש שרק ריחף מתחת בלי ליצור תחושת
     מגע אמיתית. ***/
  bottom: -6px;
  width: 260px;
  height: 22px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 50%, rgba(6, 3, 1, 0.92) 0%, rgba(6, 3, 1, 0.6) 45%, rgba(6, 3, 1, 0) 82%);
  filter: blur(3px);
  pointer-events: none;
}

.chest-inner-glow {
  position: absolute;
  left: 50%;
  bottom: 150px;
  width: 130px;
  height: 70px;
  transform: translate(-50%, 50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 50%, rgba(255, 176, 90, 0.55) 0%, rgba(255, 150, 60, 0.22) 45%, rgba(255, 150, 60, 0) 75%);
  filter: blur(6px);
  opacity: 0;
  transition: opacity 0.4s ease 0.15s;
  pointer-events: none;
}

.chest-platform.is-open .chest-inner-glow {
  opacity: 1;
}

.chest-img {
  position: absolute;
  left: 50%;
  bottom: 0;
  /* חשוב: .chest-platform עצמו הוא נקודת עיגון בגודל 0 (ראו
     למעלה), אז התמונה הנראית היא זו שחייבת לקלוט את הלחיצה
     ולהעביר אותה למעלה (bubble) לעטיפה עם role="button". בלי
     pointer-events:auto התיבה לא הייתה לחיצה בכלל. */
  pointer-events: auto;
  cursor: pointer;
}

.chest-closed {
  width: 390px;
  aspect-ratio: 494 / 345;
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  transition: opacity 180ms ease;
}

.chest-open {
  width: 381px;
  aspect-ratio: 434 / 370;
  transform: translateX(-50%) translateY(6px);
  opacity: 0;
  transition: opacity 320ms ease, transform 320ms ease;
}

.chest-platform.is-open .chest-closed {
  opacity: 0;
}

.chest-platform.is-open .chest-open {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.chest-platform:not(.is-open):hover .chest-closed {
  transform: translateX(-50%) translateY(-2px);
}

/* ===================== כפתור פתיחה ===================== */
/* ממוקם על חזית משטח האבן, מתחת לתיבה */

.open-chest-btn {
  position: absolute;
  left: 50%;
  bottom: 7%;
  transform: translateX(-50%);
  z-index: 2;
  padding: 9px 30px;
  font-family: var(--font-heading);
  font-size: clamp(0.9rem, 1.1vw, 1.05rem);
  font-weight: 700;
  color: var(--color-gold);
  background: rgba(8, 6, 4, 0.4);
  border: 1.5px solid rgba(216, 164, 91, 0.6);
  border-radius: 5px;
  letter-spacing: 0.03em;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.85);
  cursor: pointer;
  transition: box-shadow 0.25s ease, border-color 0.25s ease, background-color 0.25s ease, transform 0.15s ease, opacity 0.4s ease;
}

.open-chest-btn:hover {
  border-color: var(--color-gold);
  background: rgba(18, 13, 8, 0.55);
  box-shadow: 0 0 16px rgba(232, 194, 122, 0.5);
}

.open-chest-btn:active {
  transform: translateX(-50%) translateY(1px);
}

.open-chest-btn[disabled] {
  /* דועך ונעלם לגמרי לאחר הפתיחה - אין דרך לסגור את התיבה מחדש */
  opacity: 0;
  pointer-events: none;
  cursor: default;
  box-shadow: none;
}
