/* ==========================================================================
   Interactive campus — 3D stage, plan fallback, room panel
   Loaded only on /campus.
   ========================================================================== */

.campus-intro { padding-block: clamp(2.4rem, 5vw, 4rem) clamp(1.2rem, 2.4vw, 1.8rem); }
.campus-lede { max-width: 62ch; margin-top: 1rem; }
.campus-intro h1 { font-size: clamp(2.2rem, 1.4rem + 3vw, 3.8rem); line-height: 1.02; margin-top: 0.4rem; }
.campus-intro .hero-facts { max-width: 640px; }

.campus-stage { padding-bottom: clamp(2rem, 4vw, 3.2rem); }

/* toolbar -------------------------------------------------------------- */
.stage-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}
.floor-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: var(--white);
  border: 1px solid var(--line);
}
.floor-tab {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.82rem;
  cursor: pointer;
  transition: background var(--speed), color var(--speed);
}
.floor-tab .mono { font-size: 0.66rem; color: inherit; }
.floor-tab em { font-style: normal; }
.floor-tab:hover { background: var(--paper); color: var(--solder); }
.floor-tab.is-active { background: var(--solder); color: var(--paper); }

.stage-tools { display: flex; gap: 0.35rem; }
.tool {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--solder);
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.55rem 0.8rem;
  cursor: pointer;
  transition: background var(--speed), color var(--speed), border-color var(--speed);
}
.tool:hover { border-color: var(--solder); }
.tool.is-active { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* stage ---------------------------------------------------------------- */
.stage-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  background: #172554;
  border: 1px solid rgba(30, 58, 138, 0.5);
  box-shadow: 0 40px 80px -60px rgba(7, 18, 40, 0.9);
}

.stage-view {
  position: relative;
  min-height: 580px;
  overflow: hidden;
  background-color: #1E3A8A;
  background-image:
    radial-gradient(circle at 50% 40%, rgba(41, 84, 197, 0.1), transparent 62%),
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: auto, 44px 44px, 44px 44px;
  background-position: center, center, center;
}

.canvas-mount { position: absolute; inset: 0; cursor: grab; }
.canvas-mount:active { cursor: grabbing; }
.canvas-mount canvas { display: block; width: 100%; height: 100%; }

.stage-view.mode-plan .canvas-mount { display: none; }
.stage-view.mode-plan .stage-hint { display: none; }
.stage-view.mode-plan { min-height: 460px; }

.stage-hint {
  position: absolute;
  left: 1rem;
  bottom: 0.85rem;
  z-index: 2;
  font-size: 0.56rem;
  color: rgba(255, 255, 255, 0.38);
  pointer-events: none;
}

.room-tip {
  position: absolute;
  z-index: 3;
  transform: translate(-50%, -150%);
  padding: 0.4rem 0.6rem;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.58rem;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 8px 18px -10px rgba(0, 0, 0, 0.8);
}
.room-tip strong { display: block; font-weight: 600; letter-spacing: 0.02em; }
.room-tip span { display: block; margin-top: 0.2rem; font-size: 0.52rem; opacity: 0.62; }

/* full-bleed 3D hero ---------------------------------------------------- */
.home-hero-3d {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 720px;
  padding-block: 0;
  color: var(--paper);
  background:
    radial-gradient(64% 68% at 80% 24%, rgba(40, 80, 180, 0.42), transparent 62%),
    radial-gradient(78% 80% at 6% 94%, rgba(20, 40, 120, 0.5), transparent 58%),
    #061020;
}
.home-hero-3d::after {
  content: none;
}
.hero-canvas {
  position: absolute;
  inset: 0 0 0 auto;
  width: 63%;
  height: 100%;
  z-index: 0;
}
.hero-canvas .canvas-mount { position: absolute; inset: 0; }
.hero-canvas canvas { display: block; width: 100%; height: 100%; }
.home-hero-3d .home-hero-grid {
  position: relative;
  z-index: 2;
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 0;
}
.home-hero-3d .hero-copy {
  max-width: 40rem;
  padding-block: clamp(3rem, 7vw, 5.6rem);
}
.home-hero-3d h1 { color: #f7f5ef; }
.home-hero-3d .label { color: rgba(178, 226, 210, 0.82); }
.home-hero-3d .label::before { background: var(--amber); }
.home-hero-3d .lede { color: var(--amber); }
.home-hero-3d .hero-body { color: rgba(230, 240, 255, 0.76); }
.home-hero-3d .hero-facts {
  border-top-color: rgba(230, 240, 255, 0.18);
  color: rgba(230, 240, 255, 0.7);
}
.home-hero-3d .btn-primary { background: var(--amber); color: var(--ink); }
.home-hero-3d .btn-primary:hover { background: var(--paper); color: var(--ink); }
.home-hero-3d .btn-ghost { border-color: rgba(230, 240, 255, 0.32); color: var(--paper); }
.home-hero-3d .btn-ghost:hover { background: rgba(230, 240, 255, 0.1); border-color: rgba(230, 240, 255, 0.6); color: var(--paper); }

.hero-foot { position: relative; z-index: 2; border-top: 1px solid rgba(230, 240, 255, 0.13); }
.hero-foot-inner {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding-block: 0.85rem;
  font-size: 0.56rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(230, 240, 255, 0.58);
}
.hero-foot-inner a {
  margin-left: auto;
  color: var(--amber);
  text-decoration: none;
  border-bottom: 1px solid rgba(232, 168, 114, 0.4);
}
.hero-foot-inner a:hover { border-bottom-color: var(--amber); }
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #5ff0cc;
  box-shadow: 0 0 0 3px rgba(95, 240, 204, 0.18);
}

