/* ===========================================
   modals.css — All modal overlays:
   base modal, photobook, experience/education grid,
   and room detail / project accordion.
   =========================================== */

/* --- Base Modal --- */

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: #1a1a2e;
  border: 6px solid #fff;
  padding: 40px;
  max-width: 800px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 0 40px rgba(255, 165, 0, 0.5);
  box-sizing: border-box;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  font-family: "Press Start 2P", cursive;
  font-size: 24px;
  background: #e94560;
  color: #fff;
  border: 3px solid #fff;
  width: 50px;
  height: 50px;
  cursor: pointer;
  transition: all 0.1s;
  z-index: 2001;
}

.close-btn:hover {
  background: #ff6b6b;
}

/* --- Zine Modal --- */

#photobook-modal {
  background: rgba(250, 247, 243, 0.97);
  overflow-y: auto;
  overflow-x: hidden;
  /* centre and size to match the content column */
  left: 50%;
  transform: translateX(-50%);
  width: min(860px, calc(100% - 20px));
  border-left: 2px solid #9e8573;
  border-right: 2px solid #9e8573;
}

/* override base .modal.active flex — block lets sticky work correctly */
#photobook-modal.active {
  display: block;
}

#photobook-modal .photobook-close {
  position: sticky;
  top: 16px;
  display: block;
  margin-left: auto;
  margin-right: 16px;
  margin-top: 16px;
}

/* Scrollable content column */
.zine-container {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 90px 32px 120px;
  box-sizing: border-box;
}

/* Every group of photos is a "block" */
.zine-block {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 80px;
}

/* === Layout variants === */

/* One large photo, centred */
.zine-hero {
  justify-content: center;
}
.zine-hero .zine-img-wrap {
  width: 82%;
  flex-shrink: 0;
}

/* Two equal-width photos */
.zine-duo-even {
  align-items: center;
}
.zine-duo-even .zine-img-wrap {
  flex: 1;
  min-width: 0;
}

/* Two photos, first noticeably larger; second slightly offset down */
.zine-duo-offset {
  align-items: flex-start;
  gap: 20px;
}
.zine-duo-offset .zine-img-wrap:nth-child(1) {
  flex: 1.6;
  min-width: 0;
}
.zine-duo-offset .zine-img-wrap:nth-child(2) {
  flex: 1;
  min-width: 0;
  margin-top: 48px;
}

/* Single photo, left-aligned at ~half width */
.zine-solo-left {
  justify-content: flex-start;
}
.zine-solo-left .zine-img-wrap {
  width: 52%;
  flex-shrink: 0;
}

/* Single photo, right-aligned at ~58% width */
.zine-solo-right {
  justify-content: flex-end;
}
.zine-solo-right .zine-img-wrap {
  width: 58%;
  flex-shrink: 0;
}

/* Three equal-width photos in a row — natural proportions, vertically centred */
.zine-trio {
  align-items: center;
  gap: 12px;
}
.zine-trio .zine-img-wrap {
  flex: 1;
  min-width: 0;
}

/* Shared image-wrap base — hidden until scrolled into view */
.zine-img-wrap {
  overflow: hidden;
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 1.5s ease,
    transform 1.5s ease;
}
.zine-img-wrap.visible {
  opacity: 1;
  transform: translateY(0);
}
.zine-img-wrap img {
  width: 100%;
  height: auto;
  display: block;
}

/* --- Experience Modal --- */

#experience-modal {
  background: rgba(0, 0, 0, 0.85);
  overflow: hidden;
}

#experience-modal .experience-close {
  position: fixed;
  top: 20px;
  right: 20px;
}

.experience-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px;
}

.experience-title {
  font-family: "Press Start 2P", cursive;
  font-size: 24px;
  color: #4caf50;
  text-align: center;
  margin-bottom: 40px;
  text-shadow: 3px 3px 0 #000;
}

/* --- Education Grid (inside experience modal) --- */

.education-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 30px;
  max-width: 1000px;
  width: 100%;
}

/* Shared card base */
.uni-room {
  background: rgba(211, 47, 47, 0.9);
  border: 4px solid #fff;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
  box-sizing: border-box;
}

