/* ==========================================================================
   TABLE OF CONTENTS
   ==========================================================================
   1.  VARIABLES & GLOBAL STYLES
   2.  TYPOGRAPHY & BASE ELEMENTS
   3.  LAYOUT
   4.  NAVIGATION (SIDEBAR & MOBILE)
   5.  COMPONENTS (BUTTONS, LINKS, HELPERS)
   6.  PAGE SECTIONS
       - ABOUT
       - PROJECTS
        - Project Detail Page
        - Tag List (Reusable for Skills, Tech Stack, etc.)  
       - EXPERIENCE
       - BLOG
   7.  FOOTER
   8.  ANIMATIONS
   9.  RESPONSIVE (TABLET & DESKTOP)
*/

/* ==========================================================================
   1. VARIABLES & GLOBAL STYLES
   ========================================================================== */
:root {
  --bg-color: #2E3440;
  --bg-secondary: #3B4252;
  --text-primary: #ECEFF4;
  --text-secondary: #D8DEE9;
  --accent-color: #88C0D0;
  --border-color: #4C566A;
  --sidebar-width: 260px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
}

body.nav-is-open {
  overflow: hidden;
}
/* ==========================================================================
   2. TYPOGRAPHY & BASE ELEMENTS
   ========================================================================== */
section {
  padding: 30px 0;
  border-bottom: 2px solid var(--border-color);
}
section:last-of-type { border-bottom: none; }

h2 {
  font-family: 'Lora', serif;
  font-size: 2em;
  margin-bottom: 30px;
}

p {
  line-height: 1.8;
  margin-bottom: 20px;
  color: var(--text-secondary);
  text-align: justify;
}

a {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 500;
}

/* ==========================================================================
   3. LAYOUT
   ========================================================================== */
.site-wrapper {
  display: flex;
  flex-direction: column;
}

.main-content {
  width: 100%;
  padding: 0 20px;
  transition: transform 0.4s cubic-bezier(0.78, 0.1, 0.3, 0.9);
}

/* ==========================================================================
   4. NAVIGATION (SIDEBAR & MOBILE)
   ========================================================================== */
