:root {
  --bg-color: #fafafa;
  --text-main: #1a1a1a;
  --text-muted: #666666;
  --accent-color: #000000;

  --bg-hover: #f0f0f0;
  --bg-tag: #f5f5f5;
  --border-color: #eaeaea;
  --text-dark: #333333;
  --text-medium: #444444;

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-serif: 'Playfair Display', serif;

  --spacing-unit: 8px;
  --container-width: 680px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #121212;
    --text-main: #e0e0e0;
    --text-muted: #a0a0a0;
    --accent-color: #ffffff;

    --bg-hover: #2a2a2a;
    --bg-tag: #222222;
    --border-color: #333333;
    --text-dark: #d0d0d0;
    --text-medium: #c0c0c0;
  }
}

/* Class override for manual theme toggle */
[data-theme="dark"] {
  --bg-color: #121212;
  --text-main: #e0e0e0;
  --text-muted: #a0a0a0;
  --accent-color: #ffffff;

  --bg-hover: #2a2a2a;
  --bg-tag: #222222;
  --border-color: #333333;
  --text-dark: #d0d0d0;
  --text-medium: #c0c0c0;
}

[data-theme="light"] {
  --bg-color: #fafafa;
  --text-main: #1a1a1a;
  --text-muted: #666666;
  --accent-color: #000000;

  --bg-hover: #f0f0f0;
  --bg-tag: #f5f5f5;
  --border-color: #eaeaea;
  --text-dark: #333333;
  --text-medium: #444444;
}

[data-theme="sepia"] {
  --bg-color: #f4ecd8;
  --text-main: #433422;
  --text-muted: #705a41;
  --accent-color: #8c6b4a;

  --bg-hover: #e8ddc5;
  --bg-tag: #ebdec3;
  --border-color: #d6c5a5;
  --text-dark: #2a2015;
  --text-medium: #5c4731;
}

html {
  scrollbar-gutter: stable;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 80px 24px;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.8s ease-out forwards;
  opacity: 0;
}

.delay-1 {
  animation-delay: 0.2s;
}

.delay-2 {
  animation-delay: 0.4s;
}

/* Header */
header {
  margin-bottom: 32px;
}

h1 {
  font-family: var(--font-sans);
  font-size: 2.5rem;
  font-weight: 500;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* Theme Toggle Button */
.theme-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  margin-left: 8px;
  /* Space from Threads link */
}

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

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

/* Base state: Light OS. Next is Dark, so show Moon */
.moon-icon {
  display: block;
}

.sun-icon,
.coffee-icon {
  display: none;
}

/* Base state: Dark OS. Next is Sepia, so show Coffee. */
@media (prefers-color-scheme: dark) {
  .moon-icon {
    display: none;
  }

  .coffee-icon {
    display: block;
  }
}

/* Explicit Light Mode: Next is Dark -> Show Moon */
[data-theme="light"] .moon-icon {
  display: block;
}

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

/* Explicit Dark Mode: Next is Sepia -> Show Coffee */
[data-theme="dark"] .coffee-icon {
  display: block;
}

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

/* Explicit Sepia Mode: Next is Light -> Show Sun */
[data-theme="sepia"] .sun-icon {
  display: block;
}

[data-theme="sepia"] .moon-icon,
[data-theme="sepia"] .coffee-icon {
  display: none;
}

/* Content */
.content {
  font-size: 1.125rem;
  color: var(--text-dark);
}

.content p {
  margin-bottom: 24px;
  text-align: justify;
}

.content a {
  color: var(--text-main);
  text-decoration: underline;
  text-decoration-color: #ccc;
  text-underline-offset: 4px;
  transition: all 0.2s ease;
}

.content a:hover {
  text-decoration-color: var(--text-main);
  background-color: var(--bg-hover);
}

/* Signature / Footer */
.footer {
  margin-top: 80px;
  padding-top: 40px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.social-links {
  display: flex;
  gap: 16px;
  align-items: center;
}

.social-links a {
  color: var(--text-muted);
  text-decoration: none;
}

.social-links a:hover {
  color: var(--text-main);
}

/* Tabs Navigation */
.tabs-nav {
  margin-top: 32px;
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0;
}

.tab-btn {
  background: none;
  border: none;
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--text-muted);
  cursor: pointer;
  padding-bottom: 12px;
  position: relative;
  transition: color 0.2s ease;
  /* Layout shift fix */
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  color: var(--text-main);
  font-weight: 500;
}

/* Reserve space for bold text to prevent layout shift */
.tab-btn::before {
  content: attr(data-text);
  height: 0;
  visibility: hidden;
  overflow: hidden;
  user-select: none;
  pointer-events: none;
  font-weight: 500;
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--text-main);
}

/* Tab Views */
.tab-view {
  display: none;
  animation: fadeIn 0.4s ease-out;
}

.tab-view.active {
  display: block;
}

/* Resume Styling */
.resume-section {
  margin-bottom: 48px;
}

.resume-section h2 {
  font-family: var(--font-sans);
  font-size: 1.5rem;
  font-weight: 500;
  margin-bottom: 24px;
  color: var(--text-main);
}

.resume-item {
  display: flex;
  gap: 32px;
  margin-bottom: 32px;
}

.resume-date {
  min-width: 120px;
  font-size: 0.9rem;
  color: var(--text-muted);
  padding-top: 4px;
  /* Align with title */
}

.resume-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.company {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-style: italic;
}

.resume-content p {
  font-size: 1rem;
  color: var(--text-medium);
  line-height: 1.6;
}

/* Skills List */
.skills-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.skills-list li {
  background-color: var(--bg-tag);
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.9rem;
  color: var(--text-dark);
}

/* Mobile Responsiveness for Resume */
@media (max-width: 600px) {
  .resume-item {
    flex-direction: column;
    gap: 8px;
  }

  /* Header Top Alignment */
}

/* Skills Formatting */
.skill-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-medium);
}

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