:root {
  --bg-color: #F6F4F0;
  --text-color: #1a1a1a;
  --accent-color: #002366;
  --muted-color: #57606f;
  --border-color: #d1d1d1;
  --font-sans: "Rubik", sans-serif;
  --font-serif: "Playfair Display", serif;
  --max-width: 800px;
}

* {
  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;
  padding: 2rem 1rem;
  min-height: 100vh;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  transition: opacity 0.8s ease, transform 0.4s ease;
}

nav {
  margin-bottom: 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--muted-color);
  font-size: 0.95rem;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent-color);
}

/* Typography */
h1,
h2,
h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  color: var(--accent-color);
  margin-bottom: 1rem;
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  line-height: 1.1;
  margin-top: -0.2rem;
}

h2 {
  font-size: 1.5rem;
  margin-top: 2.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

h3 {
  font-size: 1.2rem;
  margin-bottom: 0.25rem;
  color: var(--text-color);
}

p {
  margin-bottom: 1rem;
  color: var(--muted-color);
}

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

a:hover {
  text-decoration: underline;
}

/* Profile Section */
.profile-header {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
  margin-bottom: 2rem;
}

.profile-info {
  flex: 1;
}

.profile-img {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.subtitle {
  font-size: 1.1rem;
  font-style: italic;
  color: var(--accent-color);
  margin-bottom: 1rem;
}

.social-links {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.social-links a {
  color: var(--text-color);
  font-size: 1.2rem;
}

.nav-links a:hover,
.nav-links a.active,
.social-links a:hover {
  color: var(--accent-color);
}

/* Lists */
ul {
  list-style: none;
}

li {
  margin-bottom: 0.5rem;
  color: var(--muted-color);
}

/* Projects & Work */
.project-item {
  margin-bottom: 2rem;
}

.project-meta {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--muted-color);
  margin-bottom: 0.5rem;
}

.project-links {
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.skills-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

/* Footer */
footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted-color);
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
  .profile-header {
    flex-direction: column-reverse;
    align-items: center;
    text-align: center;
  }

  .profile-img {
    width: 120px;
    height: 120px;
  }

  .social-links {
    justify-content: center;
  }

  .nav-links {
    justify-content: center;
    width: 100%;
  }

  .skills-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* Desktop Sidebar Layout */
@media (min-width: 1024px) {
  .container {
    max-width: 1100px;
    display: grid;
    /* 3-column grid: left balanced column, fixed 650px center column, right balanced column */
    grid-template-columns: 1fr 650px 1fr;
    gap: 0;
    margin: 6rem auto;
    align-items: start;
  }

  nav {
    grid-column: 1;
    position: sticky;
    top: 6rem;
    height: fit-content;
    margin-bottom: 0;
    padding-right: 1.5rem;
    border-right: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
  }

  .nav-links {
    flex-direction: column;
    align-items: flex-end;
    gap: 1.25rem;
  }

  .nav-links a {
    font-size: 0.9rem;
    font-weight: 500;
  }

  .container>*:not(nav) {
    grid-column: 2;
    padding-left: 2rem;
  }

  /* Typography alignment for desktop */
  h1 {
    margin-top: -0.4rem;
    line-height: 1.1;
  }
}

/* Loading Screen */
#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-color);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.6s;
}

#loading-screen.fade-out {
  opacity: 0;
  visibility: hidden;
}

.loader-logo {
  width: 200px;
  height: auto;
  margin-bottom: 2rem;
}

.loader-logo path {
  stroke: var(--accent-color);
  stroke-width: 3;
  fill: none;
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: draw 1.2s ease-in-out forwards;
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

.loading-text {
  font-family: var(--font-serif);
  font-size: 0.9rem;
  color: var(--accent-color);
  letter-spacing: 0.2rem;
  text-transform: uppercase;
  opacity: 0;
  animation: fadeIn 0.4s ease-in-out 0.2s forwards;
}

@keyframes fadeIn {
  to {
    opacity: 0.6;
  }
}

/* Content Transitions */
.content-wrapper {
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.content-wrapper.fade-exit {
  opacity: 0;
  transform: translateY(10px);
}

.content-wrapper.fade-enter {
  opacity: 0;
  transform: translateY(-10px);
}