/* --- Mobile Header --- */
.main-header-mobile {
  position: sticky;
  top: 1px;
  z-index: 102;
  background: var(--bg-secondary);
  border: 1px solid var(--accent-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 10px;
  border-radius: 0 0 20px 20px;
  border-bottom: 5px solid var(--accent-color);
}

.mobile-logo {
  font-family: 'Lora', serif;
  font-weight: 700;
  font-size: 1.8em;
  text-decoration: none;
  color: var(--accent-color);
  transition: transform 0.4s ease, color 0.3s ease;
}
.mobile-logo:hover { color: var(--accent-color); }
.mobile-logo.is-open { transform: scale(1.1) translateX(-15px); }

.menu-toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 5px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 101;
}
.menu-toggle .bar {
  width: 25px;
  height: 3px;
  background-color: var(--text-primary);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.menu-toggle.is-open .bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.menu-toggle.is-open .bar:nth-child(2) { opacity: 0; }
.menu-toggle.is-open .bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* --- Sidebar --- */
.sidebar-nav {
  position: fixed;
  top: 55px;
  left: 0;
  width: var(--sidebar-width);
  height: calc(100% - 55px); /* FIXED: was 'stretch' */
  padding: 30px;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  overflow-y: auto;
  z-index: 99;
  transform: translateX(-100%);
  transition: transform 0.4s cubic-bezier(0.78, 0.1, 0.3, 0.9);
  border-radius: 0 20px 20px 0;
  border-right: 5px solid var(--accent-color);
}
.sidebar-nav.is-open {
  transform: translateX(0);
  box-shadow: 10px 0 20px rgba(0, 0, 0, 0.2);
}
.sidebar-header h3 {
  font-family: 'Lora', serif;
  font-size: 2em;
  color: var(--accent-color);
  text-align: center;
}
.sidebar-header p {
  font-size: 0.9em;
  color: var(--text-secondary);
  line-height: 1.2;
  text-align: center;
}
.sidebar-nav ul {
  list-style: none;
  flex-grow: 1;
}
.sidebar-nav ul li a {
  display: block;
  padding: 10px;
  font-size: 1.2em;
  color: var(--text-primary);
}
.sidebar-nav ul li a:hover { color: var(--accent-color); }


/* ==========================================================================
   5. COMPONENTS (BUTTONS, LINKS, HELPERS)
   ========================================================================== */
.btn-link,
.btn-resume,
.project-card a {
  margin-top: 20px;
  display: inline-block;
  padding: 12px;
  border: 1px solid var(--accent-color);
  border-radius: 20px;
  color: var(--accent-color);
  text-align: center;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  z-index: 1;
  transition: color 0.4s ease;
}
.btn-link::after,
.btn-resume::after,
.project-card a::after {
  content: '';
  position: absolute;
  z-index: -1;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: var(--accent-color);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease-out;
}
.btn-link:hover::after,
.btn-resume:hover::after,
.project-card a:hover::after { transform: scaleX(1); }

.btn-link:hover,
.btn-resume:hover,
.project-card a:hover { color: var(--bg-secondary); }

.page-subtitle {
  max-width: 600px;
  margin: -20px auto 40px;
  color: var(--text-secondary);
}
.cta-container {
  text-align: center; 
}


/* ==========================================================================
   6. PAGE SECTIONS
   ========================================================================== */

   /* --- About Section --- */
.about-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.about-photo-container {
  order: 1;
  margin-bottom: 20px;
}
.about-text {
  order: 2;
}
.profile-photo {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 3px solid var(--accent-color);
  object-fit: cover;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* --- Projects Section --- */
.project-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
.project-card {
  padding: 25px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  transition: transform 0.3s ease, border-color 0.3s ease;
}
.project-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-color);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}
.project-card h3 {
  font-family: 'Lora', serif;
  color: var(--accent-color);
  margin-bottom: 10px;
}
.horizontal-scroll-wrapper {
  overflow-x: auto;
  white-space: nowrap;
  padding-bottom: 20px;
}
.horizontal-scroll-wrapper::-webkit-scrollbar { height: 8px; }
.horizontal-scroll-wrapper::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 4px;
}
.horizontal-scroll-wrapper::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
.horizontal-scroll-wrapper::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}
.projects-container-horizontal {
  display: inline-flex;
  gap: 30px;
}
.projects-container-horizontal .project-card {
  min-width: 320px;
  white-space: normal;
}

/* --- Project Detail Page --- */
.project-header { text-align: center; 
  margin-bottom: 30px; 
}
.project-header h1 {
  font-family: 'Lora', serif;
  font-size: 2.5em;
  margin-bottom: 30px;
}
.project-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 30px;
}
.project-section { margin-bottom: 30px; 
  border-top: 2px solid var(--border-color);
}
.project-section h2 {
  margin-top: 30px;
  margin-bottom: 20px;
}
.project-section ul { list-style-position: outside; 
  padding-left: 10px; 
}

/* --- Tag List (Reusable for Skills, Tech Stack, etc.) --- */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
  list-style: none;
}
.tag-list li {
  padding: 10px 20px;
  font-size: 0.9em;
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  transition: transform 0.3s ease, border-color 0.3s ease;
}
.tag-list li:hover {
  transform: translateY(-3px);
  border-color: var(--accent-color);
}


/* --- Experience Section --- */
.timeline {
  position: relative;
}
.timeline::before{
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: 18px;
  width: 3px;
  background: var(--border-color);
  z-index: 0;
}
.timeline-dot {
  position: absolute;
  z-index: 2;
  top: 12px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--accent-color);
}
.timeline-item {
  position: relative;
  width: 100%;
  margin-left: 10px;
  padding: 10px 20px;
}
.timeline-date {
  font-weight: 500;
  color: var(--accent-color);
  margin-bottom: 10px;
}
.timeline-content h3 { margin-bottom: 10px; color: var(--text-primary); }
.timeline-content p { margin: 0; font-size: 0.9em; }

/* --- Blog Section --- */
.blog-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
}
.blog-post-card {
  padding: 30px;
  background: var(--bg-secondary);
  border-radius: 20px;
  border-left: 3px solid var(--accent-color);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.blog-post-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}
