/* =============================================================================
   FONTS
   ============================================================================= */

@font-face {
  font-family: "Tianzheng";
  src: url("../tianzheng_font.min.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
}

/* =============================================================================
   BASE & TYPOGRAPHY  (#11 softer text hierarchy)
   ============================================================================= */

body,
h1,
h2,
h3,
h4,
h5,
h6,
.navbar-brand {
  font-family: "Inter", sans-serif !important;
}

body {
  background-color: #fbfbfb;
  color: #4a5568;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: #2d3748;
}

/* =============================================================================
   SCROLL PROGRESS BAR  (#15)
   ============================================================================= */

#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, #4285f4, #9b72cb, #d96570);
  z-index: 9999;
  transition: width 0.05s linear;
}

/* =============================================================================
   LAYOUT
   ============================================================================= */

/* Navbar  (#5 scroll-shrink, #14 link hovers) */
.navbar {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(10px);
  background-color: rgba(255, 255, 255, 0.95) !important;
  padding-top: 1rem;
  padding-bottom: 1rem;
  transition:
    padding 0.3s ease,
    box-shadow 0.3s ease,
    backdrop-filter 0.3s ease;
}

.navbar.scrolled {
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(20px);
}

/* Nav link hover underline slide-in (#14) */
.navbar .nav-link {
  position: relative;
  transition: color 0.25s ease;
}

.navbar .nav-link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #4285f4, #9b72cb);
  transition:
    width 0.3s ease,
    left 0.3s ease;
  border-radius: 1px;
}

.navbar .nav-link:hover::after,
.navbar .nav-link.active::after {
  width: 100%;
  left: 0;
}

/* Active nav indicator (#4) */
.navbar .nav-link.active {
  color: #4285f4 !important;
  font-weight: 600;
}

/* Intro / Hero Section (#1 animated blobs) */
.block-intro {
  background-image: url("/img/bg-g-l.svg");
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  position: relative;
  overflow: hidden;
  min-height: max(700px, calc(100vh - 56px));
  display: flex;
  align-items: center;
  justify-content: center;
}

.block-intro::before,
.block-intro::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

.block-intro::before {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(66, 133, 244, 0.6), transparent 70%);
  top: -150px;
  right: -100px;
  animation: blob-float-1 12s ease-in-out infinite;
}

.block-intro::after {
  width: 550px;
  height: 550px;
  background: radial-gradient(
    circle,
    rgba(155, 114, 203, 0.55),
    transparent 70%
  );
  bottom: -100px;
  left: -80px;
  animation: blob-float-2 15s ease-in-out infinite;
}

/* Make hero content sit above the blobs */
.block-intro > .container {
  position: relative;
  z-index: 1;
  width: 100%;
}

@keyframes blob-float-1 {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(-60px, 40px) scale(1.1);
  }
  66% {
    transform: translate(30px, -30px) scale(0.95);
  }
}

@keyframes blob-float-2 {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(50px, -50px) scale(1.08);
  }
  66% {
    transform: translate(-40px, 20px) scale(0.92);
  }
}

/* Wave Divider (#7) */
.wave-divider {
  display: block;
  width: 100%;
  line-height: 0;
  margin-top: -2px;
}

.wave-divider svg {
  display: block;
  width: 100%;
  height: auto;
}

/* Avatar (#2 gradient ring + glow + hover) */
.avatar {
  width: clamp(150px, 25vw, 250px) !important;
  height: clamp(150px, 25vw, 250px) !important;
  border-radius: 50%;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  position: relative;
  transition:
    transform 0.4s ease,
    box-shadow 0.4s ease;
}

.avatar::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background-image: url("/img/avatars/figure.png");
  background-size: cover;
  background-position: center;
  z-index: 1;
}

/* Gradient ring via outline trick */
.avatar::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    #4285f4,
    #9b72cb,
    #d96570,
    #9b72cb,
    #4285f4
  );
  background-size: 300% 300%;
  z-index: 0;
  animation: ring-shift 4s ease infinite;
  filter: drop-shadow(0 0 15px rgba(155, 114, 203, 0.4));
}

