/* ==========================================================================
   LAP · AI4Science
   NUS / LAP Institutional Design System
   Palette: NUS Blue (#003D7C), Deep Navy (#002B5C), NUS Orange (#EF7C00),
            Crisp White (#FFFFFF), Cool Academic Gray (#F4F6F9)
   Typography: Roboto (300 / 400 / 500 / 700) + JetBrains Mono
   ========================================================================== */

:root {
  /* Institutional Brand Colors (matched to zxw.ac.cn / NUS palette) */
  --nus-blue: #003D7C;
  --nus-navy: #002B5C;
  --nus-navy-deep: #001D3D;
  --nus-blue-bright: #0056B3;
  --nus-ice: #E8F1FA;
  --nus-orange: #EF7C00;
  --nus-orange-soft: rgba(239, 124, 0, 0.12);

  /* Neutral Surfaces */
  --bg-white: #FFFFFF;
  --bg-tint: #F4F6F9;
  --bg-card: #FFFFFF;

  /* Ink Hierarchy */
  --ink-1: #1A202C;
  --ink-2: #333C4A;
  --ink-3: #556070;
  --ink-4: #7A8699;

  /* Hairlines & Shadows */
  --line-1: #E2E8F0;
  --line-2: #CBD5E1;
  --shadow-sm: 0 2px 8px rgba(0, 43, 92, 0.05);
  --shadow-md: 0 10px 30px -12px rgba(0, 43, 92, 0.12), 0 2px 6px rgba(0, 43, 92, 0.04);
  --shadow-lg: 0 18px 42px -14px rgba(0, 43, 92, 0.18), 0 4px 12px rgba(0, 43, 92, 0.06);

  /* Typography */
  --sans: "Roboto", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  background: var(--bg-white);
  color: var(--ink-1);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg-white);
}

.shell {
  width: 100%;
  max-width: 1240px;
  padding-inline: clamp(20px, 4vw, 36px);
  margin-inline: auto;
}

/* ==========================================================================
   Scroll Reveal & Motion Control
   ========================================================================== */
html.js:not([data-motion="off"]) .rv {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity 0.72s var(--ease-out) var(--d, 0s),
    transform 0.72s var(--ease-out) var(--d, 0s);
}

html.js:not([data-motion="off"]) .rv.in {
  opacity: 1;
  transform: none;
}

html[data-motion="off"] *,
html[data-motion="off"] *::before,
html[data-motion="off"] *::after {
  animation: none !important;
  transition: none !important;
}

html[data-motion="off"] .loop-pulse {
  display: none;
}

/* ==========================================================================
   01 · Full-Bleed Deep NUS Blue Hero Banner
   ========================================================================== */
.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1000px 560px at 82% 18%, rgba(89, 166, 255, 0.18) 0%, transparent 62%),
    radial-gradient(760px 480px at 12% 88%, rgba(239, 124, 0, 0.11) 0%, transparent 60%),
    linear-gradient(135deg, var(--nus-navy-deep) 0%, var(--nus-navy) 48%, var(--nus-blue) 100%);
  color: #FFFFFF;
  padding-block: clamp(64px, 8vw, 108px);
  border-bottom: 4px solid var(--nus-orange);
}

.hero__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.7;
}

.hero__grid-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 85% 85% at 50% 45%, #000 35%, transparent 100%);
}

.hero__inner {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(0, 0.94fr);
  gap: clamp(36px, 5vw, 72px);
  align-items: center;
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 22px;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #CFE4FF;
}

.hero__bar {
  width: 28px;
  height: 3px;
  background: var(--nus-orange);
  display: inline-block;
}

.hero__title {
  margin: 0 0 24px;
  font-family: var(--sans);
  font-weight: 300;
  font-size: clamp(2.4rem, 4.6vw, 3.8rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: #FFFFFF;
}

.hero__title strong {
  font-weight: 700;
  color: #FFFFFF;
}

.hero__lede {
  margin: 0 0 36px;
  max-width: 58ch;
  font-size: 1.05rem;
  font-weight: 300;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.86);
}

.hero__metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding-top: 26px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric__index {
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--nus-orange);
}

.metric__label {
  font-size: 0.92rem;
  font-weight: 500;
  color: #FFFFFF;
}

/* Interactive Closed-Loop Glass Panel in Hero */
.hero__visual {
  margin: 0;
}

.loop-panel {
  background: rgba(0, 29, 61, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  padding: 20px 22px 22px;
  backdrop-filter: blur(10px);
  box-shadow: 0 24px 48px -20px rgba(0, 10, 28, 0.55);
}

.loop-panel__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.loop-panel__tag {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: #CFE4FF;
}

.loop-panel__hint {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.56);
}

.loop-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.loop-core-ring {
  transform-origin: 230px 168px;
  animation: corePulse 3.6s ease-in-out infinite;
}

@keyframes corePulse {
  0%, 100% { opacity: 0.35; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.08); }
}

