/* =========================================================
   ONE-PAGE MODE SWITCH (HOME + WORK + TEACHING)
   - HOME stays identical
   - WORK stays intact
   - TEACHING is an isolated third mode
   ========================================================= */

body[data-mode="home"]{
  --web-hole-base: 230;
}

body[data-mode="work"],
body[data-mode="teaching"]{
  --web-hole-base: 190;
}

/* HOME hero visible only in HOME */
body[data-mode="home"] .hero{
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* HOME hero hidden in WORK / TEACHING */
body[data-mode="work"] .hero,
body[data-mode="teaching"] .hero{
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Shared mode roots */
#main,
#teaching-mode{
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 15;
  opacity: 0;
  visibility: hidden;
  transition: opacity 220ms ease, visibility 220ms ease;
  pointer-events: none;
}

body[data-mode="work"] #main{
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

body[data-mode="teaching"] #teaching-mode{
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Keep nav + panels above everything */
#site-nav{ position: relative; z-index: 60; }
.panel{ position: relative; z-index: 80; }

.top-nav a.is-active{
  color: rgba(255,255,255,0.96);
}

#home-spiderweb-canvas{
  z-index: 6;
  pointer-events: none;
}

#card-stack{ position: relative; z-index: 16; }
#graph-container{ position: relative; z-index: 17; }

/* =========================================================
   TEACHING MODE
   ========================================================= */

#teaching-mode{
  background: transparent;
}

#teaching-mode .teaching-wrap{
  display: grid;
  place-items: center;
  gap: 14px;
}

#teaching-stack{
  position: relative;
  width: 420px;
  height: 420px;
  margin: 0 auto;
  pointer-events: auto;
  z-index: 10;
}

#teaching-main-stack{
  position: relative;
  width: 420px;
  height: 420px;
}

#teaching-main-stack .teaching-layer{
  position: absolute;
  left: 50%;
  top: 50%;
  width: 92px;
  height: 92px;
  border: 0;
  border-radius: 50%;
  background: rgba(250,250,250,0.98);
  box-shadow: none;
  cursor: pointer;
  pointer-events: auto;
  outline: none;
  padding: 0;
  will-change: transform, opacity;
  transition: opacity 220ms ease, box-shadow 220ms ease;
}

#teaching-main-stack .teaching-layer::before,
#teaching-main-stack .teaching-layer::after{
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
}

#teaching-main-stack .teaching-layer::after{
  background: rgba(250,250,250,0.98);
  opacity: 0.96;
  transform-origin: center;
  animation: teaching-flicker 3.4s ease-in-out infinite;
  filter: brightness(1.08) contrast(1.05);
}

#teaching-main-stack .teaching-layer::before{
  border: 1px solid rgba(255,255,255,0.28);
  opacity: calc(var(--teaching-glow, 0) * 1);
  box-shadow:
    0 0 18px rgba(255,255,255, calc(var(--teaching-glow, 0) * 0.55)),
    0 0 42px rgba(255,255,255, calc(var(--teaching-glow, 0) * 0.18));
}

#teaching-main-stack .teaching-layer .label{
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 14px;
  text-align: center;
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 8px;
  font-weight: 500;
  line-height: 1.15;
  color: rgba(0,0,0,1);
  opacity: 0;
  transition: opacity 180ms ease;
  pointer-events: none;
  z-index: 2;
}

#teaching-main-stack .teaching-layer.is-hover .label,
#teaching-main-stack .teaching-layer:focus-visible .label{
  opacity: 1;
}

#teaching-main-stack .teaching-layer:focus-visible{
  box-shadow: 0 0 0 2px rgba(255,255,255,0.35);
}
.teaching-hint{
  color: rgba(255,255,255,0.55);
  font-size: 13px;
  letter-spacing: 0.02em;
  text-align: center;

  margin-top: var(--hint-offset-y);
  transform: translateX(var(--hint-offset-x)) translateY(0);
  transition: transform 0.6s ease, opacity 0.6s ease;

  position: relative;
  z-index: 2;
}

@keyframes teaching-flicker {
  0%, 100% {
    opacity: 0.96;
    transform: scale(1);
    filter: brightness(1.12) contrast(1.06);
  }
  50% {
    opacity: 0.78;
    transform: scale(0.93);
    filter: brightness(0.90) contrast(0.98);
  }
}

/* =========================================================
   TEACHING DETAIL OVERLAY
   ========================================================= */

#teaching-detail-overlay[aria-hidden="true"]{
  display: none;
}

