/* ===========================
   Alex Khoo - Portfolio Styles
   =========================== */

/* ---------- CSS Variables ---------- */
:root {
  --bg: #ffffff;
  --bg-elevated: #ffffff;
  --bg-card: #f8fafc;
  --text-primary: #0f1b3d;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent: #1e3a5f;
  --accent-hover: #152c4a;
  --accent-glow: rgba(30, 58, 95, 0.08);
  --border: #e2e8f0;
  --border-hover: #cbd5e1;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.08);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html.dark {
  --bg: #0b0f1a;
  --bg-elevated: #111827;
  --bg-card: #151d2e;
  --text-primary: #e8ecf4;
  --text-secondary: #8b95a8;
  --text-muted: #5a6478;
  --accent: #5b8cb8;
  --accent-hover: #4a7ba8;
  --accent-glow: rgba(91, 140, 184, 0.15);
  --border: #1e293b;
  --border-hover: #334155;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.4);
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-hover);
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

/* ---------- Container ---------- */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Navbar ---------- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition), border-color var(--transition);
}

html.dark .navbar {
  background: rgba(11, 15, 26, 0.85);
}

.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.logo-dot {
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition);
  position: relative;
  padding: 4px 0;
}

.nav-links a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
}

.nav-links a.active::after,
.nav-links a:hover::after {
  width: 100%;
}

/* Theme Toggle */
.theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

html.dark .icon-sun {
  display: none;
}

html.dark .icon-moon {
  display: block;
}

html.light .icon-sun,
html:not(.dark) .icon-sun {
  display: block;
}

html.light .icon-moon,
html:not(.dark) .icon-moon {
  display: none;
}

/* Start light by default */
.icon-sun {
  display: block;
}
.icon-moon {
  display: none;
}

/* Mobile nav toggle */
.mobile-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  position: relative;
}

.hamburger,
.hamburger::before,
.hamburger::after {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  transition: all var(--transition);
  position: absolute;
  left: 4px;
}

.hamburger {
  top: 15px;
}

.hamburger::before {
  content: "";
  top: -7px;
}

.hamburger::after {
  content: "";
  top: 7px;
}

.mobile-toggle.open .hamburger {
  background: transparent;
}

.mobile-toggle.open .hamburger::before {
  top: 0;
  transform: rotate(45deg);
}

.mobile-toggle.open .hamburger::after {
  top: 0;
  transform: rotate(-45deg);
}

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 120px 24px 60px;
  position: relative;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 720px;
}

.hero-photo {
  width: 160px;
  height: 160px;
  border-radius: 24px;
  object-fit: cover;
  border: 3px solid var(--border);
  margin-top: 28px;
  margin-bottom: 28px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
}

.hero-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid rgba(30, 58, 95, 0.2);
  padding: 6px 18px;
  border-radius: 100px;
  margin-bottom: 32px;
}

.hero-name {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.hero-name-light {
  font-weight: 300;
  color: var(--text-secondary);
}

.hero-tagline {
  font-size: 1.15rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 560px;
  margin: 0 auto 36px;
}

.hero-ctas {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.hero-socials {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 40px;
}

.hero-socials a {
  color: var(--text-muted);
  transition: color var(--transition), transform var(--transition);
}

.hero-socials a:hover {
  color: var(--accent);
  transform: translateY(-2px);
}

.hero-now {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 12px 20px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.now-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  display: inline-block;
  animation: pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.hero-scroll-indicator {
  position: absolute;
  bottom: 32px;
  animation: float 2s ease-in-out infinite;
  color: var(--text-muted);
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(8px); }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-sans);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  color: var(--accent);
}

.btn-full {
  width: 100%;
}

/* ---------- Sections ---------- */
.section {
  padding: 100px 0;
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 48px;
  color: var(--text-primary);
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 48px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
}

/* ---------- About ---------- */
.about-content {
  max-width: 720px;
}

.about-content p {
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 16px;
}

.about-content strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* ---------- Experience / Timeline ---------- */
.timeline {
  position: relative;
  padding-left: 32px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: 48px;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-marker {
  position: absolute;
  left: -32px;
  top: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  background: var(--bg);
}

.timeline-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: border-color var(--transition);
}

.timeline-content:hover {
  border-color: var(--border-hover);
}

.timeline-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.timeline-company {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 4px;
}

.timeline-date {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 16px;
}

.timeline-bullets {
  list-style: none;
}

.timeline-bullets li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 10px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.timeline-bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.6;
}

.project-btn {
  margin-top: 16px;
  font-size: 0.85rem;
  padding: 8px 18px;
}

