:root {
  --light: #fcf9ea;
  --dark: #1a1a1a;
  --gray: #666666;
  --lightgray: #e0e0e0;
  --secondary: #0055ff;
  --bodyFont: 'Newsreader', serif;
  --monoFont: 'JetBrains Mono', monospace;
  --bg-color: var(--light);
  --text-color: var(--dark);
  --link-hover: var(--gray);
  --btn-bg: var(--dark);
  --btn-text: var(--light);
  --noise-opacity: 0.1;
}

[data-theme="dark"] {
  --bg-color: #1a1b1a;
  --text-color: #eeeeee;
  --gray: #aaaaaa;
  --lightgray: #333333;
  --link-hover: #cccccc;
  --btn-bg: #eeeeee;
  --btn-text: #1a1b1a;
  --noise-opacity: 0.1;
}

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

body {
  font-family: var(--bodyFont);
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  font-size: 1.1rem;
  max-width: 850px;
  margin: 0 auto;
  padding: 2rem;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  opacity: var(--noise-opacity);
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* TOP NAVIGATION */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5rem;
}

.site-name {
  font-weight: 700;
  font-size: 1.2rem;
  text-decoration: none;
  color: var(--text-color);
}

.nav-links {
  display: flex;
  gap: 1.2rem;
  align-items: center;
}

.nav-links a,
.theme-toggle {
  color: var(--gray);
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.nav-links a:hover,
.theme-toggle:hover {
  color: var(--text-color);
}

.nav-links svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

/* HEADER */
header {
  margin-bottom: 4rem;
}

h1 {
  font-size: 2.0rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--gray);
  font-size: 1.25rem;
  font-weight: 400;
  margin-bottom: 1.5rem;
  max-width: 600px;
}

a {
  color: var(--text-color);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--link-hover);
}

section {
  margin-bottom: 4.5rem;
}

h2 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  font-weight: 600;
  border-bottom: 1px solid var(--lightgray);
  padding-bottom: 0.5rem;
}

.experience-item,
.project-item,
.publication-item {
  margin-bottom: 1.5rem;
}

.experience-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.2rem;
}

.experience-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.experience-date {
  font-family: var(--monoFont);
  font-size: 0.85rem;
  color: var(--gray);
}

.experience-company {
  font-style: italic;
  color: var(--gray);
  margin-bottom: 0.5rem;
}

ul {
  padding-left: 1.5rem;
  color: var(--text-color);
}

li {
  margin-bottom: 0.5rem;
}

.project-item h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.mail-feature {
  margin-top: 1rem;
  max-width: 500px;
}

.mail-feature form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.mail-feature input,
.mail-feature textarea {
  width: 100%;
  padding: 0.5rem 0;
  font-family: var(--bodyFont);
  font-size: 1rem;
  border: none;
  border-bottom: 1px solid var(--gray);
  background-color: transparent;
  color: var(--text-color);
  outline: none;
  transition: border-color 0.2s;
}

.mail-feature input:focus,
.mail-feature textarea:focus {
  border-bottom-color: var(--text-color);
}

.mail-feature button {
  font-family: var(--monoFont);
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  margin-top: 0.5rem;
  background-color: transparent;
  color: var(--text-color);
  border: 1px solid var(--gray);
  border-radius: 4px;
  cursor: pointer;
  align-self: flex-start;
  transition: all 0.2s;
}

.mail-feature button:hover {
  border-color: var(--text-color);
  background-color: var(--text-color);
  color: var(--bg-color);
}

@media (max-width: 600px) {
  .experience-header {
    flex-direction: column;
  }

  .research-group {
    flex-direction: column;
    gap: 0.5rem;
  }

  .research-year {
    width: auto;
  }
}

.research-group {
  display: flex;
  gap: 2rem;
  margin-bottom: 2rem;
}

.research-year {
  font-family: var(--monoFont);
  color: var(--gray);
  width: 60px;
  flex-shrink: 0;
  padding-top: 0.1rem;
}

.research-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.research-list .publication-item {
  margin-bottom: 0;
}

#easter-egg-trigger {
  cursor: pointer;
  outline: none;
}

#easter-egg-trigger:focus,
#easter-egg-trigger:active {
  outline: none;
}

#easter-egg-car {
  position: fixed;
  top: -12px;
  left: -12px;
  z-index: 9999;
  will-change: transform;
  pointer-events: none;
  color: var(--text-color);
}

#easter-egg-msg {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-color);
  color: var(--bg-color);
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 0.9rem;
  z-index: 9999;
  pointer-events: none;
  font-family: var(--monoFont);
  opacity: 0.8;
  animation: fadeout 3s forwards;
}

/* Terminal Overlay */
#terminal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #0d0d0d;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  padding: 2rem;
  box-sizing: border-box;
  opacity: 1;
  transition: opacity 0.3s ease;
}

#terminal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.terminal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  max-width: 800px;
  width: 100%;
}

.terminal-buttons {
  display: flex;
  gap: 8px;
}

.terminal-hint {
  color: #666;
  font-family: var(--monoFont);
  font-size: 0.85rem;
}

.terminal-btn {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #333;
}

.terminal-btn.close-btn {
  background-color: #ff5f56;
  cursor: pointer;
}

.terminal-btn.close-btn:hover {
  background-color: #ff4444;
}

.terminal-body {
  color: #00ff00;
  font-family: var(--monoFont);
  font-size: 1.1rem;
  line-height: 1.6;
  max-width: 800px;
}

.terminal-cursor {
  display: inline-block;
  font-weight: bold;
  animation: blink 1s step-end infinite;
}

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

.headlight-beam {
  opacity: 0;
  transition: opacity 0.3s ease;
}

[data-theme="dark"] .headlight-beam {
  opacity: 1;
}

#easter-egg-speedometer {
  position: fixed;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  background: var(--bg-color);
  color: var(--text-color);
  padding: 0.3rem 0.6rem;
  border: 2px solid var(--gray);
  border-radius: 6px;
  font-family: var(--monoFont);
  font-weight: bold;
  font-size: 0.9rem;
  z-index: 9999;
  pointer-events: none;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  opacity: 0.9;
  transition: color 0.1s, border-color 0.1s;
}

#easter-egg-speedometer.max-speed {
  color: #ff4444;
  border-color: #ff4444;
}

#easter-egg-speedometer.safe-speed {
  color: #44ffa2;
  border-color: #44ffa2;
}


@keyframes fadeout {
  0% {
    opacity: 0.8;
  }

  80% {
    opacity: 0.8;
  }

  100% {
    opacity: 0;
  }
}