.uni-room:hover {
  background: rgba(255, 82, 82, 0.9);
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.5);
}

.uni-room h3 {
  font-size: 12px;
  color: #ffeb3b;
  text-align: center;
  margin-bottom: 15px;
  text-shadow: 2px 2px 0 #000;
}

.uni-room .room-content {
  font-size: 8px;
  color: #fff;
  line-height: 1.6;
  text-align: center;
}

/* Colour variants per education type */
.edu-bsc {
  background: rgba(211, 47, 47, 0.9) !important;
}
.edu-bsc:hover {
  background: rgba(255, 82, 82, 0.9) !important;
}
.edu-bsc h3 {
  color: #ffeb3b !important;
}

.edu-msc-container {
  background: rgba(20, 70, 35, 0.95);
  border: 4px solid #fff;
  padding: 20px;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
  grid-row: span 2;
  box-sizing: border-box;
}

.msc-title {
  font-family: "Press Start 2P", cursive;
  font-size: 12px;
  color: #ffeb3b;
  text-align: center;
  margin-bottom: 15px;
  text-shadow: 2px 2px 0 #000;
}

.msc-description {
  font-family: "Press Start 2P", cursive;
  font-size: 8px;
  color: #fff;
  text-align: center;
  line-height: 1.6;
  margin-bottom: 20px;
}

.msc-modules {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.edu-msc {
  background: rgba(46, 125, 50, 0.9) !important;
  padding: 8px 12px !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
}
.edu-msc h3 {
  margin: 0;
  text-align: center;
  font-size: 10px;
}
.edu-msc:hover {
  background: rgba(76, 175, 80, 0.9) !important;
}

.edu-academia {
  background: rgba(0, 105, 120, 0.9) !important;
}
.edu-academia:hover {
  background: rgba(0, 150, 166, 0.9) !important;
}
.edu-academia h3 {
  color: #ffeb3b !important;
}

.edu-internship {
  background: rgba(46, 125, 50, 0.9) !important;
}
.edu-internship:hover {
  background: rgba(76, 175, 80, 0.9) !important;
}
.edu-internship h3 {
  color: #ff8c00 !important;
}

.edu-certificate {
  grid-column: span 2;
  background: rgba(106, 27, 154, 0.9) !important;
}
.edu-certificate:hover {
  background: rgba(142, 36, 170, 0.9) !important;
}
.edu-certificate h3 {
  color: #ff8c00 !important;
}

/* Legacy university grid (kept for compatibility) */
.university-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 30px;
  max-width: 900px;
  width: 100%;
}

/* Mobile-only summary shown instead of full room-content */
.room-summary,
.msc-description-mobile {
  display: none;
  font-family: "Press Start 2P", cursive;
  font-size: 7px;
  color: #fff;
  text-align: center;
  line-height: 1.6;
}

/* --- Room Dialogue Modal (JRPG style) --- */

#room-modal {
  background: rgba(0, 0, 0, 0.45);
  align-items: flex-end;
  padding-bottom: 50px;
}

/* Centred wrapper — wide margins on desktop, nearly full on mobile */
.dialogue-box {
  display: flex;
  align-items: flex-end;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 48px;
  box-sizing: border-box;
  gap: 16px;
}

/* Character sprite — standing beside the bubble with a small nameplate */
.dialogue-portrait {
  flex-shrink: 0;
  width: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.dialogue-portrait-base {
  font-family: "Press Start 2P", cursive;
  font-size: 8px;
  color: #1a1a2e;
  background: rgba(247, 247, 242, 0.95);
  border: 3px solid #1a1a2e;
  border-radius: 10px;
  width: 100%;
  text-align: center;
  padding: 6px 0;
  letter-spacing: 1px;
}

.dialogue-sprite {
  width: 160px;
  height: auto;
  display: block;
  image-rendering: pixelated;
}

/* Speech bubble panel */
.dialogue-panel {
  flex: 1;
  position: relative;
  background: rgba(247, 247, 242, 0.95);
  border: 3px solid #1a1a2e;
  border-radius: 20px;
  padding: 16px 20px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 130px;
}

/* Speech bubble tail — points left toward the character */
.dialogue-panel::before {
  content: "";
  position: absolute;
  right: 100%;
  bottom: 36px;
  width: 0;
  height: 0;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-right: 18px solid #1a1a2e;
}
.dialogue-panel::after {
  content: "";
  position: absolute;
  right: calc(100% - 4px);
  bottom: 37px;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 16px solid rgba(247, 247, 242, 0.95);
}

.dialogue-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 2px solid #1a1a2e;
}