.svg-core-sub {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  fill: #93C5FD;
}

.svg-core-main {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 700;
  fill: #FFFFFF;
}

.loop-node {
  cursor: pointer;
  outline: none;
}

.svg-node-box {
  fill: rgba(255, 255, 255, 0.08);
  stroke: rgba(255, 255, 255, 0.24);
  stroke-width: 1.2;
  transition: fill 0.25s ease, stroke 0.25s ease, filter 0.25s ease;
}

.svg-node-kicker {
  font-family: var(--mono);
  font-size: 8.8px;
  letter-spacing: 0.1em;
  fill: #93C5FD;
}

.svg-node-title {
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 500;
  fill: #FFFFFF;
}

.loop-node:hover .svg-node-box,
.loop-node:focus-visible .svg-node-box {
  fill: rgba(255, 255, 255, 0.14);
  stroke: rgba(255, 255, 255, 0.55);
}

.loop-node.is-active .svg-node-box {
  fill: rgba(255, 255, 255, 0.96);
  stroke: var(--nus-orange);
  stroke-width: 2;
}

.loop-node.is-active .svg-node-kicker {
  fill: var(--nus-orange);
}

.loop-node.is-active .svg-node-title {
  fill: var(--nus-navy);
  font-weight: 700;
}

.loop-caption {
  margin-top: 10px;
  padding: 14px 16px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-left: 3px solid var(--nus-orange);
  min-height: 92px;
}

.loop-caption__badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: #FFB357;
  margin-bottom: 4px;
}

.loop-caption__text {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 300;
  line-height: 1.58;
  color: rgba(255, 255, 255, 0.9);
}

/* ==========================================================================
   Shared Institutional Sections
   ========================================================================== */
.section {
  padding-block: clamp(64px, 7.5vw, 96px);
}

.section--white {
  background: var(--bg-white);
}

.section--tint {
  background: var(--bg-tint);
  border-top: 1px solid var(--line-1);
  border-bottom: 1px solid var(--line-1);
}

.section__head {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 20px 44px;
  align-items: end;
  margin-bottom: clamp(34px, 4vw, 52px);
}

.section__kicker {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--nus-blue);
}

.section__title {
  margin: 0;
  font-family: var(--sans);
  font-weight: 300;
  font-size: clamp(1.85rem, 3.1vw, 2.55rem);
  line-height: 1.18;
  letter-spacing: -0.015em;
  color: var(--nus-navy);
}

.section__rule {
  width: 52px;
  height: 3px;
  background: var(--nus-orange);
  margin-top: 16px;
}

.section__summary {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 400;
  line-height: 1.7;
  color: var(--ink-3);
}

/* ==========================================================================
   02 · Three Pillars
   ========================================================================== */
.pillars {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.pillar {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--line-1);
  border-radius: 10px;
  padding: 28px 26px 24px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.28s var(--ease-out), box-shadow 0.28s var(--ease-out), border-color 0.28s ease;
}

.pillar__bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--nus-blue);
  transform-origin: left;
  transition: background 0.25s ease;
}

.pillar__bar--accent {
  background: var(--nus-orange);
}

.pillar:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--line-2);
}

.pillar:hover .pillar__bar {
  background: var(--nus-orange);
}

.pillar__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.pillar__num {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-4);
}

.pillar__badge {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--nus-blue);
  background: var(--nus-ice);
  padding: 4px 10px;
  border-radius: 4px;
}

.pillar__badge--accent {
  color: #B85D00;
  background: var(--nus-orange-soft);
}

.pillar__media {
  display: flex;
  justify-content: center;
  margin: 4px 0 22px;
}

.pillar__medallion {
  width: 212px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #FFFFFF 55%, #F4F7FB 100%);
  border: 1px solid rgba(0, 61, 124, 0.10);
  box-shadow:
    inset 0 2px 6px rgba(255, 255, 255, 0.95),
    0 14px 30px -16px rgba(0, 43, 92, 0.22),
    0 2px 6px rgba(0, 43, 92, 0.05);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.45s var(--ease-out), box-shadow 0.45s var(--ease-out), border-color 0.35s ease;
}

.pillar__medallion img {
  width: 92%;
  height: 92%;
  object-fit: contain;
  display: block;
  transition: transform 0.5s var(--ease-out);
}

.pillar:hover .pillar__medallion {
  transform: translateY(-4px);
  border-color: rgba(239, 124, 0, 0.45);
  box-shadow:
    inset 0 2px 6px rgba(255, 255, 255, 0.95),
    0 20px 36px -14px rgba(0, 43, 92, 0.28),
    0 4px 10px rgba(0, 43, 92, 0.08);
}

.pillar:hover .pillar__medallion img {
  transform: scale(1.045);
}

.pillar__title {
  margin: 0 0 12px;
  font-size: 1.28rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--nus-navy);
}

