/*-----------------------------------*\
  #motion.css
  Motion layer (GSAP, see assets/js/motion.js) and the Research page.
  Everything here degrades to static, fully visible content without JS
  or under prefers-reduced-motion.
\*-----------------------------------*/





/*-----------------------------------*\
  #MOTION STATES
\*-----------------------------------*/

/* first frame: hidden until motion.js builds the intro (a timeout in <head> lifts this) */
.motion-pending .sidebar,
.motion-pending .navbar,
.motion-pending article.active { opacity: 0; }

/* GSAP owns page entrances once the motion layer is running */
.motion-ready article.active { animation: none; }

/* magnetic buttons: CSS must not ease the per-frame transforms GSAP writes */
.motion-ready .btn,
.motion-ready .form-btn {
  transition: box-shadow var(--transition-1), background var(--transition-1), color var(--transition-1);
}

/* elements mid-reveal must not have their transforms smoothed by CSS hover transitions */
.is-revealing { transition: none !important; }

/* kinetic type: each word rises out of its own mask */
.split-word {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-bottom: 0.12em;
  margin-bottom: -0.12em;
}

.split-inner {
  display: inline-block;
  will-change: transform;
}

.typed-text { display: inline-block; }

/* article titles: the gradient bar grows in with the heading */
.article-title::after {
  transform: scaleX(var(--title-bar, 1));
  transform-origin: left center;
}





/*-----------------------------------*\
  #SCROLL PROGRESS & SIGNAL FIELD
\*-----------------------------------*/

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--text-gradient-yellow);
  transform: scaleX(0);
  transform-origin: left center;
  z-index: 9500;
  pointer-events: none;
}

.signal-field {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}





/*-----------------------------------*\
  #NAVBAR (7 pages + sliding indicator)
\*-----------------------------------*/

.navbar-list {
  flex-wrap: nowrap;
  justify-content: space-evenly;
  padding: 0 4px;
}

.navbar-link {
  --fs-8: 10.5px;
  padding: 19px 4px;
  white-space: nowrap;
}

@media (max-width: 359px) {
  .navbar-link {
    --fs-8: 10px;
    padding: 18px 3px;
  }
}

/* the chat and terminal buttons sit above the bottom navbar until it moves to the top */
@media (max-width: 1023px) {
  .chat-fab { bottom: 72px; }
  .term-fab { bottom: 136px; }
}

.nav-indicator {
  position: absolute;
  left: 0;
  bottom: 12px;
  width: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--text-gradient-yellow);
  pointer-events: none;
}

@media (min-width: 580px) {
  .navbar-list { justify-content: center; }
  .navbar-link {
    --fs-8: 14px;
    padding: 20px 5px;
  }
}

@media (min-width: 768px) {
  .navbar-link {
    --fs-8: 15px;
    padding: 20px 7px;
  }
}

@media (min-width: 1024px) {
  .navbar-list { gap: 26px; }
  .nav-indicator { bottom: 14px; }
}





/*-----------------------------------*\
  #SPOTLIGHT CARDS
\*-----------------------------------*/

.has-spotlight { position: relative; }

.spotlight {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    260px circle at var(--spot-x, 50%) var(--spot-y, 50%),
    rgba(82, 246, 255, 0.11),
    transparent 70%
  );
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
  z-index: 2;
}

.has-spotlight:hover .spotlight { opacity: 1; }





/*-----------------------------------*\
  #RESUME TIMELINE
\*-----------------------------------*/

.timeline-list { position: relative; }

.timeline-progress {
  position: absolute;
  top: 5px;
  left: -30px;
  width: 1px;
  height: 0;
  background: linear-gradient(to bottom, var(--orange-yellow-crayola), var(--accent-lime));
  box-shadow: 0 0 10px rgba(82, 246, 255, 0.45);
  transform-origin: top center;
  pointer-events: none;
  z-index: 1;
}

.timeline-item::after { transition: box-shadow 0.5s ease, transform 0.5s ease; }

.timeline-item.is-passed::after {
  box-shadow: 0 0 0 4px rgba(82, 246, 255, 0.22), 0 0 14px rgba(82, 246, 255, 0.75);
  transform: scale(1.25);
}

.timeline-points {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.timeline-points li {
  position: relative;
  padding-left: 18px;
  color: var(--light-gray);
  font-size: var(--fs-7);
  font-weight: var(--fw-300);
  line-height: 1.55;
}

.timeline-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 8px;
  height: 1px;
  background: var(--orange-yellow-crayola);
}

.skill-progress-fill { transform-origin: left center; }





/*-----------------------------------*\
  #RESEARCH
\*-----------------------------------*/

.research .section-intro { margin-bottom: 26px; }

.paper {
  position: relative;
  margin-bottom: 24px;
  padding: 22px 18px;
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(16, 22, 36, 0.94), rgba(8, 12, 20, 0.94));
  border: 1px solid var(--surface-border);
  box-shadow: var(--shadow-2);
}

.paper:last-of-type { margin-bottom: 0; }

.paper-head { margin-bottom: 16px; }

