/* ============================================================
   Custom Styles — stanleyluuuu.github.io
   Fonts loaded via <link> in layouts/partials/head/extensions.html
   ============================================================ */

/* ============================================================
   CSS CUSTOM PROPERTIES — colour system
   ============================================================ */
:root {
  --bg-base:    #ffffff;
  --bg-surface: #f8faff;
  --bg-raised:  #eef4ff;

  --border-subtle:  rgba(37, 99, 235, 0.08);
  --border-default: rgba(37, 99, 235, 0.14);
  --border-accent:  rgba(99, 179, 237, 0.35);

  --accent:       #2563EB;
  --accent-light: #60A5FA;
  --accent-glow:  rgba(37, 99, 235, 0.12);
}

body.dark {
  --bg-base:    #0d1117;
  --bg-surface: #161b22;
  --bg-raised:  #1c2333;

  --border-subtle:  rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.10);
  --border-accent:  rgba(99, 179, 237, 0.28);

  --accent:       #4299e1;
  --accent-light: #63b3ed;
  --accent-glow:  rgba(66, 153, 225, 0.14);
}

/* --- Typography --- */
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

h1, h2, h3, h4, h5, h6,
.navbar-brand {
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.03em;
}

code, pre, .tech-tag {
  font-family: 'DM Mono', monospace;
}

/* --- Hero --- */
#hero {
  min-height: 80vh !important;
  padding-top: 4rem !important;
  padding-bottom: 2rem !important;
}

#hero h1 {
  font-weight: 700;
  line-height: 1.1;
}

body.dark #hero h1 {
  background: linear-gradient(135deg, #ffffff 0%, #90cdf4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 36px rgba(66, 153, 225, 0.28));
}

#hero h2 {
  font-weight: 300;
  line-height: 1.2;
}

#hero p {
  font-family: 'Inter', sans-serif;
  font-size: 1.05rem;
  line-height: 1.75;
  max-width: 560px;
}

/* Hero image: circular with blue ring */
#hero .image img {
  border-radius: 50% !important;
  border: 3px solid var(--primary-color) !important;
  box-shadow: 0 0 0 6px var(--secondary-color),
              0 16px 48px rgba(37, 99, 235, 0.2) !important;
}

/* Hero Resume button: filled blue, vertically aligned with social icons */
#hero a.btn:not(.social-icon) {
  background-color: var(--primary-color) !important;
  color: #FAFAF8 !important;
  border-color: var(--primary-color) !important;
  font-weight: 600;
  vertical-align: middle !important;
}

#hero a.btn:not(.social-icon):hover {
  background-color: #1D4ED8 !important;
  color: #FAFAF8 !important;
  opacity: 1 !important;
}

/* --- Navbar --- */
.navbar-brand img {
  vertical-align: middle !important;
}

nav, .navbar, header nav {
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
}

body.dark nav,
body.dark .navbar,
body.dark header nav {
  background: rgba(13, 17, 23, 0.80) !important;
  border-bottom: 1px solid var(--border-subtle);
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.04em;
}

/* Theme toggle: vertically center with nav links */
.nav-item .text-center:has(#theme-toggle) {
  display: flex !important;
  align-items: center !important;
  height: 100% !important;
}

#theme-toggle {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  padding: 4px !important;
}

/* ============================================================
   SECTION BACKGROUNDS — light mode alternation
   Order: Hero(white) → About(blue-tint) → Experience(white)
          → Projects(blue-tint) → Education(white) → Contact(blue-tint)
   ============================================================ */

#about      { background-color: #EFF6FF !important; }
#experience { background-color: #ffffff !important; }
#projects   { background-color: #EFF6FF !important; }
#education  { background-color: #ffffff !important; }
#contact    { background-color: #EFF6FF !important; }

/* Dark mode overrides — layered depth with new colour system */
body.dark #about      { background-color: var(--bg-surface) !important; }
body.dark #experience { background-color: var(--bg-base)    !important; }
body.dark #projects   { background-color: var(--bg-surface) !important; }
body.dark #education  { background-color: var(--bg-base)    !important; }
body.dark #contact    { background-color: var(--bg-surface) !important; }

/* ============================================================
   ABOUT — skill pills
   ============================================================ */

/* Fix: theme sets overflow:hidden on #about ul which clips pill hover */
#about ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding: 6px 2px 2px;   /* top padding gives first-row pills room to lift */
  margin: 14px 0 0;
  list-style: none;
  grid-template-columns: unset;
  overflow: visible !important;
}

/* About content text: explicit color to prevent any cascade bug */
#about .content,
#about .content p {
  color: var(--text-color) !important;
}

