/* ===== CSS Custom Properties & Theme System ===== */
:root {
  color-scheme: light;
  --bg-primary: #f5f1e8;
  --bg-secondary: #ede8dd;
  --text-primary: #2c2c2c;
  --text-secondary: #666;
  --border-color: #d4cfc4;
  --accent-blue: #4a90b8;
  --accent-purple: #8b5a8f;
  --accent-orange: #d97a4a;

  /* Typography */
  --font-serif: 'Lora', Georgia, serif;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-header: 'Shippori Mincho B1', Georgia, serif;

  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  --spacing-2xl: 4rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg-primary: #0f1419;
    --bg-secondary: #1a1f2e;
    --text-primary: #e8e8e8;
    --text-secondary: #b8b8b8;
    --border-color: #2a3142;
    --accent-blue: #6ba3d1;
    --accent-purple: #a876b8;
    --accent-orange: #e8956a;
  }
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg-primary: #0f1419;
  --bg-secondary: #1a1f2e;
  --text-primary: #e8e8e8;
  --text-secondary: #b8b8b8;
  --border-color: #2a3142;
  --accent-blue: #6ba3d1;
  --accent-purple: #a876b8;
  --accent-orange: #e8956a;
}

/* ===== Base Styles ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-serif);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ===== Header & Navigation ===== */
header {
  background-color: var(--bg-secondary);
  padding: var(--spacing-xl) var(--spacing-lg);
  border-bottom: 1px solid var(--border-color);
}

.header-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--spacing-lg);
  max-width: 1400px;
  margin: 0 auto;
}

.header-content {
  flex: 1;
  min-width: 0;
}

header h1 {
  font-family: var(--font-header);
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: var(--spacing-md);
  letter-spacing: -0.01em;
}

header .bio {
  font-size: 1.5rem;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 1000px;
}

.theme-toggle {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: var(--spacing-xs);
  opacity: 0.6;
  transition: opacity 0.2s ease;
  font-family: var(--font-serif);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
}

.theme-toggle:hover {
  opacity: 1;
}

.theme-toggle svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
}

.theme-label {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
}

/* ===== Main Content ===== */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
}

/* ===== Hero / Bio Section ===== */
.hero {
  display: none;
}

/* ===== Current Projects Section ===== */
.current-projects {
  padding: var(--spacing-2xl) 0;
  border-bottom: 1px solid var(--border-color);
}

.current-projects .section-title {
  text-align: center;
}

.section-title {
  font-family: var(--font-header);
  font-size: 1.75rem;
  font-weight: 700;
  text-transform: capitalize;
  letter-spacing: 0;
  margin-bottom: var(--spacing-lg);
  color: var(--text-primary);
}

.projects-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-md);
  justify-content: flex-start;
}

.project-item {
  flex: 1 1 calc(50% - var(--spacing-md) / 2);
  max-width: 50%;
  padding: var(--spacing-md);
  transition: box-shadow 0.3s ease;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: var(--spacing-md);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  font-size: 1.2rem;
}

.project-item:hover {
  box-shadow: 0 2px 8px rgba(74, 144, 184, 0.1);
}

.project-image {
  width: 75px;
  height: 75px;
  border-radius: 6px;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
  border: 3px solid var(--project-color, var(--border-color));
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.project-item:hover .project-image {
  transform: scale(1.04);
}

.project-title {
  font-weight: 600;
  margin-bottom: var(--spacing-xs);
  color: var(--project-color, var(--text-primary));
}

.project-description {
  color: var(--text-secondary);
  font-size: 1.1rem;
  list-style: 1.2;
}

/* ===== Timeline Section ===== */
.timeline-section {
  padding: var(--spacing-2xl) 0;
  position: relative;
}

.section-divider {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4rem;
  height: 4rem;
  background-color: var(--bg-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.section-divider i {
  width: 2rem;
  height: 2rem;
  stroke-width: 2;
  color: rgba(232, 232, 232, 0.75);
}

.timeline-section .section-title {
  font-family: var(--font-header);
  font-size: 1.75rem;
  text-transform: capitalize;
  letter-spacing: 0;
  text-align: center;
  font-weight: 700;
  margin-bottom: var(--spacing-2xl);
}

.timeline {
  position: relative;
  padding: var(--spacing-lg) 0;
}

/* Vertical line */
.timeline::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background-color: var(--border-color);
  transform: translateX(-50%);
  z-index: 0;
}

.timeline-item {
  margin-bottom: var(--spacing-xl);
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-lg);
  position: relative;
}

/* Alternating layout */
.timeline-item:nth-child(odd) .timeline-content {
  margin-left: 0;
  margin-right: 0;
  text-align: right;
  padding-right: 0;
  flex: 1;
  order: 1;
}

.timeline-item:nth-child(odd) .timeline-badge {
  order: 2;
  flex-shrink: 0;
}

.timeline-item:nth-child(odd)::after {
  content: '';
  flex: 1;
  order: 3;
}

.timeline-item:nth-child(even) .timeline-content {
  margin-left: 0;
  margin-right: 0;
  text-align: left;
  padding-left: 0;
  flex: 1;
  order: 3;
}

.timeline-item:nth-child(even) .timeline-badge {
  order: 2;
  flex-shrink: 0;
}

.timeline-item:nth-child(even)::before {
  content: '';
  flex: 1;
  order: 1;
}

/* Badge/Circle */
.timeline-badge {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background-color: var(--bg-secondary);
  border: 3px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  z-index: 10;
  flex-shrink: 0;
}

/* Image-based badge */
.timeline-image-badge {
  width: 12rem;
  height: auto;
  border-radius: 8px;
  background-color: transparent;
  padding: 0;
  overflow: visible;
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.15),
    0 4px 12px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.3s ease;
  perspective: 1000px;
  position: relative;
  flex-shrink: 0;
  margin: 0 auto;
}