.paper-title {
  color: var(--white-1);
  font-size: 18px;
  font-weight: var(--fw-600);
  line-height: 1.3;
  letter-spacing: -0.2px;
  max-width: 48ch;
  margin-bottom: 10px;
  text-wrap: balance;
}

.paper-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
  font-family: var(--ff-mono);
  font-size: 11.5px;
  color: var(--vegas-gold);
}

.paper-meta li { padding-right: 12px; }

.paper-meta a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--surface-border);
  text-underline-offset: 3px;
}

.paper-meta a:hover,
.paper-meta a:focus-visible { text-decoration-color: currentColor; }

.paper-meta li + li {
  padding-left: 12px;
  border-left: 1px solid var(--surface-border);
}

.paper-abstract {
  color: var(--light-gray);
  font-size: var(--fs-6);
  font-weight: var(--fw-300);
  line-height: 1.65;
  max-width: 64ch;
  margin-bottom: 18px;
}

.paper-abstract strong {
  color: var(--white-2);
  font-weight: var(--fw-600);
}

.paper-grid {
  display: grid;
  gap: 22px;
  margin-bottom: 22px;
}

/* stat tiles */
.paper-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 12px;
}

.paper-stats li {
  padding-left: 12px;
  border-left: 1px solid var(--surface-border);
}

.stat-num {
  color: var(--white-1);
  font-size: 26px;
  font-weight: var(--fw-600);
  line-height: 1.15;
  letter-spacing: -0.5px;
}

.stat-label {
  color: var(--light-gray-70);
  font-size: var(--fs-7);
  line-height: 1.4;
}

/* coverage chart: one series, bars grow from a shared baseline */
.coverage-chart {
  padding: 16px;
  border-radius: 14px;
  background: rgba(7, 10, 17, 0.6);
  border: 1px solid var(--surface-border);
}

.coverage-chart figcaption {
  color: var(--white-2);
  font-size: var(--fs-6);
  font-weight: var(--fw-500);
  margin-bottom: 4px;
}

.coverage-chart .chart-note {
  color: var(--light-gray-70);
  font-size: 12px;
  margin-bottom: 14px;
}

.cov-list {
  display: grid;
  gap: 12px;
  border-left: 1px solid rgba(120, 160, 190, 0.28);
}

.cov-row {
  display: grid;
  row-gap: 6px;
  transition: opacity 0.25s ease;
}

.cov-list:hover .cov-row:not(:hover) { opacity: 0.45; }

.cov-label {
  padding-left: 10px;
  color: var(--light-gray);
  font-size: 12.5px;
  line-height: 1.3;
}