#about ul li {
  position: relative;
  margin-bottom: 0;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  background-color: transparent;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  /* Hover animation */
  transition: transform 0.18s cubic-bezier(0.25, 1, 0.5, 1),
              box-shadow 0.18s cubic-bezier(0.25, 1, 0.5, 1),
              opacity 0.18s ease;
  cursor: default;
}

#about ul li::before { content: none; }

/* Core AI/ML skills (1–4): filled primary blue */
#about ul li:nth-child(-n+4) {
  background-color: var(--primary-color);
  color: #F0F9FF;
  border-color: var(--primary-color);
}

/* Infrastructure skills (5–8): filled sky-blue */
#about ul li:nth-child(n+5):nth-child(-n+8) {
  background-color: #0369A1;
  color: #F0F9FF;
  border-color: #0369A1;
}

/* Remaining (9+): outline */
#about ul li:nth-child(n+9) {
  background-color: transparent;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
}

#about ul li:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.18);
  opacity: 0.88;
}

/* ============================================================
   PROJECTS — no-image cards, unified left border
   ============================================================ */

#projects .card.project-card-noimg {
  min-height: unset !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: 12px !important;
  border-left: 3px solid var(--accent) !important;
  background: var(--bg-surface);
  box-shadow: 0 4px 16px var(--accent-glow) !important;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease !important;
  will-change: transform;
  position: relative;
  overflow: hidden;
}

#projects .card.project-card-noimg::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(66, 153, 225, 0.04) 0%, transparent 55%);
  pointer-events: none;
}

/* Fix: ensure card title and body text are always visible */
#projects .card.project-card-noimg .card-title,
#projects .card.project-card-noimg .card-text,
#projects .card.project-card-noimg .card-text p {
  color: var(--text-color) !important;
}

#projects .card.project-card-noimg .card-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

#projects .card.project-card-noimg:hover {
  transform: translateY(-4px) !important;
  border-color: var(--border-accent) !important;
  box-shadow:
    0 0 0 1px rgba(99, 179, 237, 0.08),
    0 12px 40px rgba(0, 0, 0, 0.22),
    0 2px 8px var(--accent-glow) !important;
}

/* Badge chips */
#projects .row .col-lg-6:nth-child(1) .badge {
  background-color: #DBEAFE !important;
  color: #1D4ED8 !important;
}
#projects .row .col-lg-6:nth-child(2) .badge {
  background-color: #DBEAFE !important;
  color: #1D4ED8 !important;
}
#projects .row .col-lg-6:nth-child(3) .badge {
  background-color: #DBEAFE !important;
  color: #1D4ED8 !important;
}
#projects .row .col-lg-6:nth-child(4) .badge {
  background-color: #DBEAFE !important;
  color: #1D4ED8 !important;
}

/* ============================================================
   EXPERIENCE
   ============================================================ */

#experience .experience-container {
  border-radius: 12px !important;
  border: 1px solid var(--border-subtle) !important;
  box-shadow: 0 4px 24px var(--accent-glow) !important;
  background: var(--bg-surface);
}

#experience .nav-item .nav-link.active {
  color: var(--primary-color) !important;
  font-weight: 600;
}

/* "present" jobs — subtle green text */
#experience small:is([data-i18n*="present"], [class*="present"]) {
  color: #059669;
}

/* ============================================================
   EDUCATION
   ============================================================ */

/* Header row: title left, date right — date never wraps */
.edu-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.4rem;
}

.edu-date {
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 0.875rem;
  color: var(--text-secondary-color);
  padding-top: 0.15rem;
}

/* Both cards: same border treatment, consistent hover */
#education .card {
  border: 1px solid var(--border-subtle) !important;
  background: var(--bg-surface);
  box-shadow: 0 4px 24px rgba(37, 99, 235, 0.08) !important;
  border-radius: 12px !important;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease !important;
}

#education .card:hover {
  transform: translateY(-3px);
  border-color: var(--border-accent) !important;
  box-shadow:
    0 0 0 1px rgba(99, 179, 237, 0.08),
    0 8px 32px rgba(0, 0, 0, 0.18),
    0 2px 8px var(--accent-glow) !important;
}

#education .index {
  background-color: var(--primary-color) !important;
}

/* Lab link button — unified pill style (VSLab & PMML) */
.lab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.3rem 0.85rem;
  border: 1px solid rgba(99, 179, 237, 0.35);
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 500;
  font-family: 'DM Mono', monospace;
  color: #4299e1;
  background: rgba(99, 179, 237, 0.07);
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
  letter-spacing: 0.02em;
}

