/* ============================================
   PORTFOLIO — Nigel Tan Jin Chun
   Light theme · High contrast · Interactive
   ============================================ */

:root {
  /* Light palette — professional, high contrast */
  --bg-primary: #fafbfc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  --accent: #0f766e;
  --accent-hover: #0d9488;
  --accent-muted: rgba(15, 118, 110, 0.1);
  
  --border: #e2e8f0;
  --border-hover: #0f766e;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.1);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Outfit", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
}

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

/* Reveal animation */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

.hero .section__text__p1 {
  opacity: 0;
  animation: fadeInUp 0.8s ease forwards;
}

.hero .title {
  animation: fadeInUp 0.8s ease 0.1s forwards;
  opacity: 0;
}

.hero .section__text__p2 {
  animation: fadeInUp 0.8s ease 0.2s forwards;
  opacity: 0;
}

.hero .section__text__p3 {
  animation: fadeInUp 0.8s ease 0.3s forwards;
  opacity: 0;
}

.hero .btn-container {
  animation: fadeInUp 0.8s ease 0.4s forwards;
  opacity: 0;
}

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

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

#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  transform: scaleX(0);
  transform-origin: left center;
  z-index: 120;
  opacity: 0.9;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 2rem;
  height: 72px;
}

.logo {
  font-family: "JetBrains Mono", monospace;
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  color: var(--accent);
}

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

.nav-links {
  display: flex;
  list-style: none;
  gap: 2rem;
}

.nav-links a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  position: relative;
}

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

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

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

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

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

/* Mobile Nav */
#hamburger-nav {
  display: none;
}

.hamburger-icon {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 28px;
  height: 20px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.hamburger-icon span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: var(--transition);
}

.hamburger-icon.open span:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}

.hamburger-icon.open span:nth-child(2) {
  opacity: 0;
}

.hamburger-icon.open span:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

.menu-links {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  min-width: 180px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-lg);
}

.menu-links.open {
  max-height: 400px;
  opacity: 1;
  visibility: visible;
}

.menu-links a {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--text-secondary);
  font-weight: 500;
  border-radius: var(--radius-sm);
}

.menu-links a:hover {
  background: var(--accent-muted);
  color: var(--accent);
}

.menu-links a.active {
  background: var(--accent-muted);
  color: var(--accent);
}

/* Sections */
.section {
  min-height: 100vh;
  padding: 6rem 2rem 4rem;
  max-width: 1200px;
  margin: 0 auto;
}

.section-title {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 3rem;
  text-align: center;
  color: var(--text-primary);
}

.section-title::after {
  content: "";
  display: block;
  width: 48px;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), transparent);
  margin: 0.5rem auto 0;
  border-radius: 2px;
}

.section-subtitle {
  text-align: center;
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: -1.5rem 0 2rem;
}

.section-subtitle a {
  color: var(--accent);
  font-weight: 500;
}

.section-subtitle a:hover {
  text-decoration: underline;
}

/* Hero */
.hero {
  display: flex;
  align-items: center;
  padding-top: 8rem;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  pointer-events: none;
  z-index: 0;
  animation: heroFloat 14s ease-in-out infinite;
}

.hero::before {
  width: 320px;
  height: 320px;
  background: radial-gradient(circle at center, rgba(15, 118, 110, 0.18), rgba(15, 118, 110, 0));
  top: 10%;
  left: -100px;
}

.hero::after {
  width: 260px;
  height: 260px;
  background: radial-gradient(circle at center, rgba(20, 184, 166, 0.14), rgba(20, 184, 166, 0));
  bottom: 8%;
  right: -80px;
  animation-delay: -6s;
}

.hero-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4rem;
  width: 100%;
  position: relative;
  z-index: 1;
}

@keyframes heroFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-18px);
  }
}

.section__pic-container {
  flex-shrink: 0;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid var(--border);
  box-shadow: var(--shadow-lg);
  transition: var(--transition);
}

.section__pic-container:hover {
  border-color: var(--accent);
  transform: scale(1.02);
  box-shadow: 0 20px 50px rgba(15, 118, 110, 0.15);
}

.section__pic-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.section__text {
  text-align: left;
  max-width: 520px;
}

