/* --- NEW: Scroll Reveal Animation --- */
.reveal-text {
  transition:
    opacity 1s cubic-bezier(0.2, 0.8, 0.2, 1),
    transform 1s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: opacity, transform;
}

/* JS Users: Hidden initially */
html.js-enabled .reveal-text {
  opacity: 0;
  transform: translateY(30px);
}

/* JS Users: Revealed */
html.js-enabled .reveal-text.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delays for list items */
.reveal-delay-100 {
  transition-delay: 100ms;
}
.reveal-delay-200 {
  transition-delay: 200ms;
}
.reveal-delay-300 {
  transition-delay: 300ms;
}

/* --- NEW: Edu List Item Pop Animation --- */
.edu-item {
  /* SIMPLIFIED: Changed from bouncy cubic-bezier to smooth ease-out */
  transition: all 0.2s ease-out;
  position: relative;
  padding: 12px;
  margin: -12px;
  border-radius: 12px;
  border: 1px solid transparent;
}

.edu-item:hover {
  background: rgba(255, 255, 255, 0.6);
  /* SIMPLIFIED: Removed scale, reduced distance */
  transform: translateX(4px);
  box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.05);
  z-index: 20;
  border-color: rgba(0, 0, 0, 0.05);
}

/* Specific hover styles for Red card items */
.group:hover .edu-item-red:hover {
  background: rgba(255, 245, 245, 0.8); /* Softer red tint */
  border-color: rgba(254, 202, 202, 0.5);
}

/* Specific hover styles for Blue card items */
.group:hover .edu-item-blue:hover {
  background: rgba(239, 246, 255, 0.8); /* Softer blue tint */
  border-color: rgba(191, 219, 254, 0.5);
}

/* --- Markdown Alerts (GitHub Style 2024) --- */
.markdown-alert {
  padding: 8px 16px;
  margin-bottom: 16px;
  border-left: 3px solid;
  font-size: 14px;
  color: inherit;
  /* Use explicit GitHub-like colors */
}

.markdown-alert-title {
  display: flex;
  align-items: center;
  font-weight: 600;
  margin-bottom: 4px;
  gap: 8px;
  line-height: 1.5;
}

.markdown-alert-title svg {
  width: 16px;
  height: 16px;
}

/* Note (Blue) */
.markdown-alert-note {
  background-color: #f8faff; /* Subtler blue */
  border-left-color: #0969da;
  color: #1f2328;
}
.markdown-alert-note .markdown-alert-title {
  color: #0969da;
}

/* Tip (Green) */
.markdown-alert-tip {
  background-color: #f6fff8; /* Subtler green */
  border-left-color: #1a7f37;
  color: #1f2328;
}
.markdown-alert-tip .markdown-alert-title {
  color: #1a7f37;
}

/* Important (Purple) */
.markdown-alert-important {
  background-color: #fcfaff; /* Subtler purple */
  border-left-color: #8250df;
  color: #1f2328;
}
.markdown-alert-important .markdown-alert-title {
  color: #8250df;
}

/* Warning (Amber) */
.markdown-alert-warning {
  background-color: #fff8c5; /* Official GitHub light warning bg is typically yellowish */
  background-color: #fffdf5; /* Tweaked for cleaner look */
  border-left-color: #9a6700;
  color: #1f2328;
}
.markdown-alert-warning .markdown-alert-title {
  color: #9a6700;
}

/* Caution (Red) */
.markdown-alert-caution {
  background-color: #fff5f5; /* Subtler red */
  border-left-color: #cf222e;
  color: #1f2328;
}
.markdown-alert-caution .markdown-alert-title {
  color: #cf222e;
}

/* Spacing Override for Typography Plugin */
.prose .markdown-alert {
  margin-top: 1.25em;
  margin-bottom: 1.25em;
}
.prose .markdown-alert p {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
  line-height: 1.5;
}
.prose .markdown-alert .markdown-alert-title {
  margin-top: 0;
  margin-bottom: 0;
}

