/*-----------------------------------*\
  #RESET
\*-----------------------------------*/

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

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: 'Lora', 'Crimson Text', Georgia, 'Times New Roman', serif;
  background: #F4F1DE;
  color: #3D2F1F;
  line-height: 1.7;
  font-size: 15px;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  width: 100%;
}

/* Sans-serif for headers */
h1, h2, h3, .location, .meta, .nav-link {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 600;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.2s ease;
}

.main-content a {
  text-decoration: underline;
}


ul {
  list-style: none;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

.decorative-line {
  color: #5B8FA3;
  font-size: 1rem;
  line-height: 1.5;
  margin: 2rem 0;
  opacity: 0.6;
  white-space: nowrap;
  overflow: hidden;
  text-align: center;
  letter-spacing: 0.1em;
}

/*-----------------------------------*\
  #LAYOUT
\*-----------------------------------*/

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8rem 6rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 4rem;
  opacity: 0;
  animation: fadeIn 0.8s ease-out forwards;
  position: relative;
  z-index: 10;
  width: 100%;
  box-sizing: border-box;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    /* remove transform here */
  }
  to {
    opacity: 1;
    /* and here */
  }
}


@media (min-width: 850px) {
  .container {
    grid-template-columns: 1fr 180px;
    gap: 3rem;
    padding: 8rem 7rem;
    align-items: start;
  }
}

/* Gradual padding reduction for smooth transition - desktop layout */
@media (max-width: 1200px) and (min-width: 850px) {
  .container {
    padding: 6rem 5rem;
  }
}

@media (max-width: 1100px) and (min-width: 850px) {
  .container {
    padding: 5rem 4rem;
  }
}

@media (max-width: 1000px) and (min-width: 850px) {
  .container {
    padding: 4rem 3rem;
    gap: 2.5rem;
  }
}

@media (max-width: 950px) and (min-width: 850px) {
  .container {
    padding: 3rem 2rem;
    gap: 2rem;
    grid-template-columns: 1fr 150px;
  }
  
  .profile-photo {
    width: 100px;
    height: 100px;
  }
  
  .sidebar-nav {
    font-size: 0.85rem;
  }
  
  .nav-link {
    font-size: 0.85rem;
  }
}

/*-----------------------------------*\
  #MAIN CONTENT
\*-----------------------------------*/

.main-content {
  max-width: 700px;
  text-align: left;
}

.content-section {
  margin-bottom: 4rem;
}

.content-section:last-child {
  margin-bottom: 0;
}

.content-section h1 {
  font-size: 2rem;
  font-weight: 600;
  color: #3D2F1F;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.content-section h2 {
  font-size: 1.25rem;
  font-weight: 500;
  color: #5B8FA3;
  margin-bottom: 1.5rem;
  margin-top: 2.5rem;
}

.content-section h3 {
  font-size: 1.1rem;
  font-weight: 500;
  color: #5B8FA3;
  margin-bottom: 0.5rem;
}

.content-section p {
  margin-bottom: 1.25rem;
  color: #6B4E3D;
  line-height: 1.7;
  font-size: 15px;
}

.content-section p:last-child {
  margin-bottom: 0;
}

