/* ─── Custom Properties ─── */

:root {
  --bg: #F5F3EF;
  --text: #1A1A1A;
  --text-secondary: #6B6560;
  --text-muted: #A09A93;
  --accent: #3AAFA9;
  --accent-hover: #2D8E89;
  --accent-glow: rgba(58, 175, 169, 0.12);
  --border: #E4DFD7;
  --surface: rgba(0, 0, 0, 0.03);
  --radius: 10px;
  --noise-opacity: 0.5;
  color-scheme: light dark;
}

/* ─── Dark Mode ─── */

@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    --bg: #1A1A1A;
    --text: #F5F3EF;
    --text-secondary: #B5AFA8;
    --text-muted: #807A73;
    --accent: #3AAFA9;
    --accent-hover: #4DC9C3;
    --accent-glow: rgba(58, 175, 169, 0.15);
    --border: #333;
    --surface: rgba(255, 255, 255, 0.05);
    --noise-opacity: 0.3;
  }
}

:root.dark {
  --bg: #1A1A1A;
  --text: #F5F3EF;
  --text-secondary: #B5AFA8;
  --text-muted: #807A73;
  --accent: #3AAFA9;
  --accent-hover: #4DC9C3;
  --accent-glow: rgba(58, 175, 169, 0.15);
  --border: #333;
  --surface: rgba(255, 255, 255, 0.05);
  --noise-opacity: 0.3;
}

/* ─── Reset & Base ─── */

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

html {
  scroll-behavior: smooth;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 100px 24px 72px;
  background: var(--bg);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.3s ease, color 0.3s ease;
}

/* ─── Noise Texture Overlay ─── */

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

/* ─── Container ─── */

.container {
  max-width: 540px;
  width: 100%;
  position: relative;
  z-index: 1;
}

/* ─── Site Controls (Dark Mode + Language Toggle) ─── */

.site-controls {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-toggle {
  display: flex;
  align-items: center;
  gap: 0;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 8px;
  transition: color 0.25s ease, background 0.25s ease;
  user-select: none;
}

.lang-toggle:hover {
  background: var(--surface);
  color: var(--text-secondary);
}

.lang-toggle .lang-option {
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.25s ease, background 0.25s ease;
}

.lang-toggle .lang-option.active {
  color: var(--text);
  background: var(--surface);
}

.lang-toggle .lang-sep {
  color: var(--border);
  margin: 0 2px;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.25s ease, background 0.25s ease;
}

.theme-toggle:hover {
  background: var(--surface);
  color: var(--text-secondary);
}

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

.theme-toggle .icon-moon,
.theme-toggle .icon-sun {
  display: none;
}

/* Show moon icon in light mode (default) */
.theme-toggle .icon-moon { display: block; }
.theme-toggle .icon-sun { display: none; }

/* Show sun icon in dark mode */
:root.dark .theme-toggle .icon-moon { display: none; }
:root.dark .theme-toggle .icon-sun { display: block; }

@media (prefers-color-scheme: dark) {
  :root:not(.light) .theme-toggle .icon-moon { display: none; }
  :root:not(.light) .theme-toggle .icon-sun { display: block; }
}

/* ─── Typography ─── */

h1, h2 {
  font-family: 'Instrument Serif', Georgia, serif;
  font-weight: 400;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 36px;
  line-height: 1.2;
  margin-bottom: 20px;
  color: var(--text);
}

h2 {
  font-size: 22px;
  margin-bottom: 20px;
  color: var(--text);
  position: relative;
  display: inline-block;
}

h2::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--accent);
  opacity: 0.4;
}

p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.75;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.25s ease;
}

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

strong {
  font-weight: 600;
  color: var(--text);
}

/* ─── Focus Styles ─── */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ─── Header ─── */

header {
  margin-bottom: 56px;
  padding-bottom: 48px;
  border-bottom: 1px solid var(--border);
}

header p {
  margin-bottom: 10px;
}

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

/* ─── Avatar ─── */

.avatar {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 20px;
  border: 2px solid var(--border);
  box-shadow:
    0 0 0 4px var(--bg),
    0 0 0 5px var(--border);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.avatar:hover {
  transform: scale(1.08) rotate(2deg);
  box-shadow:
    0 0 0 4px var(--bg),
    0 0 0 5px var(--accent),
    0 4px 20px var(--accent-glow);
}

/* ─── Sections ─── */

section {
  margin-bottom: 56px;
}

/* ─── Skill Pills ─── */

.skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
}