/* ---------- Projects ---------- */
.project-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.filter-btn {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 20px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-sans);
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-btn.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
}

.project-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.project-card.hidden {
  display: none;
}

.project-card-inner {
  padding: 28px;
}

.project-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.tag {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 100px;
  border: 1px solid;
}

.tag-quant {
  color: #1e3a5f;
  border-color: rgba(30, 58, 95, 0.25);
  background: rgba(30, 58, 95, 0.06);
}

.tag-ml {
  color: #2563eb;
  border-color: rgba(37, 99, 235, 0.25);
  background: rgba(37, 99, 235, 0.06);
}

.tag-systems {
  color: #64748b;
  border-color: rgba(100, 116, 139, 0.25);
  background: rgba(100, 116, 139, 0.06);
}

.tag-featured {
  color: #0f766e;
  border-color: rgba(15, 118, 110, 0.25);
  background: rgba(15, 118, 110, 0.06);
}

html.dark .tag-quant {
  color: #7db4e0;
}

html.dark .tag-ml {
  color: #93b5f8;
}

html.dark .tag-systems {
  color: #94a3b8;
}

html.dark .tag-featured {
  color: #5eead4;
}

.project-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1.4;
}

.project-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.project-outcomes {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.outcome {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 4px 12px;
  border-radius: 100px;
}

/* ---------- Research ---------- */
.research-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.research-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: border-color var(--transition);
}

.research-card:hover {
  border-color: var(--border-hover);
}

.research-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.research-card ul {
  list-style: none;
}

.research-card li {
  position: relative;
  padding-left: 16px;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.research-card li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.skill-group h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.skill-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 100px;
  transition: all var(--transition);
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- Certifications ---------- */
.certs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 48px;
}

.cert-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.cert-group h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.cert-list li {
  position: relative;
  padding-left: 16px;
  margin-bottom: 10px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.cert-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.cert-year {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 4px;
}

.activity-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 2px;
}

.activity-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.activity-content p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.activity-content strong {
  color: var(--text-primary);
}

/* ---------- Awards ---------- */
.awards-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.award-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.award-item:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow);
}

.award-badge {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  margin-top: 2px;
}

.badge-global {
  background: rgba(30, 58, 95, 0.1);
  color: var(--accent);
}

html.dark .badge-global {
  background: rgba(91, 140, 184, 0.15);
  color: var(--accent);
}

.badge-champion {
  background: rgba(16, 124, 65, 0.1);
  color: #107c41;
}

html.dark .badge-champion {
  background: rgba(52, 211, 153, 0.12);
  color: #34d399;
}

.badge-gold {
  background: rgba(180, 130, 10, 0.12);
  color: #9a6e08;
}

html.dark .badge-gold {
  background: rgba(212, 175, 55, 0.15);
  color: #d4af37;
}

.badge-silver {
  background: rgba(100, 116, 139, 0.12);
  color: #4e6071;
}

html.dark .badge-silver {
  background: rgba(148, 163, 184, 0.1);
  color: #94a3b8;
}

.award-body {
  flex: 1;
}

.award-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.45;
  margin-bottom: 4px;
}

.award-year {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-left p {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.footer-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400 !important;
  margin-top: 4px;
}

.footer-right {
  display: flex;
  gap: 24px;
}

.footer-right a {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.footer-right a:hover {
  color: var(--accent);
}

/* ---------- Toast ---------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--accent);
  color: var(--text-primary);
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(12px); }
}

.toast-enter {
  animation: toastIn 0.3s ease forwards;
}

.toast-exit {
  animation: toastOut 0.3s ease forwards;
}

/* ---------- Reveal Animation ---------- */
.reveal-section {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .reveal-section {
    opacity: 1;
    transform: none;
  }

  .mobile-toggle {
    display: block;
  }

  .nav-links {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    gap: 0;
    padding: 8px 0;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
  }

  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-links a {
    display: block;
    padding: 14px 24px;
    font-size: 1rem;
  }

  .nav-links a::after {
    display: none;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .research-grid {
    grid-template-columns: 1fr;
  }

  .skills-grid {
    grid-template-columns: 1fr;
  }

  .awards-list {
    grid-template-columns: 1fr;
  }

  .certs-grid {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }

  .section {
    padding: 64px 0;
  }

  .hero {
    padding: 100px 24px 60px;
  }
}

@media (max-width: 480px) {
  .hero-ctas {
    flex-direction: column;
    align-items: center;
  }

  .hero-ctas .btn {
    width: 100%;
    max-width: 280px;
  }
}
