/* ==========================================================================
   VARIABLES & THEME
   ========================================================================== */
:root {
  /* Dark Theme (Default) */
  --bg-color: #000000;
  --bg-rgb: 0, 0, 0;
  --bg-secondary: #111111;
  --bg-tertiary: #1a1a1a;
  
  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --text-muted: #666666;
  
  --border-color: #222222;
  --border-hover: #333333;
  
  --accent: #ffffff; /* pure white accents */
  
  --nav-height: 80px;
  --max-width: 720px;
  --radius: 12px;
  
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  
  /* Timeline Dots */
  --dot-1: #3b82f6; /* Blue */
  --dot-2: #eab308; /* Yellow */
  --dot-3: #22c55e; /* Green */
  --dot-4: #ef4444; /* Red */
}

[data-theme="light"] {
  --bg-color: #ffffff;
  --bg-rgb: 255, 255, 255;
  --bg-secondary: #f4f4f5;
  --bg-tertiary: #e4e4e7;
  
  --text-primary: #000000;
  --text-secondary: #52525b;
  --text-muted: #a1a1aa;
  
  --border-color: #e4e4e7;
  --border-hover: #d4d4d8;
  
  --accent: #000000;
}

/* ==========================================================================
   RESET & BASE
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  background: none;
  border: none;
  color: inherit;
  font-family: inherit;
  cursor: pointer;
}

h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.2;
}

/* ==========================================================================
   LAYOUT
   ========================================================================== */
.minimal-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.main-content {
  padding-top: calc(var(--nav-height) + 40px);
  padding-bottom: 80px;
  min-height: calc(100vh - 80px);
}

.section {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

.section.active {
  display: block;
}

.section-header {
  margin-bottom: 40px;
}

.section-header h2 {
  font-size: 2rem;
  margin-bottom: 4px;
}

.section-header p {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* ==========================================================================
   NAVIGATION
   ========================================================================== */
#navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--nav-height);
  background: rgba(var(--bg-rgb), 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.nav-avatar img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-color);
}

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

.nav-link {
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

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

.theme-toggle {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
  color: var(--text-secondary);
}

.theme-toggle:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }

/* ==========================================================================
   HOME
   ========================================================================== */
.home-hero {
  margin-top: 40px;
  margin-bottom: 30px;
}

.hero-title {
  font-size: 2.5rem;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 90%;
}

.latest-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.latest-header h3 {
  font-size: 1.1rem;
}

.latest-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}

.latest-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
}

.latest-card img {
  width: 100%;
  height: 340px;
  object-fit: cover;
  display: block;
}

.latest-card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 30px 20px 20px;
  background: linear-gradient(transparent, rgba(0,0,0,0.9));
  color: #fff;
}

.latest-card-title {
  font-size: 1.25rem;
  font-weight: 600;
}

/* ==========================================================================
   ABOUT & TIMELINE
   ========================================================================== */
/* Photo Fan */
.photo-fan {
  position: relative;
  height: 240px;
  margin-bottom: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.fan-img-wrap {
  position: absolute;
  width: 160px;
  height: 200px;
  border-radius: 12px;
  overflow: hidden;
  border: 4px solid var(--bg-color);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  transition: transform 0.3s ease;
}

.fan-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Fan positioning */
.img-1 { transform: translateX(-120px) rotate(-12deg); z-index: 1; }
.img-2 { transform: translateX(-40px) rotate(-4deg); z-index: 2; }
.img-3 { transform: translateX(40px) rotate(4deg); z-index: 3; }
.img-4 { transform: translateX(120px) rotate(12deg); z-index: 4; }

.photo-fan:hover .img-1 { transform: translateX(-140px) rotate(-15deg); }
.photo-fan:hover .img-2 { transform: translateX(-50px) rotate(-5deg); }
.photo-fan:hover .img-3 { transform: translateX(50px) rotate(5deg); }
.photo-fan:hover .img-4 { transform: translateX(140px) rotate(15deg); }

/* Story & Education */
.about-story, .about-education {
  margin-bottom: 40px;
  padding: 30px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

.about-story h3, .about-education h3 {
  font-size: 1.25rem;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.about-story p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.7;
}

.edu-list {
  list-style: none;
}

.edu-list li {
  margin-bottom: 12px;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.edu-list li strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Timeline */
.timeline-header {
  display: flex;
  align-items: center;
  margin-bottom: 30px;
}

.timeline-header h3 {
  font-size: 1.5rem;
  width: 100px; /* Align with timeline left */
}

.timeline {
  display: flex;
  flex-direction: column;
}

.tl-item {
  display: flex;
  position: relative;
  padding-bottom: 40px;
}

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

.tl-left {
  width: 100px;
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  padding-right: 20px;
}

.tl-date {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.tl-divider {
  position: relative;
  width: 2px;
  background: var(--border-color);
  margin-right: 30px;
}

.tl-dot {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--dot-1);
}

.tl-item:nth-child(2n) .tl-dot { background: var(--dot-2); }
.tl-item:nth-child(3n) .tl-dot { background: var(--dot-3); }
.tl-item:nth-child(4n) .tl-dot { background: var(--dot-4); }

.tl-right {
  flex: 1;
  padding-top: 0;
}

.tl-company {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.tl-role {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 12px;
}

.tl-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.tl-desc ul {
  padding-left: 20px;
  list-style-type: circle;
}

.tl-desc li {
  margin-bottom: 6px;
}

.tl-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tl-skill {
  font-size: 0.8rem;
  background: var(--bg-secondary);
  padding: 4px 10px;
  border-radius: 100px;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

/* ==========================================================================
   PROJECTS
   ========================================================================== */
.projects-list {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.project-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--bg-secondary);
  transition: border-color 0.2s, transform 0.2s;
  cursor: pointer;
  display: flex;
  gap: 20px;
}

.project-item:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.proj-thumb {
  width: 180px;
  height: 120px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border-color);
}

.proj-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.proj-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.proj-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==========================================================================
   CERTIFICATIONS
   ========================================================================== */
.certs-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cert-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-color);
  overflow: hidden;
  transition: border-color 0.2s;
}

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

.cert-header {
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-secondary);
}