.pillar__desc {
  margin: 0 0 22px;
  font-size: 0.93rem;
  line-height: 1.7;
  color: var(--ink-2);
  flex: 1;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--line-1);
}

.tag-list li {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--nus-navy);
  background: var(--bg-tint);
  border: 1px solid var(--line-1);
  padding: 4px 9px;
  border-radius: 4px;
}

/* ==========================================================================
   03 · Methodology Pipeline
   ========================================================================== */
.pipeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.step {
  position: relative;
  background: var(--bg-white);
  border: 1px solid var(--line-1);
  border-top: 3px solid var(--nus-blue);
  border-radius: 8px;
  padding: 24px 22px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease-out), border-top-color 0.25s ease, box-shadow 0.25s ease;
}

.step:hover {
  transform: translateY(-4px);
  border-top-color: var(--nus-orange);
  box-shadow: var(--shadow-md);
}

.step__num {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--nus-orange);
  margin-bottom: 10px;
}

.step__title {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--nus-navy);
}

.step__body {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--ink-3);
}

/* ==========================================================================
   04 · Compute & Software Stack
   ========================================================================== */
.infra-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.infra-card {
  background: var(--bg-tint);
  border: 1px solid var(--line-1);
  border-left: 4px solid var(--nus-blue);
  border-radius: 8px;
  padding: 22px 24px;
  transition: border-left-color 0.25s ease, background 0.25s ease;
}

.infra-card:hover {
  border-left-color: var(--nus-orange);
  background: #FFFFFF;
  box-shadow: var(--shadow-sm);
}

.infra-card__label {
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--ink-4);
  margin-bottom: 8px;
}

.infra-card__value {
  display: block;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--nus-navy);
  margin-bottom: 10px;
}

.infra-card__meta {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.62;
  color: var(--ink-3);
}

.stack-panel {
  background: var(--bg-white);
  border: 1px solid var(--line-1);
  border-radius: 10px;
  padding: 26px;
  box-shadow: var(--shadow-sm);
}

.stack-panel__bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-bottom: 20px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line-1);
}

.stack-panel__title {
  margin: 0 0 2px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--nus-navy);
}

.stack-panel__sub {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-4);
}

.filter-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  background: var(--bg-tint);
  border: 1px solid var(--line-1);
  border-radius: 6px;
}

.filter-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 0.84rem;
  font-weight: 500;
  padding: 7px 15px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.filter-btn:hover {
  color: var(--nus-navy);
}

.filter-btn.is-active {
  background: var(--nus-blue);
  color: #FFFFFF;
}

.stack-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.stack-item {
  background: var(--bg-tint);
  border: 1px solid var(--line-1);
  border-radius: 8px;
  padding: 18px 20px;
  transition: border-color 0.22s ease, transform 0.22s var(--ease-out), background 0.22s ease;
}

.stack-item:hover {
  background: #FFFFFF;
  border-color: var(--nus-blue);
  transform: translateY(-2px);
}

.stack-item[hidden] {
  display: none;
}

.stack-item__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}

.stack-item__name {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--nus-navy);
}

.stack-item__cat {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--nus-blue);
}

.stack-item[data-cat="ml"] .stack-item__cat {
  color: #C26200;
}

.stack-item__desc {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.58;
  color: var(--ink-3);
}

/* Institutional Bridge Banner to existing HPC page */
.hpc-bridge {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 22px 26px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--nus-navy) 0%, var(--nus-blue) 100%);
  color: #FFFFFF;
}

.hpc-bridge__kicker {
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: #FFB357;
  margin-bottom: 4px;
}

.hpc-bridge__text {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.92);
}

.hpc-bridge__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 6px;
  background: var(--nus-orange);
  color: #FFFFFF;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.2s ease, transform 0.2s var(--ease-out);
}

.hpc-bridge__link:hover {
  background: #D96E00;
  transform: translateY(-1px);
}

/* ==========================================================================
   Minimal Institutional Footer
   ========================================================================== */
.foot {
  background: var(--bg-tint);
  border-top: 1px solid var(--line-1);
}

.foot__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding-block: 22px;
}

.foot__meta {
  margin: 0;
  font-size: 0.84rem;
  color: var(--ink-4);
}

.motion-toggle {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  border-radius: 6px;
  border: 1px solid var(--line-2);
  background: #FFFFFF;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 0.74rem;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.motion-toggle:hover {
  border-color: var(--nus-blue);
  color: var(--nus-navy);
}

.motion-toggle__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--nus-orange);
}

html[data-motion="off"] .motion-toggle__dot {
  background: var(--ink-4);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1024px) {
  .hero__inner,
  .section__head {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .pillars,
  .infra-grid,
  .stack-grid,
  .pipeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .hero__metrics,
  .pillars,
  .pipeline,
  .infra-grid,
  .stack-grid {
    grid-template-columns: 1fr;
  }

  .stack-panel {
    padding: 18px;
  }
}
