:root{
  /* animated brain outline/fill */
  --neuro-stroke: #CAA7A7;        /* soft rose used today */

  /* tan “note” chip (your active labels + hover) */
  --note: #E5D8CB;

  --note-hover: #E5D8CB


}

:root[data-theme="dark"]{
  /* swap stroke to a cool bright that pops on dark */
  --neuro-stroke: #7DD3FC;        /* sky-cyan */

  /* warm, subdued chip bg for dark */
  --note: #3B3228;

  --note-hover: #3B3228

}




html, body {
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  background: linear-gradient(to bottom right, var(--panel-0), var(--panel-1));
}

.brain-svg-view {
  display: none;
}

.brain-svg-view.active-view {
  display: block;
}


.label-group {
  display: none;
}

.label-group.active-labels {
  display: block;
}

.label-group .label:hover {
  background-color: var(--note-hover);
  
}


.brain-container {
  background: linear-gradient(to bottom right, var(--panel-0), var(--panel-1));
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 140px 0 20px;
  position: relative;
}





.brain-svg-wrapper {
  display: flex;
  justify-content: center;
}

.svg-aligned-wrapper {
  position: relative;
  width: 500px;
  height: auto;
}

.svg-aligned-wrapper svg {
  width: 100%;
  height: auto;
  display: block;
}



.animated-path {
  fill: var(--neuro-stroke);
  fill-opacity: 0;
  stroke: var(--neuro-stroke);
  stroke-width: 30;

  stroke-dasharray: 4000;
  stroke-dashoffset: 4000;
  opacity: 0;
  transform: scale(0.95);
  transform-origin: center;

  animation:
    drawAndFade 3s ease-in-out forwards,
    fillAfterStroke 1s ease-in 3.2s forwards;
}

.lateral-brain .animated-path {
  stroke-width: 8; /* slightly thinner for lateral */
  stroke: var(--neuro-stroke);
  stroke-dasharray: 4000;
  stroke-dashoffset: 4000;
  transform: scale(0.98);
  animation:
    drawAndFadeLateral 3.5s ease-in-out forwards,
    fillAfterStrokeLateral 1s ease-in 3.6s forwards;
}

@keyframes drawAndFadeLateral {
  0% {
    stroke-dashoffset: 4000;
    opacity: 0;
  }
  50% {
    opacity: 0.8;
  }
  100% {
    stroke-dashoffset: 0;
    opacity: 1;
  }
}

@keyframes fillAfterStrokeLateral {
  from {
    fill-opacity: 0;
  }
  to {
    fill-opacity: 0.5; /* softer than sagittal fill */
  }
}


/* Default animated-path already applies to both */

.sagittal-brain .animated-path {
  stroke-width: 10;
  stroke: var(--neuro-stroke);
  stroke-dasharray: 4000;
  stroke-dashoffset: 4000;
  transform: scale(0.96);
  animation:
    drawAndFadeSagittal 4s ease-in-out forwards,
    fillAfterStrokeSagittal 1.2s ease-in 4.2s forwards;
}

@keyframes drawAndFadeSagittal {
  0% {
    stroke-dashoffset: 4000;
    opacity: 0;
  }
  40% {
    opacity: 1;
  }
  100% {
    stroke-dashoffset: 0;
    opacity: 1;
  }
}

@keyframes fillAfterStrokeSagittal {
  from {
    fill-opacity: 0;
  }
  to {
    fill-opacity: 0.6; /* More visible than coronal */
  }
}


/* Override for coronal SVGs */
.coronal-brain .animated-path {
  stroke-width: 5;
  stroke: var(--neuro-stroke);
  stroke-dasharray: 4000;
  stroke-dashoffset: 4000;
  transform: scale(1);
  animation:
    drawAndFadeCoronal 5.5s ease-in-out forwards,
    fillAfterStrokeCoronal 1s ease-in 5.8s forwards;
}

/* New animations for coronal view */
@keyframes drawAndFadeCoronal {
  0% {
    stroke-dashoffset: 4000;
    opacity: 0;
  }
  40% {
    opacity: 1;
  }
  100% {
    stroke-dashoffset: 0;
    opacity: 1;
  }
}