.section__text__p1 {
  font-size: 1.1rem;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.title {
  font-size: 3rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.title .accent {
  color: var(--accent);
}

.section__text__p2 {
  font-size: 1.25rem;
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.section__text__p3 {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.hero-contact {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.hero-contact a {
  color: var(--accent);
  font-weight: 500;
}

.hero-contact a:hover {
  text-decoration: underline;
}

/* Buttons */
.btn-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(15, 118, 110, 0.3);
}

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
}

.btn-secondary:hover {
  background: var(--accent-muted);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* Social */
.socials-container {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.socials-container a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.socials-container a:hover {
  background: var(--accent-muted);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

/* About */
.about-card {
  max-width: 720px;
  margin: 0 auto;
  padding: 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.about-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
}

.about-card p {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

/* Timeline (Experience) */
.timeline {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
}

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

.timeline-item {
  position: relative;
  padding-left: 48px;
  padding-bottom: 2.5rem;
}

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

.timeline-marker {
  position: absolute;
  left: 4px;
  top: 6px;
  width: 18px;
  height: 18px;
  background: var(--accent);
  border: 3px solid var(--bg-primary);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
}

.timeline-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: var(--transition);
}

.timeline-content:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.timeline-date {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.timeline-content h3 {
  font-size: 1.125rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.timeline-org {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.timeline-content ul {
  list-style: none;
}

.timeline-content li {
  font-size: 0.95rem;
  color: var(--text-secondary);
  padding-left: 1.25rem;
  position: relative;
  margin-bottom: 0.4rem;
}

.timeline-content li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* Education */
.education-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.education-card {
  padding: 1.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: var(--transition);
}

.education-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.edu-date {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 500;
  display: block;
  margin-bottom: 0.5rem;
}

.education-card h3 {
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.education-card p {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

/* Skills Tabs */
.skills-tabs {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 0.6rem 1.25rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

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

.tab-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.skills-content {
  max-width: 800px;
  margin: 0 auto;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.4s ease;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.skill-tag {
  padding: 0.5rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  color: var(--text-secondary);
  transition: var(--transition);
}

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

/* Projects */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.project-card {
  padding: 1.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: var(--transition);
}

.project-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.project-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 0.75rem;
  padding: 0.25rem 0.6rem;
  background: var(--accent-muted);
  border-radius: var(--radius-sm);
}

.project-card h3 {
  font-size: 1.125rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.project-card p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.project-actions .btn {
  flex: 1;
  min-width: 120px;
}

/* Certifications */
.certifications-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.cert-card {
  display: block;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: var(--transition);
  text-decoration: none;
  color: inherit;
}

.cert-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.cert-issuer {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  display: block;
  margin-bottom: 0.35rem;
}

.cert-card h4 {
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
  line-height: 1.4;
}

.cert-date {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Volunteering */
.volunteer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.volunteer-card {
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.volunteer-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.volunteer-date {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.volunteer-card h3 {
  margin-top: 0.6rem;
  margin-bottom: 0.35rem;
  font-size: 1.05rem;
}

.volunteer-org {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.45;
}

.volunteer-focus {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 500;
}

/* Achievements */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.achievement-card {
  padding: 1.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: var(--transition);
}

.achievement-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.achievement-card h4 {
  font-size: 1.1rem;
  color: var(--accent);
  margin-bottom: 1rem;
}

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

.achievement-card li {
  font-size: 0.95rem;
  color: var(--text-secondary);
  padding: 0.35rem 0;
  padding-left: 1.25rem;
  position: relative;
}

.achievement-card li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* Footer */
.footer {
  padding: 2rem;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.footer-links {
  display: flex;
  gap: 1rem;
}

.footer-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.footer-links a:hover {
  background: var(--accent-muted);
  border-color: var(--accent);
}

.footer-links .icon {
  width: 20px;
  height: 20px;
}

.footer-copyright {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Back to top */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
  z-index: 50;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
}

/* Loader */
.loader-container {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader-container.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader {
  width: min(92vw, 560px);
  padding: 2rem 2rem 1.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfa 100%);
  box-shadow: var(--shadow-lg);
  text-align: center;
  cursor: pointer;
}

.welcome-kicker {
  color: var(--accent);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}

.welcome-title {
  font-size: clamp(1.4rem, 4vw, 2rem);
  line-height: 1.25;
  margin-bottom: 0.4rem;
  color: var(--text-primary);
}

.welcome-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 1.2rem;
}

.loader-ring {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
