:root {
  /* Light Theme (Default) */
  --bg-color: #fdf6e3;
  --text-color: #333333;
  --accent-color: #d33682;
  /* Pinkish-red accent */
  --secondary-color: #586e75;
  --link-color: #268bd2;
  --border-color: #e0e0e0;
  --nav-hover-bg: rgba(0, 0, 0, 0.05);

  --font-serif: 'Merriweather', serif;
  --font-sans: 'Inter', sans-serif;
  --max-width: 960px;
}

[data-theme='dark'] {
  --bg-color: #0f172a;
  /* Slate 900 - Introduction to aesthetic dark */
  --text-color: #e2e8f0;
  /* Slate 200 */
  --accent-color: #f472b6;
  /* Soft Pink */
  --secondary-color: #94a3b8;
  /* Slate 400 */
  --link-color: #38bdf8;
  /* Sky Blue */
  --border-color: #1e293b;
  /* Slate 800 */
  --nav-hover-bg: rgba(255, 255, 255, 0.05);
}

/* Reset & Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--text-color);
  /* Ensure headers adapt to theme */
  margin-bottom: 1rem;
}

a {
  color: var(--text-color);
  text-decoration: none;
  transition: color 0.2s, border-bottom 0.2s;
  border-bottom: 2px solid transparent;
  /* Prepare for hover underline */
}

a:hover {
  color: var(--accent-color);
  text-decoration: none;
  border-bottom: 2px solid var(--accent-color);
}

img {
  max-width: 100%;
  border-radius: 8px;
}

/* Layout */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
}

/* Header */
header {
  padding: 2rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* Removed border-bottom transparent */
}

.logo a {
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: 1.5rem;
  color: var(--text-color);
  font-style: italic;
  border-bottom: none;
  /* Logo doesn't need underline usually */
}

.logo a:hover {
  border-bottom: none;
  color: var(--accent-color);
}

nav ul {
  display: flex;
  list-style: none;
  gap: 1.5rem;
  align-items: center;
}

nav a {
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.25rem 0;
}

/* Highlight Active Section */
nav a.active {
  color: var(--accent-color);
  border-bottom: 2px solid var(--accent-color);
}

/* Hamburger Menu (Default Desktop) */
.hamburger-menu {
  display: none;
}

/* Theme Toggle Switch */
.theme-toggle-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--secondary-color);
  border-radius: 50px;
  padding: 5px;
  position: relative;
  width: 60px;
  height: 30px;
  cursor: pointer;
  margin-left: 1rem;
  transition: background-color 0.3s ease;
}

.theme-toggle-wrapper .fa-sun {
  color: #f39c12;
  font-size: 14px;
  z-index: 1;
  margin-left: 5px;
}

.theme-toggle-wrapper .fa-moon {
  color: #f1c40f;
  font-size: 14px;
  z-index: 1;
  margin-right: 5px;
}

.theme-toggle-ball {
  position: absolute;
  background-color: var(--bg-color);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  left: 4px;
  transition: transform 0.3s ease;
  z-index: 2;
}

/* Dark Theme State for Toggle */
[data-theme='dark'] .theme-toggle-ball {
  transform: translateX(30px);
}

[data-theme='dark'] .theme-toggle-wrapper {
  background-color: #475569;
  /* Slate 600 */
}


/* Hero Section */
.hero {
  padding: 4rem 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 4rem;
}

.hero-text {
  flex: 1;
}

.hero h1 {
  font-size: 3rem;
  line-height: 1.2;
  margin-bottom: 1.5rem;
  color: var(--text-color);
}

.hero .highlight {
  color: var(--accent-color);
  font-style: italic;
  display: block;
  font-size: 0.8em;
  margin-top: 0.5rem;
}

.hero p {
  color: var(--secondary-color);
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
  max-width: 600px;
}

.hero-image {
  flex: 0 0 350px;
}

.hero-image img {
  width: 100%;
  height: auto;
  border-radius: 45% 55% 70% 30% / 30% 30% 70% 70%;
  box-shadow: 10px 10px 0px rgba(0, 0, 0, 0.05);
  object-fit: cover;
  aspect-ratio: 1/1;
}

/* Social Links */
.social-links {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
  /* Handle smaller screens better */
}

.social-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--text-color);
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  border-bottom: 1px solid var(--text-color);
  /* Override generic link border */
}

.social-btn:hover {
  background: var(--text-color);
  color: var(--bg-color);
  border-bottom: 1px solid var(--text-color);
}

/* Recent Content Section */
.recent-content {
  padding: 4rem 0;
  display: flex;
  gap: 4rem;
  align-items: flex-start;
}

.column {
  flex: 1;
}

.section-header {
  display: flex;
  align-items: flex-start;
  /* Align to top so texts stack nicely vs the link */
  justify-content: space-between;
  margin-bottom: 2rem;
  font-family: var(--font-serif);
}

.section-header div {
  display: flex;
  flex-direction: column;
}

.section-header h3 {
  margin-bottom: 0.2rem;
  font-size: 1.5rem;
}

.section-subtitle {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--secondary-color);
  font-style: italic;
  font-weight: normal;
}