.blog-date { font-size: 0.9em; color: var(--text-secondary); margin-bottom: 10px; }
.blog-post-card h3 {
  font-family: 'Lora', serif;
  color: var(--text-primary);
  margin-bottom: 15px;
  transition: color 0.3s ease;
}
.blog-post-card:hover h3 { color: var(--accent-color); }
.blog-excerpt { color: var(--text-secondary); margin-bottom: 20px; }
.read-more { font-weight: 700; transition: color 0.3s ease; }
.read-more:hover { color: #fff; }


/* ==========================================================================
   7. FOOTER
   ========================================================================== */
footer {
  text-align: center;
  color: var(--text-secondary);
  border-top: 2px solid var(--border-color);
  padding: 20px 0;
}
footer p {
  text-align: center;
  margin-bottom: 0;
}

/* ==========================================================================
   8. ANIMATIONS
   ========================================================================== */
/* --- Keyframe Definitions --- */
@keyframes slideInFromRight {
  from { opacity: 0; transform: translateX(50px); }
  to   { opacity: 1; transform: translateX(0); }
}

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

/* --- Shared Animation Applications --- */
.timeline-item,
.project-card,
.blog-post-card {
  animation: fadeInUp 0.6s ease forwards;
  opacity: 0;
}

/* Stagger Project Card animations */
.project-card:nth-child(1) { animation-delay: 0.1s; }
.project-card:nth-child(2) { animation-delay: 0.2s; }
.project-card:nth-child(3) { animation-delay: 0.3s; }
.project-card:nth-child(4) { animation-delay: 0.4s; }
.project-card:nth-child(5) { animation-delay: 0.5s; }
.project-card:nth-child(6) { animation-delay: 0.6s; }
.project-card:nth-child(7) { animation-delay: 0.7s; }
.project-card:nth-child(8) { animation-delay: 0.8s; }
.project-card:nth-child(9) { animation-delay: 0.9s; }
.project-card:nth-child(10) { animation-delay: 1s; }

/* Stagger Blog Card animations */
.blog-post-card:nth-child(1) { animation-delay: 0.1s; }
.blog-post-card:nth-child(2) { animation-delay: 0.2s; }
.blog-post-card:nth-child(3) { animation-delay: 0.3s; }

/* Stagger Timeline Item animations */
.timeline-item:nth-child(1) { animation-delay: 0.2s; }
.timeline-item:nth-child(2) { animation-delay: 0.4s; }
.timeline-item:nth-child(3) { animation-delay: 0.6s; }
.timeline-item:nth-child(4) { animation-delay: 0.8s; }
.timeline-item:nth-child(5) { animation-delay: 1s; }


/* ==========================================================================
   9. RESPONSIVE (TABLET & DESKTOP)
   ========================================================================== */
@media (min-width: 992px) {
  
  /* About section two-column layout for desktop */
  .about-container {
    flex-direction: row;
    align-items: center;
    flex-direction: row; 
    gap: 40px;
  }
  .about-text {
    order: 0;
    flex: 1;
    text-align: left;
  }
  .about-text p {
    margin-bottom: 0;
  }
  .about-photo-container {
    order: 0;
    flex-shrink: 0;
    margin-bottom: 0;
  }

  .site-wrapper { flex-direction: row; }
  
  .main-content {
    width: calc(100% - var(--sidebar-width));
    margin-left: var(--sidebar-width);
    padding: 0 80px;
    animation: slideInFromRight 0.8s ease-out;
    transform: translateX(0) !important;
  }
  
  .main-header-mobile { display: none; }
  
  .sidebar-nav {
    top: 0;
    height: 100%;
    transform: translateX(0);
    box-shadow: 10px 0 20px rgba(0, 0, 0, 0.2);
    border-right: 5px solid var(--accent-color);
  }
  .sidebar-nav ul li a {
    position: relative;
  }
  .sidebar-nav ul li a::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    height: 100%; width: 3px;
    background: var(--accent-color);
    transform: scaleY(0);
    transform-origin: center;
    transition: transform 0.3s ease-in-out;
  }
  .sidebar-nav ul li a:hover::before { transform: scaleY(1); }

  section { padding: 30px 0; }
  h2 { font-size: 2em; }
    
  .timeline::after { left: 20px; }
  .timeline-item { margin-left: 20px; padding: 10px 40px; }
  .timeline-dot { left: -8px; }
  
  .project-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
  }
  .project-header h1 { font-size: 3.5em; }
}