/* --- Original Marquee Animation Restoration --- */
@keyframes marquee {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

.animate-marquee {
  display: flex;
  width: max-content;
  animation: marquee 30s linear infinite;
  will-change: transform; /* Kept for performance optimization */
}

/* Pause on hover */
.hover-pause:hover .animate-marquee {
  animation-play-state: paused;
}

/* Utility class overrides for the JS component specific needs if any */
.font-mono-custom {
  font-family: "JetBrains Mono", monospace;
}

/* --- GRAPH STYLES (Migrated from about.html) --- */

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background-color: #e4e4e7;
  border-radius: 20px;
}

/* Path Transitions & Glows */
.path-line {
  transition:
    opacity 0.6s ease,
    stroke 0.6s ease,
    filter 0.6s ease;
}
.path-active-red {
  stroke: #ef4444;
  opacity: 1;
  filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.6));
  stroke-width: 3;
}
.path-active-blue {
  stroke: #3b82f6;
  opacity: 1;
  filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.7));
  stroke-width: 3;
}
.path-inactive {
  opacity: 0.1;
  filter: none;
  stroke-width: 2;
}
.path-inactive.red-base {
  stroke: #ef4444;
}
.path-inactive.blue-base {
  stroke: #3b82f6;
}

/* Node Centering Strategy */
.node-circle {
  transform: translate(-50%, -50%);
  transition:
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    background-color 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease,
    filter 0.3s ease,
    opacity 0.3s ease;
  cursor: pointer;
  z-index: 50;
}
.node-circle:hover {
  transform: translate(-50%, -50%) scale(1.2);
  z-index: 70;
}
.node-circle.active-node {
  transform: translate(-50%, -50%) scale(1.15);
  z-index: 60;
}

/* NODE DIMMING LOGIC */
.node-wrapper.node-dimmed .node-circle {
  opacity: 0.8;
  filter: grayscale(1);
  border-color: #52525b;
}
.node-wrapper.node-dimmed .node-label {
  opacity: 0;
  transform: translateY(5px);
}
.node-wrapper.node-dimmed:hover .node-circle {
  opacity: 1;
  filter: grayscale(0);
}
.node-wrapper.node-dimmed:hover .node-label {
  opacity: 1;
  transform: translateY(0);
}

/* Label Transitions */
.node-label {
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

/* Active Glows */
.node-active-glow {
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.6);
  border-color: #93c5fd;
  background-color: #172554;
  color: white;
}
.node-active-glow-red {
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.6);
  border-color: #fca5a5;
  background-color: #450a0a;
  color: white;
}

/* PARTICLE ANIMATIONS */
.particle-dot {
  opacity: 0;
  fill: white;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.9));
  will-change: offset-path, offset-distance, opacity;
}
/* Dynamic offset-path handled in Trajectory.ts */

/* Chaos Section & Node Animations */
.node-wrapper {
  position: absolute;
  transition:
    top 1s cubic-bezier(0.4, 0, 0.2, 1),
    left 1s cubic-bezier(0.4, 0, 0.2, 1),
    transform 1s ease;
  z-index: 20;
  will-change: top, left, transform;
}
.node-visual {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  border-radius: 9999px;
  border-width: 1px;
  font-family: monospace;
  font-size: 0.75rem;
  font-weight: 500;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(12px);
  transition:
    transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    background-color 0.5s ease,
    border-color 0.5s ease,
    color 0.5s ease;
  cursor: default;
}
.node-visual:hover {
  transform: scale(1.2);
  z-index: 50;
  background-color: rgba(39, 39, 42, 0.95);
  border-color: rgba(59, 130, 246, 0.5);
}
.physics-active {
  transition: none !important;
}