.section-header a {
  font-size: 0.9rem;
  color: var(--link-color);
  font-family: var(--font-sans);
  font-weight: normal;
  margin-top: 5px;
  /* Visual alignment with title */
}

/* Item List / Jitter Reduction */
.item-list,
.paper-list {
  min-height: 200px;
  /* Prevent layout shift while loading */
}

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

.item-list li {
  margin-bottom: 1.5rem;
  font-size: 1rem;
}

.item-date {
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--secondary-color);
  margin-right: 0.8rem;
}

.item-title {
  font-weight: 600;
  color: var(--link-color);
  border-bottom: 1px solid transparent;
}

.item-title:hover {
  border-bottom: 1px solid var(--accent-color);
}

/* Content Pages */
.page-title {
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  text-align: center;
  font-size: 2.5rem;
}

/* Papershelf & Blog List Generic */
.paper-list {
  max-width: 800px;
  margin: 0 auto;
}

.paper-item {
  display: flex;
  gap: 1.5rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border-color);
  align-items: baseline;
}

.paper-year {
  font-family: monospace;
  color: var(--secondary-color);
  flex: 0 0 100px;
}

.paper-details h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.paper-details h3 a {
  color: var(--text-color);
}

.paper-meta {
  font-size: 0.9rem;
  color: var(--secondary-color);
}

/* Accomplishments / Timeline */
.timeline {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 0;
}

.timeline-item {
  position: relative;
  border-left: 2px solid var(--border-color);
  padding-left: 2rem;
  margin-bottom: 3rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 0;
  width: 10px;
  height: 10px;
  background-color: var(--accent-color);
  border-radius: 50%;
}

.timeline-date {
  font-family: monospace;
  color: var(--secondary-color);
  margin-bottom: 0.5rem;
  display: block;
}

/* Bookshelf specific */
.book-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.25rem;
  font-family: var(--font-serif);
}

.book-author {
  font-size: 0.85rem;
  color: var(--secondary-color);
  font-style: italic;
}

.book-list {
  list-style: disc;
  margin-left: 2rem;
  max-width: 800px;
  margin: 0 auto;
  padding-left: 1.5rem;
}

.book-list li {
  margin-bottom: 0.75rem;
}

.read-section {
  margin-top: 3rem;
}


/* Responsive */
/* Responsive */
@media (max-width: 768px) {

  /* Tighter container for mobile */
  .container {
    padding: 0 1rem;
  }

  /* Reduce Logo size to fit with Hamburger */
  .logo a {
    font-size: 1.2rem;
  }

  /* Header & Nav - Hamburger Layout */
  header {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
  }

  /* Show Hamburger */
  .hamburger-menu {
    display: block;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-color);
    padding: 0.5rem;
    margin-left: auto;
    /* Force to right */
  }

  /* Nav Container moves to next line (but absolute now) */
  nav {
    order: 3;
    /* Position context for absolute dropdown if needed, 
           but usually header relative works better. 
           Let's rely on header relative. */
  }

  /* Standard header relative positioning */
  header {
    position: relative;
  }

  /* Nav List - Overlay Mode */
  nav ul {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    /* Push it right below the header */
    left: 0;
    width: 100%;
    background-color: var(--bg-color);
    /* Match theme bg */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    padding: 1rem 2rem;
    /* Add side padding for alignment */
    text-align: left;
    align-items: flex-start;
    align-items: flex-start;
    /* Flex items align left */
    border-top: 1px solid var(--border-color);
    z-index: 100;
    /* Ensure it floats on top */
  }

  /* Ensure links take full width for easier clicking and consistent alignment */
  nav a {
    display: block;
    width: 100%;
    text-align: left;
  }

  /* Ensure links take full width */
  nav a {
    display: block;
    width: 100%;
    text-align: left;
  }

  /* Show class added via JS */
  nav ul.show {
    display: flex;
  }

  /* Hero */
  .hero {
    flex-direction: column;
    gap: 2rem;
    text-align: center;
  }

  .hero p,
  .social-links {
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
  }

  /* Content Layout */
  .recent-content {
    flex-direction: column;
    gap: 3rem;
  }

  /* Timeline & Lists */
  .timeline,
  .paper-list {
    padding-left: 0;
    margin-left: 0;
  }

  .book-list {
    padding-left: 1.5rem;
    /* Restore bullet indentation */
    margin-left: 0;
  }

  .timeline-item {
    padding-left: 1.5rem;
  }
}




/* Left Alignment Utility */
.left-aligned {
  text-align: left;
}

.left-aligned .page-title {
  text-align: left;
}

.left-aligned p {
  text-align: left;
  margin-left: 0;
  margin-right: auto;
}

/* Timeline Left Align (Default is left, but ensuring override if needed) */
.left-aligned .timeline-item {
  text-align: left;
}

/* Force left alignment for containers in left-aligned mode */
.left-aligned .timeline,
.left-aligned .paper-list,
.left-aligned .book-list {
  margin-left: 0;
  margin-right: auto;
  max-width: 100%;
}

/* End of styles */