.dialogue-speaker {
  font-family: "Press Start 2P", cursive;
  font-size: 9px;
  color: #1a1a2e;
}

.dialogue-close {
  font-family: "Press Start 2P", cursive;
  font-size: 14px;
  background: transparent;
  color: rgba(26, 26, 46, 0.4);
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
}

.dialogue-close:hover {
  color: #1a1a2e;
}

.dialogue-topic-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dialogue-topic-arrow {
  font-size: 10px;
  color: #1a1a2e;
  animation: dialogue-blink 1s step-end infinite;
}

@keyframes dialogue-blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

.dialogue-topic {
  font-family: "Press Start 2P", cursive;
  font-size: 7px;
  color: #1a1a2e;
  opacity: 0.6;
}

/* Text body */
.dialogue-text {
  font-family: "VT323", monospace;
  font-size: 21px;
  color: #2a2a3e;
  line-height: 1.5;
}

.dialogue-text.dialogue-entering {
  animation: dialogue-fadein 0.2s ease;
}

@keyframes dialogue-fadein {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dialogue-text a {
  color: #2a5aaa;
  text-decoration: none;
  border-bottom: 1px solid rgba(42, 90, 170, 0.4);
}
.dialogue-text a:hover {
  color: #1a3a7a;
}
.dialogue-text em {
  font-style: italic;
}

/* Footer: counter + nav buttons */
.dialogue-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid rgba(26, 26, 46, 0.15);
}

.dialogue-counter {
  font-family: "Press Start 2P", cursive;
  font-size: 10px;
  color: rgba(26, 26, 46, 0.5);
}

.dialogue-nav-btns {
  display: flex;
  gap: 8px;
}

.dialogue-nav-btn {
  font-family: "Press Start 2P", cursive;
  font-size: 7px;
  background: #1a1a2e;
  color: #f7f7f2;
  border: 2px solid #1a1a2e;
  border-radius: 6px;
  padding: 7px 12px;
  cursor: pointer;
  transition: background 0.15s ease;
  line-height: 1;
}

.dialogue-nav-btn:disabled {
  opacity: 0.22;
  cursor: not-allowed;
}

.dialogue-nav-btn:not(:disabled):hover {
  background: #3a3a6e;
  border-color: #3a3a6e;
}

/* --- Dialogue Topic Choices --- */

.dialogue-choices {
  flex-direction: column;
  gap: 8px;
}

.dialogue-question {
  font-family: "VT323", monospace;
  font-size: 21px;
  color: #2a2a3e;
  margin: 0 0 6px 0;
}

.dialogue-choice-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.dialogue-choice-btn {
  font-family: "Press Start 2P", cursive;
  font-size: 11px;
  background: transparent;
  color: #1a1a2e;
  border: 2px solid rgba(26, 26, 46, 0.25);
  border-radius: 4px;
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
  transition:
    border-color 0.1s ease,
    background 0.1s ease;
  line-height: 1.5;
  width: 100%;
}

.dialogue-choice-btn:hover {
  border-color: #1a1a2e;
  background: rgba(26, 26, 46, 0.07);
}

/* Mobile: nearly edge-to-edge, smaller sprite */
@media (max-width: 640px) {
  .dialogue-box {
    padding: 0 10px;
    gap: 8px;
  }
  .dialogue-portrait {
    width: 80px;
  }
  .dialogue-sprite {
    width: 80px;
  }
  .dialogue-portrait-base {
    font-size: 6px;
  }
  .dialogue-choice-btn {
    font-size: 9px;
  }
}