.cov-track {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* bar colour validated for the dark surface (dataviz lightness band + contrast) */
.cov-fill {
  flex: 0 0 calc(var(--value) * (100% - 60px));
  height: 10px;
  border-radius: 0 4px 4px 0;
  background: #1fa3b3;
}

.cov-value {
  color: var(--white-2);
  font-size: var(--fs-7);
  font-weight: var(--fw-500);
  white-space: nowrap;
}

.cov-row-best .cov-label { color: var(--white-2); font-weight: var(--fw-500); }

/* numbered findings */
.paper-findings {
  display: grid;
  gap: 12px;
  margin-bottom: 22px;
  counter-reset: finding;
}

.paper-findings li {
  position: relative;
  padding: 14px 16px 14px 50px;
  border-radius: 14px;
  background: var(--surface-1);
  border: 1px solid var(--surface-border);
  counter-increment: finding;
}

.paper-findings li::before {
  content: counter(finding);
  position: absolute;
  top: 14px;
  left: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  font-family: var(--ff-mono);
  font-size: 12px;
  color: var(--smoky-black);
  background: var(--text-gradient-yellow);
}

.finding-title {
  color: var(--white-2);
  font-size: var(--fs-6);
  font-weight: var(--fw-600);
  margin-bottom: 4px;
}

.paper-findings p {
  color: var(--light-gray);
  font-size: var(--fs-7);
  font-weight: var(--fw-300);
  line-height: 1.55;
}

/* structural properties */
.property-list {
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
  counter-reset: property;
}

.property-list li {
  position: relative;
  padding-left: 34px;
  color: var(--white-2);
  font-size: var(--fs-6);
  line-height: 1.5;
  counter-increment: property;
}

.property-list li::before {
  content: counter(property, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 1px;
  font-family: var(--ff-mono);
  font-size: 12px;
  color: var(--orange-yellow-crayola);
}

/* lifecycle figure */
.lifecycle {
  margin-bottom: 22px;
  padding: 18px 16px;
  border-radius: 14px;
  background: rgba(7, 10, 17, 0.6);
  border: 1px solid var(--surface-border);
}

.lifecycle-sides {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.side {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: var(--fs-7);
  font-weight: var(--fw-500);
  color: var(--white-2);
  border: 1px solid var(--surface-border);
}

.side small {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  font-weight: var(--fw-300);
  color: var(--light-gray-70);
}

.side-vendor { background: linear-gradient(90deg, rgba(82, 246, 255, 0.14), rgba(82, 246, 255, 0.02)); }

.side-client {
  text-align: right;
  background: linear-gradient(270deg, rgba(184, 255, 106, 0.12), rgba(184, 255, 106, 0.02));
}

.lifecycle-stages {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.stage {
  --link: 1;
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* connector between consecutive stages (vertical on small screens) */
.stage:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 32px;
  width: 1px;
  height: calc(100% - 18px);
  background: linear-gradient(to bottom, var(--orange-yellow-crayola), rgba(82, 246, 255, 0.2));
  transform: scaleY(var(--link));
  transform-origin: top center;
}

.stage-num {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-family: var(--ff-mono);
  font-size: 13px;
  color: var(--orange-yellow-crayola);
  background: var(--eerie-black-1);
  border: 1px solid rgba(82, 246, 255, 0.35);
  transition: background 0.4s ease, color 0.4s ease, box-shadow 0.4s ease;
}

.stage.is-lit .stage-num {
  color: var(--smoky-black);
  background: var(--orange-yellow-crayola);
  box-shadow: 0 0 0 5px rgba(82, 246, 255, 0.12);
}

.stage-evidence.is-lit .stage-num {
  background: var(--accent-lime);
  box-shadow: 0 0 0 5px rgba(184, 255, 106, 0.14);
}

.stage-name {
  color: var(--white-2);
  font-size: var(--fs-7);
  line-height: 1.35;
}

.loop-track { display: none; }

.lifecycle-loops {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.loop {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--light-gray);
  font-size: var(--fs-7);
  font-weight: var(--fw-300);
  line-height: 1.5;
}

.loop ion-icon {
  flex-shrink: 0;
  margin-top: 1px;
  font-size: 18px;
  color: var(--orange-yellow-crayola);
}

.loop-product ion-icon { color: var(--accent-lime); }

.loop strong {
  color: var(--white-2);
  font-weight: var(--fw-500);
}

.lifecycle figcaption {
  color: var(--light-gray-70);
  font-size: 12px;
  line-height: 1.5;
}

/* research topics: static wrap by default, a marquee once motion.js runs */
.topic-marquee { margin-bottom: 22px; }

.topic-track {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.topic-track li {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: var(--fs-7);
  white-space: nowrap;
  color: var(--white-2);
  background: rgba(82, 246, 255, 0.08);
  border: 1px solid rgba(82, 246, 255, 0.2);
}

.motion-ready .topic-marquee {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.motion-ready .topic-track {
  flex-wrap: nowrap;
  width: max-content;
}

.paper-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.paper-actions .btn { font-family: inherit; }

.btn.is-copied {
  border-color: rgba(184, 255, 106, 0.5);
  color: var(--accent-lime);
}

@media (min-width: 580px) {
  .paper { padding: 26px; }
  .paper-title { font-size: 20px; }
  .paper-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 768px) {

  .paper-adequacy .paper-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    align-items: center;
    gap: 28px;
  }

  .paper-adequacy .paper-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .paper-findings { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .property-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }

  .property-list li {
    padding: 26px 0 0;
    font-size: var(--fs-7);
  }

  /* lifecycle becomes a horizontal track with the adaptation loop drawn beneath */
  .lifecycle { padding: 22px; }

  .lifecycle-stages {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0;
    margin-bottom: 0;
  }

  .stage {
    flex-direction: column;
    text-align: center;
    padding: 0 6px;
  }

  .stage:not(:last-child)::after {
    left: calc(50% + 20px);
    top: 16px;
    width: calc(100% - 40px);
    height: 1px;
    background: linear-gradient(90deg, var(--orange-yellow-crayola), rgba(82, 246, 255, 0.25));
    transform: scaleX(var(--link));
    transform-origin: left center;
  }

  .stage-name { font-size: 12.5px; }

  /* spans stage 2 to stage 6 centres: one column-half in from each edge of columns 2-6 */
  .loop-track {
    display: block;
    position: relative;
    height: 26px;
    margin: 8px calc(100% / 12) 14px calc(100% / 12 * 3);
    border: 1px solid rgba(82, 246, 255, 0.35);
    border-top: 0;
    border-radius: 0 0 12px 12px;
  }

  .loop-track-line {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 1px;
    background: var(--orange-yellow-crayola);
    transform-origin: right center;
  }

  .loop-track-dot {
    position: absolute;
    right: -4px;
    bottom: -4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-lime);
    box-shadow: 0 0 0 2px var(--eerie-black-1), 0 0 12px rgba(184, 255, 106, 0.8);
    opacity: 0;
  }

  .lifecycle-loops { grid-template-columns: 1fr 1fr; gap: 16px; }
}

@media (min-width: 1024px) {
  .paper { padding: 30px; }
  .paper-title { font-size: 21px; }
}





/*-----------------------------------*\
  #REDUCED MOTION
\*-----------------------------------*/

@media (prefers-reduced-motion: reduce) {
  .motion-pending .sidebar,
  .motion-pending .navbar,
  .motion-pending article.active { opacity: 1; }

  .scroll-progress,
  .signal-field,
  .spotlight,
  .nav-indicator { display: none; }
}
