/* =========================================================
   animations.css – icons, scroll reveal, hover effects
   Everything respects "reduce motion" (see the bottom).
   ========================================================= */

/* ---------- 1. Page load + scroll progress bar ---------- */
body {
  animation: page-in .5s ease both;
}
@keyframes page-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 50;
  background: var(--beam);
  transform-origin: left;
  transform: scaleX(0);
}

/* ---------- 2. Scroll reveal (JS adds .is-visible) ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .7s ease, transform .7s ease;
}
.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- 4. Icon base ---------- */
.icon {
  width: 56px;
  height: 56px;
  flex: none;
  color: var(--beam);
  overflow: visible;
  --play: paused;
}
.icon-large {
  width: 92px;
  height: 92px;
}
.icon * {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon .soft {
  stroke: var(--soft);
}
.icon .thick {
  stroke-width: 8;
}
.icon .fillc {
  fill: currentColor;
  stroke: none;
}
.icon .accent {
  stroke: var(--amber);
}

/* animations that loop only while hovered / focused (or always on big icons) */
.tool-item:hover .icon, .tool-item:focus-within .icon, .icon-live {
  --play: running;
}

/* draw-in: lines "write themselves" when the icon first appears */
.icon .draw {
  stroke-dasharray: 100;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1.1s ease;
}
.js .icon:not(.drawn) .draw {
  stroke-dashoffset: 100;
}
.icon .draw:nth-of-type(2) {
  transition-delay: .15s;
}
.icon .draw:nth-of-type(3) {
  transition-delay: .3s;
}
.tool-item:hover .icon .draw, .tool-item:focus-within .icon .draw {
  animation: redraw .9s ease;
}
@keyframes redraw {
  from {
    stroke-dashoffset: 100;
  }
  to {
    stroke-dashoffset: 0;
  }
}

/* ---------- 5. Individual icons ---------- */

/* Ansys Lumerical – light pulse running along a waveguide */
.ic-light, .g-light {
  stroke: var(--amber);
  stroke-dasharray: 12 88;
  animation: travel 2.4s linear infinite;
  animation-play-state: var(--play, running);
}
@keyframes travel {
  from {
    stroke-dashoffset: 12;
  }
  to {
    stroke-dashoffset: -88;
  }
}

/* Adobe Illustrator – pulsing bezier handles */
.ic-pulse {
  transform-box: fill-box;
  transform-origin: center;
  animation: pulse 1.2s ease-in-out infinite;
  animation-play-state: var(--play);
}
@keyframes pulse {
  50% {
    transform: scale(1.7);
  }
}

/* Adobe Photoshop – layers breathe apart and together */
.ic-l1 {
  animation: lift-up 1.4s ease-in-out infinite alternate;
  animation-play-state: var(--play);
}
.ic-l3 {
  animation: lift-down 1.4s ease-in-out infinite alternate;
  animation-play-state: var(--play);
}
@keyframes lift-up {
  to {
    transform: translateY(-6px);
  }
}
@keyframes lift-down {
  to {
    transform: translateY(6px);
  }
}

/* MS Office – text lines draw one after another (delays above) */

/* CapCut – play button pulse */
.ic-play {
  fill: currentColor;
  transform-box: fill-box;
  transform-origin: center;
  animation: pulse-soft 1.3s ease-in-out infinite;
  animation-play-state: var(--play);
}
@keyframes pulse-soft {
  50% {
    transform: scale(1.25);
  }
}

/* Research – dashed ring slowly rotating */
.ic-ring {
  stroke-dasharray: 6 5;
  transform-box: fill-box;
  transform-origin: center;
  animation: spin 6s linear infinite;
  animation-play-state: var(--play);
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Education – tassel swinging */
.ic-tassel {
  transform-box: fill-box;
  transform-origin: top center;
  animation: swing 1.6s ease-in-out infinite alternate;
  animation-play-state: var(--play);
}
@keyframes swing {
  from {
    transform: rotate(-14deg);
  }
  to {
    transform: rotate(14deg);
  }
}

/* Computer – blinking cursor */
.ic-cursor {
  animation: blink 1s steps(2, start) infinite;
  animation-play-state: var(--play);
}
@keyframes blink {
  to {
    opacity: 0;
  }
}

/* Contact – envelope floating */
.ic-env {
  animation: float 1.6s ease-in-out infinite alternate;
  animation-play-state: var(--play);
}
@keyframes float {
  to {
    transform: translateY(-5px);
  }
}

/* ---------- 6. Home page waveguide divider ---------- */
.guide {
  display: block;
  width: 100%;
  height: 56px;
  margin: 8px 0 0;
}
.guide path {
  fill: none;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.g-core {
  stroke: var(--line);
  stroke-width: 12;
}
.g-light {
  stroke-width: 3;
  animation-duration: 4.5s;
  --play: running;
}

/* ---------- 8. Reduce motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .js .reveal {
    opacity: 1;
    transform: none;
  }
  .js .icon:not(.drawn) .draw {
    stroke-dashoffset: 0;
  }
}

/* hero + page title extras */
.guide {
  display: block;
  width: 100%;
  height: 56px;
}
.page-title {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.tool-item:hover .tool-text, .tool-item:focus-within .tool-text {
  transform: translateX(4px);
}