.cert-title {
  font-weight: 600;
  font-size: 1.1rem;
}

.cert-issuer {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.cert-chevron {
  width: 20px;
  height: 20px;
  transition: transform 0.3s ease;
  color: var(--text-muted);
}

.cert-card.open .cert-chevron {
  transform: rotate(180deg);
}

.cert-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  background: var(--bg-color);
}

.cert-card.open .cert-body {
  max-height: 500px; /* Arbitrary large height */
  padding: 20px;
}

.subcert-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.subcert-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.subcert-item::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-hover);
}

/* ==========================================================================
   CONTACT
   ========================================================================== */
.contact-desc {
  margin-bottom: 24px;
}

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

.contact-pill {
  display: flex;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  transition: background 0.2s, border-color 0.2s;
  gap: 16px;
}

.contact-pill:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-hover);
}

.cp-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
}

.cp-icon svg {
  width: 20px;
  height: 20px;
}

.cp-info {
  display: flex;
  flex-direction: column;
}

.cp-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.cp-val {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer {
  padding: 40px 0;
  border-top: 1px solid var(--border-color);
  margin-top: 60px;
}

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

.footer-socials {
  display: flex;
  gap: 20px;
}

.footer-socials a {
  color: var(--text-muted);
  transition: color 0.2s;
}

.footer-socials a:hover {
  color: var(--text-primary);
}

.footer-socials svg {
  width: 20px;
  height: 20px;
}

.footer-inner p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ==========================================================================
   ANIMATIONS, TYPEWRITER & MODAL
   ========================================================================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Typewriter Cursor */
.cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  vertical-align: text-bottom;
  background-color: var(--text-primary);
  animation: blink 1s step-end infinite;
  margin-left: 4px;
}

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

.reveal, .reveal-after-type {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.reveal.is-visible, .reveal-after-type.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }

/* Detail Modal */
.project-detail {
  position: fixed;
  inset: 0;
  background: var(--bg-color);
  z-index: 200;
  overflow-y: auto;
  padding-top: 40px;
  padding-bottom: 80px;
}

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

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 40px;
}

.btn-back:hover {
  color: var(--text-primary);
}

.btn-back svg {
  width: 20px;
  height: 20px;
}

/* Project Detail Content */
.pd-img {
  width: 100%;
  height: 400px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 30px;
  border: 1px solid var(--border-color);
}

.pd-title {
  font-size: 2rem;
  margin-bottom: 12px;
}

.pd-skills {
  margin-bottom: 24px;
}

.pd-desc {
  font-size: 1.05rem;
  color: var(--text-secondary);
  white-space: pre-line;
  margin-bottom: 40px;
}

.btn-primary {
  display: inline-block;
  padding: 12px 24px;
  background: var(--text-primary);
  color: var(--bg-color);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
}

.btn-primary:hover {
  opacity: 0.9;
}

/* Responsive */
@media (max-width: 600px) {
  .nav-links {
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .nav-link {
    font-size: 0.85rem;
  }
  .nav-avatar {
    display: none; /* Hide avatar on mobile to make room for links */
  }
  .contact-grid {
    grid-template-columns: 1fr;
  }
  .timeline-header h3 {
    width: auto;
    margin-right: 20px;
  }
  .tl-left {
    width: 80px;
    padding-right: 15px;
  }
  .project-item {
    flex-direction: column;
  }
  .proj-thumb {
    width: 100%;
    height: 200px;
  }
  .photo-fan {
    transform: scale(0.8);
  }
}

/* Contact Hero */
.contact-hero { text-align: center; margin-bottom: 40px; padding: 30px; background: var(--bg-secondary); border-radius: var(--radius); border: 1px solid var(--border-color); }
.contact-avatar { width: 100px; height: 100px; border-radius: 50%; margin-bottom: 20px; border: 2px solid var(--border-color); }
.contact-funny-bio { color: var(--text-secondary); font-size: 1rem; max-width: 500px; margin: 0 auto; line-height: 1.6; }


/* Hero CV and Open to Work */
.btn-micro {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 8px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
  height: 28px;
}
.btn-micro:hover {
  background: var(--border-color);
}
.hero-open-roles {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-top: 12px;
  font-weight: 500;
}