/* fullscreen ------------------------------------------------------------ */
.campus-stage:fullscreen {
  display: flex;
  flex-direction: column;
  padding: 0;
  background: var(--paper);
  overflow: hidden;
}
.campus-stage:fullscreen .wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: none;
  padding: clamp(0.8rem, 1.5vw, 1.4rem);
}
.campus-stage:fullscreen .stage-top { margin-bottom: 0.7rem; }
.campus-stage:fullscreen .stage-grid {
  flex: 1;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
}
.campus-stage:fullscreen .stage-view,
.campus-stage:fullscreen .stage-view.mode-plan { min-height: 0; height: 100%; }
.campus-stage:fullscreen .room-panel { max-height: none; }
.campus-stage:fullscreen .plan-stack { padding: clamp(1rem, 2vw, 2rem); }

@media (max-width: 900px) {
  .campus-stage:fullscreen .stage-grid { grid-template-columns: 1fr; }
  .campus-stage:fullscreen .room-panel { display: none; }
}

/* plan fallback -------------------------------------------------------- */
.plan-stack { position: absolute; inset: 0; display: none; padding: clamp(0.8rem, 2vw, 1.6rem); }
.stage-view.mode-plan .plan-stack { display: block; }

.floor-plan { display: none; width: 100%; height: 100%; }
.floor-plan.is-active { display: block; }

.plan-outline { fill: rgba(255, 255, 255, 0.015); stroke: rgba(255, 255, 255, 0.22); stroke-width: 0.35; }
.plan-corridor { fill: rgba(255, 255, 255, 0.03); stroke: rgba(255, 255, 255, 0.1); stroke-width: 0.15; stroke-dasharray: 0.9 0.7; }