@keyframes ring-shift {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* Hero staggered entrance (#3) */
.hero-reveal {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.7s ease,
    transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.hero-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Section Headings */
.SectionTitle {
  margin-bottom: 50px !important;
}

.SectionTitle h2 {
  margin-bottom: 0 !important;
}

h2.text-center::after {
  content: "";
  display: block;
  width: 80px;
  height: 4px;
  background: linear-gradient(to right, #4285f4, #9b72cb);
  margin: 10px auto 0;
  border-radius: 2px;
}

/* Dot-grid background texture (#12) */
.portfolio-block.cv {
  background-image: radial-gradient(circle, #d4d4d4 1px, transparent 1px);
  background-size: 28px 28px;
  background-position: 0 0;
}

/* Scroll-reveal sections (#6) */
.scroll-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition:
    opacity 0.6s ease-out,
    transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.scroll-reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Footer (#13 richer footer) */
.page-footer {
  padding: 24px 0 !important;
  border-top: 3px solid transparent;
  border-image: linear-gradient(90deg, #4285f4, #9b72cb, #d96570) 1;
  background: #f7f7f8;
}

.page-footer p {
  color: #4a5568;
  font-size: 11px;
  margin-bottom: 0;
}

/* =============================================================================
   COMPONENTS
   ============================================================================= */

/* --- Cards (Skills / Contact) --- (#8 glassmorphism) */
.portfolio-info-card {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
  margin-bottom: 20px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  transition:
    box-shadow 0.3s ease,
    transform 0.3s ease;
}

.portfolio-info-card:hover {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

/* --- Skill Pills (#10) --- */
.skill-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.skill-pill {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 500;
  color: #4a5568;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(66, 133, 244, 0.2);
  transition: all 0.25s ease;
}

.skill-pill:hover {
  background: linear-gradient(
    135deg,
    rgba(66, 133, 244, 0.1),
    rgba(155, 114, 203, 0.1)
  );
  border-color: rgba(155, 114, 203, 0.4);
  transform: translateY(-1px);
  box-shadow: 0 3px 12px rgba(66, 133, 244, 0.12);
}

.skill-category {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9b72cb;
  margin-top: 12px;
  margin-bottom: 6px;
}

.skill-category:first-child {
  margin-top: 0;
}

/* --- Education / Experience Items --- (#9 gradient border animation) */
.item {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid #f0f0f0;
  border-left: 5px solid #4285f4;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  position: relative;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-left-color 0.4s ease;
}

.item:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  border-left-color: #9b72cb;
}

.item .period {
  white-space: nowrap;
}

/* Details accordion */
.details {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition:
    max-height 0.3s cubic-bezier(0, 1, 0, 1),
    opacity 0.15s ease-out;
}

.details.show {
  max-height: 800px;
  opacity: 1;
  transition:
    max-height 0.4s ease-in-out,
    opacity 0.2s ease-in-out;
}

/* Experience item header — flex row with toggle left, title right */
h3.item-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
  margin-bottom: 8px;
  user-select: none;
}

.item-title {
  flex: 1;
}

/* Toggle button — circle pill that holds the chevron */
.item-toggle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4285f4, #9b72cb);
  box-shadow: 0 2px 6px rgba(66, 133, 244, 0.35);
  transition: box-shadow 0.2s ease;
}

h3.item-header:hover .item-toggle {
  box-shadow: 0 4px 12px rgba(66, 133, 244, 0.5);
}

/* Gradient chevron icon — white to contrast against the pill */
.item-toggle .arrow {
  color: white;
  font-size: 12px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: rotate(-90deg); /* collapsed = pointing right */
}

/* When open, rotate to point down */
h3.item-header.open .item-toggle .arrow {
  transform: rotate(0deg);
}

/* --- Contact List (#14 link hover) --- */
.contact-list {
  list-style: none;
  padding: 0;
}

.contact-list li {
  margin-bottom: 0.5rem;
}

.contact-list i {
  width: 1.5em;
  text-align: center;
  margin-right: 0.5rem;
}

.contact-list a {
  position: relative;
  text-decoration: none;
  color: #4285f4;
  transition: color 0.25s ease;
}

.contact-list a::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 0;
  height: 1.5px;
  background: linear-gradient(90deg, #4285f4, #9b72cb);
  transition: width 0.3s ease;
  border-radius: 1px;
}

.contact-list a:hover {
  color: #9b72cb;
}

.contact-list a:hover::after {
  width: 100%;
}

/* --- Intro Text --- */
.intro-text {
  font-weight: bold;
  font-size: clamp(1.2rem, 3.5vw, 3rem) !important;
  font-family: "Tianzheng", "Inter", sans-serif;
}

/* --- LinkedIn Icon --- */
.linkedin-icon {
  width: 1em;
  height: 1em;
  margin: 0 6px;
  vertical-align: middle;
  position: relative;
  top: -0.1em;
}

.linkedin-hidden {
  opacity: 0;
  pointer-events: none;
}

#linkedin-link {
  transition: opacity 0.3s ease;
}

/* =============================================================================
   ANIMATIONS & EFFECTS
   ============================================================================= */

@keyframes gradient-shift {
  0%,
  100% {
    background-position: 0% center;
  }
  50% {
    background-position: 100% center;
  }
}

@keyframes blink-caret {
  from,
  to {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

/* Gradient text highlight (static) */
.highlight {
  font-weight: bold;
  background: linear-gradient(
    74deg,
    #4285f4 0%,
    #9b72cb 9%,
    #d96570 20%,
    #d96570 24%,
    #9b72cb 35%,
    #4285f4 44%,
    #9b72cb 50%,
    #d96570 56%,
    #d96570 75%,
    #9b72cb 87%,
    #4285f4 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  position: relative;
  display: inline-block;
  animation: gradient-shift 3s ease infinite;
}

/* Typewriter animated text */
.typewriter-text {
  font-weight: 600;
  background: linear-gradient(
    74deg,
    #4285f4 0%,
    #9b72cb 30%,
    #d96570 60%,
    #9b72cb 80%,
    #4285f4 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  background-size: 200% auto;
  animation: gradient-shift 3s ease infinite;
}

/* Typewriter blinking cursor */
.typewriter-cursor {
  font-weight: 400;
  font-family: "Inter", sans-serif;
  color: #4285f4;
  animation: blink-caret 0.75s step-end infinite;
  margin-left: 2px;
}
