/* Research areas page (/areas/) — the "molecule" of research areas + paper panel */

.areas-stage {
  position: relative;
  margin: 28px 0 30px;
  border-radius: 20px;
  overflow: clip;            /* not 'hidden': keeps the molecule sticky beside long lists */
  background:
    radial-gradient(700px 360px at 85% 0%, rgba(20,184,166,.20), transparent 65%),
    radial-gradient(500px 300px at 0% 100%, rgba(240,138,60,.08), transparent 60%),
    linear-gradient(160deg, #0b1a2a 0%, var(--ink) 55%, #12304a 100%);
  box-shadow: var(--shadow-md);
}
.areas-graph { position: relative; }
.areas-stage svg { display: block; width: 100%; height: auto; transition: opacity .17s ease; }
.areas-stage-title {
  margin: 0; padding: 26px 32px 0;
  font-family: var(--font-display); font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 700;
  color: #fff; letter-spacing: -0.02em;
}
.areas-stage-title::before { display: none; }   /* no accent bar inside the dark panel */

/* bonds */
.ar-bond { cursor: pointer; outline: none; }
.ar-bond-line { stroke: rgba(190, 205, 215, .45); stroke-linecap: round; transition: stroke .25s ease, opacity .25s ease; }
.ar-bond-hit { stroke: transparent; stroke-linecap: round; }
.ar-bond.is-lit .ar-bond-line { stroke: rgba(143, 227, 216, .95); }
.ar-bond.is-selected .ar-bond-line { stroke: #8fe3d8; }

/* spheres */
.ar-atom { cursor: pointer; outline: none; }
.ar-sphere { filter: drop-shadow(0 8px 18px rgba(0,0,0,.45)); transition: opacity .25s ease; }
.ar-halo { fill: none; stroke: rgba(143,227,216,0); stroke-width: 3; transition: stroke .25s ease; }
.ar-atom:hover .ar-halo, .ar-atom:focus-visible .ar-halo, .ar-atom.is-main .ar-halo { stroke: rgba(143,227,216,.55); }
.ar-atom.is-selected .ar-halo { stroke: #8fe3d8; stroke-dasharray: 5 4; }
.ar-ring { fill: none; stroke-width: 3; opacity: .9; pointer-events: none; }
.ar-badge { stroke: #0b1a2a; stroke-width: 3; filter: drop-shadow(0 2px 4px rgba(0,0,0,.4)); }
.ar-count { font-family: var(--font-display); font-weight: 800; text-anchor: middle; pointer-events: none; }
.ar-label { font-family: var(--font-display); font-weight: 600; fill: #e6f1f5; text-anchor: middle; pointer-events: none;
            paint-order: stroke; stroke: rgba(11,26,42,.85); stroke-width: 4px; stroke-linejoin: round; }

/* dim everything that isn't related to the hovered / selected item */
.areas-stage.has-focus .ar-atom:not(.is-lit) { opacity: .1; }
.areas-stage.has-focus .ar-atom.is-lit:not(.is-main) { opacity: .55; }      /* connected areas: visible but secondary */
.areas-stage.has-focus .ar-atom.is-lit:not(.is-main) .ar-label { fill: #9fb2c1; }
.areas-stage.has-focus .ar-bond:not(.is-lit) .ar-bond-line { opacity: .04; }
.areas-stage.has-focus .ar-bond.is-lit:not(.is-selected) .ar-bond-line { opacity: .6; }
.ar-atom, .ar-bond { transition: opacity .25s ease; }

.areas-tip {
  position: absolute; z-index: 2; pointer-events: none;
  padding: 8px 12px; border-radius: 10px; max-width: 220px;
  background: rgba(255,255,255,.96); color: var(--ink); box-shadow: var(--shadow-md);
  font-size: .85rem; line-height: 1.35;
  opacity: 0; transform: translateY(4px); transition: opacity .15s ease, transform .15s ease;
}
.areas-tip.show { opacity: 1; transform: none; }
.areas-tip strong { display: block; font-family: var(--font-display); }
.areas-tip span { color: var(--muted); }

/* ---------- paper panel ----------
   Wide screens: two columns inside the stage (molecule | papers), the molecule
   stays in view while a long list scrolls with the page. Narrow screens: the
   panel sits directly below the molecule. */
.areas-body { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) {
  .areas-stage.is-open .areas-body { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
  .areas-stage.is-open .areas-graph { position: sticky; top: 70px; }
}

.areas-panel {
  align-self: start;
  overflow: hidden;
  margin: 0 16px 16px;
  padding: 22px 24px 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .10);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  color: #dbe7ef;
}
@media (min-width: 900px) { .areas-panel { margin: 16px 20px 20px 0; } }
.areas-panel[hidden] { display: none; }

.areas-panel-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  margin: -22px -24px 6px; padding: 20px 24px 18px;
  background: rgba(4, 12, 24, .62);
  border-bottom: 1px solid rgba(255,255,255,.10);
  border-left: 5px solid var(--area, #2dd4bf);
  border-radius: 16px 16px 0 0;
}
.areas-panel-head h2 {
  margin: 0; font-size: 1.35rem; color: #fff; outline: none;
}
.areas-panel-head h2::before { display: none; }
.areas-panel-head p { margin: 4px 0 0; font-size: .9rem; color: #9fb2c1; line-height: 1.45; }
.areas-close {
  flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.06);
  color: #e6f1f5; font-size: 1.35rem; line-height: 1; cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease;
}
.areas-close:hover, .areas-close:focus-visible { background: rgba(20,184,166,.25); border-color: rgba(143,227,216,.6); outline: none; }

.areas-papers { list-style: none; margin: 0; padding: 0; }
.areas-papers li { padding: 12px 0; border-top: 1px solid rgba(255,255,255,.08); }
.areas-papers li:first-child { border-top: none; }
.pp-title { font-family: var(--font-display); font-weight: 600; font-size: .98rem; line-height: 1.4; color: #fff; }
.pp-title a, .pp-title a:visited { color: #fff; background-image: linear-gradient(#8fe3d8, #8fe3d8); background-size: 0% 1px; }
.pp-title a:hover { color: #8fe3d8; background-size: 100% 1px; }
.pp-meta { margin-top: 3px; font-size: .82rem; color: #9fb2c1; }

/* entrance: panel slides in, entries fade up one after another */
.areas-panel.is-entering { animation: ar-panel-in .35s ease both; }
.areas-panel.is-entering li { animation: ar-item-in .4s ease both; animation-delay: calc(var(--i, 0) * 35ms + 80ms); }
@keyframes ar-panel-in { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes ar-item-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (max-width: 899.98px) { @keyframes ar-panel-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } } }
@media (prefers-reduced-motion: reduce) {
  .areas-panel.is-entering, .areas-panel.is-entering li { animation: none; }
}