#teaching-detail-overlay{
  position: fixed;
  inset: 0;
  z-index: 95;
}

#teaching-detail-overlay .teaching-detail-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.76);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

#teaching-detail-overlay .teaching-detail-panel{
  position: relative;
  z-index: 1;
  width: min(960px, calc(100% - 48px));
  max-height: calc(100vh - 52px);
  margin: 26px auto;
  overflow: auto;
  background: rgba(5,7,10,0.96);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 22px;
  box-shadow:
    0 28px 88px rgba(0,0,0,0.68),
    inset 0 1px 0 rgba(255,255,255,0.03);
}

#teaching-detail-overlay .teaching-detail-close{
  position: absolute;
  top: 22px;
  right: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.92);
  font: 500 12px/1 "Montserrat", system-ui, sans-serif;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  z-index: 3;
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

#teaching-detail-overlay .teaching-detail-close:hover{
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.28);
  transform: translateY(-1px);
}

#teaching-detail-overlay .teaching-detail-inner{
  display: block;
  padding: 0;
}

#teaching-detail-overlay .teaching-detail-hero{
  margin: 0;
  min-height: 280px;
  border-radius: 22px 22px 0 0;
  overflow: hidden;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

#teaching-detail-overlay .teaching-detail-copy{
  display: grid;
  align-content: start;
  gap: 0;
  padding: 42px 52px 48px;
}

#teaching-detail-overlay .teaching-detail-kicker{
  margin-bottom: 12px;
  font: 500 12px/1.4 "Montserrat", system-ui, sans-serif;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.52);
}

#teaching-detail-overlay .teaching-detail-title{
  margin: 0 0 18px;
  max-width: 14ch;
  font: 600 clamp(32px, 3.5vw, 52px)/1.04 "Montserrat", system-ui, sans-serif;
  color: rgba(255,255,255,0.98);
}

#teaching-detail-overlay .teaching-detail-text{
  margin: 0 0 30px;
  max-width: 66ch;
  font: 400 15px/1.85 "Montserrat", system-ui, sans-serif;
  color: rgba(255,255,255,0.78);
}

#teaching-detail-overlay .teaching-detail-section-title{
  margin-bottom: 16px;
  font: 500 12px/1.4 "Montserrat", system-ui, sans-serif;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.46);
}

#teaching-detail-overlay .teaching-detail-list{
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 12px;
}

#teaching-detail-overlay .teaching-detail-list li{
  color: rgba(255,255,255,0.84);
  font: 400 14px/1.8 "Montserrat", system-ui, sans-serif;
}

#teaching-detail-overlay .teaching-image-slot{
  position: relative;
}

#teaching-detail-overlay .teaching-image-slot img{
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  filter: grayscale(1) contrast(1.04) brightness(0.76);
}

#teaching-detail-overlay .teaching-image-slot[data-empty="true"]::before{
  content: "Banner image not found";
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: inherit;
  color: rgba(255,255,255,0.38);
  font: 500 12px/1 "Montserrat", system-ui, sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#teaching-detail-overlay .teaching-image-slot[data-empty="true"] img{
  display: none;
}
body.teaching-detail-open{
  overflow: hidden;
}

@media (max-width: 980px){
  #teaching-detail-overlay .teaching-detail-hero{
    min-height: 240px;
  }

  #teaching-detail-overlay .teaching-detail-copy{
    padding: 34px 34px 38px;
  }
}

@media (max-width: 736px){
  #teaching-stack,
  #teaching-main-stack{
    width: 320px;
    height: 320px;
  }

  #teaching-main-stack .teaching-layer{
    width: 84px;
    height: 84px;
  }

  #teaching-detail-overlay .teaching-detail-panel{
    width: min(100% - 24px, 1120px);
    margin: 12px auto;
  }

  #teaching-detail-overlay .teaching-detail-inner{
    padding: 0;
  }

  #teaching-detail-overlay .teaching-detail-copy{
    padding: 26px 20px 28px;
  }

  #teaching-detail-overlay .teaching-detail-title{
    font-size: clamp(28px, 9vw, 38px);
  }

  #teaching-detail-overlay .teaching-detail-hero{
    min-height: 200px;
  }
}


/* =========================================================
   SHARED GLOBAL SITE HINTS
   - keep one fixed hint block across HOME / WORK / TEACHING
   ========================================================= */

.work-hint,
.teaching-hint,
#floating-statement{
  display: none !important;
}