.plan-room rect {
  fill: rgba(41, 84, 197, 0.1);
  stroke: rgba(110, 150, 240, 0.55);
  stroke-width: 0.3;
  cursor: pointer;
  transition: fill 180ms, stroke 180ms;
}
.plan-room.type-lab rect { fill: rgba(41, 84, 197, 0.16); stroke: rgba(120, 160, 255, 0.75); }
.plan-room.type-class rect { fill: rgba(18, 96, 79, 0.4); stroke: rgba(120, 220, 190, 0.6); }
.plan-room.type-office rect { fill: rgba(232, 168, 114, 0.1); stroke: rgba(232, 168, 114, 0.65); }
.plan-room.type-service rect { fill: rgba(255, 255, 255, 0.04); stroke: rgba(255, 255, 255, 0.3); }
.plan-room.type-hall rect { fill: rgba(232, 168, 114, 0.16); stroke: rgba(232, 168, 114, 0.9); }
.plan-room.type-stair rect { fill: rgba(255, 255, 255, 0.05); stroke: rgba(255, 255, 255, 0.42); stroke-dasharray: 1 0.7; }
.plan-step { stroke: rgba(255, 255, 255, 0.4); stroke-width: 0.18; pointer-events: none; }
.plan-entry line { stroke: #5ff0cc; stroke-width: 0.5; }
.plan-entry path { fill: #5ff0cc; }
.plan-entry text {
  font-family: var(--mono);
  font-size: 2.2px;
  fill: #5ff0cc;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.plan-room:hover rect,
.plan-room:focus-visible rect,
.plan-room.is-active rect {
  fill: rgba(232, 168, 114, 0.4);
  stroke: #E8A872;
  stroke-width: 0.55;
}
.plan-room:focus { outline: none; }

.plan-room text {
  font-family: var(--mono);
  fill: rgba(255, 255, 255, 0.72);
  pointer-events: none;
  letter-spacing: 0.02em;
}

.plan-annot {
  font-family: var(--mono);
  font-size: 2px;
  fill: rgba(255, 255, 255, 0.35);
  letter-spacing: 0.08em;
}

/* room panel ----------------------------------------------------------- */
.room-panel {
  position: relative;
  padding: clamp(1.3rem, 2vw, 1.9rem);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.72);
  background: #050f20;
  max-height: 700px;
  overflow-y: auto;
}
.room-panel .label { color: var(--amber); margin-bottom: 0.7rem; }
.room-panel .label::before { background: var(--amber); opacity: 1; }
.panel-lead { color: var(--white); font-size: 1.3rem; line-height: 1.25; }
.panel-note { margin-top: 0.7rem; font-size: 0.9rem; color: rgba(255, 255, 255, 0.55); }

.legend-title {
  margin-top: 1.8rem;
  padding-bottom: 0.5rem;
  font-size: 0.58rem;
  color: rgba(255, 255, 255, 0.4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.panel-legend li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.72);
}
.panel-legend em {
  margin-left: auto;
  font-style: normal;
  font-size: 0.58rem;
  color: rgba(255, 255, 255, 0.45);
}
.legend-dot { flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; }
.legend-dot.type-lab { background: #7FA2FF; }
.legend-dot.type-class { background: #4FE0BC; }
.legend-dot.type-office { background: #F2BE8C; }
.legend-dot.type-service { background: #AEBAB5; }
.legend-dot.type-hall { background: #F6D08A; }
.legend-dot.type-stair { background: #9FB6AE; }

.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.panel-title { color: var(--white); font-size: clamp(1.4rem, 1.1rem + 0.8vw, 1.9rem); line-height: 1.12; }
.panel-close {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}
.panel-close:hover { border-color: var(--amber); color: var(--amber); }

.panel-meta { display: flex; flex-wrap: wrap; gap: 0.4rem 0.9rem; margin-top: 0.7rem; font-size: 0.58rem; color: var(--amber); }
.panel-meta span { display: inline-flex; align-items: center; gap: 0.4rem; }
.panel-meta span + span::before { content: ""; width: 3px; height: 3px; background: currentColor; border-radius: 50%; opacity: 0.6; }

.panel-desc { margin-top: 1rem; font-size: 0.94rem; color: rgba(255, 255, 255, 0.72); }

.panel-section { margin-top: 1.4rem; }
.panel-section h3 {
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 0.5rem;
}
.panel-list li {
  padding: 0.42rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.78);
}
.panel-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.panel-chips li {
  padding: 0.25rem 0.5rem;
  border: 1px solid rgba(232, 168, 114, 0.35);
  color: var(--amber);
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.03em;
}
.panel-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 1.4rem;
  color: var(--amber);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 1px solid rgba(232, 168, 114, 0.35);
  padding-bottom: 0.2rem;
}
.panel-link:hover { border-bottom-color: var(--amber); }

.stage-note { margin-top: 0.8rem; font-size: 0.56rem; color: var(--muted); }

/* room directory ------------------------------------------------------- */
.room-index { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.8rem 2.8rem; }
.index-floor { border-top: 2px solid var(--solder); padding-top: 0.9rem; }
.index-floor-title { color: var(--solder); margin-bottom: 0.5rem; }
.index-room {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.55rem 0;
  border: 0;
  border-bottom: 1px dashed var(--line);
  background: none;
  color: inherit;
  font: inherit;
  font-size: 0.92rem;
  text-align: left;
  cursor: pointer;
}
.index-room:hover { color: var(--blue); }
.index-dot { flex: 0 0 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.index-dot.type-lab { background: var(--blue); }
.index-dot.type-class { background: var(--solder-soft); }
.index-dot.type-office { background: var(--amber); }
.index-dot.type-service { background: #9AA4A0; }
.index-dot.type-hall { background: #B8862F; }
.index-type { margin-left: auto; font-size: 0.6rem; color: var(--muted); }

@media (min-width: 1120px) {
  .room-index { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.4rem 2rem; }
  .index-room { font-size: 0.86rem; }
  .index-type { display: none; }
}

/* responsive ----------------------------------------------------------- */
@media (max-width: 1000px) {
  .stage-grid { grid-template-columns: 1fr; }
  .room-panel { border-left: 0; border-top: 1px solid rgba(255, 255, 255, 0.08); max-height: none; }
  .stage-view { min-height: 480px; }
}

@media (max-width: 720px) {
  .stage-top { align-items: stretch; }
  .floor-tabs { overflow-x: auto; scrollbar-width: none; }
  .floor-tabs::-webkit-scrollbar { display: none; }
  .floor-tab { flex: 0 0 auto; padding: 0.5rem 0.65rem; }
  .floor-tab em { display: none; }
  .stage-tools { justify-content: flex-end; }
  .stage-view { min-height: 380px; }
  .stage-hint { display: none; }
  .room-index { grid-template-columns: 1fr; }
  .room-panel { padding: 1.2rem; }
}

@media (max-width: 900px) {
  .home-hero-3d { min-height: 0; }
  .home-hero-3d::after { display: none; }
  .hero-canvas { position: relative; inset: auto; width: 100%; height: 330px; order: -1; }
  .home-hero-3d .hero-copy { padding-block: 2.2rem 2.6rem; }
  .hero-foot-inner { flex-wrap: wrap; font-size: 0.52rem; }
}

@media (prefers-reduced-motion: reduce) {
  .plan-room rect { transition: none; }
}