.location {
  color: #5B8FA3;
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.meta {
  color: #5B8FA3;
  font-size: 0.85rem;
  margin-bottom: 1rem;
  font-weight: 500;
}

/*-----------------------------------*\
  #PROJECTS
\*-----------------------------------*/

.project-item {
  margin-bottom: 3rem;
}

/* Project items with images use flex layout */
.project-item:has(.project-image) {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.project-item-content {
  flex: 1;
}

.project-item h3 {
  margin-bottom: 0.75rem;
}

.project-item p {
  margin-bottom: 1rem;
}

.project-item a {
  color: #5B8FA3;
  font-weight: 500;
}

.project-item a:hover {
  color: #4A7A8C;
}

.project-image {
  flex-shrink: 0;
  width: 200px;
  max-width: 100%;
  border-radius: 8px;
  object-fit: cover;
}

/* Responsive: stack image on top for smaller screens */
@media (max-width: 849px) {
  .project-item:has(.project-image) {
    flex-direction: column;
    gap: 1.5rem;
  }
  
  .project-image {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
  }
}

/*-----------------------------------*\
  #EXPERIENCE
\*-----------------------------------*/

.experience-item {
  margin-bottom: 2.5rem;
}

/* Experience items with images use flex layout */
.experience-item:has(.project-image) {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.experience-item-content {
  flex: 1;
}

.experience-item:last-child {
  margin-bottom: 0;
}

.experience-item h3 {
  margin-bottom: 0.5rem;
}

.experience-item p {
  margin-bottom: 1rem;
}

/* Responsive: stack image on top for smaller screens */
@media (max-width: 849px) {
  .experience-item:has(.project-image) {
    flex-direction: column;
    gap: 1.5rem;
  }
  
  .experience-item .project-image {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
  }
}

/*-----------------------------------*\
  #CONTACT
\*-----------------------------------*/

.contact-list {
  margin-top: 1.5rem;
}

.contact-list li {
  margin-bottom: 0.75rem;
}

.contact-list a {
  color: #5B8FA3;
  font-weight: 500;
}

.contact-list a:hover {
  color: #4A7A8C;
}

/*-----------------------------------*\
  #SIDEBAR
\*-----------------------------------*/

.sidebar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

@media (min-width: 850px) {
  .sidebar {
    position: sticky;
    top: 8rem;          /* matches container's top padding, so it won't move */
    align-self: start;
    align-items: flex-start;
    height: fit-content;
  }
}




.profile-photo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  text-align: center;
}

@media (min-width: 850px) {
  .sidebar-nav {
    text-align: left;
    padding-left: 0.5rem;
  }
}

.nav-link {
  color: #3D2F1F;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.5rem 0;
  position: relative;
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: #5B8FA3;
}

.nav-link.active {
  color: #5B8FA3;
  font-weight: 500;
}

/*-----------------------------------*\
  #RESPONSIVE
\*-----------------------------------*/

/* Continue desktop layout with reduced padding until mobile breakpoint */
@media (max-width: 849px) {
  .container {
    padding: 0;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
  }

  .main-content {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    overflow-wrap: break-word;
    word-wrap: break-word;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    padding: 1.5rem;
    padding-top: calc(100px + 1.5rem);
    text-align: left;
  }

  .sidebar {
    order: -1;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    margin: 0;
    width: 100%;
    flex-wrap: nowrap;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #F4F1DE;
    z-index: 100;
  }

  .profile-photo {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
  }

  .sidebar-nav {
    flex-direction: row;
    gap: 1rem;
    width: auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
    flex: 1;
    min-width: 0;
  }

  .nav-link {
    white-space: nowrap;
    font-size: 0.85rem;
    padding: 0.25rem 0;
  }

  .content-section h1 {
    font-size: 1.75rem;
  }

  .content-section h2 {
    font-size: 1.25rem;
    margin-top: 2rem;
  }

  .decorative-line {
    overflow-x: hidden;
    width: 100%;
  }
}

@media (max-width: 600px) {
  .main-content {
    padding: 1rem;
    padding-top: calc(80px + 1rem);
  }

  .sidebar {
    padding: 0.75rem 1rem;
    gap: 0.75rem;
  }

  .profile-photo {
    width: 50px;
    height: 50px;
  }

  .sidebar-nav {
    gap: 0.5rem;
  }

  .nav-link {
    font-size: 0.75rem;
  }

  .content-section h1 {
    font-size: 1.5rem;
  }
}

/* Ensure body overflow is only hidden on mobile layout */
@media (max-width: 849px) {
  body {
    overflow: hidden;
  }
}


/* DESKTOP: fixed sidebar, main content scrolls */
@media (min-width: 850px) {
  /* Stop using grid at this size so fixed sidebar is easier to control */
  .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 8rem 7rem;
    display: block;          /* instead of grid here */
    position: relative;
  }

  /* Give the main content room so it doesn't sit under the sidebar */
  .main-content {
    max-width: 700px;
    margin-right: 100px;     /* ~sidebar width + gap */
  }

  /* Fixed sidebar that doesn't move vertically when scrolling */
  .sidebar {
    position: fixed;
    top: 8rem;               /* vertical position */
    right: calc((100vw - 1200px) / 2 + 7rem); 
    /* explanation:
       - (100vw - 1200px)/2 centers the 1200px container
       - + 7rem matches the container's side padding
    */
    width: 180px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2rem;
  }
}