.skill-pill {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface);
  padding: 4px 12px;
  border-radius: 100px;
  border: 1px solid var(--border);
  white-space: nowrap;
  letter-spacing: 0.01em;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.skill-pill:hover {
  color: var(--text-secondary);
  border-color: var(--accent);
}

/* ─── Project List ─── */

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

.project-list li {
  border-radius: 8px;
  transition: background 0.25s ease;
}

.project-list li:hover {
  background: var(--surface);
}

.project-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 8px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.25s ease;
  cursor: default;
}

a.project-item {
  cursor: pointer;
}

a.project-item:hover {
  color: inherit;
}

.project-list li:hover .project-item {
  transform: translateX(4px);
}

.project-name {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  color: var(--text);
}

.badge-soon {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 2px 7px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

.project-desc {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-line {
  flex: 1;
  height: 1px;
  border-bottom: 1px dashed var(--border);
  margin: 0 4px;
  min-width: 24px;
  opacity: 0.7;
}

.project-year {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  flex-shrink: 0;
}

/* ─── CTA Button ─── */

.cta-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 26px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: var(--bg);
  background: var(--text);
  border-radius: 100px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.cta-button:hover {
  color: var(--bg);
  transform: translateY(-2px);
  box-shadow:
    0 6px 20px rgba(0, 0, 0, 0.12),
    0 0 24px var(--accent-glow);
}

:root.dark .cta-button:hover {
  box-shadow:
    0 6px 20px rgba(0, 0, 0, 0.3),
    0 0 24px rgba(58, 175, 169, 0.25);
}

@media (prefers-color-scheme: dark) {
  :root:not(.light) .cta-button:hover {
    box-shadow:
      0 6px 20px rgba(0, 0, 0, 0.3),
      0 0 24px rgba(58, 175, 169, 0.25);
  }
}

.cta-button:active {
  transform: translateY(0);
}

/* ─── Footer ─── */

.footer {
  text-align: center;
  padding-top: 36px;
  border-top: 1px solid var(--border);
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 8px;
  list-style: none;
}

.social-links a {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  transition: all 0.25s ease;
}

.social-links a:hover {
  color: var(--text);
  background: var(--surface);
  transform: translateY(-2px);
}

.social-links svg {
  width: 18px;
  height: 18px;
}

/* ─── Entrance Animations ─── */

.fade-in {
  opacity: 0;
  transform: translateY(20px);
}

.fade-in.visible {
  animation: slideUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* Stagger children inside header */
header.fade-in.visible .avatar { animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both; opacity: 0; }
header.fade-in.visible h1 { animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.12s both; opacity: 0; }
header.fade-in.visible p:nth-of-type(1) { animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both; opacity: 0; }
header.fade-in.visible p:nth-of-type(2) { animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.28s both; opacity: 0; }
header.fade-in.visible .skills-list { animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.36s both; opacity: 0; }
header.fade-in.visible .cta-button { animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.44s both; opacity: 0; }

/* Stagger project list items */
.fade-in.visible .project-list li:nth-child(1) { animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both; opacity: 0; }
.fade-in.visible .project-list li:nth-child(2) { animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.18s both; opacity: 0; }
.fade-in.visible .project-list li:nth-child(3) { animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.26s both; opacity: 0; }
.fade-in.visible .project-list li:nth-child(4) { animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.34s both; opacity: 0; }
.fade-in.visible .project-list li:nth-child(5) { animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.42s both; opacity: 0; }

/* ─── Reduced Motion ─── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .fade-in {
    opacity: 1;
    transform: none;
  }
}

/* ─── Responsive ─── */

@media (max-width: 480px) {
  body {
    padding: 48px 16px 40px;
  }

  h1 {
    font-size: 30px;
  }

  h2 {
    font-size: 20px;
  }

  .container {
    max-width: 100%;
  }

  .project-desc {
    display: none;
  }

  .project-item {
    padding: 12px 4px;
  }

  .site-controls {
    top: 12px;
    right: 12px;
  }

  .skill-pill {
    font-size: 11px;
    padding: 3px 10px;
  }
}
