/* Primary interface interaction language
   Purpose: clear affordance, restrained academic motion, and one coherent system. */

:root {
  --interaction-blue: #1677c8;
  --interaction-blue-deep: #0d5fa4;
  --interaction-line: rgba(69, 143, 207, 0.32);
  --interaction-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Header navigation: current location is always legible; hover previews the same rule. */
.nav-links a {
  position: relative;
  transition: color 180ms ease !important;
}

.nav-links a::after {
  left: 50% !important;
  right: auto !important;
  width: 100% !important;
  height: 2px !important;
  border-radius: 99px;
  background: currentColor !important;
  opacity: 0;
  transform: translateX(-50%) scaleX(0.22) !important;
  transform-origin: center;
  transition: transform 220ms var(--interaction-ease), opacity 180ms ease !important;
}

.nav-links a:hover::after,
.nav-links a:focus-visible::after,
.nav-links a.active::after {
  opacity: 1;
  transform: translateX(-50%) scaleX(1) !important;
}

.nav-links a:focus-visible,
.button:focus-visible,
.project-overview-link:focus-visible,
.studio-tabs button:focus-visible,
.proposal-tabs button:focus-visible,
.reader-toolbar button:focus-visible,
.reader-nav:focus-visible,
.page-card:focus-visible,
.carousel-card:focus-visible,
.section-rail a:focus-visible {
  outline: 2px solid rgba(22, 119, 200, 0.72) !important;
  outline-offset: 4px;
}

/* Compact chapter rail: a small web-native navigation component. */
.section-rail {
  position: fixed;
  z-index: 920;
  top: 50%;
  right: 18px;
  display: grid;
  gap: 4px;
  padding: 8px 6px;
  border: 1px solid rgba(110, 156, 196, 0.22);
  border-radius: 999px;
  background: rgba(248, 252, 255, 0.74);
  box-shadow: 0 12px 38px rgba(31, 74, 112, 0.09);
  backdrop-filter: blur(14px) saturate(125%);
  transform: translateY(-50%);
}

.section-rail a {
  position: relative;
  display: grid;
  place-items: center;
  width: 18px;
  height: 24px;
  color: #688098;
  text-decoration: none;
}

.section-rail a::after {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 rgba(22, 119, 200, 0);
  transition: width 220ms var(--interaction-ease), height 220ms var(--interaction-ease), color 180ms ease, box-shadow 220ms ease;
}

.section-rail a:hover::after,
.section-rail a.active::after {
  width: 9px;
  height: 9px;
  color: var(--interaction-blue);
  box-shadow: 0 0 0 4px rgba(22, 119, 200, 0.10);
}

.section-rail span {
  position: absolute;
  top: 50%;
  right: 25px;
  width: max-content;
  padding: 6px 9px 6px 28px;
  border: 1px solid rgba(101, 151, 195, 0.24);
  border-radius: 8px;
  color: #123958;
  background: rgba(250, 253, 255, 0.94);
  box-shadow: 0 10px 28px rgba(25, 68, 106, 0.10);
  font-size: 12px;
  font-weight: 720;
  letter-spacing: 0.02em;
  opacity: 0;
  pointer-events: none;
  transform: translate(7px, -50%);
  transition: opacity 160ms ease, transform 220ms var(--interaction-ease);
}

.section-rail i {
  position: absolute;
  z-index: 1;
  top: 50%;
  right: 70px;
  color: #6e91b1;
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translate(7px, -50%);
  transition: opacity 160ms ease, transform 220ms var(--interaction-ease);
}

.section-rail a:hover span,
.section-rail a:focus-visible span,
.section-rail a:hover i,
.section-rail a:focus-visible i {
  opacity: 1;
  transform: translate(0, -50%);
}

body[data-section="top"] .section-rail {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(8, 19, 29, 0.54);
}

body[data-section="top"] .section-rail a {
  color: rgba(230, 241, 248, 0.54);
}

body[data-section="top"] .section-rail a.active::after {
  color: #cde9fb;
  box-shadow: 0 0 0 4px rgba(205, 233, 251, 0.11);
}

/* Non-clickable evidence gets local light, not a fake button or 3D tilt. */
.ambient-surface {
  position: relative;
  isolation: isolate;
}

.surface-sheen {
  position: absolute !important;
  z-index: 3 !important;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(240px circle at var(--surface-x, 50%) var(--surface-y, 50%), rgba(151, 209, 248, 0.18), transparent 72%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.ambient-surface:hover > .surface-sheen {
  opacity: 1;
}

/* Clear, shared feedback for controls. */
.hero-actions a,
.studio-tabs button,
.proposal-tabs button,
.reader-toolbar button,
.project-overview-link,
.reader-nav {
  transition:
    color 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 220ms var(--interaction-ease),
    transform 220ms var(--interaction-ease) !important;
}

.hero-actions a:hover,
.project-overview-link:hover,
.reader-nav:hover {
  transform: translateY(-2px) !important;
}

.hero-actions a:active,
.project-overview-link:active,
.studio-tabs button:active,
.proposal-tabs button:active,
.reader-toolbar button:active,
.reader-nav:active {
  transform: translateY(0) scale(0.98) !important;
}

.project-overview-link {
  display: inline-flex !important;
  align-items: center;
  gap: 9px;
  padding-right: 10px !important;
}

.project-overview-link::after {
  content: "↗";
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: currentColor;
  background: rgba(22, 119, 200, 0.08);
  transition: transform 220ms var(--interaction-ease), background 180ms ease;
}

.project-overview-link:hover::after {
  background: rgba(255, 255, 255, 0.16);
  transform: translate(2px, -2px);
}

/* Academic outcomes: emphasize the real links, not the whole card as a button. */
.paper-list li {
  transition: border-color 220ms ease, box-shadow 240ms var(--interaction-ease), background-color 220ms ease !important;
}

.paper-list li:hover {
  border-color: rgba(70, 142, 207, 0.38) !important;
  box-shadow: 0 24px 54px rgba(35, 82, 123, 0.11) !important;
}

.paper-list li strong > a {
  text-decoration-color: transparent;
  text-underline-offset: 5px;
  transition: color 180ms ease, text-decoration-color 180ms ease;
}

.paper-list li strong > a:hover,
.paper-list li strong > a:focus-visible {
  color: var(--interaction-blue-deep) !important;
  text-decoration-color: rgba(22, 119, 200, 0.44);
}

.paper-actions a {
  display: inline-flex !important;
  align-items: center;
  gap: 4px;
}

.paper-actions a::after {
  content: "→";
  transform: translateX(-2px);
  transition: transform 180ms var(--interaction-ease);
}

.paper-actions a:hover::after {
  transform: translateX(2px);
}

/* Undergraduate path: responsive markers reveal the hierarchy without implying clicks. */
.foundation-card {
  transition: border-color 220ms ease, box-shadow 260ms var(--interaction-ease) !important;
}

.foundation-card:hover {
  border-color: rgba(74, 148, 213, 0.36) !important;
  box-shadow: 0 26px 62px rgba(36, 84, 126, 0.11) !important;
}

.foundation-card .foundation-node,
.foundation-card .foundation-num {
  transition: transform 220ms var(--interaction-ease), color 180ms ease, box-shadow 220ms ease;
}

.foundation-card:hover .foundation-node {
  transform: scale(1.15);
  box-shadow: 0 0 0 7px rgba(22, 119, 200, 0.10);
}

.foundation-card:hover .foundation-num {
  color: var(--interaction-blue-deep) !important;
  transform: translateX(2px);
}

/* Research trace: progression is shown by type and a restrained baseline, never arrows. */
#research .research-card,
#research .method-card,
#research .research-logic-panel {
  transition: border-color 220ms ease, box-shadow 260ms var(--interaction-ease), background-color 220ms ease !important;
}

#research .research-card:hover {
  border-color: rgba(55, 137, 207, 0.38) !important;
  box-shadow: inset 3px 0 0 rgba(22, 119, 200, 0.72), 0 18px 42px rgba(43, 91, 131, 0.08) !important;
  background-color: rgba(255, 255, 255, 0.82) !important;
}

#research .research-chain {
  position: relative;
  isolation: isolate;
}

