/* ---------------------------------------------------
RESEARCH (home page, section 02)
Left half: the paper list on the whiteboard surface.
Right half: the reading pane for the selected paper
(a full-screen sheet on phones). Builds on the card
system in assets/css/course-dashboard.css.
----------------------------------------------------- */
#section2 {
  background: transparent;
}

#section2 .fp-tableCell {
  display: block;
  height: 100% !important;
}

.rd-screen {
  position: relative;
  display: flex;
  align-items: stretch;
  min-height: 100vh;
}

/* the left half */
#research-dashboard.cd {
  width: 50%;                       /* exactly half: the divide matches the About panel */
  min-width: 560px;
  padding: 84px 40px 32px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(180deg, rgba(18, 18, 23, 0.82) 0%, rgba(18, 18, 23, 0.92) 100%);
  background-size: 28px 28px, 28px 28px, 100% 100%;
  color: rgba(255, 255, 255, 0.85);
}

/* on wide screens the panel grows but its content stays readable */
#research-dashboard.cd > * {
  width: 100%;
  max-width: 720px;
}

#section2 .cd-head {
  margin-bottom: 16px;
  padding-bottom: 16px;
}

#section2 .cd-head-side {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.cd-stat {
  margin-right: 6px;
  font-family: 'Inconsolata', monospace;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.4);
  white-space: nowrap;
}

.cd-stat b {
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
}

/* type switch: Published / Working papers / All */
.rd-seg {
  display: inline-flex;
  gap: 2px;
  align-self: flex-start;
  max-width: 100%;
  margin-bottom: 12px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  flex-shrink: 0;
}

.rd-seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-family: 'Quicksand', sans-serif;
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: .18em;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.rd-seg-btn small {
  font-family: 'Inconsolata', monospace;
  font-size: 10.5px;
  letter-spacing: 0;
  color: rgba(255, 255, 255, 0.28);
}

.rd-seg-btn:hover,
.rd-seg-btn:focus-visible {
  color: #fff;
  outline: none;
}