@keyframes fillAfterStrokeCoronal {
  from {
    fill-opacity: 0;
  }
  to {
    fill-opacity: 0.4;
  }
}

@keyframes drawAndFade {
  to {
    stroke-dashoffset: 0;
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fillAfterStroke {
  to {
    fill-opacity: 1;
  }
}

.dorsal-brain .animated-path {
  stroke: var(--neuro-stroke);
  stroke-width: 10;
  stroke-dasharray: 4000;
  stroke-dashoffset: 4000;
  fill: var(--neuro-stroke);
  fill-opacity: 0;

  transform: scale(1);
  opacity: 0;

  animation:
    drawAndFadeDorsal 5s ease-in-out forwards,
    fillAfterStrokeDorsal 1.2s ease-in 5.3s forwards;
}

/* Dorsal stroke animation */
@keyframes drawAndFadeDorsal {
  0% {
    stroke-dashoffset: 4000;
    opacity: 0;
  }
  30% {
    opacity: 0.5;
  }
  100% {
    stroke-dashoffset: 0;
    opacity: 1;
  }
}

/* Dorsal fill animation */
@keyframes fillAfterStrokeDorsal {
  from {
    fill-opacity: 0;
  }
  to {
    fill-opacity: 0.3;
  }
}


.brain-overlay {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Slight hover brightening */
.brain-overlay:hover {
  filter: brightness(1.15);
  transition: filter 0.2s ease;
}

.vmPFC-area {
  top: 33%;
  left: 16%;
  width: 13%;
  height: 20%;
  background-color: rgba(181, 194, 202, 0.4); /*  */
  border-radius: 50% 40% 60% 70% / 50% 60% 45% 65%;
  transform: rotate(-10deg) skewX(-4deg);
}

/* OFC — purple violet, translucent */
.OFC-area {
  top: 51%;
  left: 20%;
  width: 14%;
  height: 3%;
  background-color: rgba(128, 0, 128, 0.4); /* purple with 40% opacity */
  border-radius: 40% 25% 35% 50% / 50% 40% 60% 45%;
}



/* TPJ — dusty rose-mauve, translucent */
.TPJ-area {
  top: 35%;
  left: 70%;
  width: 12%;
  height: 14%;
  background-color: rgba(177, 112, 118, 0.4); /* #B17076 with 40% opacity */
}


/* SMA — golden ochre, translucent- for dorsal view */
.SMA-area {
  top: 30%;
  left: 48%;
  width: 12%;
  height: 30%;
  background-color: rgba(218, 165, 32, 0.4); /* golden ochre with 40% opacity */
}

/* VTA — deep teal, translucent */
.VTA-area {
  top: 50%;
  left: 52%;
  width: 8%;
  height: 18%;
  background-color: rgba(0, 128, 128, 0.4); /* teal with 40% opacity */
}



.ACC-area {
  top: 30%;
  left: 25%;
  width: 15%;
  height: 15%;
  background-color: rgba(139, 99, 159, 0.4); /* Lavender-purple */
  position: absolute;
  pointer-events: none;

  border-radius: 50%; /* Perfect circle */
  transform: rotate(-3deg); /* Slight tilt for anatomical flow */
}

.PCC-area {
  top: 25%;
  left:60%;
  width: 11%;
  height: 15%;
  background-color: rgba(200, 50, 50, 0.4); /* soft but noticeable red */
  border-radius: 55% 60% 45% 50% / 50% 55% 50% 60%;
  transform: rotate(-4deg) skewX(-2deg);
}

.CN-area {
  top: 28%;
  left: 57%;
  width: 4%;
  height: 10%;
  background-color: rgba(255, 165, 0, 0.4); /* translucent orange */
  border-radius: 60% 50% 50% 60% / 55% 50% 45% 55%;
  transform: rotate(3deg) skewX(1deg);
}

/* Insula — burgundy, translucent */
.Insula-area {
  top: 30%;
  left: 70%;
  width: 6%;
  height: 20%;
  background-color: rgba(128, 0, 32, 0.4); /* Burgundy with 40% opacity */
  border-radius: 60% 40% 70% 50% / 50% 60% 40% 70%;
}


/* Amygdala — electric blue, translucent */
.Amygdala-area {
  top: 53%;
  left: 34%;
  width: 5%;
  height: 5%;
  background-color: rgba(0, 100, 255, 0.4); /* Electric blue with 40% opacity */
}



.dlPFC-area {
  top: 19%;
  left: 22%;
  width: 14%;
  height: 16%;
  background-color: rgba(100, 161, 101, 0.4); /* elegant mossy green */
  border-radius: 60% 50% 45% 65% / 55% 60% 45% 55%;
  transform: rotate(-7deg) skewX(-4deg);
}

.label {
  font-family: 'Georgia', serif;
  background: transparent;
  color: var(--ink);
  font-weight: 500;
  padding: 4px 10px;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  cursor: pointer;
  opacity: 0;
  font-size: 14px;
  transform: translateY(-20px);
  animation: slideDownElegant 0.8s ease-out forwards;
  z-index: 5;
  transition: all 0.25s ease;
}


.label-group {
  position: absolute;
  top: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px; /* spacing between labels */
  z-index: 10;
}


.label-group {
  display: none;
}

.label-group.active-labels {
  display: flex;
}

@keyframes slideDownElegant {
  0% {
    opacity: 0;
    transform: translateY(-40px);
    filter: blur(2px);
  }
  60% {
    opacity: 0.6;
    transform: translateY(10px);
    filter: blur(1px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}


.label-group .label:nth-child(1) {
  animation-delay: 0.2s;
}
.label-group .label:nth-child(2) {
  animation-delay: 0.4s;
}
.label-group .label:nth-child(3) {
  animation-delay: 0.6s;
}
.label-group .label:nth-child(4) {
  animation-delay: 0.8s;
}

.label-group .label:nth-child(5) {
  animation-delay: 1s;
}



/* When the label is active */
.label.active {
  background-color: var(--note);
  color: var(--ink);
  border-color: var(--note);
}

/* Animation for label appearance */
@keyframes fadeSlideIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.brain-overlay.sticky {
  opacity: 1 !important;
  filter: brightness(1.15);
  pointer-events: auto;
}



.region-info {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 0;
  opacity: 0;
  transform: translateY(10px); /* ⬅️ less aggressive */
  max-height: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;

  background: var(--panel-gradient);
  border: 1.2px solid var(--ink);
  border-radius: 12px; /* ⬅️ slightly tighter */
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(10px);

  transition:
    opacity 0.35s ease,
    transform 0.35s ease,
    max-height 0.4s ease,
    padding 0.35s ease,
    margin 0.35s ease;
}

.region-info.visible {
  position: static;
  opacity: 1;
  transform: translateY(0);
  max-height: 500px;
  padding: 20px 24px;
  margin: 16px auto 40px;  /* ⬅️ tighter space above */
  pointer-events: auto;
  z-index: auto;
  overflow-y: auto;
}



.region-info h3 {
  font-size: 16px;
  margin-bottom: 12px;
  color: var(--ink);
}

.region-description {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary)
}

.region-papers {
  padding-left: 20px;
  margin-top: 10px;
}

.region-papers li {
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
}

/* separate ref vs notes */
.paper-ref {
  font-weight: 500;       /* makes citation line stand out */
  margin-bottom: 10px;
  
}

.paper-notes {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-2, #555);
  margin: 12px 0 8px 0; 
}

.mini-label{
  display:block;
  font-size:12px;
  font-weight:600;
  letter-spacing:.02em;
  color: var(--ink-2, #555);
  margin: 0 0 4px 0;
  /* no text-transform to keep your tone; add if you want */
  /* text-transform: uppercase; */
}



.brain-orientation-switcher {
  position: absolute;
  top: 20px;
  left: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  z-index: 10;
  max-width: 320px; /* LIMIT width to allow only two buttons per row */
}

@keyframes slideInElegant {
  0% {
    opacity: 0;
    transform: translateX(-80px);
    filter: blur(2px);
  }
  60% {
    opacity: 0.6;
    transform: translateX(10px);
    filter: blur(1px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
    filter: blur(0);
  }
}

.orientation-btn {
  font-family: 'Georgia', serif;
  padding: 5px 10px;
  border: 2px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  border-radius: 8px;
  font-weight: bold;
  transition: background 0.3s ease;
  min-width: 80px; /* or whatever width works nicely */
  text-align: center;

  opacity: 0;
  transform: translateX(-80px);
  animation: slideInElegant 1s ease-out forwards;
}

.orientation-btn:nth-child(1) {
  animation-delay: 0.2s;
}
.orientation-btn:nth-child(2) {
  animation-delay: 0.4s;
}
.orientation-btn:nth-child(3) {
  animation-delay: 0.6s;
}

.orientation-btn:nth-child(4) {
  animation-delay: 0.8s;
}



.orientation-btn.active {
  background-color: var(--note); /* Soft tan for active highlight */
}


@media (max-width: 600px) {
 

  .svg-aligned-wrapper {
    width: 90vw;  /* Shrink SVG container responsively */
    max-width: 450px;
  }

  .label {
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 8px;
  }

  .label-left,
  .label-right {
    top: 12px;
  }

  .region-info {
    padding: 10px;
    margin: 20px auto;
    font-size: 12px;
    max-width: 60vw;
  }

  .orientation-btn {
    padding: 3px 7px;
    font-size: 10px;
  }

  .brain-orientation-switcher {
    top: 12px;
    left: 12px;
    gap: 6px;
    flex-wrap: wrap;
  }

}

body, .brain-container {
  overflow-x: hidden;
}

/* === Neuroeconomics Banner Styles === */

#neuro-slide {
  position: absolute;
  top: 180px;
  right: 20px;
  max-width: 360px;
  z-index: 20;
  font-family: 'Georgia', serif;
}

/* Brain icon banner */
#neuro-banner {
  background: var(--panel-0);
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  gap: 8px;

  opacity: 0;
  transform: translateX(100px);
  animation: slideInFromRight 1s ease forwards 1s;
  transition: background 0.3s ease;
}

#neuro-banner:hover {
  background-color: var(--note-hover);
}

/* Slide in from right animation */
@keyframes slideInFromRight {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
/* The full info panel */
#neuro-info {
  display: block;
  background: var(--panel-0);
  border: 1.5px solid var(--ink);
  border-radius: 12px;
  padding: 20px;
  margin-top: 12px;
  font-size: 14px;
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  animation: unfurlSlide 0.4s ease forwards;

  /* scrolling */
  max-height: 300px;               /* cap the height */
  overflow-y: auto;                /* enable scroll */
  -webkit-overflow-scrolling: touch; /* smooth iOS scroll */
}

/* Collapse class (safe, scoped) */
#neuro-info.is-collapsed {
  display: none;
}

/* Expansion animation */
@keyframes unfurlSlide {
  from {
    opacity: 0;
    transform: scaleY(0.9) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scaleY(1) translateY(0);
  }
}

/* === Mobile tweaks === */
@media (max-width: 600px) {
  #neuro-info {
    font-size: 12px;   /* smaller text */
    padding: 12px;     /* reduce padding */
    max-height: 220px; /* tighter panel */
  }
}


.neuro-close-btn {
  font-family: 'Georgia', serif;
  padding: 5px 10px;
  border: 2px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  border-radius: 8px;
  font-weight: bold;
  transition: background 0.3s ease;
}

.neuro-close-btn:hover {
  background-color: var(--note);
}

@media (max-width: 600px) {
  #neuro-slide {
    max-width: 220px;   /* much smaller for iPhone */
    right: 10px;        /* tuck it in a bit */
    top: 140px;         /* optional: raise slightly on small screens */
  }

  #neuro-banner {
    padding: 6px 10px;
    font-size: 12px;
    gap: 6px;
    border-radius: 8px;
  }

  #neuro-banner i {
    font-size: 14px;
  }

  #neuro-banner span {
    font-size: 12px;
  }
}