#research .research-chain::before,
#research .research-chain::after {
  content: "" !important;
  display: block !important;
  position: absolute;
  z-index: 5;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  pointer-events: none;
}

#research .research-chain::before {
  background: rgba(86, 145, 195, 0.17);
}

#research .research-chain::after {
  right: auto;
  width: var(--research-progress, 0%);
  background: linear-gradient(90deg, #75afe0, #1777c8);
  box-shadow: 0 0 16px rgba(23, 119, 200, 0.22);
  opacity: 0;
  transition: width 340ms var(--interaction-ease), opacity 180ms ease;
}

#research.is-tracing .research-chain::after {
  opacity: 1;
}

#research .method-card {
  cursor: default !important;
}

#research .method-card > span,
#research .method-card h3,
#research .method-card small {
  transition: color 180ms ease, border-color 180ms ease, background-color 180ms ease, transform 220ms var(--interaction-ease);
}

#research .method-card.is-trace-past > span,
#research .method-card.is-trace-active > span {
  color: #ffffff !important;
  background: var(--interaction-blue) !important;
  border-color: var(--interaction-blue) !important;
}

#research .method-card.is-trace-active {
  background: inherit !important;
  box-shadow: inset 0 -2px 0 var(--interaction-blue) !important;
}

#research .method-card.is-trace-active h3 {
  color: var(--interaction-blue-deep) !important;
  transform: translateY(-1px);
}