.timeline-shadow {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  top: 8px;
  left: 8px;
  opacity: 0.5;
  pointer-events: none;
  z-index: -1;
  transform-style: preserve-3d;
  transition: transform 0.05s ease-out;
}

.timeline-image-badge:hover {
  transform: translateX(-50%) scale(1.08);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.2),
    0 6px 16px rgba(0, 0, 0, 0.12);
}

.timeline-badge-image {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  border-radius: 8px;
  position: relative;
  z-index: 1;
}

.timeline-content {
  padding-bottom: var(--spacing-md);
}

.timeline-year {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: var(--spacing-xs);
}

.timeline-title {
  font-weight: 600;
  font-size: 1.2rem;
  margin-bottom: var(--spacing-xs);
}

.timeline-title a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s ease;
  border-bottom: 1px dotted transparent;
  transition: border-color 0.2s ease;
  padding-bottom: 2px;
}

.timeline-title a:hover {
  border-bottom-color: currentColor;
}

.timeline-description {
  color: var(--text-secondary);
  font-size: 1.2rem;
  line-height: 1.6;
  margin-bottom: var(--spacing-md);
}

.timeline-image {
  width: 100%;
  max-width: 280px;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  margin-top: var(--spacing-md);
}

@media (prefers-color-scheme: dark) {
  .timeline-image {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }
}

[data-theme="dark"] .timeline-image {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ===== Contact Section ===== */
.contact-section {
  padding: var(--spacing-2xl) 0;
  position: relative;
  text-align: center;
  border-top: 1px solid var(--border-color);
}

.contact-section .section-divider {
  top: 0;
}

.contact-content {
  padding-top: var(--spacing-2xl);
}

.contact-content p {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-md);
}

.contact-link {
  display: inline-block;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent-blue);
  text-decoration: none;
  padding: var(--spacing-md) var(--spacing-lg);
  border: 2px solid var(--accent-blue);
  border-radius: 6px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.contact-link:hover {
  background-color: var(--accent-blue);
  color: var(--bg-primary);
}

/* ===== Footer & Social Links ===== */
footer {
  border-top: 1px solid var(--border-color);
  padding: var(--spacing-2xl) var(--spacing-lg);
  text-align: center;
  margin-top: var(--spacing-2xl);
}

.social-links {
  display: flex;
  justify-content: center;
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
}

.social-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 1.25rem;
  transition: color 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.social-link i {
  width: 24px;
  height: 24px;
  stroke-width: 1.5;
}

.social-link:hover {
  color: var(--accent-blue);
}

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

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
  .header-wrapper {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-md);
  }

  header h1 {
    font-size: 2rem;
  }

  main {
    padding: 0 var(--spacing-md);
  }

  /* Hide the vertical timeline line on mobile */
  .timeline::before {
    display: none;
  }

  /* Stack timeline items vertically */
  .timeline-item {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .timeline-item:nth-child(odd) .timeline-content,
  .timeline-item:nth-child(even) .timeline-content {
    margin-left: 0;
    margin-right: 0;
    text-align: center;
    width: 100%;
    padding-left: 0;
    padding-right: 0;
    order: 2 !important;
  }

  .timeline-item:nth-child(odd) .timeline-badge,
  .timeline-item:nth-child(even) .timeline-badge {
    order: 1 !important;
    position: static !important;
    left: auto !important;
    margin-bottom: var(--spacing-md);
    display: none;
  }

  .timeline-item:nth-child(odd) .timeline-image-badge,
  .timeline-item:nth-child(even) .timeline-image-badge {
    display: flex !important;
  }

  .timeline-item:nth-child(odd)::after,
  .timeline-item:nth-child(even)::before {
    display: none;
  }

  .projects-list {
    gap: var(--spacing-md);
    flex-direction: column;
  }

  .project-item {
    flex: 1 1 100%;
    max-width: 100%;
  }
}