.lab-btn:hover {
  background: rgba(99, 179, 237, 0.16);
  border-color: rgba(99, 179, 237, 0.6);
  color: #63b3ed;
  transform: translateY(-1px);
  text-decoration: none;
}

/* ============================================================
   CONTACT
   ============================================================ */

#contact .btn {
  background-color: var(--primary-color) !important;
  color: #F0F9FF !important;
  border-color: var(--primary-color) !important;
  font-weight: 600;
  padding: 0.65rem 2rem !important;
}

#contact .btn:hover {
  background-color: #1D4ED8 !important;
  opacity: 1 !important;
}

/* ============================================================
   FOOTER
   ============================================================ */

footer {
  border-top: 1px solid var(--border-subtle);
}

body.dark footer {
  background: linear-gradient(to bottom, var(--bg-surface) 0%, var(--bg-base) 100%);
}

footer a[href*="github"]:hover   { color: #24292F !important; }
footer a[href*="linkedin"]:hover { color: #0A66C2 !important; }

/* ============================================================
   TECH TAGS — monospace pill with accent border
   ============================================================ */
.tech-tag {
  background: rgba(37, 99, 235, 0.10) !important;
  border: 1px solid rgba(37, 99, 235, 0.22) !important;
  color: var(--accent-light) !important;
  border-radius: 6px !important;
  padding: 0.2rem 0.65rem !important;
  font-size: 0.75rem !important;
  font-weight: 500 !important;
  letter-spacing: 0.03em;
  transition: background 0.2s, border-color 0.2s;
}

.tech-tag:hover {
  background: rgba(37, 99, 235, 0.18) !important;
  border-color: rgba(37, 99, 235, 0.4) !important;
}

/* ============================================================
   DELIGHT
   ============================================================ */

/* Hero: subtle dot-grid background */
#hero {
  background-image: radial-gradient(circle, rgba(37, 99, 235, 0.10) 1px, transparent 1px);
  background-size: 28px 28px;
}

/* "Live" pulsing green dot on the first experience nav tab (current role) */
#experience .nav-item:first-child .nav-link::before {
  content: '●';
  color: #10B981;
  font-size: 0.45rem;
  vertical-align: middle;
  margin-right: 5px;
  display: inline-block;
  animation: live-pulse 2.2s ease-in-out infinite;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.25; }
}

/* Copy-email toast notification */
#copy-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: #1E1B4B;
  color: #F5F4FF;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 9999;
  white-space: nowrap;
}

#copy-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   ANIMATIONS
   ============================================================ */

/* Scroll progress bar */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--primary-color);
  z-index: 9999;
  transition: width 0.1s linear;
  pointer-events: none;
}

/* Scroll reveal: initial state */
.will-reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Stagger delay via CSS custom property */
.will-reveal[style*="--stagger"] {
  transition-delay: calc(var(--stagger, 0) * 80ms);
}

/* Revealed state */
.did-reveal {
  opacity: 1;
  transform: translateY(0);
}

/* Hero image: subtle float loop */
@keyframes avatar-float {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-8px); }
}

#hero .image.animate img {
  animation:
    fade-in 0.8s cubic-bezier(0.16, 1, 0.3, 1),
    avatar-float 4s 0.9s ease-in-out infinite;
}

/* Navbar link underline slide */
header .navbar-nav .nav-link {
  position: relative;
}

header .navbar-nav .nav-link::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--primary-color);
  border-radius: 1px;
  transition:
    width 0.22s cubic-bezier(0.25, 1, 0.5, 1),
    left  0.22s cubic-bezier(0.25, 1, 0.5, 1);
}

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

/* Social icon hover: scale */
#hero a.btn.social-icon {
  transition:
    transform 0.2s cubic-bezier(0.25, 1, 0.5, 1),
    background-color 0.2s ease,
    opacity 0.2s ease !important;
}

#hero a.btn.social-icon:hover {
  transform: scale(1.15) !important;
  opacity: 1 !important;
}

/* Button press feedback */
#hero a.btn:not(.social-icon):active,
#contact .btn:active {
  transform: scale(0.96) !important;
  transition: transform 0.08s ease !important;
}

/* Ripple effect */
.btn-ripple {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  transform: translate(-50%, -50%) scale(0);
  animation: ripple-expand 0.55s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: none;
}

@keyframes ripple-expand {
  to {
    transform: translate(-50%, -50%) scale(30);
    opacity: 0;
  }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  #hero .image.animate img {
    animation: none !important;
  }
  .will-reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}