#research.is-tracing .research-logic-panel {
  border-color: rgba(54, 137, 207, 0.40) !important;
  box-shadow: 0 28px 64px rgba(44, 91, 132, 0.12) !important;
}

/* Project media is the main visual interaction: calm parallax, clear viewing cue. */
.studio-gallery button {
  overflow: hidden;
  isolation: isolate;
}

.studio-gallery button img {
  transition: transform 520ms var(--interaction-ease), filter 260ms ease !important;
  transform: translate(var(--pointer-shift-x, 0), var(--pointer-shift-y, 0)) scale(1.002);
}

.studio-gallery button::before {
  content: "查看大图  ↗";
  position: absolute;
  z-index: 6;
  right: 12px;
  bottom: 12px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 999px;
  color: #ffffff;
  background: rgba(7, 30, 49, 0.68);
  box-shadow: 0 8px 24px rgba(9, 29, 46, 0.18);
  backdrop-filter: blur(9px);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.04em;
  opacity: 0;
  transform: translateY(7px);
  transition: opacity 180ms ease, transform 240ms var(--interaction-ease);
}

.studio-gallery button:hover img,
.studio-gallery button:focus-visible img {
  filter: saturate(1.04) contrast(1.02);
  transform: translate(var(--pointer-shift-x, 0), var(--pointer-shift-y, 0)) scale(1.035);
}

.studio-gallery button:hover::before,
.studio-gallery button:focus-visible::before {
  opacity: 1;
  transform: translateY(0);
}

.studio-tabs button,
.proposal-tabs button,
.reader-toolbar button {
  position: relative;
}

.studio-tabs button:not(.active):hover,
.proposal-tabs button:not(.active):hover,
.reader-toolbar button:not(.active):hover {
  color: var(--interaction-blue-deep) !important;
  border-color: rgba(22, 119, 200, 0.34) !important;
  background: rgba(234, 246, 255, 0.76) !important;
}

/* Reader: image navigation should feel tactile, but remain stable. */
.reader-nav:hover {
  border-color: rgba(22, 119, 200, 0.42) !important;
  color: var(--interaction-blue-deep) !important;
  background: rgba(247, 252, 255, 0.96) !important;
  box-shadow: 0 15px 32px rgba(31, 76, 116, 0.13) !important;
}

.page-card {
  transition: transform 240ms var(--interaction-ease), border-color 180ms ease, box-shadow 240ms var(--interaction-ease), opacity 180ms ease !important;
}

.page-card:hover,
.page-card:focus-visible {
  border-color: rgba(22, 119, 200, 0.46) !important;
  box-shadow: 0 18px 38px rgba(31, 75, 114, 0.14) !important;
  transform: translateY(-3px) !important;
}

.page-card:active {
  transform: translateY(0) scale(0.985) !important;
}

@media (max-width: 1180px) {
  .section-rail {
    display: none;
  }
}

@media (hover: none), (pointer: coarse) {
  .surface-sheen,
  .studio-gallery button::before {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .section-rail *,
  .surface-sheen,
  .nav-links a::after,
  .foundation-card,
  .foundation-card .foundation-node,
  .foundation-card .foundation-num,
  #research .research-card,
  #research .method-card,
  #research .method-card *,
  #research .research-chain::after,
  .studio-gallery button,
  .studio-gallery button img,
  .studio-gallery button::before,
  .page-card,
  .project-overview-link,
  .project-overview-link::after {
    transition: none !important;
  }

  .surface-sheen,
  #research .research-chain::after,
  .studio-gallery button::before {
    display: none !important;
  }

  .foundation-card:hover .foundation-node,
  .foundation-card:hover .foundation-num,
  #research .method-card.is-trace-active h3,
  .studio-gallery button:hover img,
  .page-card:hover,
  .project-overview-link:hover {
    transform: none !important;
  }
}