/* Terminal Typing Effect Cursor */
.typing-cursor::after {
  content: "▋";
  animation: blink 1s step-start infinite;
  color: #3b82f6;
  margin-left: 2px;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* Grid Backgrounds */
.bg-grid {
  background-image:
    linear-gradient(to right, #f4f4f5 1px, transparent 1px),
    linear-gradient(to bottom, #f4f4f5 1px, transparent 1px);
  background-size: 40px 40px;
}
.bg-grid-dark {
  background-image:
    linear-gradient(to right, #27272a 1px, transparent 1px),
    linear-gradient(to bottom, #27272a 1px, transparent 1px);
  background-size: 40px 40px;
}

/* --- TIMELINE STYLES (Migrated from about.html) --- */
.timeline-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  /* ANCHOR: Scroll Bubble Defense - Prevent Trap */
  overscroll-behavior: auto !important;
  touch-action: pan-y !important;
  pointer-events: auto !important;
}
.description-content {
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mobile: Active state triggers expansion + Scroll Snap */
@media (max-width: 768px) {
  /* Fix Scroll Trap: Remove snap from html */
  html {
    scroll-snap-type: none !important;
  }

  /* New Wrapper controls the snap environment (Consolidated V5) */
  .timeline-scroll-wrapper {
    scroll-snap-type: y proximity !important; /* ANCHOR: Snapping is Proximity (Fixes Exit Trap) */
    overscroll-behavior: auto !important;     /* ANCHOR: Exit Strategy */
    overflow-y: auto !important;
    height: 80vh !important;
    padding-top: 0 !important;                /* FILTER: Precision - Anchor at 0px */
    padding-bottom: 0 !important;             /* FILTER: Symmetry - handled by HTML Spacer */
    scroll-padding-top: 0 !important;
    scrollbar-width: none;
    -ms-overflow-style: none;
    clip-path: inset(0 0 0 0);                /* FILTER: Leak Clip */
  }

  .timeline-scroll-wrapper::-webkit-scrollbar {
    display: none;
  }

  .timeline-item {
    scroll-snap-align: center !important;
    scroll-snap-stop: always !important; /* ANCHOR: Precision */
    scroll-snap-stop: always !important; /* Strict Stop */
    min-height: 30vh !important; /* V5: Ultra-Dense (Allows 50vh space for neighbors) */
    display: flex;
    position: relative !important;
    align-items: center;
    flex-direction: column;
    justify-content: center;
  }

  /* FILTER: Symmetry Compensation */
  .timeline-first {
      margin-top: calc(35vh - 2rem) !important;
  }

  /* V3.5: Populate Estate - Always show content on mobile */
  .description-content {
    max-height: none !important;
    opacity: 1 !important;
    margin-top: 1rem !important;
  }

  /* V3.5: Better Padding */
  .timeline-card {
    padding: 1.75rem !important;
  }

  /* Refined Animation */
  .timeline-card, .description-content, .timeline-dot {
    transition-duration: 0.6s !important; /* Slower */
    transition-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1) !important; /* Soft ease */
  }

  .timeline-item.active .timeline-card {
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 0 0 40px -5px rgba(99, 102, 241, 0.4); /* Stronger pop */
    transform: scale(1.02);
  }
  /* Removed Legacy .active expansion to prevent layout thrashing */
  /* V4: Mobile Interactive Focus ("The Pop") */
  /* V6: Fluid Animation Profile (Flowing & Effortless) */
  /* Default State (Background/Dimmed) */
  .timeline-item .timeline-card {
    opacity: 0.15 !important;
    transform: scale(0.95);
    will-change: transform, opacity; /* Hardware Accel */
    /* Decoupled Transitions for Organic Feel */
    transition: 
        opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),      /* Smooth fade */
        transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), /* Elastic pop */
        box-shadow 0.6s ease;
  }

  /* Active State (Foreground/Focused) - VISUAL ONLY */
  .timeline-item.active .timeline-card {
    opacity: 1 !important;
    transform: scale(1.0);
    box-shadow: 0 0 40px -5px rgba(99, 102, 241, 0.6) !important;
    border-color: rgba(99, 102, 241, 0.8) !important;
  }

  /* Snapped State (Stopped) - CONTENT EXPANSION */
  /* This only happens when scroll stops, preventing layout thrashing */
  .timeline-item.snapped .description-content {
    max-height: 500px; /* Generous limit */
    opacity: 1;
    margin-top: 1rem;
  }

  .timeline-item.snapped .timeline-card {
    /* Optional: Extra pop when fully snapped? */
  }

  /* Active Dot Pop */
  .timeline-item.active .timeline-dot {
    background-color: #6366f1 !important;
    transform: scale(1.5);
    box-shadow: 0 0 15px rgba(99, 102, 241, 1);
  }

  /* Robust Mobile Alignment Fix (V3.6) */
  .mobile-dot-fix {
    left: 19px !important;
    transform: translateX(-50%) !important;
  }
}