.rd-seg-btn.is-active {
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.rd-seg-btn.is-active small { color: rgba(255, 255, 255, 0.6); }
.rd-seg-btn.is-active[data-type="published"] { color: #86efac; }
.rd-seg-btn.is-active[data-type="working"] { color: #fcd34d; }
.rd-seg-btn.is-active[data-type="report"] { color: #93c5fd; }

/* topic sub-filter chips */
.cd-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
  flex-shrink: 0;
}

.cd-filters-label {
  margin-right: 4px;
  font-family: 'Inconsolata', monospace;
  font-size: 11px;
  letter-spacing: .08em;
  color: rgba(255, 255, 255, 0.3);
}

.cd-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  font-family: 'Quicksand', sans-serif;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: .14em;
  text-transform: uppercase;
  line-height: 1;
  color: rgba(255, 255, 255, 0.62);
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.cd-filter small {
  font-family: 'Inconsolata', monospace;
  font-size: 10px;
  letter-spacing: 0;
  color: rgba(255, 255, 255, 0.3);
}

.cd-filter:hover,
.cd-filter:focus-visible {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
  outline: none;
}

.cd-filter.is-active {
  color: #fff;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.04);
}

.cd-filter.is-active small { color: rgba(255, 255, 255, 0.6); }

.cd-filter.is-empty {
  opacity: 0.35;
  pointer-events: none;
}

/* paper cards */
.cd-card-num {
  font-family: 'Inconsolata', monospace;
  font-size: 12px;
  letter-spacing: .04em;
  color: rgba(255, 255, 255, 0.3);
  font-variant-numeric: tabular-nums;
}

.cd-chip--published { color: #86efac; border-color: rgba(134, 239, 172, 0.35); }
.cd-chip--working   { color: #fcd34d; border-color: rgba(252, 211, 77, 0.35); }
.cd-chip--report    { color: #93c5fd; border-color: rgba(147, 197, 253, 0.35); }

.cd-card--paper .cd-card-title {
  text-wrap: balance;
}

/* journal + co-authors, directly under the title */
.cd-card-venue {
  margin: -2px 0 0;
  font-family: 'Work Sans', sans-serif;
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.58);
}

.cd-card-journal {
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
}

.cd-card-sep {
  margin: 0 6px;
  color: rgba(255, 255, 255, 0.3);
}

.cd-card--paper .cd-card-desc {
  -webkit-line-clamp: 2;
}

/* cards open towards the pane: nudge right on hover, white bar on the selected one */
.cd-card--paper.is-clickable:hover,
.cd-card--paper.is-clickable:focus-visible {
  transform: translateX(3px);
}

.cd-card--paper::after {
  content: '';
  position: absolute;
  right: -1px;
  top: 14px;
  bottom: 14px;
  width: 2px;
  border-radius: 2px;
  background: #fff;
  opacity: 0;
  transform: scaleY(0.4);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.cd-card--paper.is-clickable:hover::after {
  opacity: 0.35;
  transform: scaleY(0.7);
}

.cd-card--paper.is-open {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
  transform: translateX(3px);
}

.cd-card--paper.is-open::after {
  opacity: 1;
  transform: none;
}

/* the connector: from the selected card's edge to the divide */
.rd-beam {
  position: absolute;
  z-index: 3;
  height: 2px;
  border-radius: 1px;
  background: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.35);
  transform-origin: left center;
  transform: scaleX(0);
  opacity: 0;
  pointer-events: none;
  transition: top 0.28s cubic-bezier(.2, .8, .2, 1);
}

/* ---------------------------------------------------
READING PANE (right half) — continues the list panel
----------------------------------------------------- */
.rd-reader {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: stretch;
  background: rgba(10, 10, 14, 0.9);
}

.rd-reader[hidden] {
  display: none;
}

/* marker on the divide, level with the selected paper */
.rd-reader-marker {
  position: absolute;
  left: -1px;
  width: 2px;
  border-radius: 2px;
  background: #fff;
  transition: top 0.28s cubic-bezier(.2, .8, .2, 1), height 0.28s cubic-bezier(.2, .8, .2, 1), opacity 0.2s ease;
  pointer-events: none;
}

.rd-reader-marker.is-off {
  opacity: 0;
}

.rd-reader-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 800px;
  min-height: 0;
  padding-top: 84px;
}

/* contents settle in one after another; leave upwards when switching paper */
.rd-stagger > * {
  opacity: 0;
  transform: translateY(10px);
}

.rd-stagger.is-in > * {
  opacity: 1;
  transform: none;
  transition: opacity 0.32s ease, transform 0.32s cubic-bezier(.2, .8, .2, 1);
}

.rd-stagger.is-in > :nth-child(1) { transition-delay: 0.06s; }
.rd-stagger.is-in > :nth-child(2) { transition-delay: 0.11s; }
.rd-stagger.is-in > :nth-child(3) { transition-delay: 0.16s; }
.rd-stagger.is-in > :nth-child(4) { transition-delay: 0.21s; }
.rd-stagger.is-in > :nth-child(5) { transition-delay: 0.26s; }
.rd-stagger.is-in > :nth-child(6) { transition-delay: 0.31s; }
.rd-stagger.is-in > :nth-child(n+7) { transition-delay: 0.36s; }

.rd-stagger.is-out > * {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.rd-reader-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 0 40px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.rd-reader-headtext {
  min-width: 0;
}

.rd-reader-kicker {
  margin: 0 0 8px;
  font-family: 'Quicksand', sans-serif;
  font-size: 10px;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
}

.rd-type-published { color: #86efac; }
.rd-type-working   { color: #fcd34d; }
.rd-type-report    { color: #93c5fd; }

.rd-reader-title {
  margin: 0;
  font-family: 'Quicksand', sans-serif;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  color: #fff;
  text-wrap: balance;
}

.rd-reader-venue {
  margin: 8px 0 0;
  font-family: 'Work Sans', sans-serif;
  font-size: 13px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.6);
}

.rd-reader-venue strong {
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
}

.rd-reader-close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.rd-reader-close:hover,
.rd-reader-close:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  outline: none;
}

.rd-reader-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 22px 40px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.rd-reader-body::-webkit-scrollbar { width: 5px; }
.rd-reader-body::-webkit-scrollbar-thumb { border-radius: 999px; background: rgba(255, 255, 255, 0.18); }

.rd-reader-body h4 {
  margin: 18px 0 8px;
  font-family: 'Quicksand', sans-serif;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
}

.rd-reader-body h4:first-child {
  margin-top: 0;
}

.rd-reader-body p {
  margin: 0 0 12px;
  font-family: 'Work Sans', sans-serif;
  font-size: 14px;
  font-weight: 300;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.78);
}

.cd-paper-cite {
  margin: 0;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 3px solid rgba(255, 255, 255, 0.45);
  background: rgba(0, 0, 0, 0.25);
  font-family: 'Inconsolata', monospace;
  font-size: 12.5px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.72);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.rd-reader-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.rd-reader-foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 40px 32px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  font-family: 'Quicksand', sans-serif;
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.rd-reader-foot a {
  max-width: 48%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.42);
  text-decoration: none;
  cursor: pointer;
}

.rd-reader-foot a:hover {
  color: #fff;
  text-decoration: none;
}

.rd-reader-foot a:empty {
  visibility: hidden;
}

.rd-reader-prev:not(:empty)::before { content: '\2190\00a0'; }
.rd-reader-next:not(:empty)::after  { content: '\00a0\2192'; }
.rd-reader-next { margin-left: auto; }

/* one glitch tick on the title as it lands: the shared keyframes in assets/css/style.css */
.rd-glitch { animation: text-tick 0.38s steps(1) 1; }

@media (prefers-reduced-motion: reduce) {
  .rd-stagger > *, .rd-stagger.is-in > *, .rd-stagger.is-out > * { opacity: 1; transform: none; transition: none; }
  .rd-glitch { animation: none; }
  .cd-card--paper.is-clickable:hover { transform: none; }
}

/* ---------------------------------------------------
RESPONSIVE
----------------------------------------------------- */
@media (max-width: 1199px) {
  #research-dashboard.cd {
    width: 58%;
    min-width: 0;
  }
  .rd-reader-head, .rd-reader-body, .rd-reader-foot { padding-left: 28px; padding-right: 28px; }
}

@media (max-width: 899px) {
  .rd-screen {
    display: block;
  }
  #research-dashboard.cd {
    width: 100%;
    max-width: none;
    padding-left: 20px;
    padding-right: 20px;
    border-right: 0;
  }
  #section2 .cd-head-side {
    justify-content: flex-start;
  }
  .rd-seg {
    overflow-x: auto;
    scrollbar-width: none;
  }
  .rd-seg::-webkit-scrollbar { display: none; }
  .cd-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-left: -20px;
    margin-right: -20px;
    padding: 0 20px 6px;
    scrollbar-width: none;
  }
  .cd-filters::-webkit-scrollbar { display: none; }
  .cd-filter { flex-shrink: 0; }

  /* reading pane becomes a full-screen sheet */
  .rd-reader {
    position: fixed;
    inset: 0;
    z-index: 10000;
    padding: 0;
    background: rgba(0, 0, 0, 0.6);
  }
  .rd-reader { background: rgba(18, 18, 23, 0.97); }
  .rd-reader-marker, .rd-beam { display: none; }
  .rd-stagger > * { opacity: 1; transform: none; }
  .rd-reader-panel {
    max-width: none;
    padding-top: 0;
    animation: rd-reader-up 0.28s ease;
  }
  @keyframes rd-reader-up {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: none; }
  }
  .rd-reader-head { padding: 14px 16px; }
  .rd-reader-body { padding: 18px 16px; }
  .rd-reader-foot { padding: 12px 16px 20px; }
  .rd-reader-title { font-size: 17px; }
  body.rd-reader-open { overflow: hidden; }
}
